/* Quantix Support portal: client side. Palette follows the Quantix Business Hub (ink + gold). */
:root {
  --bg: #F3F2EE; --panel: #FFFFFF; --panel2: #F8F7F4; --ink: #15171C; --ink2: #454A53; --mute: #7F838B; --hair: #E3E1DB;
  --night: #111318; --gold: #B8912C; --goldink: #8C6A12; --goldsoft: #F4ECD7; --goldhover: #A5801F;
  --ok: #237A45; --oksoft: #E3F2E8; --warn: #9A6200; --warnsoft: #FBEFD8; --bad: #B23A2A; --badsoft: #F9E4E0; --info: #2D5B8A; --infosoft: #E3ECF6;
  --onaccent: #FFFFFF; --shadow: 0 1px 2px rgba(20,18,10,.05), 0 4px 14px rgba(20,18,10,.05);
  --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1014; --panel: #171A20; --panel2: #1D2027; --ink: #EDEDEA; --ink2: #C3C6CC; --mute: #8D929B; --hair: #2A2E36;
  --night: #07080B; --gold: #D6AE4A; --goldink: #E3C06A; --goldsoft: #2B2517; --goldhover: #E0BC5E;
  --ok: #5CC285; --oksoft: #17281E; --warn: #E0A640; --warnsoft: #2B2214; --bad: #E7735F; --badsoft: #2D1915; --info: #7FAEDD; --infosoft: #16202B;
  --onaccent: #15171C; --shadow: none; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0E1014; --panel: #171A20; --panel2: #1D2027; --ink: #EDEDEA; --ink2: #C3C6CC; --mute: #8D929B; --hair: #2A2E36;
  --night: #07080B; --gold: #D6AE4A; --goldink: #E3C06A; --goldsoft: #2B2517; --goldhover: #E0BC5E;
  --ok: #5CC285; --oksoft: #17281E; --warn: #E0A640; --warnsoft: #2B2214; --bad: #E7735F; --badsoft: #2D1915; --info: #7FAEDD; --infosoft: #16202B;
  --onaccent: #15171C; --shadow: none; color-scheme: dark; }
[dir="rtl"] { --font: "IBM Plex Sans Arabic", "Inter", system-ui, Arial, sans-serif; }

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--goldink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; text-wrap: balance; font-weight: 600; }
h1 { font-size: 24px; letter-spacing: -.01em; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--mute); } .small { font-size: 13px; } .hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 13px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* header */
.qp-top { background: var(--panel); border-bottom: 1px solid var(--hair); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.qp-top .in { max-width: 1040px; margin: auto; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 64px; }
.qp-logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.qp-logo:hover { text-decoration: none; }
.qp-logo img { height: 40px; width: auto; display: block; }
.qp-logo span { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); border-inline-start: 1px solid var(--hair); padding-inline-start: 10px; }
.qp-nav { display: flex; gap: 4px; flex: 1; }
.qp-nav a { color: var(--ink2); padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.qp-nav a:hover { background: var(--panel2); text-decoration: none; }
.qp-nav a.on { color: var(--ink); background: var(--goldsoft); font-weight: 600; }
.qp-act { display: flex; gap: 4px; align-items: center; }
.icon-btn { position: relative; border: 0; background: none; color: var(--ink2); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: var(--panel2); color: var(--ink); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.dot { position: absolute; top: 2px; inset-inline-end: 0; background: var(--bad); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
@media (max-width: 640px) { .qp-nav { display: none; } .qp-logo span { display: none; } .qp-logo img { height: 34px; } .qp-top .in { gap: 8px; } }
.qp-bottom { display: none; }
@media (max-width: 640px) {
  .qp-bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--hair); z-index: 20; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .qp-bottom a { flex: 1; text-align: center; padding: 10px 4px; color: var(--ink2); font-size: 12px; font-weight: 600; }
  .qp-bottom a.on { color: var(--goldink); }
  .qp-bottom a:hover { text-decoration: none; }
  .wrap { padding-bottom: 90px !important; }
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 60px; }
.narrow { max-width: 760px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 600; margin-bottom: 4px; }

.card { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.tlayout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .tlayout { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } .wrap { padding-top: 18px; } }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--hair); background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--mute); text-decoration: none; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--onaccent); }
.btn.gold:hover { background: var(--goldhover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink2); }
.field { margin-bottom: 16px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); padding: 10px 12px; border: 1px solid var(--hair); border-radius: 8px; background: var(--panel); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--goldsoft); border-color: var(--gold); }
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: 12px; color: var(--mute); margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.sp { flex: 1; }

/* choice tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tile { border: 1px solid var(--hair); background: var(--panel); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; user-select: none; }
.tile:hover { border-color: var(--mute); }
.tile.on { border-color: var(--gold); background: var(--goldsoft); color: var(--ink); font-weight: 600; }
.tile .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--mute); }
.tile[data-v="urgent"] .sw { background: var(--bad); } .tile[data-v="high"] .sw { background: var(--warn); } .tile[data-v="normal"] .sw { background: var(--info); } .tile[data-v="low"] .sw { background: var(--ok); }
.prio { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--panel2); color: var(--ink2); border: 1px solid var(--hair); white-space: nowrap; }
.pill.new { background: var(--infosoft); color: var(--info); border-color: transparent; }
.pill.assigned, .pill.in_progress { background: var(--goldsoft); color: var(--goldink); border-color: transparent; }
.pill.waiting_client { background: var(--warnsoft); color: var(--warn); border-color: transparent; }
.pill.resolved { background: var(--oksoft); color: var(--ok); border-color: transparent; }
.pill.urgent { background: var(--badsoft); color: var(--bad); border-color: transparent; }
.pill.high { background: var(--warnsoft); color: var(--warn); border-color: transparent; }
.pill.w-in { background: var(--oksoft); color: var(--ok); border-color: transparent; white-space: normal; }
.pill.w-out { background: var(--badsoft); color: var(--bad); border-color: transparent; white-space: normal; }

/* ticket list */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--hair); background: var(--panel); color: var(--ink2); font-size: 13px; font-weight: 600; }
.tabs a.on { background: var(--gold); border-color: var(--gold); color: var(--onaccent); }
.tabs a:hover { text-decoration: none; }
.tcard { display: block; background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); }
.tcard:hover { border-color: var(--gold); text-decoration: none; }
.tcard .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.tcard .t { font-weight: 600; font-size: 16px; }
.tlist { display: flex; flex-direction: column; gap: 10px; }
.progress { display: flex; gap: 4px; margin-top: 10px; }
.progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--hair); }
.progress i.on { background: var(--gold); }

/* steps on the ticket page */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.steps div { font-size: 12px; font-weight: 600; color: var(--mute); padding-top: 10px; border-top: 3px solid var(--hair); }
.steps div.on { color: var(--ink); border-color: var(--gold); }

/* timeline */
.tl { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--hair); border-radius: 10px; padding: 12px 14px; background: var(--panel); max-width: 92%; }
.msg.us { background: var(--goldsoft); border-color: transparent; align-self: flex-start; }
.msg.them { align-self: flex-end; background: var(--panel2); }
.msg .who { font-size: 12px; color: var(--mute); margin-bottom: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.msg .who b { color: var(--ink); }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.sys { font-size: 13px; color: var(--mute); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sys::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--hair); flex: none; }

.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* files */
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.file { width: 116px; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; background: var(--panel); cursor: pointer; font-size: 12px; padding: 0; text-align: start; color: var(--ink); font-family: inherit; }
.file .th { height: 84px; background: var(--panel2); display: grid; place-items: center; color: var(--mute); overflow: hidden; }
.file .th img { width: 100%; height: 100%; object-fit: cover; }
.file .th svg { width: 28px; height: 28px; }
.file .nm { padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop { border: 2px dashed var(--hair); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--mute); cursor: pointer; background: var(--panel2); }
.drop:hover, .drop.drag { border-color: var(--gold); background: var(--goldsoft); color: var(--ink2); }
.drop b { color: var(--ink); display: block; margin-bottom: 2px; }
.upl { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; }
.bar { height: 6px; background: var(--hair); border-radius: 3px; overflow: hidden; flex: 1; }
.bar > span { display: block; height: 100%; background: var(--gold); }
.x { cursor: pointer; color: var(--mute); border: 0; background: none; font-size: 16px; }

/* login */
.auth { min-height: 100%; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--hair); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-card .logo { display: block; height: 64px; width: auto; margin: 0 auto 6px; }
.auth-card .sub { text-align: center; color: var(--mute); font-size: 14px; margin: 0 0 22px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--mute); }

/* modal, toast, dropdown */
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,12,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); color: var(--ink); border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 22px; }
.modal.wide { max-width: 900px; }
.viewer img, .viewer video { max-width: 100%; max-height: 72vh; display: block; margin: auto; border-radius: 8px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60; font-size: 14px; max-width: 90vw; }
.toast.err { background: var(--bad); }
.dropdown { position: absolute; top: 60px; inset-inline-end: 12px; width: 360px; max-width: calc(100vw - 24px); background: var(--panel); color: var(--ink); border: 1px solid var(--hair); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); z-index: 40; max-height: 70vh; overflow: auto; }
.dropdown .item { padding: 12px 14px; border-bottom: 1px solid var(--hair); font-size: 14px; cursor: pointer; }
.dropdown .item:hover { background: var(--panel2); }
.dropdown .item.unread { background: var(--goldsoft); }
.empty { text-align: center; padding: 40px 16px; color: var(--mute); }
.empty svg { width: 44px; height: 44px; color: var(--gold); margin-bottom: 8px; }
.empty b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }
.stars { display: flex; gap: 6px; font-size: 30px; }
.stars button { border: 0; background: none; cursor: pointer; color: var(--hair); font-size: inherit; padding: 0; line-height: 1; }
.stars button.on { color: var(--gold); }
.note { background: var(--goldsoft); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink); }
.note.warn { background: var(--warnsoft); }
.note.ok { background: var(--oksoft); }
.help { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; background: var(--night); color: #fff; border-radius: var(--radius); padding: 14px 16px; margin-top: 20px; }
.help b { color: #fff; }
.help .sp { flex: 1 1 220px; min-width: 0; }
.help .num { font-family: var(--mono); color: #E8C766; user-select: all; }
