/* ============================================================
   AHOY Supplier & Payables Portal - Design System
   Ported from the Ahoy brand theme (Lexend Deca / IBM Plex Mono)
   ============================================================ */

:root {
  --bg-0: #F3F5FF;
  --bg-1: #FFFFFF;
  --bg-2: #E8ECFB;
  --bg-3: #E0E5F6;

  --line-1: rgba(51, 62, 99, 0.12);
  --line-2: rgba(51, 62, 99, 0.20);
  --line-3: rgba(51, 62, 99, 0.34);

  --blue: #0066FF;
  --blue-bright: #0066FF;
  --blue-deep: #0033A0;
  --blue-hover: #0052D6;
  --blue-soft: rgba(0, 102, 255, 0.12);
  --blue-glow: rgba(0, 102, 255, 0.28);
  --red: #FF0005;
  --red-soft: rgba(255, 0, 5, 0.10);
  --green: #00B865;
  --green-soft: rgba(0, 184, 101, 0.12);
  --yellow: #FFA200;
  --yellow-soft: rgba(255, 162, 0, 0.14);
  --violet: #6C5CE7;
  --violet-soft: rgba(108, 92, 231, 0.12);

  --txt-1: #333E63;
  --txt-2: #485E79;
  --txt-3: #6E7DA6;
  --txt-4: #9AA6C4;

  --font: 'Lexend Deca', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;

  --sidebar-w: 268px;
  --topbar-h: 66px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(51, 62, 99, 0.04);
  --shadow-lift: 0 12px 28px -12px rgba(0, 102, 255, 0.30);
  --shadow-pop: 0 24px 60px -20px rgba(51, 62, 99, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #root { height: 100%; }
html, body {
  margin: 0;
  background: var(--bg-0);
  color: var(--txt-1);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  font-size: 15px;
  line-height: 1.5;
}
body {
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(0, 102, 255, 0.06), transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(51, 62, 99, 0.05), transparent 60%),
    linear-gradient(180deg, #F3F5FF 0%, #E7ECFB 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
a { color: var(--blue-bright); text-decoration: none; cursor: pointer; }
img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
::selection { background: var(--blue-soft); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; }

/* ============================================================ TYPOGRAPHY */
.mono { font-family: var(--font-mono); }
.kicker {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--blue-bright);
}
.h-page { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.h-sec { font-size: 19px; font-weight: 700; }
.sub { color: var(--txt-3); font-size: 14px; }
.muted { color: var(--txt-3); }
.tiny { font-size: 12px; }
.strong { font-weight: 600; color: var(--txt-1); }
.nowrap { white-space: nowrap; }

/* ============================================================ AUTH SHELL */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line-1);
  border-radius: 22px;
  padding: 38px 34px;
  box-shadow: var(--shadow-pop);
}
.auth-card.wide { max-width: 720px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }

/* ============================================================ APP SHELL */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app-body { min-width: 0; display: flex; flex-direction: column; }
.app-main { min-width: 0; padding: 30px 40px 90px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line-1);
  padding: 20px 14px 40px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(243, 245, 255, 0.55));
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px; margin-bottom: 14px; user-select: none; }
.brand-logo { width: 38px; height: 38px; flex: none; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; line-height: 1; }
.brand-sub { font-size: 9.5px; letter-spacing: 0.20em; text-transform: uppercase; color: var(--txt-3); font-weight: 600; margin-top: 3px; }

.nav-group-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--txt-4); padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: 10px; color: var(--txt-2);
  font-size: 14px; font-weight: 400; transition: all .14s; position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.7); color: var(--txt-1); }
.nav-item.active { background: var(--blue); color: #fff; font-weight: 500; box-shadow: 0 6px 16px -8px var(--blue-glow); }
.nav-item.active .nav-ico { opacity: 1; }
.nav-ico { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--blue-soft); color: var(--blue-bright); padding: 1px 8px; border-radius: 999px;
}
.nav-item.active .nav-badge { background: rgba(255, 255, 255, 0.24); color: #fff; }
.sidebar-spacer { flex: 1; }

.side-user {
  margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-1);
  background: rgba(255, 255, 255, 0.6); display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; background: var(--blue-deep);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; border-radius: 13px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 40px;
  border-bottom: 1px solid var(--line-1);
  background: rgba(243, 245, 255, 0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.topbar .crumb { font-size: 13px; color: var(--txt-3); font-family: var(--font-mono); letter-spacing: .02em; }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: var(--txt-2); position: relative; transition: all .14s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.8); color: var(--txt-1); }
.icon-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg-0); }

.hamburger { display: none; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 400;
  cursor: pointer; border: 1px solid transparent; transition: all .15s; white-space: nowrap;
}
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px -8px rgba(0, 102, 255, 0.45); }
.btn.primary:hover { background: var(--blue-hover); box-shadow: 0 10px 24px -8px rgba(0, 102, 255, 0.55); transform: translateY(-1px); }
.btn.dark { background: var(--txt-1); color: #fff; }
.btn.dark:hover { background: var(--blue-deep); transform: translateY(-1px); }
.btn.outline { border-color: var(--line-2); color: var(--txt-1); background: rgba(255, 255, 255, 0.6); }
.btn.outline:hover { border-color: var(--blue); color: var(--blue); }
.btn.ghost { color: var(--txt-2); }
.btn.ghost:hover { color: var(--blue-bright); background: rgba(255, 255, 255, 0.7); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.success { background: var(--green); color: #fff; }
.btn.success:hover { filter: brightness(.96); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.lg { padding: 14px 26px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================================================ CARDS / PANELS */
.panel {
  background: var(--bg-1); border: 1px solid var(--line-1); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.panel.pad { padding: 22px; }
.panel-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--line-1);
}
.panel-head h3 { font-size: 15px; font-weight: 700; }
.panel-body { padding: 20px; }

.card {
  background: var(--bg-1); border: 1px solid var(--line-1); border-radius: var(--radius);
  padding: 20px; transition: all .2s; box-shadow: var(--shadow-card);
}
.card.hover:hover { transform: translateY(-3px); border-color: var(--line-3); box-shadow: var(--shadow-lift); }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 16px; align-items: center; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap20 { gap: 20px; } .gap24 { gap: 24px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt32 { margin-top: 32px; }
.mb4 { margin-bottom: 4px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; } .mb24 { margin-bottom: 24px; }
.fill { flex: 1; }

/* Stat / KPI card */
.stat { position: relative; overflow: hidden; }
.stat .k { font-family: var(--font-mono); font-size: 11px; color: var(--txt-3); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; line-height: 1; }
.stat .d { font-size: 13px; color: var(--txt-3); margin-top: 8px; }
.stat .ico-badge {
  position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; background: var(--blue-soft); color: var(--blue);
}
.trend-up { color: var(--green); font-weight: 600; }
.trend-down { color: var(--red); font-weight: 600; }

/* ============================================================ BADGES / PILLS */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; text-transform: uppercase;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.blue { background: var(--blue-soft); color: var(--blue-deep); }
.badge.green { background: var(--green-soft); color: #00744a; }
.badge.yellow { background: var(--yellow-soft); color: #9a6200; }
.badge.red { background: var(--red-soft); color: #b00003; }
.badge.violet { background: var(--violet-soft); color: #4b3fb0; }
.badge.gray { background: rgba(51, 62, 99, 0.08); color: var(--txt-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 4px 11px; border-radius: 999px; background: var(--bg-2); color: var(--txt-2); }

/* ============================================================ TABLES */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl thead th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--txt-3); padding: 10px 16px; border-bottom: 1px solid var(--line-1);
  white-space: nowrap; position: sticky; top: 0; background: var(--bg-1);
}
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-1); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(0, 102, 255, 0.035); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 500; color: var(--txt-1); }
.cell-sub { font-size: 12px; color: var(--txt-3); }

/* ============================================================ FORMS */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--txt-2); }
.field .req { color: var(--red); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--txt-4); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.85); color: var(--txt-1); font-size: 14px; transition: all .14s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.input::placeholder, .textarea::placeholder { color: var(--txt-4); }
.textarea { resize: vertical; min-height: 90px; }
.input.err, .select.err { border-color: var(--red); }
.field .msg-err { font-size: 12px; color: var(--red); }
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--txt-4); font-family: var(--font-mono); font-size: 13px; pointer-events: none; }
.input-group .input { padding-left: 42px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .span2 { grid-column: 1 / -1; }

/* Checkbox / toggle */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--txt-2); }
.check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--blue); }

/* File dropzone */
.dropzone {
  border: 1.5px dashed var(--line-3); border-radius: 12px; padding: 22px; text-align: center;
  background: rgba(255, 255, 255, 0.5); transition: all .15s; cursor: pointer;
}
.dropzone:hover { border-color: var(--blue); background: var(--blue-soft); }
.dropzone.filled { border-style: solid; border-color: var(--green); background: var(--green-soft); text-align: left; }

/* ============================================================ STEPPER (wizard) */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 8px; }
.step { display: flex; align-items: center; gap: 10px; flex: 1; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; background: var(--bg-2);
  color: var(--txt-3); border: 2px solid transparent; transition: all .2s;
}
.step.active .dot { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px var(--blue-soft); }
.step.done .dot { background: var(--green); color: #fff; }
.step .lbl { font-size: 12.5px; font-weight: 500; color: var(--txt-3); }
.step.active .lbl, .step.done .lbl { color: var(--txt-1); }
.step .bar { flex: 1; height: 2px; background: var(--line-1); margin: 0 6px; border-radius: 2px; }
.step.done .bar { background: var(--green); }

/* ============================================================ TIMELINE */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-node { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; z-index: 1; background: var(--bg-2); color: var(--txt-3); }
.tl-node.done { background: var(--green); color: #fff; }
.tl-node.active { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px var(--blue-soft); }
.tl-node.reject { background: var(--red); color: #fff; }
.tl-line { width: 2px; flex: 1; background: var(--line-1); min-height: 14px; }
.tl-line.done { background: var(--green); }
.tl-body { padding-bottom: 22px; }
.tl-title { font-weight: 600; font-size: 14px; }
.tl-meta { font-size: 12px; color: var(--txt-3); font-family: var(--font-mono); margin-top: 2px; }
.tl-note { font-size: 13px; color: var(--txt-2); margin-top: 6px; }

/* ============================================================ TABS */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-1); margin-bottom: 22px; }
.tab {
  padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--txt-3); position: relative;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .14s;
}
.tab:hover { color: var(--txt-1); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Segmented */
.segmented { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--txt-3); }
.segmented button.active { background: #fff; color: var(--blue); box-shadow: var(--shadow-card); }

/* ============================================================ MODAL / DRAWER */
/* Modals must sit above the drawer (101), the mobile sidebar (120) and the
   copilot launcher (150), otherwise their buttons are unclickable. */
.scrim { position: fixed; inset: 0; background: rgba(20, 26, 48, 0.42); backdrop-filter: blur(3px); z-index: 160; display: grid; place-items: center; padding: 24px; animation: fade .18s ease; }
.modal { width: 100%; max-width: 540px; background: var(--bg-1); border-radius: 18px; box-shadow: var(--shadow-pop); max-height: 90vh; overflow: auto; animation: pop .2s cubic-bezier(.2,.7,.2,1); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line-1); position: sticky; top: 0; background: var(--bg-1); z-index: 2; }
.modal-body { padding: 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line-1); position: sticky; bottom: 0; background: var(--bg-1); }

.drawer-scrim { position: fixed; inset: 0; background: rgba(20, 26, 48, 0.42); backdrop-filter: blur(3px); z-index: 100; animation: fade .18s ease; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw); background: var(--bg-1); box-shadow: var(--shadow-pop); z-index: 101; overflow-y: auto; animation: slideIn .24s cubic-bezier(.2,.7,.2,1); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes revealUp { to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ MISC */
.divider { height: 1px; background: var(--line-1); margin: 20px 0; }
.dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 20px; font-size: 14px; }
.dl dt { color: var(--txt-3); font-size: 13px; }
.dl dd { margin: 0; color: var(--txt-1); font-weight: 500; }
.kv { display: flex; flex-direction: column; gap: 3px; }
.kv .k { font-size: 12px; color: var(--txt-3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.kv .v { font-size: 15px; font-weight: 600; }

.empty { text-align: center; padding: 54px 20px; color: var(--txt-3); }
.empty .ico { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--txt-4); opacity: .7; }
.empty h4 { font-size: 16px; color: var(--txt-2); margin-bottom: 6px; }

.spinner { width: 20px; height: 20px; border: 2.5px solid var(--blue-soft); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
.page-loading { display: grid; place-items: center; min-height: 60vh; }

.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 280px; max-width: 380px; padding: 14px 16px; border-radius: 12px; background: var(--bg-1);
  border: 1px solid var(--line-1); box-shadow: var(--shadow-pop); display: flex; gap: 12px; align-items: flex-start;
  animation: slideIn .22s ease;
}
.toast .bar { width: 3px; align-self: stretch; border-radius: 3px; }
.toast.success .bar { background: var(--green); }
.toast.error .bar { background: var(--red); }
.toast.info .bar { background: var(--blue); }

.progressbar { height: 7px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progressbar > span { display: block; height: 100%; border-radius: 999px; background: var(--blue); transition: width .4s ease; }

.doc-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line-1); border-radius: 12px; background: var(--bg-1); }
.doc-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); }

.link { color: var(--blue); font-weight: 500; }
.link:hover { text-decoration: underline; }
.sep-dot::before { content: '·'; margin: 0 7px; color: var(--txt-4); }

.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 10px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.85); min-width: 240px;
}
.search input { border: none; background: none; outline: none; width: 100%; font-size: 14px; }

/* ============================================================ COPILOT */
.copilot-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 150; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; color: var(--txt-1); overflow: hidden;
  background: #fff; border: 1px solid var(--line-1);
  box-shadow: 0 14px 34px -10px var(--blue-glow); transition: transform .15s, box-shadow .15s;
}
.copilot-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 18px 40px -10px var(--blue-glow); }
.copilot-panel {
  position: fixed; right: 24px; bottom: 92px; z-index: 150; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 130px));
  background: var(--bg-1); border: 1px solid var(--line-1); border-radius: 18px; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; overflow: hidden; animation: pop .18s cubic-bezier(.2,.7,.2,1);
}
.copilot-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue-deep)); }
.copilot-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.copilot-empty { margin: auto 0; }
.copilot-chip { text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-1); font-size: 13px; color: var(--txt-2); transition: all .12s; }
.copilot-chip:hover { border-color: var(--blue); color: var(--blue); }
.copilot-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.copilot-msg.user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.copilot-msg.assistant { align-self: flex-start; background: var(--bg-2); color: var(--txt-1); border-bottom-left-radius: 4px; }
.copilot-note { background: var(--yellow-soft); color: #9a6200; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; }
.copilot-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-1); }
.copilot-input input { flex: 1; border: 1px solid var(--line-2); border-radius: 999px; padding: 10px 14px; font-size: 13.5px; outline: none; }
.copilot-input input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.copilot-input .btn { border-radius: 50%; width: 40px; height: 40px; padding: 0; flex: none; }

/* ============================================================ RESPONSIVE */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 120; width: 280px; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .24s ease;
  }
  .sidebar.open { transform: none; }
  .hamburger { display: grid; }
  .topbar { padding: 0 20px; }
  .app-main { padding: 22px 18px 80px; }
  .mobile-scrim { position: fixed; inset: 0; background: rgba(20,26,48,.4); z-index: 110; }
}
@media (max-width: 700px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .app-main { padding: 18px 14px 80px; }
  .drawer { width: 100vw; }
}
