/* Graaphix Desk — helpdesk workspace UI (desktop-first) */
:root {
  --ink: #12344d;
  --ink-2: #2c4a60;
  --muted: #6f7c87;
  --faint: #92a2b1;
  --line: #dfe5ea;
  --line-2: #ebeff3;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --hover: #f5f7f9;
  --accent: #0f5c4d;
  --accent-2: #137363;
  --accent-soft: #e6f2ef;
  --link: #0f6e5c;
  --sel: #ebf5f2;
  --red: #d72d30;
  --red-soft: #ffecf0;
  --amber: #b45309;
  --amber-soft: #fff4e5;
  --green: #00795b;
  --green-soft: #e0f5ec;
  --blue: #2c5cc5;
  --blue-soft: #e5f2fd;
  --purple: #6e48c7;
  --purple-soft: #f0ebfb;
  --note: #fff6e9;
  --note-line: #fbd9a8;
  --wa: #128c4a;
  --radius: 6px;
  --shadow: 0 2px 6px rgba(18, 52, 77, .08), 0 8px 24px rgba(18, 52, 77, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; flex: none; vertical-align: middle; }
.small svg { width: 14px; height: 14px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.sep { width: 1px; height: 22px; background: var(--line); display: inline-block; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); display: inline-block; vertical-align: middle; margin: 0 7px; }

/* ---------- app shell: icon rail + top bar */
.shell { display: grid; grid-template-columns: 60px 1fr; grid-template-rows: 60px 1fr; height: 100vh; }
.rail { grid-row: 1 / 3; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; z-index: 20; }
.rail .logo { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; margin-bottom: 14px; }
.rail a, .rail button { position: relative; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); background: none; border: 0; cursor: pointer; }
.rail a:hover, .rail button:hover { background: var(--hover); text-decoration: none; }
.rail a.active { background: var(--ink); color: #fff; }
.rail svg { width: 20px; height: 20px; }
.rail .tip { position: absolute; left: 48px; top: 50%; transform: translateY(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 30; }
.rail a:hover .tip, .rail button:hover .tip { opacity: 1; }
.rail .spacer { flex: 1; }

.topbar { grid-column: 2; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 14px; background: #fff; border-bottom: 1px solid var(--line); min-width: 0; }
.topbar .title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar .title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; min-width: 0; }
.topbar .crumbs a { color: var(--link); white-space: nowrap; }
.topbar .crumbs svg { width: 14px; height: 14px; color: var(--muted); }
.count-pill { background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 0 8px; line-height: 20px; }
.iconbtn { width: 34px; height: 34px; border-radius: 6px; border: 1px solid transparent; background: none; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative; flex: none; }
.iconbtn:hover { background: var(--hover); border-color: var(--line); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .badge-n { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.star { color: #c3ced8; }
.star.on { color: #f2b200; }
.star.on svg { fill: #f2b200; }
.content { grid-column: 2; overflow: hidden; min-width: 0; min-height: 0; position: relative; }
.scroll { overflow: auto; height: 100%; }
.page { padding: 20px 24px 40px; max-width: 1500px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; min-height: 34px; }
.page-head .sub { color: var(--muted); font-size: 13px; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 5px; border: 1px solid #cfd7df; background: #fff; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink); white-space: nowrap; box-shadow: 0 1px 0 rgba(18, 52, 77, .04); }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.on { background: var(--sel); border-color: #b6d8cf; color: var(--accent); }
.btn svg { width: 15px; height: 15px; }
.btn-group { display: inline-flex; position: relative; }
.btn-group > .btn:first-child { border-radius: 5px 0 0 5px; }
.btn-group > .btn:nth-child(2) { border-radius: 0 5px 5px 0; border-left: 1px solid rgba(255, 255, 255, .35); padding: 0 7px; }
.input, select.input, textarea.input { width: 100%; height: 34px; border: 1px solid #cfd7df; border-radius: 5px; padding: 0 10px; background: #fff; outline: none; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 70px; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { height: 30px; font-size: 13px; }
.input[readonly] { background: var(--bg); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.f > span { color: var(--ink-2); }
.req { color: var(--red); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.toggle { position: relative; width: 36px; height: 20px; flex: none; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: #c3ced8; border-radius: 10px; cursor: pointer; transition: .15s; }
.toggle span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::before { transform: translateX(16px); }

.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: 38px; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; z-index: 80; max-height: 60vh; overflow: auto; }
.menu.left { left: 0; right: auto; }
.menu.up { top: auto; bottom: 38px; }
.menu button, .menu a { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 5px; cursor: pointer; color: var(--ink); font-size: 13.5px; white-space: nowrap; }
.menu button:hover, .menu a:hover, .menu .on { background: var(--sel); text-decoration: none; }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }
.menu .mh { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 6px 10px 4px; }

/* inline pick (priority / group-agent / status on cards) */
.pick { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 6px; border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--ink-2); max-width: 230px; }
.pick:hover { background: var(--hover); }
.pick .chev { width: 12px; height: 12px; color: var(--faint); flex: none; }
.pick .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick svg.lead { width: 14px; height: 14px; color: var(--muted); flex: none; }
.pdot { width: 9px; height: 9px; border-radius: 2px; flex: none; display: inline-block; }
.p-low { background: #3dbb7b; } .p-medium { background: #4a90e2; } .p-high { background: #f5a623; } .p-urgent { background: #e43538; }

/* ---------- cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card-b { padding: 14px 16px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #f9fafb; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table tr.sel td { background: var(--sel) !important; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.b-new { background: var(--green-soft); color: var(--green); }
.b-due { background: var(--red-soft); color: var(--red); }
.b-overdue { background: var(--red-soft); color: var(--red); }
.b-responded { background: var(--blue-soft); color: var(--blue); }
.b-reopened { background: var(--purple-soft); color: var(--purple); }
.b-spam { background: var(--red-soft); color: var(--red); }
.b-onhold { background: var(--amber-soft); color: var(--amber); }
.tagchip { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid #cfd7df; border-radius: 4px; font-size: 11.5px; color: var(--ink-2); background: #fff; white-space: nowrap; }
.st-open { background: var(--blue-soft); color: var(--blue); }
.st-in_progress { background: var(--purple-soft); color: var(--purple); }
.st-pending { background: var(--amber-soft); color: var(--amber); }
.st-resolved { background: var(--green-soft); color: var(--green); }
.st-closed { background: #eceff3; color: #4b5563; }
.pr-urgent { background: var(--red-soft); color: var(--red); }
.pr-high { background: var(--amber-soft); color: var(--amber); }
.pr-medium { background: var(--blue-soft); color: var(--blue); }
.pr-low { background: var(--green-soft); color: var(--green); }
.hot { background: var(--amber-soft); color: var(--amber); }
.warm { background: #fef9c3; color: #854d0e; }
.cool { background: #e0f2fe; color: #0369a1; }
.ls { background: #eef2f6; color: #334155; }
.ls-won { background: var(--green-soft); color: var(--green); }
.ls-lost, .ls-not_interested { background: #f3f4f6; color: #6b7280; }
.ls-proposal, .ls-negotiation, .ls-meeting { background: var(--purple-soft); color: var(--purple); }
.ls-contacted, .ls-follow_up { background: var(--blue-soft); color: var(--blue); }
.ch { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ch svg { width: 14px; height: 14px; }
.code { font: 600 12px var(--mono); color: var(--muted); letter-spacing: -.02em; }
.dept { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dept i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; overflow: hidden; background: #fff3c4; color: #8a6d00; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.av-0 { background: #fff3c4; color: #8a6d00; } .av-1 { background: #ede7fb; color: #5b3fb0; } .av-2 { background: #e0f2fe; color: #0369a1; }
.av-3 { background: #fde8e8; color: #b42318; } .av-4 { background: #e0f5ec; color: #00795b; } .av-5 { background: #f1f0ec; color: #4b5563; }
.av-agent { background: var(--ink); color: #fff; }
.stars { color: #d97706; }

/* ---------- tickets workspace: views | list | filters */
.ws { display: grid; grid-template-columns: 272px 1fr auto; height: 100%; min-height: 0; }
.ws > * { min-width: 0; min-height: 0; }
.ws.collapsed { grid-template-columns: 0 1fr auto; }
.ws.collapsed .vpanel { display: none; }
.vpanel { background: #fff; border-right: 1px solid var(--line); overflow: auto; padding: 12px 10px 30px; }
.vsearch { position: relative; margin: 0 4px 6px; }
.vsearch svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; color: var(--faint); }
.vsearch input { padding-left: 32px; }
.vsec { border-bottom: 1px solid var(--line-2); padding: 6px 0 8px; }
.vsec-h { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; padding: 8px 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.vsec-h svg { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.vsec.closed .vsec-h svg { transform: rotate(-90deg); }
.vsec.closed .vlist { display: none; }
.vlist a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 5px; color: var(--ink-2); font-size: 13.5px; }
.vlist a:hover { background: var(--hover); text-decoration: none; }
.vlist a.active { background: var(--sel); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.vlist a svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.vlist a .n { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.vlist .none { padding: 6px 10px; color: var(--faint); font-size: 12.5px; }

.tlist { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); min-height: 54px; flex-wrap: wrap; }
.tbar .lbl { color: var(--muted); font-size: 13px; }
.tscroll { flex: 1; overflow: auto; padding: 12px 16px 30px; position: relative; }
.newpill { position: sticky; top: 0; z-index: 5; margin: 0 auto 8px; width: max-content; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 18px; padding: 6px 14px 6px 8px; cursor: pointer; font-size: 13.5px; }
.newpill i { width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; }
.newpill i svg { width: 13px; height: 13px; }
.tcard { display: grid; grid-template-columns: 22px 42px 1fr 240px; gap: 12px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 14px 12px; margin-bottom: 8px; cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.tcard:hover { border-color: #c3ced8; box-shadow: 0 2px 8px rgba(18, 52, 77, .07); }
.tcard.sel { background: var(--sel); border-color: #b6d8cf; }
.tcard.done .subj, .tcard.done .meta { color: var(--muted); font-weight: 500; }
.tcard input[type=checkbox] { margin-top: 14px; width: 15px; height: 15px; }
.tcard .avatar { width: 40px; height: 40px; margin-top: 2px; font-size: 14px; }
.tcard .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tcard .subj { font-weight: 600; font-size: 14.5px; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.tcard .subj .code { font-weight: 500; font-size: 12.5px; margin-left: 2px; }
.tcard .meta { margin-top: 6px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; flex-wrap: wrap; row-gap: 2px; }
.tcard .meta svg { width: 14px; height: 14px; color: var(--muted); margin-right: 5px; }
.tcard .meta .bad { color: var(--red); }
.tcard .meta .slai { display: inline-flex; align-items: center; }
.tcard .props { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; min-width: 0; }
.pager { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pager .btn { width: 30px; padding: 0; justify-content: center; }

.fpanel { width: 300px; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.fpanel .fh { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink-2); }
.fpanel .fh a { font-weight: 500; letter-spacing: 0; font-size: 12.5px; }
.fpanel .fb { flex: 1; overflow: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.fpanel .ff { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.fpanel .ff .btn { flex: 1; justify-content: center; }
.ms { border: 1px solid #cfd7df; border-radius: 5px; min-height: 34px; padding: 4px 30px 4px 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; cursor: pointer; position: relative; background: #fff; }
.ms::after { content: ""; position: absolute; right: 12px; top: 12px; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.ms .ph { color: var(--faint); padding-left: 4px; font-size: 13.5px; }
.ms .chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2f6; border: 1px solid #d6dee6; border-radius: 4px; padding: 0 3px 0 7px; font-size: 12.5px; font-weight: 600; height: 24px; }
.ms .chip b { font-weight: 400; cursor: pointer; color: var(--muted); padding: 0 4px; }
.ms-menu { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; z-index: 60; padding: 4px; cursor: default; }
.ms-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; font-size: 13.5px; cursor: pointer; }
.ms-menu label:hover { background: var(--hover); }

/* ---------- ticket page */
.tp { display: grid; grid-template-columns: 270px 1fr 300px 260px; height: 100%; min-height: 0; }
.tp > * { min-width: 0; min-height: 0; }
.tp.nolist { grid-template-columns: 0 1fr 300px 260px; }
.tp.nolist .mini { display: none; }
.mini { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.mini .mh { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; height: 48px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.mini .ml { overflow: auto; flex: 1; }
.mini a { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.mini a:hover { background: var(--hover); text-decoration: none; }
.mini a.active { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.mini a .avatar { width: 28px; height: 28px; font-size: 11px; }
.mini a .who { font-size: 12px; color: var(--muted); }
.mini a .s { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini a.done .s { font-weight: 400; color: var(--muted); }
.mini a .c { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }

.conv { display: flex; flex-direction: column; background: #fff; }
.ttools { display: flex; align-items: center; gap: 6px; padding: 0 16px; height: 48px; border-bottom: 1px solid var(--line); background: #fff; }
.cscroll { flex: 1; overflow: auto; padding: 18px 22px 30px; }
.thead { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.thead .ticon { width: 34px; height: 34px; border-radius: 6px; background: var(--bg); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.thead .ticon svg { width: 18px; height: 18px; }
.thead input.subj { font-size: 19px; font-weight: 600; border: 1px solid transparent; border-radius: 5px; padding: 1px 6px; margin-left: -7px; width: 100%; background: transparent; outline: none; color: var(--ink); }
.thead input.subj:hover { border-color: var(--line); }
.thead input.subj:focus { border-color: var(--accent); }
.cv { display: grid; grid-template-columns: 36px 1fr; gap: 12px; margin-bottom: 14px; }
.cv .avatar { width: 34px; height: 34px; }
.cv .box { border-radius: 6px; padding: 12px 16px 14px; min-width: 0; }
.cv.first .box { padding: 4px 0 6px; border: 0 !important; background: none !important; }
.cv.inbound .box { background: #fff; border: 1px solid var(--line); }
.cv.outbound .box { background: #f6f8fa; border: 1px solid var(--line-2); }
.cv.note .box { background: var(--note); border: 1px solid var(--note-line); }
.cv.system .box { background: transparent; border: 1px dashed #cfd7df; padding: 8px 14px; }
.cv .who { font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.cv .who b { color: var(--link); font-weight: 600; }
.cv .who .act { color: var(--muted); }
.cv .who em { color: var(--muted); font-size: 12px; }
.cv .addr { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cv .body { margin-top: 10px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; overflow-x: auto; }
.cv .body p { margin: 0 0 10px; }
.cv .body img { max-width: 100%; height: auto; }
.cv .body blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.cv .quoted { margin-top: 8px; color: var(--muted); }
.morebtn { border: 1px solid var(--line); background: #f3f5f7; border-radius: 4px; padding: 0 8px; height: 18px; font-size: 13px; line-height: 12px; cursor: pointer; color: var(--muted); letter-spacing: 1px; margin-top: 6px; }
.cv .atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.att { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); max-width: 260px; }
.att:hover { text-decoration: none; border-color: #c3ced8; }
.att svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.att img { max-height: 110px; max-width: 200px; border-radius: 4px; display: block; }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dlv { font-size: 11.5px; margin-left: 6px; }
.dlv-failed, .dlv-bounced { color: var(--red); font-weight: 600; }
.dlv-read { color: #0284c7; }
.collapse-line { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px 48px; }
.collapse-line::before, .collapse-line::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.collapse-line button { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 3px 12px; cursor: pointer; font-size: 12.5px; color: var(--blue); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* composer */
.composer { margin: 4px 0 0 48px; border: 1px solid #cfd7df; border-radius: 8px; background: #fff; box-shadow: 0 1px 3px rgba(18, 52, 77, .05); }
.composer.note-mode { background: var(--note); border-color: var(--note-line); }
.composer .ctabs { display: flex; gap: 4px; padding: 8px 10px 0; flex-wrap: wrap; }
.composer .ctabs button { border: 1px solid transparent; background: none; border-radius: 5px; padding: 4px 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.composer .ctabs button:hover { background: var(--hover); }
.composer .ctabs button.active { background: var(--blue-soft); color: var(--blue); }
.composer.note-mode .ctabs button.active { background: #fde7c7; color: #8a4b00; }
.composer .ctabs svg { width: 14px; height: 14px; }
.composer .fields { padding: 6px 12px 0; }
.composer .fline { display: flex; align-items: center; gap: 8px; font-size: 13px; border-bottom: 1px solid var(--line-2); min-height: 32px; }
.composer.note-mode .fline { border-bottom-color: var(--note-line); }
.composer .fline > span:first-child { color: var(--muted); width: 54px; flex: none; }
.composer .fline input, .composer .fline select { border: 0; outline: none; flex: 1; height: 30px; background: transparent; font-size: 13px; min-width: 0; }
.composer .fline .xtra { color: var(--link); cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.composer .cfoot { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.composer.note-mode .cfoot { border-top-color: var(--note-line); }
.composer .placeholder { display: flex; align-items: center; gap: 10px; padding: 14px; color: var(--faint); cursor: text; }
.filechips { display: flex; gap: 6px; flex-wrap: wrap; }
.filechips span { background: var(--line-2); border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.win { font-size: 12px; padding: 6px 10px; border-radius: 5px; margin: 8px 12px 0; }
.win.open { background: var(--green-soft); color: var(--green); }
.win.closed { background: var(--amber-soft); color: var(--amber); }

/* rich editor */
.rte-bar { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; align-items: center; }
.rte-bar button { min-width: 28px; height: 26px; border: 0; background: none; border-radius: 4px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; font-size: 13px; padding: 0 5px; }
.rte-bar button:hover { background: rgba(18, 52, 77, .06); }
.rte-bar button svg { width: 15px; height: 15px; }
.rte-bar .sep { height: 18px; margin: 0 4px; }
.rte { min-height: 140px; max-height: 420px; overflow: auto; padding: 12px 14px; outline: none; font-size: 14px; line-height: 1.55; }
.rte:empty::before { content: attr(data-ph); color: var(--faint); }
.rte p { margin: 0 0 8px; }
.rte img { max-width: 100%; }
.composer.note-mode .rte-bar { border-bottom-color: var(--note-line); }
.rte-wrap { border: 1px solid #cfd7df; border-radius: 6px; background: #fff; }

/* properties + contact panels */
.ppanel { background: #f9fafb; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.ppanel .ps { flex: 1; overflow: auto; padding: 14px 16px; }
.ppanel .pf { padding: 12px 16px; border-top: 1px solid var(--line); }
.ppanel .pf .btn { width: 100%; justify-content: center; height: 34px; }
.sbox { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
.sbox .st { font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: space-between; }
.sla-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 3px 0; color: var(--ink-2); }
.sla-row .bad { color: var(--red); font-weight: 600; text-align: right; }
.sla-row .ok { color: var(--green); text-align: right; }
.plabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); margin: 4px 0 10px; text-transform: uppercase; }
.pfields { display: flex; flex-direction: column; gap: 12px; }
.tagbox { display: flex; flex-wrap: wrap; gap: 4px; border: 1px solid #cfd7df; border-radius: 5px; padding: 4px 6px; background: #fff; min-height: 34px; align-items: center; }
.tagbox .chip { display: inline-flex; align-items: center; gap: 2px; background: #eef2f6; border: 1px solid #d6dee6; border-radius: 4px; padding: 0 2px 0 7px; font-size: 12.5px; height: 24px; }
.tagbox .chip b { font-weight: 400; cursor: pointer; color: var(--muted); padding: 0 4px; }
.tagbox input { border: 0; outline: none; flex: 1; min-width: 60px; height: 24px; font-size: 13px; background: transparent; }
.cpanel { background: #fff; border-left: 1px solid var(--line); overflow: auto; }
.csec { border-bottom: 1px solid var(--line); }
.csec-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; font-size: 13.5px; }
.csec-h svg { width: 15px; height: 15px; color: var(--muted); }
.csec-b { padding: 0 14px 14px; font-size: 13px; }
.kv { display: grid; grid-template-columns: 86px 1fr; gap: 6px; font-size: 13px; padding: 3px 0; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.brief { font-size: 13px; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-top: 8px; }
.brief b { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }

/* ---------- dashboard */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 16px; }
.tile { padding: 16px 18px; border-right: 1px solid var(--line-2); color: inherit; display: block; }
.tile:last-child { border-right: 0; }
.tile:hover { background: var(--hover); text-decoration: none; }
.tile .l { font-size: 13px; color: var(--muted); }
.tile .v { font-size: 30px; font-weight: 600; margin-top: 2px; color: var(--ink); }
.tile.alert .v { color: var(--red); }
.dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.dash > * { min-width: 0; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; color: inherit; }
.bar:hover { text-decoration: none; }
.bar .track { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding-top: 6px; }
.spark div { flex: 1; background: var(--accent); opacity: .85; border-radius: 3px 3px 0 0; min-height: 2px; }
.todo { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.todo.done span { text-decoration: line-through; color: var(--faint); }
.todo .x { margin-left: auto; opacity: 0; }
.todo:hover .x { opacity: 1; }

/* ---------- clients / projects / import / settings */
.cl { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }
.cl > * { min-width: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .input { width: auto; min-width: 130px; max-width: 240px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pcard { display: block; color: inherit; padding: 14px 16px; }
.pcard:hover { border-color: #c3ced8; text-decoration: none; }
.progress { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; background: var(--accent); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.col { background: #eceff2; border-radius: 8px; padding: 10px; min-height: 200px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-h { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; padding: 2px 4px 10px; }
.task { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; cursor: grab; font-size: 13px; }
.task.dragging { opacity: .5; }
.task .t { font-weight: 550; margin-bottom: 6px; }
.task .m { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.task .overdue { color: var(--red); font-weight: 600; }
.addtask { width: 100%; background: transparent; border: 1px dashed #c3ced8; border-radius: 6px; padding: 7px; color: var(--muted); cursor: pointer; font-size: 13px; }
.addtask:hover { background: #fff; color: var(--ink); }
.drop-zone { border: 2px dashed #c3ced8; border-radius: 10px; padding: 36px; text-align: center; background: #fff; cursor: pointer; display: block; }
.drop-zone.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone svg { width: 36px; height: 36px; color: var(--accent); }
.set-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; }
.set-layout > * { min-width: 0; }
.snav { display: flex; flex-direction: column; gap: 1px; }
.snav a { padding: 8px 10px; border-radius: 5px; color: var(--ink-2); font-size: 13.5px; }
.snav a:hover { background: #fff; text-decoration: none; }
.snav a.active { background: #fff; color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.callout { background: #f6f9fb; border: 1px solid #dbe5ec; border-radius: 6px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.callout ol { margin: 6px 0 0; padding-left: 18px; }
.copy { display: flex; gap: 6px; }
.copy input { font-family: var(--mono); font-size: 12.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.kpi .v { font-size: 24px; font-weight: 650; }
.kpi .l { font-size: 12.5px; color: var(--muted); }

/* profile settings */
.prof { display: grid; grid-template-columns: 250px 1fr 320px; background: #fff; border: 1px solid var(--line); border-radius: 6px; min-height: 600px; }
.prof > * { min-width: 0; }
.prof .pl { background: #f3f5f7; padding: 20px; font-size: 13px; border-right: 1px solid var(--line); }
.prof .pl dl { display: grid; gap: 8px; margin: 12px 0 0; }
.prof .pl dt { color: var(--muted); font-size: 12px; }
.prof .pl dd { margin: 0 0 4px; word-break: break-word; }
.prof .pm { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.prof .pr { background: #f9fafb; border-left: 1px solid var(--line); }
.prof .pr .opt { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.prof .pr .opt h3 { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14.5px; }
.prof .pr .opt p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.ph-pop { position: absolute; right: 0; top: 36px; width: min(560px, 80vw); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 70; display: grid; grid-template-columns: 140px 1fr; min-height: 220px; }
.ph-pop .cats { background: #f9fafb; padding: 10px 0; border-right: 1px solid var(--line-2); }
.ph-pop .cats button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 16px; cursor: pointer; font-size: 13.5px; }
.ph-pop .cats button.on { color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.ph-pop .items { padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.ph-pop .items button { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.ph-pop .items button:hover { border-color: var(--blue); color: var(--blue); }

/* notifications */
.npanel { position: absolute; right: 0; top: 42px; width: 390px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 90; }
.npanel .nh { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.npanel a { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); font-size: 13px; }
.npanel a:hover { background: var(--hover); text-decoration: none; }
.npanel a.unread { background: #f4f9ff; }
.npanel a.unread .t::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: 1px; }

/* search overlay */
.sov { position: fixed; inset: 0; background: rgba(18, 52, 77, .35); z-index: 120; display: grid; place-items: start center; padding-top: 10vh; }
.sov .sbox2 { width: min(680px, 92vw); background: #fff; border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.sov .sin { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sov .sin svg { width: 18px; height: 18px; color: var(--muted); }
.sov .sin input { border: 0; outline: none; flex: 1; font-size: 16px; height: 30px; }
.sov .sres { max-height: 60vh; overflow: auto; padding: 6px; }
.sov .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 8px 10px 4px; }
.sov .sres a { display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink); align-items: baseline; }
.sov .sres a:hover, .sov .sres a.sel { background: var(--sel); text-decoration: none; }
kbd { font: 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); background: #fff; }

/* ---------- modal, toast */
.overlay { position: fixed; inset: 0; background: rgba(18, 52, 77, .38); display: grid; place-items: start center; padding-top: 7vh; z-index: 100; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); margin-bottom: 40px; }
.modal.wide { width: min(880px, 94vw); }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-h h2 { flex: 1; font-size: 16px; }
.modal-b { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line-2); background: #f9fafb; border-radius: 0 0 10px 10px; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.x:hover { background: var(--line-2); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); font-size: 13.5px; max-width: 420px; cursor: pointer; animation: tin .18s ease-out; display: flex; gap: 12px; align-items: center; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--accent); }
.toast button { background: none; border: 1px solid rgba(255, 255, 255, .6); color: #fff; border-radius: 4px; padding: 2px 10px; cursor: pointer; font-weight: 700; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.err-box { background: var(--red-soft); color: var(--red); border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px; display: grid; place-items: center; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #12344d, #0f5c4d); }
.login form { background: #fff; width: 380px; border-radius: 12px; padding: 30px 30px 26px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.login .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.login .logo { width: 40px; height: 40px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }

@media (max-width: 1440px) {
  .tp { grid-template-columns: 250px 1fr 290px 0; }
  .tp .cpanel { display: none; }
  .tp.nolist { grid-template-columns: 0 1fr 290px 0; }
}
@media (max-width: 1200px) {
  .ws { grid-template-columns: 0 1fr auto; }
  .ws .vpanel { display: none; }
  .tp, .tp.nolist { grid-template-columns: 0 1fr 280px 0; }
  .tp .mini { display: none; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .dash, .cl, .prof { grid-template-columns: 1fr; }
  .tcard { grid-template-columns: 22px 40px 1fr 200px; }
}
