/* ==================================================================
   Webresource Hub Office
   ================================================================== */
:root {
  --brand:      #1C2463;   /* logo navy, deepened — sidebar and document headers */
  --brand-2:    #2D378C;   /* logo navy */
  --sky:        #27AAE1;   /* logo blue */
  --leaf:       #3BB54A;   /* logo green */
  --gold:       #FCB016;   /* logo amber */
  --ok:         #1E7A34;
  --ok-sf:      #E5F6E8;
  --accent:     #0E6FA3;   /* actions: logo blue deepened for white text */
  --accent-dk:  #0B5A86;
  --accent-sf:  #E3F4FC;
  --ink:        #121833;
  --ink-2:      #3C4566;
  --muted:      #69728F;
  --canvas:     #F3F5FA;
  --surface:    #FFFFFF;
  --line:       #E0E4EE;
  --line-2:     #EDF0F6;
  --amber:      #B86E00;  --amber-sf: #FCF1DC;
  --red:        #C0262D;  --red-sf:   #FBE7E7;
  --blue:       #2563A8;  --blue-sf:  #E5EEF8;
  --grey-sf:    #EEF0EE;
  --radius:     10px;
  --lift:       0 1px 2px rgba(18,24,51,.06), 0 1px 1px rgba(18,24,51,.03);
  --lift-2:     0 10px 30px rgba(18,24,51,.14);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-dk); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; }
h3 { font-size: 14.5px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.inline { display: inline; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 16px; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- The logo's three colours as a thin stripe ---------- */
.stripe { height: 4px; background: linear-gradient(90deg, var(--sky) 0 42%, var(--leaf) 42% 74%, var(--gold) 74% 100%); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--brand); color: #D9DEF2; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 30px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 4px 8px 16px; color: #fff; text-decoration: none !important; }
.brand img { height: 40px; width: auto; display: block; }
.brand b { display: block; font-size: 13.5px; line-height: 1.2; }
.brand small { color: #A9B3E0; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.nav-group { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #98A3D6; padding: 14px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: #D9DEF2; font-weight: 500; text-decoration: none !important; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 #FCB016; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--canvas); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 38px; }
.top-search input { border: none; background: none; flex: 1; font: inherit; outline: none; min-width: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 9px; color: var(--ink-2); background: none; border: none; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--canvas); text-decoration: none; }
.bell em { position: absolute; top: 3px; right: 2px; background: var(--red); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; }
.menu-btn { display: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 9px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--canvas); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-sf); color: var(--accent-dk); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.who { font-weight: 600; font-size: 13px; line-height: 1.15; }
.who small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.usermenu .menu { position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--lift-2); min-width: 200px; padding: 6px; z-index: 30; }
.usermenu .menu a, .usermenu .menu button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--ink); font: inherit; background: none; border: none; cursor: pointer; text-align: left; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--canvas); text-decoration: none; }
.page { padding: 22px 24px 60px; max-width: 1360px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--lift); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font-size: 14.5px; }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--lift); color: var(--ink); display: block; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-red .stat-value { color: var(--red); }
.stat-amber .stat-value { color: var(--amber); }
.stat-green .stat-value { color: var(--ok); }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--accent-dk); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--canvas); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #A11E24; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--accent-dk); font: inherit; cursor: pointer; padding: 0; }
.link-btn.danger { color: var(--red); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill-green { background: var(--ok-sf); color: var(--ok); }
.pill-amber { background: var(--amber-sf); color: var(--amber); }
.pill-red   { background: var(--red-sf); color: var(--red); }
.pill-blue  { background: var(--blue-sf); color: var(--blue); }
.pill-grey  { background: var(--grey-sf); color: var(--ink-2); }

.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-weight: 500; }
.flash-ok   { background: var(--ok-sf); color: var(--ok); }
.flash-err  { background: var(--red-sf); color: var(--red); }
.flash-warn { background: var(--amber-sf); color: var(--amber); }
.note { background: var(--blue-sf); color: #1D4E85; padding: 10px 13px; border-radius: 9px; font-size: 13px; }
.note-amber { background: var(--amber-sf); color: #7A4A00; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFBFA; white-space: nowrap; }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.t tr:last-child td { border-bottom: none; }
.t tbody tr:hover td { background: #F8FAFD; }
.t .right, .t th.right { text-align: right; }
.t tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #FAFBFA; }
.t td.sub-row { padding-left: 34px; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 10px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
label.f { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
label.f small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input[type=search], input[type=url], input[type=time], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(14,111,163,.14); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.filters input, .filters select { width: auto; min-width: 150px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px 14px; margin: 0; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tabs a.on { color: var(--accent-dk); border-color: var(--accent); }

dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12.5px; }
dl.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Conversation (tickets) ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.msg-head { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.msg-head b { color: var(--ink); }
.msg-body { padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.client { border-left: 3px solid var(--blue); }
.msg.staff { border-left: 3px solid var(--accent); }
.msg.internal { background: #FFFBEF; border-left: 3px solid var(--amber); }
.msg.system { background: none; border: none; text-align: center; color: var(--muted); font-size: 12px; }
.msg.system .msg-body { padding: 2px; }

/* ---------- Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 6px 0 0; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar i { display: block; width: 100%; max-width: 34px; background: var(--sky); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar i.out { background: #E3A23B; }
.bars .bar span { font-size: 10.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; }
.bars .pair { display: flex; gap: 2px; width: 100%; justify-content: center; align-items: flex-end; height: 100%; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.meter { height: 7px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 18px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: none; }
.list li.unread { background: #F2F8FD; font-weight: 600; }

/* ---------- Documents (invoice, payslip) ---------- */
.doc { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #fff; max-width: 860px; margin: 0 auto; padding: 40px 44px; border: 1px solid var(--line); border-radius: 10px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--brand); padding-bottom: 16px; margin-bottom: 20px; }
.doc-head h1 { font-size: 26px; letter-spacing: .02em; color: var(--brand); }
.doc .t th { background: var(--brand); color: #fff; }
.doc-totals { margin-left: auto; width: 300px; margin-top: 10px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.doc-totals .grand { border-top: 2px solid var(--ink); font-weight: 700; font-size: 16px; padding-top: 8px; }
.stamp { display: inline-block; border: 3px solid currentColor; padding: 4px 14px; font-weight: 800; letter-spacing: .1em; transform: rotate(-6deg); border-radius: 6px; }

/* ---------- Sign-in & public pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand) 0%, #141A4D 55%, var(--canvas) 55.1%); }
.auth { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; box-shadow: var(--lift-2); padding: 30px 28px; }
.auth .brand { color: var(--ink); padding: 0 0 18px; }
.auth .brand img { height: 50px; }
.auth { overflow: hidden; }
.auth .brand small { color: var(--muted); }
.public-top { background: var(--brand); color: #fff; }
.public-top .in { max-width: 980px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.public-top a { color: #D9DEF2; }
.public { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.kb-body h3 { margin: 18px 0 6px; }
.kb-body p, .kb-body li { line-height: 1.65; }
.stars { display: flex; gap: 6px; }
.stars button { font-size: 26px; background: none; border: none; cursor: pointer; color: #C9CFCB; padding: 0; }
.stars button:hover, .stars button.on { color: var(--gold); }

/* ---------- Small screens ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--lift-2); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .menu-btn { display: inline-grid; }
  .who { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .page { padding: 16px 16px 50px; }
  .top { padding: 0 10px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; }
  dl.kv dd { margin-bottom: 8px; }
  .doc { padding: 22px 16px; }
  .doc-head { flex-direction: column; }
  .doc-totals { width: 100%; }
  .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
}

@media print {
  .no-print, .side, .top, .page-head .actions, .flash { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .doc { border: none; padding: 0; max-width: none; }
  .card { box-shadow: none; }
  a { color: inherit; }
}
.red { color: var(--red); }
