/* ================= Tezzo AI — look and feel =================
   Same family as Tezzo Software: a near-black top band that holds the menu, the page title and the key
   figures on soft pastel cards, then white rounded cards on a light grey page. Manrope font.
   All colours are tokens below; the dark look only changes the tokens. */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --ink: #0f0f10; --ink-2: #1b1b1e; --on-ink: #f4f4f2; --on-ink-2: #a3a3a6;
  --bg: #ececea; --card: #ffffff; --card2: #f5f5f3; --line: #e6e6e2; --hover: #f6f6f3;
  --text: #121214; --text2: #44444a; --muted: #636369;
  --accent: #0f0f10; --accent-ink: #ffffff; --link: #0f0f10; --prog: #5cbf9b; --track: #ececea;
  --field: #f6f6f4; --field-line: #e1e1dc;
  --p-blue: #c9d9e9; --p-lilac: #d9c9f1; --p-mint: #bfe5d4; --p-sand: #e7e3db; --p-pink: #f6d3d6; --p-ink: #121214;
  --good: #126a45; --warn: #82540a; --bad: #ad2833; --info: #2a5fae;
  --good-bg: #dcf2e7; --warn-bg: #f9edd1; --bad-bg: #fbdfe1; --info-bg: #dfe8f6; --muted-bg: #efefec;
  --radius: 20px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15,15,16,.04), 0 8px 24px -12px rgba(15,15,16,.12);
  --shadow-hi: 0 2px 6px rgba(15,15,16,.06), 0 24px 48px -20px rgba(15,15,16,.28);
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: "Manrope", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #050506; --ink-2: #141416; --on-ink: #f4f4f2; --on-ink-2: #9a9a9e;
  --bg: #0d0d0f; --card: #17171a; --card2: #1f1f23; --line: #2a2a2f; --hover: #202024;
  --text: #f1f1ef; --text2: #c4c4c8; --muted: #8e8e95;
  --accent: #f1f1ef; --accent-ink: #0f0f10; --link: #f1f1ef; --track: #26262b;
  --field: #111114; --field-line: #2c2c31;
  --p-blue: #263646; --p-lilac: #332a45; --p-mint: #1f3a2f; --p-sand: #34302a; --p-pink: #44282c; --p-ink: #f1f1ef;
  --good: #6fd0ab; --warn: #e9b65c; --bad: #f08a92; --info: #8fb5f0;
  --good-bg: #173326; --warn-bg: #3a2e16; --bad-bg: #3f1d21; --info-bg: #1a2a42; --muted-bg: #222226;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-hi: 0 24px 48px -20px rgba(0,0,0,.8);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; font-weight: 800; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--text2); font-weight: 700; }
p { margin: 0 0 10px; }
a, .link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--prog); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .num { font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack > * + * { margin-top: 12px; }

/* Top band */
.band { background: var(--ink); color: var(--on-ink); padding: 0 28px 28px; }
.band-in { max-width: 1240px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 18px; height: 68px; }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand i { width: 30px; height: 30px; border-radius: 10px; background: var(--p-mint); color: var(--p-ink); display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 15px; }
.brand small { display: block; font-size: 10px; font-weight: 600; color: var(--on-ink-2); letter-spacing: .14em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; margin-left: 12px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--on-ink-2); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav a:hover { color: var(--on-ink); background: rgba(255,255,255,.06); }
.nav a.on { background: var(--on-ink); color: var(--ink); }
.nav .badge { background: var(--p-pink); color: var(--p-ink); border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 800; }
.top-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); background: transparent; color: var(--on-ink); cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.who { font-size: 12px; color: var(--on-ink-2); text-align: right; line-height: 1.3; margin-right: 4px; }
.who b { color: var(--on-ink); display: block; font-size: 13px; }
.title-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 0 20px; }
.title-row .sub { color: var(--on-ink-2); margin-top: 4px; }
.band .btn.light { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { border-radius: var(--radius); padding: 16px 18px; color: var(--p-ink); min-height: 108px; display: flex; flex-direction: column; justify-content: space-between; }
.tile .k { font-size: 12px; font-weight: 700; opacity: .75; }
.tile .v { font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.tile .s { font-size: 12px; opacity: .7; }
.t-blue { background: var(--p-blue); } .t-lilac { background: var(--p-lilac); } .t-mint { background: var(--p-mint); } .t-sand { background: var(--p-sand); } .t-pink { background: var(--p-pink); }

/* Page */
main { max-width: 1240px; margin: 0 auto; padding: 24px 28px 90px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px; padding: 10px 18px; font: 600 14px/1 var(--font); cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; transition: transform .15s var(--ease), background .15s; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
label.f { display: block; font-weight: 600; font-size: 13px; color: var(--text2); margin-bottom: 12px; }
label.f > span.hint { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
input, select, textarea { width: 100%; margin-top: 6px; font: 14px/1.4 var(--font); color: var(--text); background: var(--field); border: 1px solid var(--field-line); border-radius: var(--radius-sm); padding: 10px 12px; unicode-bidi: plaintext; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--card); }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; }
.pw { position: relative; } .pw input { padding-right: 44px; } .pw button { position: absolute; right: 6px; top: 12px; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--muted-bg); color: var(--text2); white-space: nowrap; }
.chip.ai { background: var(--good-bg); color: var(--good); } .chip.handover { background: var(--bad-bg); color: var(--bad); } .chip.closed { background: var(--muted-bg); color: var(--muted); }
.chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.info { background: var(--info-bg); color: var(--info); }

/* Progress */
.bar { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--prog); border-radius: 999px; transition: width .4s var(--ease); }
.bar.warn > i { background: #e8a35c; } .bar.full > i { background: #e08a96; }

/* Lists */
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--p-lilac); color: var(--p-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; height: calc(100vh - 260px); min-height: 480px; }
.inbox .threads-card { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.inbox .threads { overflow-y: auto; padding: 8px; }
.thread { display: flex; gap: 10px; padding: 12px; border-radius: 14px; cursor: pointer; align-items: center; }
.thread:hover { background: var(--hover); }
.thread.on { background: var(--card2); }
.thread .meta { min-width: 0; flex: 1; }
.thread .top { display: flex; justify-content: space-between; gap: 8px; }
.thread .name { font-weight: 700; }
.thread .last { color: var(--muted); font-size: 13px; }
.thread .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); flex: none; }
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: var(--card2); }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; unicode-bidi: plaintext; }
.msg.customer { align-self: flex-start; background: var(--card); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg.ai { align-self: flex-end; background: var(--p-mint); color: var(--p-ink); border-bottom-right-radius: 6px; }
.msg.staff { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 6px; }
.msg .by { display: block; font-size: 11px; font-weight: 700; opacity: .65; margin-bottom: 2px; }
.msg .at { display: block; font-size: 10px; opacity: .55; margin-top: 3px; }
.reply { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.reply textarea { margin: 0; min-height: 44px; height: 44px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td input { margin: 0; }
.scroll-x { overflow-x: auto; }

/* Wizard */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { padding: 6px 12px; border-radius: 999px; background: var(--muted-bg); color: var(--muted); font-weight: 700; font-size: 12px; }
.steps span.on { background: var(--ink); color: var(--on-ink); } .steps span.done { background: var(--good-bg); color: var(--good); }
.types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.type { border: 2px solid var(--line); border-radius: 18px; padding: 18px; cursor: pointer; background: var(--card); text-align: left; font: inherit; color: inherit; }
.type:hover { border-color: var(--muted); }
.type.on { border-color: var(--ink); background: var(--card2); }
.type .ic { font-size: 26px; display: block; margin-bottom: 6px; }
.type b { display: block; font-size: 15px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; word-break: break-all; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--ink); color: var(--on-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 40px; line-height: 1.08; max-width: 520px; margin: 24px 0 14px; }
.auth-side p { color: var(--on-ink-2); max-width: 460px; font-size: 15px; }
.auth-points { display: grid; gap: 10px; margin-top: 26px; max-width: 460px; }
.auth-points div { background: rgba(255,255,255,.06); border-radius: 14px; padding: 12px 14px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-box { width: 100%; max-width: 420px; }
.tabs { display: flex; gap: 4px; background: var(--muted-bg); padding: 4px; border-radius: 999px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 999px; font: 700 13px var(--font); color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* Messages, modal, help */
.notice { border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.bad { background: var(--bad-bg); color: var(--bad); } .notice.info { background: var(--info-bg); color: var(--info); } .notice.good { background: var(--good-bg); color: var(--good); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-hi); z-index: 1000; font-weight: 600; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,15,16,.45); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.modal { background: var(--card); border-radius: 22px; padding: 22px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-hi); }
.help-steps { padding-left: 20px; } .help-steps li { margin-bottom: 6px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* Phone: bottom menu */
.bottom-nav { display: none; }
@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-side { padding: 32px 24px; } .auth-side h1 { font-size: 30px; }
}
@media (max-width: 760px) {
  .band { padding: 0 16px 20px; } main { padding: 16px 16px 100px; }
  .nav, .who { display: none; }
  h1 { font-size: 22px; } .tile .v { font-size: 26px; } .tile { min-height: 92px; padding: 14px; }
  .g2 { grid-template-columns: 1fr; } .types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .inbox.has-open .threads-card { display: none; } .inbox:not(.has-open) .chat { display: none; }
  .chat { height: calc(100vh - 200px); }
  .msg { max-width: 86%; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around; z-index: 500; }
  .bottom-nav a { color: var(--on-ink-2); text-decoration: none; font-size: 11px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px; border-radius: 12px; }
  .bottom-nav a span { font-size: 18px; }
  .bottom-nav a.on { color: var(--on-ink); background: rgba(255,255,255,.08); }
}
