/* OctoDesk — Third Octopus support portal. Light theme, navy sidebar, ember accent. */
:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #eef1f7; --border: #dde3ee;
  --text: #1c2433; --muted: #64748b;
  --accent: #d9531e; --accent-soft: rgba(217, 83, 30, 0.10);
  --navy: #0f172a; --navy-2: #1e293b;
  --blue: #2563eb; --green: #16a34a; --amber: #d97706; --red: #dc2626; --purple: #7c3aed; --slate: #64748b;
  --radius: 12px; --shadow: 0 6px 18px rgba(28, 36, 51, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 18px; margin: 0 0 8px; } h3 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
p { margin: 0 0 8px; } .muted { color: var(--muted); } .warn { color: var(--amber); } .nowrap { white-space: nowrap; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; } code.sel { display: block; padding: 8px; user-select: all; word-break: break-all; }
small { font-size: 12px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: 0 0 236px; background: var(--navy); color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none !important; }
.brand-mark { color: var(--accent); font-size: 22px; }
.brand-product { display: block; font-weight: 700; font-size: 18px; letter-spacing: .3px; line-height: 1.1; }
.brand-sub { display: block; color: #94a3b8; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.6px; }
.brand.big { justify-content: center; margin-bottom: 6px; } .brand.big .brand-product { font-size: 26px; color: var(--text); }
.sidenav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; color: #64748b; padding: 14px 10px 4px; }
.sidenav a { display: block; padding: 8px 12px; border-radius: 8px; color: #cbd5e1; font-weight: 500; }
.sidenav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.sidenav a.active { background: rgba(217, 83, 30, .18); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidefoot { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid #1e293b; }
.sidefoot .who { flex: 1; line-height: 1.2; min-width: 0; } .sidefoot .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sidefoot .who small { color: #94a3b8; }
.sidefoot .logout { color: #94a3b8; font-size: 18px; } .sidefoot .logout:hover { color: #fff; text-decoration: none; }
.content { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--text); white-space: nowrap; }

/* ---------- cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.two-col.wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.side .card { padding: 16px 18px; } .stack { display: grid; gap: 0; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 16px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- kpis / bars ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); }
.kpi .n { font-size: 26px; font-weight: 700; line-height: 1.1; } .kpi .n small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.bad .n { color: var(--red); } .kpi.warn .n { color: var(--amber); }
.bar { display: grid; grid-template-columns: 130px 1fr 32px; gap: 10px; align-items: center; margin: 5px 0; font-size: 13px; }
.bar .bl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bar .bn { text-align: right; color: var(--muted); }
.bar .bt { background: var(--surface-2); border-radius: 6px; height: 10px; overflow: hidden; } .bar .bt i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.card > table.grid { border: 0; box-shadow: none; }
.card:has(> table.grid) { overflow-x: auto; }
table.grid th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; } table.grid tr:hover td { background: #fafbfe; }
table.grid.compact td, table.grid.compact th { padding: 7px 10px; }
table.grid tr.late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
table.grid tr.attn td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
table.grid tr.dim td { opacity: .55; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
table.mini th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 4px 0; }
table.mini td { padding: 4px 0; border-top: 1px solid var(--border); }
.users input[type=text], .users input:not([type]) { width: 140px; padding: 4px 6px; } .users input.sub { font-size: 11px; margin-top: 3px; } .users select { padding: 4px 6px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13px; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-word; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; } ul.plain li:last-child { border: 0; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st-new { background: #ede9fe; color: #5b21b6; } .st-open { background: #dbeafe; color: #1e40af; } .st-waiting_client { background: #fef3c7; color: #92400e; }
.st-resolved { background: #dcfce7; color: #166534; } .st-closed { background: var(--surface-2); color: var(--muted); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.pr-low { background: #f1f5f9; color: #475569; } .pr-medium { background: #e0f2fe; color: #075985; } .pr-high { background: #ffedd5; color: #9a3412; } .pr-critical { background: #fee2e2; color: #991b1b; }
.chip { display: inline-block; background: var(--surface-2); border-radius: 6px; padding: 1px 8px; font-size: 12px; color: var(--text); }
.tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.tag.internal { background: #fef3c7; color: #92400e; }
.sla { font-size: 12px; color: var(--muted); white-space: nowrap; } .sla.late { color: var(--red); font-weight: 600; } .sla.paused { color: var(--amber); } .sla.done { color: var(--green); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #cbd5e1; color: #1e293b; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: 0 0 28px; }
.avatar.staff { background: var(--accent); color: #fff; }

/* ---------- forms ---------- */
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.form label.check, .form label.inline, .seg label { flex-direction: row; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.form input, .form select, .form textarea, .toolbar input, .toolbar select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; text-transform: none; letter-spacing: 0; color-scheme: light; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid rgba(37, 99, 235, .25); border-color: var(--blue); }
.form textarea { resize: vertical; min-height: 80px; } .form input[type=file] { padding: 6px; background: var(--surface-2); }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; } .form.narrow { max-width: 520px; }
.form .actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; } .form.side h3, .side .form h3 { margin-top: 0; }
form.inline { display: inline; }
.seg { display: flex; gap: 16px; margin-bottom: 8px; } .stars { display: flex; gap: 10px; margin: 8px 0 12px; } .stars label { flex-direction: row; text-transform: none; font-size: 13px; color: var(--text); margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--surface-2); } .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: #c2461a; }
.btn.block { width: 100%; } .btn.small { padding: 4px 10px; font-size: 12px; } .btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { min-width: 200px; } .toolbar.filters select { min-width: 130px; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; margin-right: auto; }
.tabs a { padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; } .tabs a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); } .tabs a:hover { text-decoration: none; color: var(--text); }
.reply textarea { width: 100%; }

/* ---------- conversation thread ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.msg.staff { border-left: 4px solid var(--accent); } .msg.internal { background: #fffbeb; border-color: #fde68a; border-left: 4px solid var(--amber); }
.msg header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; } .msg header b { color: var(--text); }
.msg .body { white-space: normal; line-height: 1.55; }
.sys { font-size: 12px; color: var(--muted); padding: 2px 14px; border-left: 2px dashed var(--border); margin-left: 12px; }
ul.files { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
ul.files li { background: var(--surface-2); border-radius: 6px; padding: 3px 8px; font-size: 12px; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(1200px 600px at 80% -10%, rgba(217,83,30,.12), transparent), var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px 32px; box-shadow: var(--shadow); }
.login-card .brand-mark { font-size: 26px; }
.login-tag { color: var(--muted); text-align: center; margin: 0 0 18px; }
.login-card form label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.login-card form input { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; color-scheme: light; }
.login-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) { .two-col, .two-col.wide { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { flex-direction: column; } .sidebar { width: auto; flex: none; height: auto; position: static; }
  .sidenav { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 10px 8px; } .nav-sec { width: 100%; padding: 8px 10px 2px; }
  .sidenav a { padding: 6px 10px; } .content { padding: 18px 16px 40px; } .kpis { grid-template-columns: repeat(2, 1fr); }
  table.grid { display: block; overflow-x: auto; }
}
