/* =====================================================================
   XYZ ERP + CRM — Design system
   Brand: ink black + coral→crimson gradient (XYZ brand)
   Type:  DM Sans (UI) · DM Mono (numbers, codes)
   ===================================================================== */

:root {
  --brand-1: #F37F7B;
  --brand-2: #DD1E47;
  --brand: #DD1E47;
  --brand-grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  --brand-soft: #FDECEF;
  --brand-ink: #B0123A;

  --ink: #15151A;
  --ink-2: #3D3D47;
  --muted: #74747F;
  --faint: #A3A3AD;
  --line: #E8E8EE;
  --line-2: #F0F0F4;
  --bg: #F5F5F8;
  --panel: #FFFFFF;
  --panel-2: #FAFAFC;
  --hover: #F3F3F7;

  --side-bg: #111114;
  --side-ink: #C9C9D1;
  --side-dim: #6E6E7A;
  --side-hover: #1D1D22;
  --side-active: #26262D;

  --success: #12A150; --success-bg: #E7F7EE;
  --warn: #C27803;    --warn-bg: #FEF5E2;
  --danger: #DC2640;  --danger-bg: #FDE9EC;
  --info: #2563EB;    --info-bg: #E8F0FE;
  --violet: #7C3AED;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(20, 20, 30, .05), 0 1px 1px rgba(20, 20, 30, .03);
  --sh-2: 0 6px 18px -6px rgba(20, 20, 30, .12), 0 2px 6px rgba(20, 20, 30, .05);
  --sh-3: 0 24px 60px -12px rgba(20, 20, 30, .28), 0 8px 20px -8px rgba(20, 20, 30, .14);
  --ring: 0 0 0 3px var(--ring-c, rgba(221, 30, 71, .18));

  --ease: cubic-bezier(.22, .9, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --side-w: 256px;
  --top-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-soft: #3A1520;
  --brand-ink: #FF8A9E;
  --ink: #F1F1F5;
  --ink-2: #C8C8D2;
  --muted: #9494A0;
  --faint: #66666F;
  --line: #2A2A31;
  --line-2: #222228;
  --bg: #0E0E11;
  --panel: #17171B;
  --panel-2: #1B1B20;
  --hover: #212127;
  --side-bg: #0A0A0C;
  --side-hover: #17171B;
  --side-active: #1F1F25;
  --success-bg: #0F2E1D; --warn-bg: #33270C; --danger-bg: #3A1219; --info-bg: #12213F;
  --success: #34D27B; --warn: #F2B53A; --danger: #FF5A70; --info: #6EA0FF;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 6px 18px -6px rgba(0, 0, 0, .6);
  --sh-3: 0 24px 60px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-optical-sizing: auto;
  font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
code, .mono, kbd { font-family: 'DM Mono', ui-monospace, monospace; font-size: .92em; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.text-success { color: var(--success); }
.r { text-align: right; }
.ic { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.ic.xs { width: 13px; height: 13px; }
::selection { background: color-mix(in srgb, var(--brand) 18%, transparent); }
[hidden] { display: none !important; }

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

/* =====================================================================
   App shell
   ===================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column;
  transition: width .32s var(--ease), transform .32s var(--ease);
}
.sidebar::after { /* subtle brand glow */
  content: ""; position: absolute; inset: auto 0 0 0; height: 240px; pointer-events: none;
  background: radial-gradient(120% 80% at 0% 100%, var(--side-glow, rgba(221, 30, 71, .18)), transparent 65%);
}
.brand { display: flex; align-items: center; height: 76px; padding: 0 22px; flex-shrink: 0; }
.brand-full { height: 40px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; transition: opacity .2s; }
.brand-mini { display: none; width: 34px; height: 34px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; position: relative; z-index: 1; }
.nav-group { margin-top: 14px; }
.nav-title { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-dim); padding: 0 12px 6px; white-space: nowrap; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px;
  border-radius: 10px; color: var(--side-ink); font-weight: 500; white-space: nowrap;
  transition: background .18s, color .18s, transform .18s var(--ease);
}
.nav-link .ic { width: 18px; height: 18px; opacity: .85; }
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link:active { transform: scale(.98); }
.nav-link.active { background: var(--side-active); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brand-grad); animation: growY .35s var(--ease);
}
.nav-link.active .ic { color: var(--brand-1); opacity: 1; }
.nav-collapse {
  display: flex; align-items: center; gap: 12px; margin: 8px 12px 14px; height: 38px; padding: 0 12px;
  background: transparent; border: 1px solid #222228; border-radius: 10px; color: var(--side-dim); position: relative; z-index: 1; white-space: nowrap;
}
.nav-collapse:hover { color: #fff; border-color: #33333b; }

/* company switcher */
.co-switch { margin: 0 12px 6px; position: relative; z-index: 5; }
.co-current { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.05); color: var(--side-ink); text-align: left; transition: background .15s, border-color .15s; }
.co-current:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.16); }
.co-current img, .co-menu img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; object-fit: contain; background: #fff; }
.co-current span, .co-menu span { flex: 1; min-width: 0; }
.co-current b { display: block; color: #fff; font-size: 13.5px; line-height: 1.2; }
.co-current small, .co-menu small { display: block; font-size: 11px; color: var(--side-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-menu { left: 0; right: 0; min-width: 0; transform-origin: top left; }
.co-menu form { margin: 0; }
.co-menu small { color: var(--muted); }
.co-menu button.on { background: var(--brand-soft); }
.nav-mini .co-switch { margin: 0 12px 6px; }
.nav-mini .co-current { justify-content: center; padding: 6px; }
.nav-mini .co-current > span, .nav-mini .co-current > .ic { display: none; }
.nav-mini .co-menu { right: auto; width: 240px; }

.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; transition: margin .32s var(--ease); }

/* collapsed (mini) sidebar */
.nav-mini .sidebar { width: 76px; }
.nav-mini .main { margin-left: 76px; }
.nav-mini .brand { justify-content: center; padding: 0; }
.nav-mini .brand-full { display: none; }
.nav-mini .brand-mini { display: block; }
.nav-mini .nav-title { visibility: hidden; height: 6px; padding: 0; }
.nav-mini .nav-link span, .nav-mini .nav-collapse span { display: none; }
.nav-mini .nav-link, .nav-mini .nav-collapse { justify-content: center; padding: 0; }
.nav-mini .nav-collapse .ic { transform: rotate(180deg); }
.nav-mini .nav-link:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--ink); color: var(--panel); padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; box-shadow: var(--sh-2);
  animation: pop .18s var(--ease); z-index: 60;
}
:root[data-theme="dark"] .nav-mini .nav-link:hover::after { background: #fff; color: #111; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.scrolled .topbar { border-bottom-color: var(--line); }
.cmdk-trigger {
  display: flex; align-items: center; gap: 10px; height: 40px; width: min(440px, 100%); padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--faint); text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.cmdk-trigger span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-trigger:hover { border-color: #d6d6de; box-shadow: var(--sh-1); }
kbd { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--hover); border: 1px solid var(--line); color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 8px 4px 4px; border-radius: 12px; text-align: left; }
.user-chip:hover { background: var(--hover); }
.user-chip b { display: block; font-size: 13px; line-height: 1.2; }
.user-chip small { display: block; font-size: 11.5px; color: var(--muted); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--brand-grad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); animation: pulse 2.4s infinite; }
.theme-sun { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .theme-moon { display: none; }

.content { flex: 1; padding: 22px 28px 40px; width: 100%; max-width: 1640px; margin: 0 auto; animation: pageIn .45s var(--ease); }
.foot { padding: 16px 28px 22px; color: var(--faint); font-size: 12px; text-align: center; }
.foot span { margin: 0 4px; }
.mobile-only { display: none; }
.sidebar-scrim { display: none; }

/* =====================================================================
   Page header, tabs, toolbar
   ===================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.page-head h1 .ic { width: 24px; height: 24px; color: var(--brand); }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a:hover { color: var(--brand); }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; padding: 10px 14px; color: var(--muted); font-weight: 600; white-space: nowrap; display: flex; gap: 8px; align-items: center; transition: color .2s; background: none; border: 0; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 3px; background: var(--brand-grad); animation: growX .3s var(--ease); }
.count { font-size: 11px; font-weight: 700; background: var(--hover); color: var(--muted); padding: 1px 7px; border-radius: 20px; }
.tab.on .count { background: var(--brand-soft); color: var(--brand-ink); }

.seg { display: inline-flex; background: var(--hover); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a, .seg button { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13px; border: 0; background: none; transition: all .2s var(--ease); }
.seg .on { background: var(--panel); color: var(--ink); box-shadow: var(--sh-1); }
.seg .ic { width: 15px; height: 15px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; margin-bottom: 14px; }
.search-box { position: relative; flex: 1 1 240px; max-width: 360px; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; }
.search-box input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; font: inherit; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s, background .2s; }
.search-box input:focus { border-color: var(--brand); box-shadow: var(--ring); background: var(--panel); }
.toolbar-count { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 500; }

/* =====================================================================
   Cards, KPIs
   ===================================================================== */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { color: var(--brand); width: 17px; }
.card-head .link { font-size: 12.5px; font-weight: 600; color: var(--brand); display: flex; align-items: center; gap: 4px; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mb { margin-bottom: 16px; }

.kpi { position: relative; overflow: hidden; padding: 18px 20px; transition: transform .25s var(--ease), box-shadow .25s; animation: riseIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .kpi-label { color: var(--muted); font-weight: 600; font-size: 13px; }
.kpi .kpi-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi .kpi-ic.success { background: var(--success-bg); color: var(--success); }
.kpi .kpi-ic.info { background: var(--info-bg); color: var(--info); }
.kpi .kpi-ic.warn { background: var(--warn-bg); color: var(--warn); }
.kpi .kpi-val { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .kpi-val small { font-size: 13px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.kpi .kpi-foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.trend.up { color: var(--success); background: var(--success-bg); }
.trend.down { color: var(--danger); background: var(--danger-bg); }
.kpi.hero { background: var(--side-bg); color: #fff; border-color: transparent; }
.kpi.hero::before { content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border-radius: 50%; background: var(--brand-grad); opacity: .55; filter: blur(40px); animation: float 9s ease-in-out infinite; }
.kpi.hero > * { position: relative; }
.kpi.hero .kpi-label, .kpi.hero .kpi-foot, .kpi.hero .kpi-val small { color: #b9b9c4; }
.kpi.hero .kpi-ic { background: rgba(255, 255, 255, .1); color: #fff; }

.welcome { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.welcome h1 { font-size: 26px; font-weight: 700; }
.welcome p { margin: 2px 0 0; color: var(--muted); }
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 230px; }

.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line-2); transition: background .15s; }
.list-rows li:last-child { border-bottom: 0; }
.list-rows li:hover { background: var(--panel-2); }
.list-rows .lr-main { flex: 1; min-width: 0; }
.list-rows .lr-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-rows .lr-main small { color: var(--muted); font-size: 12.5px; }
.lr-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); flex-shrink: 0; }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.bar-row .bar { grid-column: 1 / -1; height: 7px; background: var(--hover); border-radius: 6px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--brand-grad)); transform-origin: left; animation: barIn 1s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s, filter .2s;
}
.btn .ic { width: 16px; height: 16px; }
.btn:hover { border-color: #d3d3dc; box-shadow: var(--sh-1); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 55%, transparent); }
.btn.primary:hover { filter: brightness(1.06) saturate(1.05); box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn.dark { background: var(--ink); color: var(--panel); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); box-shadow: none; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.success { background: var(--success); color: #fff; border-color: transparent; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .7; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); transition: background .15s, color .15s, transform .15s; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .ic { width: 18px; height: 18px; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .22; pointer-events: none; animation: ripple .6s var(--ease); }

/* =====================================================================
   Forms
   ===================================================================== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.third { grid-column: span 1; }
.field.bool { justify-content: flex-end; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--brand); font-style: normal; }
.help { color: var(--faint); font-size: 11.5px; }
.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--ink); font: inherit; outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:hover { border-color: #d6d6de; }
:root[data-theme="dark"] .input:hover { border-color: #3a3a43; }
.input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input.readonly { display: flex; align-items: center; background: var(--panel-2); color: var(--muted); }
.input[readonly] { background: var(--panel-2); color: var(--muted); }
.input.num { font-variant-numeric: tabular-nums; }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.input-affix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: border-color .18s, box-shadow .18s; overflow: hidden; }
.input-affix span { display: grid; place-items: center; padding: 0 10px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; border-right: 1px solid var(--line); }
.input-affix .input { border: 0; border-radius: 0; box-shadow: none !important; }
.input-affix:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 17px; }
.input-icon .input { padding-left: 38px; height: 46px; border-radius: 12px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--faint); padding: 6px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input { width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--panel); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; height: 40px; }
.switch input { display: none; }
.switch .slider { width: 40px; height: 23px; border-radius: 20px; background: var(--line); position: relative; transition: background .25s var(--ease); flex-shrink: 0; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s var(--spring); }
.switch input:checked + .slider { background: var(--brand-grad); }
.switch input:checked + .slider::after { transform: translateX(17px); }
.switch-label { font-weight: 600; font-size: 13px; color: var(--ink-2); }

.check { display: inline-grid; place-items: center; cursor: pointer; }
.check input { display: none; }
.check span { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid #c9c9d3; background: var(--panel); display: grid; place-items: center; transition: all .18s var(--ease); }
.check input:checked + span { background: var(--brand-grad); border-color: transparent; }
.check input:checked + span::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); animation: pop .2s var(--spring); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; font-size: 13px; margin-bottom: 14px; }
.alert.danger { background: var(--danger-bg); color: var(--danger); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.success { background: var(--success-bg); color: var(--success); }

/* =====================================================================
   Custom select (enhances <select data-select>)
   ===================================================================== */
select[data-select] { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.cs { position: relative; min-width: 0; }
.cs-trigger {
  width: 100%; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left; color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.cs-trigger:hover { border-color: #d6d6de; }
:root[data-theme="dark"] .cs-trigger:hover { border-color: #3a3a43; }
.cs-trigger .cs-val { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-trigger .cs-val.ph { color: var(--faint); }
.cs-trigger .cs-caret { width: 16px; color: var(--faint); transition: transform .25s var(--ease); }
.cs-clear { display: none; border: 0; background: none; padding: 2px; color: var(--faint); border-radius: 6px; }
.cs-clear:hover { color: var(--ink); background: var(--hover); }
.cs.has-value .cs-clear { display: grid; }
.cs.open .cs-trigger { border-color: var(--brand); box-shadow: var(--ring); }
.cs.open .cs-caret { transform: rotate(180deg); color: var(--brand); }
.cs.compact .cs-trigger { height: 38px; background: var(--panel-2); min-width: 150px; font-size: 13px; font-weight: 500; }
.cs.compact.has-value .cs-trigger { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.cs.compact.has-value .cs-caret, .cs.compact.has-value .cs-clear { color: var(--brand-ink); }

.cs-pop {
  position: fixed; z-index: 120; min-width: 220px; max-width: 420px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-3); overflow: hidden;
  transform-origin: top center; animation: dropIn .22s var(--ease);
}
.cs-pop.up { transform-origin: bottom center; animation-name: dropUp; }
.cs-pop.closing { animation: dropOut .14s ease-in forwards; }
.cs-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.cs-search .ic { width: 15px; color: var(--faint); }
.cs-search input { flex: 1; border: 0; outline: none; background: none; font: inherit; color: var(--ink); }
.cs-list { max-height: 280px; overflow-y: auto; padding: 6px; }
.cs-group { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.cs-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; transition: background .12s; }
.cs-opt .cs-text { flex: 1; min-width: 0; }
.cs-opt .cs-text small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-opt .cs-tick { width: 15px; color: var(--brand); opacity: 0; transform: scale(.4); transition: all .2s var(--spring); }
.cs-opt.active { background: var(--hover); }
.cs-opt.selected { font-weight: 600; color: var(--brand-ink); }
.cs-opt.selected .cs-tick { opacity: 1; transform: scale(1); }
.cs-opt mark { background: none; color: var(--brand); font-weight: 700; }
.cs-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.cs-loading { padding: 16px; display: flex; justify-content: center; }
.cs-loading::after { content: ""; width: 18px; height: 18px; border: 2px solid var(--brand); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* =====================================================================
   Date picker (enhances <input data-datepicker>)
   ===================================================================== */
.dp-wrap { position: relative; }
.dp-wrap .input { padding-right: 38px; cursor: pointer; }
.dp-wrap .dp-ic { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--faint); pointer-events: none; transition: color .2s; }
.dp-wrap:focus-within .dp-ic { color: var(--brand); }
.dp {
  position: fixed; z-index: 120; width: 304px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--sh-3); padding: 14px; user-select: none;
  transform-origin: top left; animation: dropIn .24s var(--ease);
}
.dp.up { transform-origin: bottom left; animation-name: dropUp; }
.dp.closing { animation: dropOut .14s ease-in forwards; }
.dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.dp-title { flex: 1; display: flex; gap: 4px; }
.dp-title button { border: 0; background: none; font-weight: 700; font-size: 15px; padding: 4px 8px; border-radius: 8px; color: var(--ink); }
.dp-title button:hover { background: var(--hover); color: var(--brand); }
.dp-nav { width: 32px; height: 32px; border: 0; border-radius: 9px; background: none; display: grid; place-items: center; color: var(--ink-2); }
.dp-nav:hover { background: var(--hover); }
.dp-nav .ic { width: 17px; }
.dp-dow, .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--faint); padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.dp-dow span.we { color: var(--brand-1); }
.dp-days { animation: fadeSlide .28s var(--ease); }
.dp-days.prev { animation-name: fadeSlideR; }
.dp-day { position: relative; aspect-ratio: 1; border: 0; background: none; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; transition: background .12s, color .12s, transform .15s var(--ease); }
.dp-day:hover { background: var(--hover); }
.dp-day:active { transform: scale(.9); }
.dp-day.out { color: var(--faint); }
.dp-day.today { color: var(--brand); font-weight: 700; }
.dp-day.today::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand); }
.dp-day.sel { background: var(--brand-grad); color: #fff; font-weight: 700; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--brand) 70%, transparent); animation: pop .25s var(--spring); }
.dp-day.sel::after { background: #fff; }
.dp-day.in-range { background: var(--brand-soft); border-radius: 0; color: var(--brand-ink); }
.dp-day.range-start, .dp-day.range-end { background: var(--brand-grad); color: #fff; }
.dp-day.range-start { border-radius: 10px 0 0 10px; }
.dp-day.range-end { border-radius: 0 10px 10px 0; }
.dp-day.range-start.range-end { border-radius: 10px; }
.dp-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; animation: fadeSlide .25s var(--ease); }
.dp-grid3 button { border: 0; background: none; padding: 14px 0; border-radius: 10px; font-weight: 600; color: var(--ink); }
.dp-grid3 button:hover { background: var(--hover); }
.dp-grid3 button.sel { background: var(--brand-grad); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.dp-foot button { border: 0; background: none; font-weight: 600; font-size: 12.5px; color: var(--brand); padding: 6px 10px; border-radius: 8px; }
.dp-foot button:hover { background: var(--brand-soft); }
.dp-foot .dp-clear { color: var(--muted); }
.dp.range { width: auto; display: flex; gap: 0; padding: 0; }
.dp-presets { width: 150px; border-right: 1px solid var(--line-2); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.dp-presets button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.dp-presets button:hover { background: var(--hover); }
.dp-presets button.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.dp-cal { padding: 14px; width: 304px; }
.dp-range-label { font-size: 12px; color: var(--muted); text-align: center; margin-top: 8px; }

.daterange-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: 13px; white-space: nowrap; transition: all .18s; }
.daterange-btn .ic { width: 16px; color: var(--faint); }
.daterange-btn.has-value { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.daterange-btn.has-value .ic { color: var(--brand-ink); }
.daterange-btn:hover { border-color: #d3d3dc; }

/* =====================================================================
   Tables
   ===================================================================== */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th a { display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--ink); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { transition: background .15s; animation: rowIn .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr.checked { background: var(--brand-soft); }
.table tfoot td { background: var(--panel-2); font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line); }
.table .chk { width: 44px; padding-right: 0; }
.table .act { width: 90px; text-align: right; }
.table.compact td, .table.compact th { padding: 9px 14px; }
.cell-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
a.cell-link:hover span, a.cell-link:hover { color: var(--brand); }
.cell-link-plain:hover { color: var(--brand); }
.table th.sl, .table td.sl { width: 64px; text-align: center; white-space: nowrap; }
.table td.sl { font-family: 'DM Mono', monospace; font-weight: 600; color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: .55; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }
/* An open "…" menu must sit above the rows below it and be fully opaque:
   the faded .row-actions (opacity) and each row's slide-in animation make their own layers, which
   trapped the menu under the next rows and made it see-through. Lift the row whose menu is open. */
.table tbody tr:has(.menu-wrap.open) { position: relative; z-index: 40; }
tr:has(.menu-wrap.open) .row-actions, .row-actions:has(.menu-wrap.open) { opacity: 1; }
.menu-wrap.open { z-index: 81; }
.row-actions .icon-btn { width: 30px; height: 30px; }
.row-actions .ic { width: 16px; }
.bulk-bar { display: none; align-items: center; gap: 12px; padding: 10px 16px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; animation: slideDown .25s var(--ease); }
.bulk-bar.show { display: flex; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line-2); }
.pager div { display: flex; gap: 4px; }
.pager a, .pager span.cur, .pager span.dis, .pager .gap { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; font-weight: 600; }
.pager a:hover { background: var(--hover); color: var(--ink); }
.pager .cur { background: var(--ink); color: var(--panel); }
.pager .dis { opacity: .35; }
.pager .ic { width: 16px; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-muted { background: var(--hover); color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--hover); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.cat-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cat-chip .ic { width: 28px; height: 28px; padding: 6px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }

.avatar { --h: 340; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; font-size: 13px; font-weight: 700; color: hsl(var(--h) 55% 34%); background: hsl(var(--h) 75% 92%); letter-spacing: .02em; }
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 80% 80%); background: hsl(var(--h) 35% 22%); }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sq { border-radius: 9px; }

/* =====================================================================
   Menus (dropdown actions)
   ===================================================================== */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 80; min-width: 210px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-3);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97); transform-origin: top right;
  transition: opacity .18s var(--ease), transform .22s var(--ease), visibility .18s;
}
.menu.left { right: auto; left: 0; transform-origin: top left; }
.menu.drop-up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.menu-wrap.open > .menu { opacity: 1; visibility: visible; transform: none; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; border: 0; background: none; font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-align: left; transition: background .12s, color .12s, padding .15s var(--ease); }
.menu a:hover, .menu button:hover { background: var(--hover); color: var(--ink); padding-left: 13px; }
.menu .ic { width: 16px; color: var(--muted); }
.menu .danger, .menu .danger .ic { color: var(--danger); }
.menu-head { padding: 8px 10px; font-weight: 700; font-size: 13px; }
.menu-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px; color: var(--muted); font-size: 13px; }
.notif { width: 320px; }
.notif-item { gap: 12px !important; }
.ni { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ni.warn { background: var(--warn-bg); } .ni.warn .ic { color: var(--warn); }
.ni.danger { background: var(--danger-bg); } .ni.danger .ic { color: var(--danger); }
.ni.info { background: var(--info-bg); } .ni.info .ic { color: var(--info); }
.quick-create { min-width: 230px; }

/* =====================================================================
   Drawer, modal, toasts, command palette
   ===================================================================== */
.drawer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.drawer-scrim, .modal-scrim, .cmdk-scrim { position: absolute; inset: 0; background: rgba(10, 10, 14, .42); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s var(--ease); }
.drawer-panel { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(640px, calc(100% - 20px)); background: var(--panel); border-radius: 20px; box-shadow: var(--sh-3); transform: translateX(calc(100% + 30px)); transition: transform .42s var(--ease); display: flex; flex-direction: column; overflow: hidden; }
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-panel.wide { width: min(980px, calc(100% - 20px)); }
.drawer-form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--line-2); }
.drawer-head small { color: var(--brand); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }
.drawer-head h2 { font-size: 19px; margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.drawer-body .field { animation: riseIn .4s var(--ease) both; }
.drawer-body .field:nth-child(1) { animation-delay: .04s } .drawer-body .field:nth-child(2) { animation-delay: .07s } .drawer-body .field:nth-child(3) { animation-delay: .1s }
.drawer-body .field:nth-child(4) { animation-delay: .13s } .drawer-body .field:nth-child(5) { animation-delay: .16s } .drawer-body .field:nth-child(6) { animation-delay: .19s }
.drawer-body .field:nth-child(n+7) { animation-delay: .22s }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line-2); background: var(--panel-2); }
.drawer-loading { display: grid; place-items: center; height: 100%; }
.drawer-loading::after { content: ""; width: 28px; height: 28px; border: 3px solid var(--brand); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

.modal { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; pointer-events: none; }
.modal.open { pointer-events: auto; }
.modal.open .modal-scrim { opacity: 1; }
.modal-box { position: relative; width: min(420px, calc(100% - 32px)); background: var(--panel); border-radius: 20px; padding: 26px; text-align: center; box-shadow: var(--sh-3); opacity: 0; transform: scale(.92) translateY(10px); transition: all .3s var(--spring); }
.modal.open .modal-box { opacity: 1; transform: none; }
.modal-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--danger-bg); color: var(--danger); }
.modal-icon .ic { width: 26px; height: 26px; }
.modal-box h3 { font-size: 18px; }
.modal-box p { color: var(--muted); margin: 6px 0 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: center; }
.modal-actions .btn { flex: 1; }

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 420px; padding: 12px 14px; background: var(--ink); color: var(--panel); border-radius: 14px; box-shadow: var(--sh-3); font-weight: 500; animation: toastIn .45s var(--spring); position: relative; overflow: hidden; }
:root[data-theme="dark"] .toast { background: #26262d; color: #f1f1f5; }
.toast .t-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--success); color: #fff; }
.toast.error .t-ic { background: var(--danger); }
.toast.info .t-ic { background: var(--info); }
.toast .t-ic .ic { width: 16px; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand-grad); animation: toastBar 4s linear forwards; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }

.cmdk { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.cmdk.open { pointer-events: auto; }
.cmdk.open .cmdk-scrim { opacity: 1; }
.cmdk-box { position: absolute; top: 12vh; left: 50%; width: min(640px, calc(100% - 24px)); transform: translate(-50%, -14px) scale(.97); opacity: 0; background: var(--panel); border-radius: 20px; box-shadow: var(--sh-3); overflow: hidden; transition: all .28s var(--ease); }
.cmdk.open .cmdk-box { transform: translate(-50%, 0); opacity: 1; }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 60px; border-bottom: 1px solid var(--line-2); }
.cmdk-input .ic { color: var(--brand); width: 20px; height: 20px; }
.cmdk-input input { flex: 1; border: 0; outline: none; background: none; font: inherit; font-size: 16px; color: var(--ink); }
.cmdk-results { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk-sec { font-size: 10.5px; font-weight: 700; color: var(--faint); letter-spacing: .1em; text-transform: uppercase; padding: 10px 12px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; cursor: pointer; }
.cmdk-item .ci { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); flex-shrink: 0; }
.cmdk-item .ci .ic { width: 16px; }
.cmdk-item b { font-weight: 600; display: block; }
.cmdk-item small { color: var(--muted); font-size: 12px; }
.cmdk-item.active { background: var(--brand-soft); }
.cmdk-item.active .ci { background: var(--brand-grad); color: #fff; }

/* =====================================================================
   Kanban
   ===================================================================== */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.kcol { flex: 0 0 290px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 260px); transition: background .2s, border-color .2s; }
.kcol header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.kcol header b { font-size: 13.5px; }
.ksum { margin-left: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.kdot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.kdot[data-status="Won"], .kdot[data-status="Completed"], .kdot[data-status="Delivered"], .kdot[data-status="Approved"], .kdot[data-status="Done"] { background: var(--success); }
.kdot[data-status="Lost"], .kdot[data-status="Rejected"], .kdot[data-status="Cancelled"] { background: var(--danger); }
.kdot[data-status="Negotiation"], .kdot[data-status="Documents Pending"], .kdot[data-status="Received"] { background: var(--warn); }
.kdot[data-status="Contacted"], .kdot[data-status="Qualified"], .kdot[data-status="Proposal Sent"], .kdot[data-status="Submitted"], .kdot[data-status="In Process"], .kdot[data-status="In Progress"] { background: var(--info); }
.kitems { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; flex: 1; }
.kcol.drag-over { background: var(--brand-soft); border-color: var(--brand-1); }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: grab; box-shadow: var(--sh-1); transition: transform .2s var(--ease), box-shadow .2s, opacity .2s; animation: riseIn .35s var(--ease) both; }
.kcard:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.kcard.dragging { opacity: .45; transform: rotate(2deg) scale(1.02); }
.kcard .kt { font-weight: 600; font-size: 13.5px; }
.kcard .ks { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kcard .kf { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12.5px; font-weight: 600; }
.kmeta { display: flex; align-items: center; gap: 6px; }
.kdate { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 11.5px; }
.kdate.late { color: var(--danger); }

/* =====================================================================
   Detail pages
   ===================================================================== */
.profile-head { display: flex; align-items: center; gap: 18px; padding: 22px; }
.profile-head h1 { font-size: 22px; }
.profile-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); margin-top: 4px; font-size: 13px; }
.profile-head .meta span { display: inline-flex; align-items: center; gap: 5px; }
.profile-head .meta .ic { width: 14px; }
.profile-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-2); }
.stat-strip div { padding: 14px 22px; border-right: 1px solid var(--line-2); }
.stat-strip div:last-child { border-right: 0; }
.stat-strip small { color: var(--muted); font-size: 12px; font-weight: 600; display: block; }
.stat-strip b { font-size: 18px; font-variant-numeric: tabular-nums; }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.dl-grid > div { padding: 11px 20px; border-bottom: 1px solid var(--line-2); }
.dl-grid dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.dl-grid dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.tab-panels > .tab-panel { display: none; animation: fadeUp .35s var(--ease); }
.tab-panels > .tab-panel.on { display: block; }

.timeline { list-style: none; margin: 0; padding: 18px 20px; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tdot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); border: 3px solid var(--brand); }
.timeline b { font-weight: 600; }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.steps { display: flex; gap: 0; padding: 18px 20px; overflow-x: auto; }
.step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: 12px; font-weight: 600; color: var(--faint); }
.step::before { content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 3px; background: var(--line); }
.step:first-child::before { display: none; }
.step i { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; margin: 0 auto 6px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line); font-style: normal; }
.step.done { color: var(--ink-2); }
.step.done::before { background: var(--brand-grad); }
.step.done i { background: var(--brand-grad); border-color: transparent; color: #fff; }
.step.cur i { box-shadow: 0 0 0 5px var(--brand-soft); animation: pulse 2.4s infinite; }
.step i .ic { width: 14px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 54px 20px; color: var(--muted); }
.empty-state > .ic { width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.empty-state h3, .empty-state h2 { color: var(--ink); }
.empty-state p { margin: 0 0 8px; }
.empty-state.sm { padding: 26px; }
.empty-state.sm > .ic { width: 34px; height: 34px; padding: 8px; }
.empty-state.big { padding: 100px 20px; }

/* =====================================================================
   Work register (spreadsheet-style)
   ===================================================================== */
.reg-entry { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px 8px; padding: 14px; align-items: end; border-bottom: 1px solid var(--line-2); background: linear-gradient(180deg, var(--brand-soft), transparent 140%); }
.reg-entry .field label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.reg-entry .input, .reg-entry .cs-trigger { height: 38px; }
.reg-entry .btn { height: 38px; padding: 0 10px; width: 100%; }
.reg-entry .s1 { grid-column: span 1; } .reg-entry .s2 { grid-column: span 2; } .reg-entry .s3 { grid-column: span 3; } .reg-entry .s4 { grid-column: span 4; }
.reg-entry .input.num { padding: 0 8px; }
.reg-table td, .reg-table th { padding: 8px 12px; }
.reg-table td.num, .reg-table th.num { text-align: right; }
.reg-table .profit-pos { color: var(--success); font-weight: 700; }
.reg-table .profit-zero { color: var(--muted); }
.reg-table .bal-due { color: var(--danger); font-weight: 700; }
.reg-table tbody tr.flash { animation: flashRow 1.6s var(--ease); }
.wt { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-weight: 700; font-size: 11.5px; }
.wt-T { background: var(--info-bg); color: var(--info); }
.wt-O { background: var(--warn-bg); color: var(--warn); }
.reg-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.reg-summary .card { padding: 14px 16px; }
.reg-summary small { color: var(--muted); font-weight: 600; font-size: 12px; }
.reg-summary b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.reg-summary .card.accent { background: var(--side-bg); color: #fff; border-color: transparent; }
.reg-summary .card.accent small { color: #b9b9c4; }
.reg-summary .card.accent b { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* =====================================================================
   Invoice editor & document preview
   ===================================================================== */
.doc-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.items-table td { padding: 8px 8px; vertical-align: top; }
.items-table th { padding: 10px 8px; }
.items-table .input, .items-table .cs-trigger { height: 38px; }
.items-table .c-qty { width: 76px; }
.items-table .c-money { width: 120px; }
.items-table .c-vat { width: 84px; }
.items-table .c-total { width: 120px; text-align: right; font-weight: 700; padding-top: 18px; }
.items-table .c-del { width: 40px; }
.items-table tbody tr { animation: rowIn .3s var(--ease) both; }
.add-line { display: flex; gap: 8px; padding: 12px; border-top: 1px dashed var(--line); }
.totals { padding: 18px 20px; }
.totals .tr { display: flex; justify-content: space-between; padding: 7px 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.totals .tr.grand { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; font-size: 20px; font-weight: 700; color: var(--ink); }
.totals .tr.grand span:last-child { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sticky-side { position: sticky; top: calc(var(--top-h) + 14px); display: flex; flex-direction: column; gap: 16px; }

.paper { background: #fff; color: #15151a; max-width: 860px; margin: 0 auto; border-radius: 16px; box-shadow: var(--sh-2); padding: 46px 50px; position: relative; overflow: hidden; }
.paper::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: var(--brand-grad); }
.paper-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.paper-head img { height: 74px; }
.paper-co { text-align: right; font-size: 12.5px; color: #55555f; line-height: 1.6; }
.paper-co b { color: #15151a; font-size: 14px; }
.paper-title { display: flex; justify-content: space-between; align-items: flex-end; margin: 30px 0 22px; padding-bottom: 16px; border-bottom: 1px solid #ececf1; }
.paper-title h2 { font-size: 26px; letter-spacing: .02em; }
.paper-title h2 span { display: block; font-size: 15px; color: var(--brand, #DD1E47); font-weight: 600; }
.paper-meta { display: grid; grid-template-columns: repeat(2, auto); gap: 4px 18px; font-size: 13px; text-align: right; }
.paper-meta dt { color: #74747f; } .paper-meta dd { margin: 0; font-weight: 600; }
.paper-bill { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px; font-size: 13px; }
.paper-bill h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--brand, #DD1E47); margin-bottom: 6px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 13px; }
.paper table th { background: #15151a; color: #fff; text-align: left; padding: 10px 12px; font-weight: 600; font-size: 12px; }
.paper table th:first-child { border-radius: 8px 0 0 8px; } .paper table th:last-child { border-radius: 0 8px 8px 0; }
.paper table td { padding: 10px 12px; border-bottom: 1px solid #ececf1; }
.paper .r { text-align: right; }
.paper-sum { display: flex; justify-content: space-between; gap: 30px; margin-top: 18px; }
.paper-sum .words { flex: 1; font-size: 12.5px; color: #55555f; }
.paper-sum .sum { width: 320px; font-size: 13px; }
.paper-sum .sum div { display: flex; justify-content: space-between; padding: 6px 0; }
.paper-sum .sum .grand { border-top: 2px solid #15151a; margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 700; }
.paper-foot { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font-size: 12px; color: #55555f; white-space: pre-line; }
.paper-foot h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #15151a; margin-bottom: 6px; }
.paper-sign { display: flex; justify-content: space-between; margin-top: 46px; font-size: 12px; color: #74747f; }
.paper-sign div { border-top: 1px solid #c9c9d1; padding-top: 6px; width: 200px; text-align: center; }
.stamp { position: absolute; right: 60px; top: 210px; transform: rotate(-14deg); border: 3px solid; padding: 6px 16px; border-radius: 10px; font-weight: 800; font-size: 22px; letter-spacing: .12em; opacity: .7; }
.stamp.paid { color: #12A150; } .stamp.void { color: #DC2640; } .stamp.overdue { color: #DC2640; }

/* =====================================================================
   Calendar
   ===================================================================== */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 118px; padding: 8px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); transition: background .15s; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--panel-2); }
.cal-cell.out { background: var(--panel-2); }
.cal-cell.out .cal-d { color: var(--faint); }
.cal-d { font-weight: 700; font-size: 13px; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; }
.cal-cell.today .cal-d { background: var(--brand-grad); color: #fff; }
.cal-ev { display: block; margin-top: 4px; padding: 3px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; transition: transform .15s; }
.cal-ev:hover { transform: translateX(2px); }
.cal-ev.task { background: var(--info-bg); color: var(--info); }
.cal-ev.doc { background: var(--warn-bg); color: var(--warn); }
.cal-ev.job { background: var(--brand-soft); color: var(--brand-ink); }
.cal-ev.lead { background: var(--success-bg); color: var(--success); }
.cal-ev.inv { background: var(--danger-bg); color: var(--danger); }
.cal-more { font-size: 11px; color: var(--muted); margin-top: 3px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

/* =====================================================================
   Settings, services grid, reports
   ===================================================================== */
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 600; color: var(--ink-2); transition: background .15s; }
.settings-nav a:hover { background: var(--hover); }
.settings-nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.svc-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.svc-cat { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; animation: riseIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.svc-cat:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.svc-cat.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.svc-cat .sc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); flex-shrink: 0; }
.svc-cat b { display: block; font-size: 13.5px; }
.svc-cat small { color: var(--muted); font-size: 12px; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.report-card { padding: 18px; display: flex; gap: 14px; transition: transform .25s var(--ease), box-shadow .25s; animation: riseIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.report-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.report-card .rc-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.report-card b { display: block; font-size: 14.5px; }
.report-card small { color: var(--muted); }
.pl-table td { padding: 10px 20px; }
.pl-table .sec td { font-weight: 700; background: var(--panel-2); text-transform: uppercase; font-size: 11.5px; letter-spacing: .08em; color: var(--muted); }
.pl-table .tot td { font-weight: 700; border-top: 1px solid var(--line); }
.pl-table .net td { font-size: 17px; font-weight: 800; background: var(--brand-soft); color: var(--brand-ink); }

/* =====================================================================
   Auth
   ===================================================================== */
.auth { background: var(--panel); }
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art { position: relative; overflow: hidden; background: var(--side-bg, #0e0e11); color: #fff; display: flex; align-items: center; padding: 60px; }
.auth-art-inner { position: relative; z-index: 2; max-width: 460px; }
.auth-logo { width: 220px; margin-bottom: 46px; animation: fadeUp .7s var(--ease) both; }
.auth-art h2 { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; animation: fadeUp .7s .1s var(--ease) both; }
.auth-points { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 14px; color: #c9c9d1; }
.auth-points li { display: flex; gap: 12px; align-items: center; animation: fadeUp .6s var(--ease) both; }
.auth-points li:nth-child(1) { animation-delay: .2s } .auth-points li:nth-child(2) { animation-delay: .28s } .auth-points li:nth-child(3) { animation-delay: .36s } .auth-points li:nth-child(4) { animation-delay: .44s }
.auth-points .ic { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .07); color: var(--brand-1); }
.auth-orbs span { position: absolute; border-radius: 50%; filter: blur(60px); z-index: 1; }
.auth-orbs span:nth-child(1) { width: 420px; height: 420px; right: -140px; top: -120px; background: var(--brand-2); opacity: .45; animation: float 12s ease-in-out infinite; }
.auth-orbs span:nth-child(2) { width: 320px; height: 320px; left: -100px; bottom: -120px; background: var(--accent, var(--brand-1)); opacity: .3; animation: float 15s ease-in-out infinite reverse; }
.auth-orbs span:nth-child(3) { width: 200px; height: 200px; right: 20%; bottom: 18%; background: var(--orb-3, #7C3AED); opacity: .18; animation: float 10s ease-in-out infinite; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; animation: fadeUp .6s var(--ease) both; }
.auth-card h1 { font-size: 28px; }
.auth-card .sub { margin: -10px 0 6px; color: var(--muted); }
.auth-logo-sm { display: none; height: 54px; align-self: flex-start; }
.auth-foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 10px; }
/* client-preview quick sign-in (DEMO_LOGIN) */
.demo-logins { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 12px; border: 1px dashed var(--line); border-radius: 16px; background: var(--panel); }
.demo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 2px 4px 8px; }
.demo-head small { width: 100%; color: var(--muted); font-size: 12px; }
.demo-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 12px; background: none; color: var(--ink); text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.demo-user:hover, .demo-user:focus-visible { background: var(--hover); border-color: var(--line); }
.demo-user .du-main { flex: 1; min-width: 0; }
.demo-user .du-main b { display: block; font-size: 13.5px; }
.demo-user .du-main small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-user .du-role { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.demo-user .ic { color: var(--faint); }
.auth-logo-sm.on-dark, [data-theme="dark"] .auth-logo-sm.on-light { visibility: hidden; position: absolute; }
[data-theme="dark"] .auth-logo-sm.on-dark { visibility: visible; position: static; }
/* company picker on the sign-in page */
.co-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 4px; }
.co-tabs a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.co-tabs a:hover { border-color: #d6d6de; transform: translateY(-1px); }
.co-tabs a.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.co-tabs img { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; object-fit: contain; }
.co-tabs span { min-width: 0; }
.co-tabs b { display: block; font-size: 14px; line-height: 1.2; }
.co-tabs small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================================
   Animations
   ===================================================================== */
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dropUp { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dropOut { to { opacity: 0; transform: translateY(-4px) scale(.97); } }
@keyframes fadeSlide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeSlideR { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes barIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 35%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-24px, 18px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes toastBar { from { width: 100%; } to { width: 0; } }
@keyframes flashRow { 0% { background: var(--success-bg); } 100% { background: transparent; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); } }
.shake { animation: shake .45s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .reg-entry { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .reg-entry .s1, .reg-entry .s2 { grid-column: span 2; } .reg-entry .s3, .reg-entry .s4 { grid-column: span 3; }
  .doc-editor { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
}
@media (max-width: 1024px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .reg-summary { grid-template-columns: repeat(3, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  :root { --side-w: 270px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--sh-3); }
  .nav-open .sidebar { transform: none; }
  .nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; animation: fadeUp .2s; }
  .main, .nav-mini .main { margin-left: 0; }
  .nav-mini .sidebar { width: var(--side-w); }
  .mobile-only { display: inline-grid; }
  .nav-collapse { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px 30px; }
  .cmdk-trigger kbd, .hide-sm { display: none; }
  .form-grid, .dl-grid, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-logo-sm { display: block; }
  .reg-entry { grid-template-columns: 1fr 1fr; }
  .reg-entry .s1, .reg-entry .s2 { grid-column: span 1; } .reg-entry .s3, .reg-entry .s4 { grid-column: 1 / -1; }
  .reg-summary { grid-template-columns: 1fr 1fr; }
  .paper { padding: 26px 20px; }
  .paper-bill, .paper-foot { grid-template-columns: 1fr; }
  .paper-sum { flex-direction: column; }
  .paper-sum .sum { width: 100%; }
  .profile-head { flex-wrap: wrap; }
  .profile-head .actions { margin-left: 0; }
  .cal-cell { min-height: 80px; padding: 4px; }
  .cal-ev { font-size: 10px; padding: 2px 4px; }
  .dp.range { flex-direction: column; }
  .dp-presets { width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .toolbar-count { width: 100%; margin: 0; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 20px; }
  .kpi .kpi-val { font-size: 23px; }
}

/* ---------- Phones & tablets: touch-friendly layout ---------- */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  /* 16px inputs stop iOS Safari zooming in on focus */
  .input, select, textarea, .cs-trigger, .cmdk-input input { font-size: 16px; }
  .topbar { gap: 8px; }
  .cmdk-trigger { min-width: 0; flex: 1; }
  .top-actions { gap: 6px; }
  .install-btn { padding: 0 10px; }
  /* drawers become full-screen sheets */
  .drawer-panel, .drawer-panel.wide { top: 0; right: 0; bottom: 0; width: 100%; border-radius: 0; }
  .drawer-head { padding: 16px 16px 12px; padding-top: calc(16px + env(safe-area-inset-top)); }
  .drawer-body { padding: 16px; }
  .drawer-foot { padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1; }
  /* page header actions wrap under the title */
  .page-head { align-items: flex-start; }
  .head-actions { width: 100%; }
  .head-actions > .btn, .head-actions > .menu-wrap { flex: 1 1 auto; }
  .head-actions > .menu-wrap > .btn { width: 100%; }
  .menu { max-width: calc(100vw - 24px); }
  .toasts { left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
  .cmdk-box { top: calc(10px + env(safe-area-inset-top)); }
  .cmdk-results { max-height: 65vh; }
  .modal-actions { flex-direction: column-reverse; }
  /* printed documents on a small screen */
  .paper-head { flex-direction: column; }
  .paper-head img { height: 52px; }
  .paper-co { text-align: left; }
  .paper-title { flex-direction: column; align-items: flex-start; gap: 12px; }
  .paper-meta { text-align: left; }
  .paper table { display: block; overflow-x: auto; white-space: nowrap; }
  .stamp { top: 24px; right: 16px; font-size: 15px; padding: 4px 10px; border-width: 2px; }
  .paper-sign { gap: 20px; }
  .paper-sign div { width: auto; flex: 1; }
  .auth-form { padding: 28px 18px; padding-top: calc(28px + env(safe-area-inset-top)); }
}
@media (max-width: 420px) {
  .cmdk-trigger span { display: none; }
  .cmdk-trigger { flex: 0 0 40px; width: 40px; padding: 0; justify-content: center; }
  .cal-dow { padding: 8px 2px; font-size: 10px; text-align: center; }
  .cal-cell { min-height: 64px; padding: 3px; }
  .cal-d { width: 22px; height: 22px; font-size: 12px; }
}
/* touch screens: no hover-only affordances, bigger tap targets */
@media (hover: none) and (pointer: coarse) {
  .nav-link { min-height: 44px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
}

/* ---------- Installed app (standalone window) ---------- */
.is-app .topbar { height: calc(var(--top-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
.is-app .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.is-app .foot { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
@media (display-mode: standalone) { body { overscroll-behavior-y: none; } }

/* =====================================================================
   Print
   ===================================================================== */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .foot, .no-print, .toasts, .page-head .head-actions { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; animation: none; }
  .paper { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .paper::before { display: none; }
  .card { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.items-table.no-govt .c-govt { display: none; }
.parts-form { border-top: 1px solid var(--line-2); grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 860px) { .parts-form { grid-template-columns: minmax(0, 1fr) 90px; } .parts-form .field { grid-column: 1 / -1 !important; } .parts-form .field:has(input[name=qty]) { grid-column: auto !important; } }

/* number inputs without spinners in dense grids */
.items-table input[type=number], .reg-entry input[type=number], .totals input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.items-table input[type=number]::-webkit-inner-spin-button, .reg-entry input[type=number]::-webkit-inner-spin-button, .totals input[type=number]::-webkit-inner-spin-button,
.items-table input[type=number]::-webkit-outer-spin-button, .reg-entry input[type=number]::-webkit-outer-spin-button, .totals input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cs-trigger:focus-visible, .daterange-btn:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible { outline: 2px solid var(--brand-1); outline-offset: 2px; }

/* =====================================================================
   Platform: team chat, record threads, files, client document requests
   ===================================================================== */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px; background: var(--brand-grad); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; box-shadow: 0 0 0 3px var(--side-bg); animation: pop .35s var(--spring); }
.nav-mini .nav-badge { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
.nav-link { position: relative; }
.icon-btn.chat-top { position: relative; }
.icon-btn.chat-top .dot, .icon-btn.bell .dot { position: absolute; top: 3px; right: 3px; }
.chat-toast { text-decoration: none; }
.chat-toast > .ic { width: 28px; height: 28px; padding: 6px; border-radius: 9px; background: var(--brand-grad); color: #fff; flex-shrink: 0; }
.chat-toast span { display: flex; flex-direction: column; min-width: 0; }
.chat-toast small { opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.chat-toast::after { animation-duration: 6s; }

/* chat page */
.chat-app { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: calc(100vh - var(--top-h) - 64px); min-height: 520px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.chat-side { border-right: 1px solid var(--line-2); display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 18px; }
.chat-side-head b { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.chat-side-head b .ic { color: var(--brand); width: 18px; }
.chat-find { margin: 4px 12px 8px; position: relative; }
.chat-find .ic { position: absolute; left: 11px; top: 10px; width: 15px; color: var(--faint); }
.chat-find input { width: 100%; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px 0 33px; font: inherit; font-size: 13px; color: var(--ink); }
.chat-find input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.chat-hits { margin: 0 12px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-height: 300px; overflow: auto; box-shadow: var(--sh-2); }
.chat-hit { display: block; padding: 9px 12px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); }
.chat-hit:hover { background: var(--hover); }
.chat-hit small { color: var(--muted); }
.chat-hit span { display: block; color: var(--ink); margin-top: 2px; }
.chat-lists { overflow-y: auto; padding: 0 8px 16px; flex: 1; }
.chat-sec { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; display: flex; justify-content: space-between; }
.chat-sec small { text-transform: none; letter-spacing: 0; font-weight: 600; }
.chat-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; transition: background .15s; }
.chat-item:hover { background: var(--hover); }
.chat-item.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.ci-ic { width: 22px; display: grid; place-items: center; color: var(--muted); }
.ci-ic .ic { width: 16px; }
.chat-item.on .ci-ic { color: var(--brand); }
.ci-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-name small { font-size: 11px; color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ci-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px; background: var(--brand-grad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.ci-av { position: relative; display: inline-flex; }
.presence { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); border: 2px solid var(--panel-2); }
.presence.on { background: var(--success); }
.chat-head .presence { border-color: var(--panel); width: 11px; height: 11px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.chat-head h2 { font-size: 16px; }
.chat-head small { color: var(--muted); font-size: 12.5px; }
.ch-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.chat-head-act { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.chat-msgs, .thread-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.thread-msgs { max-height: 430px; min-height: 120px; padding: 14px 18px; }
.day-sep { text-align: center; margin: 6px 0; position: relative; }
.day-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line-2); }
.day-sep span { position: relative; background: var(--panel); padding: 2px 12px; border-radius: 20px; border: 1px solid var(--line-2); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 78%; }
.msg.in { animation: msgIn .35s var(--spring); }
.msg.flash .msg-bubble { box-shadow: 0 0 0 3px var(--brand-soft); }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble { background: var(--hover); border-radius: 16px 16px 16px 5px; padding: 8px 12px 9px; min-width: 120px; }
.msg.mine .msg-bubble { background: var(--brand-grad); color: #fff; border-radius: 16px 16px 5px 16px; }
.msg.guest .msg-bubble { background: var(--info-bg); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); }
.msg.internal .msg-bubble { background: var(--warn-bg); border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent); }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 2px; }
.msg-head b { font-weight: 700; }
.msg-head time { color: var(--muted); font-size: 11px; margin-left: auto; }
.msg.mine .msg-head time, .msg.mine .msg-head b { color: rgba(255, 255, 255, .85); }
.msg.mine .msg-head b { display: none; }
.msg-body { font-size: 13.5px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-body a { text-decoration: underline; }
.msg .mention { font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 0 4px; border-radius: 5px; }
.msg.mine .mention { color: #fff; background: rgba(255, 255, 255, .22); }
.msg-del { opacity: 0; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: grid; transition: opacity .15s; }
.msg:hover .msg-del { opacity: .7; }
.msg-img { display: block; margin-top: 6px; }
.msg-img img { max-width: 260px; max-height: 220px; border-radius: 10px; display: block; object-fit: cover; }
.msg-file { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.msg-file .ic { color: var(--brand); width: 20px; }
.msg-file span { display: flex; flex-direction: column; font-size: 12.5px; }
.msg-file small { color: var(--muted); }
.msg-ref { display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--panel); color: var(--brand); border: 1px solid var(--line); }
.msg.sys { max-width: 100%; align-self: center; }
.sys-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-2); padding: 5px 12px; border-radius: 20px; }
.sys-line .ic { color: var(--brand); }
.sys-line time { opacity: .7; }
.thread-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; }
.thread-empty .ic { width: 34px; height: 34px; padding: 8px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line-2); background: var(--panel); flex-wrap: wrap; }
.composer-box { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.composer textarea { width: 100%; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 13.5px; line-height: 1.4; background: var(--panel-2); color: var(--ink); min-height: 42px; max-height: 160px; }
.composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: var(--panel); }
.composer-att { position: relative; overflow: hidden; height: 42px; width: 42px; }
.composer-att input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.composer-file { font-size: 12px; color: var(--brand); margin-top: 4px; }
.composer-send { height: 42px; width: 46px; padding: 0; border-radius: 12px; }
.composer-internal { flex-basis: 100%; height: 26px; margin-left: 50px; }
.composer-internal .switch-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.thread-card .card-head { flex-wrap: wrap; row-gap: 2px; }
.thread-card .card-head small { font-size: 11.5px; }
.grid.no-print .thread-card .card-head small, .sticky-side .thread-card .card-head small { flex-basis: 100%; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* files */
.att-list { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px; }
.att-list.compact { padding: 8px 0 0; }
.file-chip { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.file-chip:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--sh-1); }
.fc-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.fc-thumb { width: 42px; height: 42px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.fc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fc-meta { min-width: 0; display: flex; flex-direction: column; }
.fc-meta b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-meta small { color: var(--muted); font-size: 11.5px; }
.file-wrap { display: flex; align-items: center; gap: 4px; }
.file-wrap .file-chip { flex: 1; min-width: 0; }
.att-drop { margin: 0 18px 18px; }
.att-drop label { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; color: var(--muted); transition: border-color .2s, background .2s; }
.att-drop label .ic { width: 26px; height: 26px; color: var(--brand); }
.att-drop label b { color: var(--ink); display: block; font-size: 13.5px; }
.att-drop label small { font-size: 12px; }
.att-drop input { display: none; }
.att-drop.over label, .att-drop label:hover { border-color: var(--brand); background: var(--brand-soft); }
.att-drop.uploading label { opacity: .6; pointer-events: none; }
.menu-file { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; border-radius: 8px; }
.menu-file:hover { background: var(--hover); }

.g-main > *, .g-2 > *, .g-3 > * { min-width: 0; }
.g-main > .grid, .g-2 > .grid { grid-template-columns: minmax(0, 1fr); }
.collab { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.collab-grid { align-items: start; }

/* document requests (staff) */
.mini-progress { height: 6px; border-radius: 6px; background: var(--hover); overflow: hidden; width: 100%; min-width: 80px; }
.mini-progress span { display: block; height: 100%; background: var(--brand-grad); border-radius: 6px; transition: width .6s var(--ease); }
.mini-progress.light { background: rgba(255, 255, 255, .15); margin-top: 6px; }
.dr-items { display: flex; flex-direction: column; }
.dr-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: start; }
.dr-item:last-child { border-bottom: 0; }
.dr-st { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--hover); color: var(--muted); }
.dr-st .ic { width: 18px; }
.dr-item.st-uploaded .dr-st { background: var(--info-bg); color: var(--info); }
.dr-item.st-approved .dr-st { background: var(--success-bg); color: var(--success); }
.dr-item.st-rejected .dr-st { background: var(--danger-bg); color: var(--danger); }
.dr-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dr-meta { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.dr-note { font-size: 12.5px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 6px 10px; margin-top: 6px; }
.dr-reject { font-size: 12.5px; color: var(--danger); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.dr-act { display: flex; align-items: center; gap: 6px; }
.dr-add { border-top: 1px solid var(--line-2); grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; }
.dr-add .field { grid-column: span 3; }
.dr-sign { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.card-body > .dr-sign { padding: 0; border: 0; }
.dr-sign img { height: 64px; max-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.share-card .card-body { display: flex; flex-direction: column; gap: 14px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { flex: 1; min-width: 0; font-size: 12px; }
.share-row { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: start; }
.qr { width: 140px; height: 140px; padding: 6px; background: #fff; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; }
.qr img, .qr canvas { width: 128px !important; height: 128px !important; }
.share-btns { display: flex; flex-direction: column; gap: 8px; }
.share-btns small { font-size: 11.5px; line-height: 1.4; }
.paper-sign.signed div:first-child { width: 260px; }
.paper-sign.signed img { display: block; height: 54px; margin: 0 auto 4px; }
@media (max-width: 860px) {
  .chat-app { grid-template-columns: 1fr; height: calc(100vh - var(--top-h) - 40px); border-radius: 14px; }
  .chat-app[data-channel]:not([data-channel="0"]) .chat-side { display: none; }
  .chat-app .chat-side { border-right: 0; }
  .msg { max-width: 92%; }
  .dr-item { grid-template-columns: 30px minmax(0, 1fr); }
  .dr-act { grid-column: 2; }
  .dr-add .field { grid-column: 1 / -1 !important; }
  .share-row { grid-template-columns: 1fr; }
}

/* =====================================================================
   Industry screens: real estate & logistics
   ===================================================================== */
.prop-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; flex-shrink: 0; }
.prop-ic .ic { width: 18px; }
.prop-ic.lg { width: 64px; height: 64px; border-radius: 18px; }
.prop-ic.lg .ic { width: 30px; height: 30px; }
.unit-chip { display: inline-grid; place-items: center; min-width: 42px; height: 36px; padding: 0 8px; border-radius: 10px; background: var(--side-bg); color: #fff; font-weight: 800; font-size: 12.5px; letter-spacing: .02em; flex-shrink: 0; font-family: 'DM Mono', monospace; }
.unit-chip.lg { min-width: 54px; height: 46px; font-size: 15px; border-radius: 13px; }
.unit-chip.xl { min-width: 76px; height: 64px; font-size: 20px; border-radius: 18px; background: var(--brand-grad); }
.unit-card { display: flex; align-items: center; gap: 12px; }
.unit-card > .pill { margin-left: auto; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; padding: 16px 18px 18px; }
.unit-tile { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: 13px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); transition: transform .2s var(--spring), box-shadow .2s; border-top: 4px solid var(--muted); }
.unit-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.unit-tile b { font-size: 15px; font-family: 'DM Mono', monospace; }
.unit-tile small { color: var(--muted); font-size: 11.5px; }
.unit-tile span { font-size: 12px; font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-tile.t-success { border-top-color: var(--success); } .unit-tile.t-warn { border-top-color: var(--warn); background: color-mix(in srgb, var(--warn-bg) 50%, var(--panel)); }
.unit-tile.t-info { border-top-color: var(--info); } .unit-tile.t-danger { border-top-color: var(--danger); }
.ut-flag { position: absolute; top: 8px; right: 8px; color: var(--warn); }
.legend .dot-success, .legend .dot-warn, .legend .dot-info, .legend .dot-danger, .legend .dot-muted { border-radius: 50%; }
.dot-success { background: var(--success); } .dot-warn { background: var(--warn); } .dot-info { background: var(--info); } .dot-danger { background: var(--danger); } .dot-muted { background: var(--faint); }
.lease-term { padding: 16px 20px 12px; }
.lt-bar { height: 10px; border-radius: 10px; background: var(--hover); overflow: hidden; }
.lt-bar span { display: block; height: 100%; border-radius: 10px; background: var(--brand-grad); transition: width .8s var(--ease); }
.lt-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.lt-labels b { color: var(--ink); }
.chq-table .muted-row td { opacity: .5; }
.mini-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); transition: transform .2s var(--spring), box-shadow .2s; }
.mini-stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.mini-stat > .ic { width: 38px; height: 38px; padding: 9px; border-radius: 11px; background: var(--hover); color: var(--muted); flex-shrink: 0; }
.mini-stat span { display: flex; flex-direction: column; }
.mini-stat b { font-size: 15px; }
.mini-stat small { color: var(--muted); font-size: 12px; }
.mini-stat.danger > .ic { background: var(--danger-bg); color: var(--danger); }
.mini-stat.warn > .ic { background: var(--warn-bg); color: var(--warn); }
.mini-stat.success > .ic { background: var(--success-bg); color: var(--success); }
.mini-stat.info > .ic { background: var(--info-bg); color: var(--info); }
.occ-list { display: flex; flex-direction: column; gap: 14px; }
.occ-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; gap: 12px; align-items: center; }
.occ-row span { display: flex; flex-direction: column; min-width: 0; }
.occ-row b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.occ-row small { color: var(--muted); font-size: 11.5px; }
.occ-row em { font-style: normal; font-weight: 700; font-size: 13px; text-align: right; }
.lane { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.lane .ic { color: var(--brand); }
.mode-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; flex-shrink: 0; }
.mode-ic .ic { width: 17px; }
.route-hero { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; padding: 20px 24px; }
.route-end { display: flex; flex-direction: column; }
.route-end small { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.route-end b { font-size: 18px; }
.route-end span { color: var(--muted); font-size: 12.5px; }
.route-end.r { text-align: right; }
.route-line { position: relative; width: min(320px, 30vw); height: 40px; }
.route-line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--line); }
.route-line i { position: absolute; top: 50%; left: 0; height: 2px; margin-top: -1px; background: var(--brand-grad); width: var(--p, 0%); transition: width .8s var(--ease); }
.route-line .ic { position: absolute; top: 50%; left: var(--p, 0%); transform: translate(-50%, -50%); width: 34px; height: 34px; padding: 8px; border-radius: 50%; background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px -6px var(--brand); }
.ms-list { list-style: none; margin: 0; padding: 16px 20px; }
.ms-list li { position: relative; padding: 0 0 18px 34px; }
.ms-list li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.ms-list li:last-child::before { display: none; }
.ms-list .ms-dot { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.ms-list .ms-dot .ic { width: 13px; }
.ms-list li:first-child .ms-dot { background: var(--brand-grad); color: #fff; box-shadow: 0 0 0 5px var(--brand-soft); }
.ms-list b { display: block; font-size: 13.5px; }
.ms-list small { color: var(--muted); font-size: 12px; }
.ms-list .ms-priv { font-size: 10.5px; margin-left: 6px; }
.pipeline-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); overflow-x: auto; }
.ps-stage { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px; border-right: 1px solid var(--line-2); color: var(--ink); position: relative; transition: background .2s; min-width: 96px; }
.ps-stage:last-child { border-right: 0; }
.ps-stage:hover { background: var(--hover); }
.ps-ic { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 4px; }
.ps-ic .ic { width: 18px; }
.ps-stage b { font-size: 22px; line-height: 1; }
.ps-stage small { color: var(--muted); font-size: 11.5px; text-align: center; }
.span-all { grid-column: 1 / -1; }
.profit-box { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-2); }
.profit-box div { padding: 12px 18px; border-right: 1px solid var(--line-2); }
.profit-box div:last-child { border-right: 0; }
.profit-box small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.profit-box b { font-size: 17px; }
.charge-form { border-top: 1px solid var(--line-2); grid-template-columns: 110px minmax(0, 2.2fr) minmax(0, 1.4fr) 80px 100px 70px auto; align-items: end; }
.charge-form .field { grid-column: auto; }
@media (max-width: 860px) {
  .route-hero { grid-template-columns: 1fr; text-align: left; }
  .route-end.r { text-align: left; }
  .route-line { width: 100%; }
  .charge-form { grid-template-columns: 1fr 1fr; }
  .charge-form .field:nth-child(3), .charge-form .field:nth-child(4) { grid-column: 1 / -1; }
  .profit-box { grid-template-columns: 1fr 1fr 1fr; }
}

/* =====================================================================
   Client portal (public pages)
   ===================================================================== */
body.portal { background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent 70%), var(--bg); min-height: 100vh; color: var(--ink); }
.p-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.p-top-in { max-width: 980px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.p-logo { height: 40px; max-width: 220px; object-fit: contain; }
.p-top-help { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.p-top-help .ic { width: 30px; height: 30px; padding: 7px; border-radius: 10px; background: var(--success-bg); color: var(--success); }
.p-top-help b { display: block; color: var(--ink); font-size: 13px; }
.p-top-help span { display: flex; flex-direction: column; }
.p-wrap { max-width: 980px; margin: 0 auto; padding: 24px 20px 120px; display: flex; flex-direction: column; gap: 18px; animation: pageIn .45s var(--ease); }
.p-wrap.wide { max-width: 1280px; }
.p-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 26px 28px; position: relative; overflow: hidden; }
.p-hero::before { content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -180px; border-radius: 50%; background: var(--brand-grad); opacity: .1; filter: blur(10px); }
.p-hero h1 { font-size: 26px; margin: 10px 0 8px; letter-spacing: -.02em; }
.p-hero p { color: var(--ink-2); margin: 0 0 12px; line-height: 1.6; max-width: 640px; }
.p-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.p-meta span { display: inline-flex; align-items: center; gap: 6px; }
.p-meta .ic { width: 15px; color: var(--brand); }
.p-ring { --p: 0; position: relative; width: 132px; height: 132px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.p-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.p-ring circle { fill: none; stroke: var(--line); stroke-width: 10; }
.p-ring circle.fg { stroke: var(--brand); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: calc(326.7 - 326.7 * var(--p) / 100); transition: stroke-dashoffset .8s var(--ease); }
.p-ring b { font-size: 26px; font-weight: 800; line-height: 1; display: block; }
.p-ring small { display: block; font-size: 11px; color: var(--muted); max-width: 90px; margin-top: 4px; }
.p-total { text-align: right; position: relative; }
.p-total small { color: var(--muted); display: block; }
.p-total b { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.p-total span { font-weight: 700; color: var(--muted); margin-left: 4px; }
.p-banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 16px; font-size: 14px; line-height: 1.5; animation: pageIn .5s var(--ease); }
.p-banner > .ic { width: 34px; height: 34px; padding: 7px; border-radius: 11px; flex-shrink: 0; }
.p-banner.ok { background: var(--success-bg); color: var(--success); } .p-banner.ok > .ic { background: var(--success); color: #fff; }
.p-banner.info { background: var(--info-bg); color: var(--info); } .p-banner.info > .ic { background: var(--info); color: #fff; }
.p-banner.warn { background: var(--warn-bg); color: var(--warn); } .p-banner.warn > .ic { background: var(--warn); color: #fff; }
.p-banner div { color: var(--ink-2); } .p-banner b { color: var(--ink); }
.p-sec { padding: 22px 24px; }
.p-sec h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.p-sec h2 > .ic { color: var(--brand); width: 18px; }
.p-num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; }
.p-saved { margin-left: auto; font-size: 12px; color: var(--success); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.p-saved.pop { animation: pop .4s var(--spring); }
.p-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.p-fields .field.full { grid-column: 1 / -1; }
.p-fields .input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
/* official numbered form (templates with "# Section" headings): label left, answer right */
.p-fsec { grid-column: 1 / -1; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 18px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.p-fields > .p-fsec:first-child { padding-top: 4px; }
.p-official .p-fields { grid-template-columns: 1fr; gap: 10px; }
.p-official .p-fields + .p-fields { margin-top: 10px; }
.p-official .p-fields .field { display: grid; grid-template-columns: minmax(0, 34%) minmax(0, 1fr); align-items: center; gap: 6px 20px; }
.p-official .p-fields .field > label { margin: 0; font-size: 13px; line-height: 1.4; }
.p-official .p-fields .field.full { align-items: start; }
.p-official .p-fields .field.full > label { padding-top: 10px; }
.p-hint { display: inline-flex; vertical-align: -2px; position: relative; color: var(--muted); cursor: help; outline: none; }
.p-hint .ic { width: 14px; height: 14px; }
.p-hint::after { content: attr(data-hint); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 10px; background: #111114; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.45; text-transform: none; letter-spacing: 0; white-space: normal; box-shadow: 0 8px 24px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 20; }
.p-hint:hover::after, .p-hint:focus::after { opacity: 1; }
.p-same { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; min-height: 40px; }
.p-same input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.p-locked { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; margin: -4px 0 18px; border: 1px solid color-mix(in srgb, var(--success) 35%, transparent); border-radius: 12px; background: var(--success-bg); color: var(--success); font-size: 14px; text-align: center; }
.p-locked .ic { width: 16px; height: 16px; flex-shrink: 0; }
.p-copied .input { background: var(--panel-2); color: var(--ink-2); }
.p-other { margin-top: 8px; animation: pageIn .3s var(--ease); }
.p-official .p-fields .field > .p-other { grid-column: 2; margin-top: 0; }
@media (max-width: 720px) { .p-official .p-fields .field > .p-other { grid-column: 1; } }
.p-fixed { gap: 8px; color: var(--ink-2) !important; font-weight: 500; }
.p-fixed .ic { width: 13px; color: var(--muted); }
/* "Download PDF" row on a submitted form */
.p-pdf-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 18px; }
/* printable sheet for the PDF copy: kept off-screen; html2pdf clones .pdf-sheet (fixed colours, no color-mix) */
/* A4 minus 10 mm margins = 190 mm ≈ 718 px — the sheet must not be wider or the right edge is cut off */
.pdf-holder { position: fixed; left: -12000px; top: 0; width: 718px; pointer-events: none; }
.pdf-sheet { width: 100%; max-width: 718px; box-sizing: border-box; background: #fff; color: #1f2430; font-family: 'DM Sans', Arial, sans-serif; font-size: 12.5px; line-height: 1.45; padding: 4px 6px; }
.pdf-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 2px solid var(--brand); }
.pdf-logo { height: 46px; width: auto; }
.pdf-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11.5px; color: #5b6070; }
.pdf-meta b { font-size: 14px; color: #1f2430; font-family: 'DM Mono', monospace; }
.pdf-status { margin-top: 3px; padding: 2px 10px; border-radius: 20px; background: #e7f7ee; color: #12803f; font-weight: 700; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
.pdf-locked { margin: 14px 0 4px; padding: 8px 12px; border: 1px solid #b7e4c7; border-radius: 8px; background: #f0faf4; color: #12803f; text-align: center; font-size: 12px; }
.pdf-title { font-size: 19px; margin: 14px 0 10px; color: #1f2430; letter-spacing: -.01em; }
.pdf-sec { margin: 16px 0 6px; padding-bottom: 5px; border-bottom: 1px solid #e3e5ea; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #8a8f9c; page-break-after: avoid; }
.pdf-table { width: 100%; border-collapse: collapse; }
.pdf-table td { padding: 6px 8px; vertical-align: top; border-bottom: 1px solid #f0f1f4; }
.pdf-l { width: 40%; color: #3d4250; font-weight: 600; }
.pdf-l i { color: #d23b4b; font-style: normal; }
.pdf-v { color: #1f2430; word-break: break-word; }
.pdf-v.empty { color: #b2b6c0; }
.pdf-decl { margin: 6px 0; font-size: 11.5px; color: #3d4250; line-height: 1.55; }
.pdf-agree { margin: 4px 0 6px; font-weight: 600; color: #12803f; }
.pdf-sig { max-height: 54px; max-width: 220px; }
.pdf-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #e3e5ea; text-align: center; font-size: 10.5px; color: #8a8f9c; }
/* portal dropdowns (assets/js/portal.js PSelect) */
.portal .cs select.invalid ~ .cs-trigger { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); animation: csShake .35s var(--ease); }
.portal .cs-trigger:disabled { background: var(--panel-2); color: var(--ink-2); cursor: default; }
.portal .cs-trigger:disabled .cs-caret, .portal .cs-trigger:disabled .cs-clear { display: none; }
.portal .cs-trigger:active:not(:disabled) { transform: scale(.995); }
.p-cs-pop .cs-opt { animation: csOptIn .26s var(--ease) both; animation-delay: calc(var(--i, 0) * 16ms); }
.p-cs-pop.up .cs-opt { animation-name: csOptInUp; }
.p-cs-pop .cs-opt.selected { background: var(--brand-soft); }
.p-cs-pop .cs-opt.selected.active { background: color-mix(in srgb, var(--brand-soft) 70%, var(--hover)); }
@keyframes csOptIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes csOptInUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes csShake { 0%, 100% { transform: none; } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .p-cs-pop .cs-opt, .portal .cs select.invalid ~ .cs-trigger { animation: none; } }
.p-sig-ro { min-height: 64px; display: flex; align-items: center; }
.p-sig-ro img { max-height: 56px; max-width: 100%; }
@media (max-width: 720px) {
  .p-official .p-fields .field { grid-template-columns: 1fr; }
  .p-official .p-fields .field.full > label { padding-top: 0; }
  .p-hint::after { left: auto; right: -8px; transform: none; }
}
.portal .field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.portal select.input { appearance: auto; }
.p-items { display: flex; flex-direction: column; gap: 12px; }
.p-item { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--panel); transition: border-color .2s, box-shadow .2s; }
.p-item.flash { animation: flashRing 1.2s var(--ease); }
.p-item.st-approved { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); }
.p-item.st-rejected { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); box-shadow: 0 0 0 3px var(--danger-bg); }
.p-item.st-uploaded { border-color: color-mix(in srgb, var(--info) 35%, var(--line)); }
.p-item-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.p-st { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.st-uploaded .p-st { background: var(--info-bg); color: var(--info); }
.st-approved .p-st { background: var(--success-bg); color: var(--success); }
.st-rejected .p-st { background: var(--danger-bg); color: var(--danger); }
.p-item-t b { display: block; font-size: 14.5px; }
.p-item-t small { color: var(--muted); font-size: 12.5px; line-height: 1.4; display: block; margin-top: 2px; }
.p-reject { display: flex; gap: 8px; margin-top: 10px; padding: 9px 12px; border-radius: 11px; background: var(--danger-bg); color: var(--danger); font-size: 13px; }
.p-reject span { color: var(--ink-2); }
.p-files { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.p-file { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 11px; padding: 5px; background: var(--panel-2); }
.p-file a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.p-file img, .p-file a > .ic { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.p-file a > .ic { padding: 9px; background: var(--brand-soft); color: var(--brand); }
.p-file span { min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.p-file span b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-file small { color: var(--muted); font-size: 11.5px; }
.p-drop { position: relative; display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px 16px; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; transition: border-color .2s, background .2s; overflow: hidden; }
.p-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.p-drop > .ic { width: 30px; height: 30px; color: var(--brand); flex-shrink: 0; }
.p-drop span { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.p-drop span b { color: var(--ink); font-size: 14px; }
.p-drop:hover, .p-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.p-drop.busy { pointer-events: none; opacity: .75; }
.p-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: transparent; }
.p-bar i { display: block; height: 100%; width: 0; background: var(--brand-grad); transition: width .2s; }
.p-item-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.p-item-ro { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.p-decl { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); margin-bottom: 16px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.p-decl .ic { color: var(--brand); flex-shrink: 0; width: 20px; }
.p-decl p { margin: 0; }
.p-sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.p-sign-grid .full { grid-column: 1 / -1; }
.sig-pad { position: relative; height: 170px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff linear-gradient(transparent 120px, #e5e7eb 120px, #e5e7eb 121.5px, transparent 121.5px); touch-action: none; }
.sig-pad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; border-radius: 14px; }
.sig-pad [data-sig-clear] { position: absolute; top: 8px; right: 8px; }
.sig-hint { position: absolute; left: 16px; bottom: 16px; font-size: 12px; color: #9ca3af; pointer-events: none; transition: opacity .2s; }
.sig-pad.signed .sig-hint { opacity: 0; }
.check-line { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; font-size: 13.5px; line-height: 1.5; cursor: pointer; }
.check-line input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.p-center { display: block; text-align: center; margin-top: 10px; }
.p-closed { padding: 60px 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.p-closed > .ic { width: 54px; height: 54px; padding: 13px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); }
.p-foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 10px 20px 110px; line-height: 1.7; }
.p-foot a { color: var(--brand); }
.p-chat-fab { position: fixed; right: 22px; bottom: 22px; z-index: 40; display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 20px 0 16px; border: 0; border-radius: 30px; background: var(--brand-grad); color: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--brand) 70%, transparent); animation: pop .5s var(--spring) .4s both; }
.p-chat-fab .ic { width: 22px; height: 22px; }
.p-chat-dot { position: absolute; top: 8px; right: 12px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; animation: pulse 2s infinite; }
.chat-open .p-chat-fab { opacity: 0; pointer-events: none; }
.p-chat { position: fixed; right: 22px; bottom: 22px; z-index: 50; width: 380px; max-width: calc(100vw - 24px); height: min(600px, calc(100vh - 40px)); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-3); display: flex; flex-direction: column; overflow: hidden; animation: popUp .35s var(--spring); }
.p-chat[hidden] { display: none; }
.p-chat header { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--side-bg); color: #fff; }
.p-chat header small { display: block; font-size: 11.5px; opacity: .7; }
.p-chat header .icon-btn { margin-left: auto; color: #fff; }
.p-chat-av { width: 38px; height: 38px; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 5px; }
.p-chat-av img { width: 100%; height: 100%; object-fit: contain; }
.p-chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-2); }
.portal .msg.guest { align-self: flex-end; flex-direction: row-reverse; }
.portal .msg.guest .msg-bubble { background: var(--brand-grad); color: #fff; border: 0; border-radius: 16px 16px 5px 16px; }
.portal .msg.guest .msg-head time, .portal .msg.guest .msg-head b { color: rgba(255, 255, 255, .85); }
.portal .msg.guest .avatar { display: none; }
.portal .msg .msg-bubble { background: var(--panel); border: 1px solid var(--line); }
.p-chat .composer { padding: 10px; }
.p-toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); z-index: 60; background: var(--ink); color: var(--panel); padding: 11px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: var(--sh-3); opacity: 0; pointer-events: none; transition: all .3s var(--spring); max-width: calc(100vw - 30px); }
.p-toast.show { opacity: 1; transform: translate(-50%, 0); }
.p-toast.bad { background: var(--danger); color: #fff; }
.p-quote { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.p-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.p-side .p-sec { padding: 18px; }
.p-side .field { margin-bottom: 12px; }
.p-paper .paper { margin: 0; max-width: none; }
@keyframes flashRing { 0% { box-shadow: 0 0 0 0 var(--brand-soft); } 40% { box-shadow: 0 0 0 6px var(--brand-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes popUp { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) {
  .p-hero { grid-template-columns: 1fr; padding: 22px 20px; }
  .p-ring { justify-self: center; }
  .p-total { text-align: left; }
  .p-fields, .p-sign-grid, .p-item-meta { grid-template-columns: 1fr; }
  .p-sec { padding: 18px 16px; }
  .p-quote { grid-template-columns: 1fr; }
  .p-side { position: static; }
  .p-top-help small { display: none; }
  .p-logo { height: 32px; }
  .p-chat { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; }
  .p-chat-fab span { display: none; }
  .p-chat-fab { padding: 0 16px; }
  .p-item-head { grid-template-columns: 34px minmax(0, 1fr); }
  .p-item-head .pill { grid-column: 2; justify-self: start; }
}
@media print {
  body.portal { background: #fff; }
  .portal .p-top, .portal .p-hero, .portal .p-side, .portal .p-chat-fab, .portal .p-chat, .portal .p-foot, .portal .p-banner { display: none !important; }
  .portal .p-wrap { padding: 0; max-width: none; }
  .portal .p-quote { display: block; }
}

/* =====================================================================
   Quotation maker (A/C & Supply quotations) + Send to Client
   ===================================================================== */
.qm-h { text-transform: uppercase; letter-spacing: .06em; font-size: 13.5px !important; color: var(--brand-ink); }
.qm-h small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.qm .form-grid.qm-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.qm .field.span2 { grid-column: span 2; }
.qm-acwrap { position: relative; }
.qm-aclist { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-3); padding: 4px; max-height: 300px; overflow: auto; }
.qm-aclist button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; background: none; border: 0; color: var(--ink); cursor: pointer; font: inherit; }
.qm-aclist button small { color: var(--muted); font-size: 11.5px; }
.qm-aclist button:hover, .qm-aclist button.on { background: var(--brand-soft); }
.qm-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.qm-item { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r); padding: 12px 14px 14px; animation: rise .25s var(--ease); }
.qm-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.qm-item-head > b { color: var(--brand-ink); font-size: 14.5px; }
.qm-item-act { display: flex; gap: 6px; flex-wrap: wrap; }
.qm-item-act .btn { min-width: 34px; }
.qm-item .qm-rm { color: var(--danger); }
.qm-item .field { margin: 0; }
.qm-item .field label { font-size: 12px; }
.qm-row { display: grid; gap: 10px; margin-top: 8px; }
.qm-ac1 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.qm-ac2, .qm-s1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qm-s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }   /* Installation item: Brand · Gas · Type · TR / Qty · Cost · Installation · Price */
.qm-item .qm-desc { margin-top: 8px; }
/* Free Quotation: product picker (search the product list, or type your own) */
.qm-pick { position: relative; }
.qm-sug { position: relative; }
.qm-sug label small { font-weight: 500; }
.qm-sug-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -6px; z-index: 1; background: var(--panel); }
.qm-sug-addbtn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0; text-transform: none; cursor: pointer; transition: background .15s, transform .1s; }
.qm-sug-addbtn:hover { background: var(--brand); color: #fff; }
.qm-sug-addbtn:active { transform: scale(.96); }
.qm-sug-addbtn .ic { width: 13px; }
.qm-sug-head { padding: 6px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.qm-suglist .qm-pick-opt b { font-weight: 500; white-space: normal; line-height: 1.4; }
.qm-suglist .qm-sug-opt { flex-direction: row; align-items: center; gap: 10px; }
.qm-suglist .qm-sug-opt b { flex: 1; min-width: 0; }
.qm-sug-del { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 17px; font-weight: 700; line-height: 1; display: grid; place-items: center; cursor: pointer; opacity: .55; transition: opacity .15s, background .15s, color .15s, border-color .15s, transform .1s; }
.qm-sug-opt:hover .qm-sug-del, .qm-sug-opt.on .qm-sug-del { opacity: 1; }
.qm-sug-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.qm-sug-del:active { transform: scale(.9); }
.qm-sug-add { display: flex; align-items: flex-start; gap: 10px; margin-top: 4px; padding: 9px 10px; border-top: 1px dashed var(--line); border-radius: 0 0 8px 8px; cursor: pointer; color: var(--brand-ink); }
.qm-sug-add:hover { background: var(--brand-soft); }
.qm-sug-add .ic { width: 18px; color: var(--brand); flex-shrink: 0; margin-top: 1px; }
.qm-sug-add span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.qm-sug-add b { font-size: 13px; font-weight: 700; }
.qm-sug-add small { font-size: 11.5px; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.qm-item:focus-within { position: relative; z-index: 6; }   /* keep the open list above the next item card */
.qm-pick label small { font-weight: 500; }
.qm-pickbox { position: relative; }
.qm-pickbox .input { padding-left: 36px; padding-right: 40px; font-weight: 600; }
.qm-pick-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); pointer-events: none; }
.qm-pick-open { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.qm-pick-open:hover { background: var(--hover); color: var(--brand); }
.qm-pick-open .ic { width: 16px; }
.qm-picklist { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; max-height: 300px; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); animation: dropIn .2s var(--ease); }
.qm-pick-opt { padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.qm-pick-opt b { font-size: 13px; font-weight: 600; color: var(--ink); }
.qm-pick-opt small { font-size: 11.5px; color: var(--muted); }
.qm-pick-opt:hover, .qm-pick-opt.on { background: var(--brand-soft); }
.qm-pick-opt:hover b, .qm-pick-opt.on b { color: var(--brand-ink); }
.qm-pick-empty { padding: 12px; text-align: center; color: var(--muted); font-size: 12.5px; }
.qm-ac2 { grid-template-columns: minmax(0, .8fr) minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, 1.4fr); }
.qm-ro { background: var(--line-2) !important; display: flex; align-items: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.qm-calc { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.qm-calc b { color: var(--ink); }
.qm-tip { margin: 10px 0 14px; }
.qm-disc { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.qm-disc .field { flex: 1; min-width: 180px; margin: 0; }
.qm-vat { display: inline-flex; align-items: center; gap: 8px; height: 42px; font-weight: 500; cursor: pointer; }
.qm-vat .input { width: 78px; height: 34px; }
.qm-vat input[type=checkbox], .qm-check input { width: 17px; height: 17px; accent-color: var(--brand); }
.qm-check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
/* Terms & letter text sets: "Load a saved set" buttons (quote maker / proposal) and the editor in Proposal Elements */
.qm-tsets { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: 12px; background: var(--brand-soft); }
.qm-tsets-l { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand-ink); margin-right: 4px; }
.qm-tsets-l .ic { width: 14px; }
.qm-tset { min-width: 82px; }
.qm-tsets-edit { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.qm-tsets-edit:hover { color: var(--brand); }
.qm-tsets-edit .ic { width: 13px; }
.ts-list { display: flex; flex-direction: column; gap: 10px; }
.ts-set { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
.ts-set[open] { background: var(--panel); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.ts-set > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.ts-set > summary::-webkit-details-marker { display: none; }
.ts-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.ts-name { max-width: 280px; height: 34px; font-weight: 700; }
.ts-set > summary .row-actions { margin-left: auto; opacity: 1; }
.ts-body { padding: 4px 12px 14px; }
/* "Terms & letter text" card: collapsed by default, header opens it */
details.qm-fold > summary { list-style: none; cursor: pointer; user-select: none; border-bottom-color: transparent; transition: border-color .25s var(--ease), background .2s; }
details.qm-fold > summary::-webkit-details-marker { display: none; }
details.qm-fold > summary:hover { background: var(--hover); }
details.qm-fold[open]:not(.qm-closing) > summary { border-bottom-color: var(--line-2); }
details.qm-fold.qm-anim { overflow: hidden; }
.qm-fold-hint { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.qm-fold-hint .when-open { display: none; }
details.qm-fold[open]:not(.qm-closing) .qm-fold-hint .when-open { display: inline; }
details.qm-fold[open]:not(.qm-closing) .qm-fold-hint .when-closed { display: none; }
.qm-fold-caret { width: 18px; color: var(--brand); transition: transform .3s var(--ease); }
details.qm-fold[open]:not(.qm-closing) .qm-fold-caret { transform: rotate(180deg); }
details.qm-fold > :not(summary) { transition: opacity .25s var(--ease), transform .3s var(--ease); }
details.qm-fold.qm-closing > :not(summary), details.qm-fold.qm-opening > :not(summary) { opacity: 0; transform: translateY(-6px); }
@media (max-width: 640px) { .qm-fold-hint .when-closed { display: none; } }
.qm-terms details { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; background: var(--panel-2); transition: border-color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease); }
.qm-terms details:hover { border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.qm-terms details[open]:not(.qm-closing) { padding-bottom: 14px; background: var(--panel); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: 0 0 0 3px var(--ring-c, rgba(34, 64, 154, .12)), var(--sh-1); }
.qm-terms summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 12px 0; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 10px; user-select: none; transition: color .25s var(--ease); }
.qm-terms summary::-webkit-details-marker { display: none; }
.qm-terms summary::before { content: ""; width: 7px; height: 7px; flex: none; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .3s var(--spring); }
.qm-terms summary::after { content: "Show"; margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 2px 9px; border-radius: 99px; background: var(--line-2); color: var(--faint); transition: background .25s, color .25s; }
.qm-terms details[open]:not(.qm-closing) > summary { color: var(--brand-ink); }
.qm-terms details[open]:not(.qm-closing) > summary::before { transform: rotate(45deg) translate(-2px, -2px); color: var(--brand); }
.qm-terms details[open]:not(.qm-closing) > summary::after { content: "Hide"; background: var(--brand-soft); color: var(--brand-ink); }
.qm-terms details.qm-anim { overflow: hidden; }
.qm-terms details > :not(summary) { transition: opacity .25s var(--ease), transform .3s var(--ease); }
.qm-terms details.qm-closing > :not(summary), .qm-terms details.qm-opening > :not(summary) { opacity: 0; transform: translateY(-6px); }
.qm-terms textarea { line-height: 1.55; }
@media (prefers-reduced-motion: reduce) { .qm-terms details, .qm-terms summary::before, .qm-terms details > :not(summary) { transition: none; } }
.qm-defbtns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.qm-sum .qm-sr { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13.5px; }
.qm-sum .qm-sr > span:first-child { color: var(--muted); }
.qm-sum .qm-sr b { text-align: right; overflow-wrap: anywhere; }
.qm-chip-ac, .qm-chip-sup { padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: 12px; }
.qm-chip-ac { background: #FDE8E9; color: #C8102E; }
.qm-chip-sup { background: var(--brand-soft); color: var(--brand-ink); }
.qm-tot { margin: 10px 0 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.qm-tot > div { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.qm-tot .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 18px; font-weight: 800; color: var(--brand-ink); }
.qm-internal { background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; line-height: 1.5; }
.btn.qm-go { background: #E31E24; border-color: transparent; color: #fff; height: 52px; font-size: 16px; font-weight: 700; border-radius: 12px; box-shadow: 0 10px 22px -10px rgba(227, 30, 36, .7); }
.btn.qm-go:hover { filter: brightness(1.06); }
.qm-step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 800; }
.qm-radios { display: flex; flex-direction: column; gap: 10px; }
.qm-radio { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.qm-radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.qm-radio input[type=radio] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.qm-radio > span { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.qm-radio small { color: var(--muted); font-size: 13px; }
.qm-sendbox { display: flex; flex-direction: column; gap: 10px; }
.qm-picked { position: relative; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; line-height: 1.55; }
.qm-picked-t { position: absolute; right: 14px; top: 12px; font-size: 15px; color: var(--brand-ink); }
.btn.qm-wa { background: #25D366; color: #fff; border-color: transparent; font-weight: 700; }
.btn.qm-wa:hover { filter: brightness(1.05); }
.btn.qm-wa span, .qm-n1 { font-weight: 800; }
.btn.disabled { opacity: .5; pointer-events: auto; }
.qm-msg summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); margin: 4px 0 8px; }
.qm-stage { position: fixed; left: -12000px; top: 0; width: 794px; background: #fff; }
.qpaper.ql-pdf { box-shadow: none !important; border-radius: 0 !important; max-width: none; width: 794px; }
.ql-pdf .ql-break span { display: none; }
.ql-pdf .ql-break { border: 0; margin: 0; height: 0; }
.qm-type { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }
@media (max-width: 860px) {
  .qm .form-grid.qm-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qm-ac1, .qm-ac2, .qm-s1, .qm-s4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qm-item-head { flex-wrap: wrap; }
}

/* ---------- printed quotation letter ---------- */
.qpaper { --q-navy: #22409A; --q-red: #E31E24; background: #fff; color: #1a1a22; max-width: 860px; margin: 0 auto; border-radius: 6px; box-shadow: var(--sh-2); padding: 34px 40px 26px; font-family: 'DM Sans', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 1.45; position: relative; }
/* letterhead (quotation maker letter): logo + company lines left, QUOTATION + reference box right */
.ql-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 18px; }
.ql-brandcol { min-width: 0; flex: 1 1 auto; }
.ql-logo { height: 54px; width: auto; max-width: 100%; display: block; }
.ql-co { margin-top: 10px; font-size: 10.5px; color: var(--q-navy); line-height: 1.6; letter-spacing: .01em; }
.ql-co .ql-trn { font-weight: 800; }
.ql-refcol { flex: 0 0 auto; width: 41%; display: flex; flex-direction: column; align-items: flex-end; }
.ql-title { font-size: 26px; letter-spacing: .1em; color: var(--q-navy); margin: 0 0 8px; font-weight: 800; line-height: 1; }
.ql-meta { width: 100%; border: 1.5px solid var(--q-navy); border-collapse: collapse; font-size: 11.5px; }
.ql-meta th { text-align: left; width: 38%; background: #eef1f9; color: var(--q-navy); font-weight: 700; padding: 5px 10px; white-space: nowrap; border-bottom: 1px solid #d5dbec; }
.ql-meta td { padding: 5px 10px; font-weight: 700; color: #1a1a22; border-bottom: 1px solid #d5dbec; }
.ql-meta tr:last-child th, .ql-meta tr:last-child td { border-bottom: 0; }
/* customer | project details */
.ql-parties { width: 100%; border: 1.5px solid var(--q-navy); border-collapse: collapse; font-size: 11.5px; margin-bottom: 14px; table-layout: fixed; }
.ql-parties thead th { background: var(--q-navy); color: #fff; text-align: left; font-weight: 700; letter-spacing: .06em; padding: 7px 12px; font-size: 11.5px; }
.ql-parties thead th + th { border-left: 1.5px solid #fff; }
.ql-parties tbody th { text-align: left; width: 16%; font-weight: 500; color: #5a5f6e; padding: 5px 12px; white-space: nowrap; border-bottom: 1px solid #e1e5f0; }
.ql-parties tbody td { width: 34%; padding: 5px 12px 5px 0; border-bottom: 1px solid #e1e5f0; overflow-wrap: anywhere; color: #1a1a22; }
.ql-parties tbody td + th { border-left: 1.5px solid var(--q-navy); }
.ql-parties tbody tr:last-child th, .ql-parties tbody tr:last-child td { border-bottom: 0; }
.ql-parties .ql-cust { font-weight: 800; font-size: 13.5px; }
.ql-subject { margin: 4px 0 8px; font-size: 12.5px; }
.ql-subject b { color: var(--q-navy); }
.ql-dear { margin: 0 0 6px; font-weight: 600; }
.ql-para { margin: 0 0 10px; text-align: justify; }
.ql-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 4px; }
.ql-tbl th { background: var(--q-navy); color: #fff; font-weight: 700; padding: 7px 8px; border: 1px solid var(--q-navy); font-size: 10.5px; letter-spacing: .04em; text-align: left; line-height: 1.2; }
.ql-tbl th small { font-weight: 500; opacity: .85; }
.ql-tbl td { border: 1px solid #c9cfe0; padding: 7px 8px; vertical-align: middle; }
.ql-tbl .c { text-align: center; } .ql-tbl .r { text-align: right; white-space: nowrap; }
.ql-tbl th.c { text-align: center; } .ql-tbl th.r { text-align: right; }
.ql-tbl td.ql-desc { line-height: 1.5; }
.ql-tbl tbody tr:nth-child(even) td { background: #fafbfe; }
.ql-tbl tfoot td { font-weight: 700; background: #f4f6fb; padding: 6px 8px; }
.ql-tbl tfoot .ql-grand td { background: var(--q-navy); color: #fff; font-size: 13px; border-color: var(--q-navy); }
.ql-brand { color: var(--q-red); font-weight: 800; letter-spacing: .02em; }
.ql-prod { font-weight: 800; color: var(--q-ink, #111); }
.ql-gas { font-weight: 700; color: inherit; white-space: nowrap; }
.ql-words { margin: 8px 0 12px; font-size: 11.5px; padding: 6px 10px; background: #f4f6fb; border-left: 3px solid var(--q-red); }
.ql-words span { color: #6b6b78; }
.ql-sec { margin: 0 0 11px; }
.ql-sec h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--q-navy); margin: 0 0 5px; padding-bottom: 3px; border-bottom: 1.5px solid #dfe3ef; }
.ql-sec ul, .ql-sec ol { margin: 0; padding-left: 18px; }
.ql-sec li { margin: 1.5px 0; }
.ql-sec ul li::marker { color: var(--q-red); }
.ql-tc ol { columns: 1; }
.ql-kv { border-collapse: collapse; width: 100%; }
.ql-kv th { text-align: left; width: 82px; font-weight: 700; color: #3c3c48; padding: 2px 0; vertical-align: top; }
.ql-kv td { padding: 2px 0; }
.ql-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 16px; font-size: 11.5px; }
.ql-sign p { margin: 0 0 4px; }
.ql-sig-space { position: relative; height: 98px; }
.ql-stamp { position: absolute; left: 4px; top: 2px; width: 92px; height: 92px; opacity: .88; transform: rotate(-8deg); }
.ql-sig-name { color: var(--q-navy); font-size: 12.5px; }
.ql-sig-client { text-align: right; }
.ql-sig-client .ql-line { display: block; border-top: 1px solid #9aa0b4; margin: 0 0 18px auto; width: 210px; padding-top: 3px; color: #6b6b78; font-size: 10.5px; text-align: center; }
.ql-esign { display: block; height: 60px; margin: 4px 0 4px auto; }
.ql-foot { margin-top: 16px; padding-top: 7px; border-top: 2px solid var(--q-navy); text-align: center; font-size: 9.5px; color: #6b6b78; }
.ql-break { margin: 22px -40px; border-top: 2px dashed #c9cfe0; position: relative; height: 0; page-break-before: always; break-before: page; }
.ql-break span { position: absolute; left: 50%; top: -10px; transform: translateX(-50%); background: #fff; color: #9aa0b4; font-size: 10px; padding: 0 10px; letter-spacing: .1em; text-transform: uppercase; }
.ql-avoid { break-inside: avoid; page-break-inside: avoid; }
@media (max-width: 700px) {
  .qpaper { padding: 20px 16px; overflow-x: auto; }
  .ql-head { flex-direction: column; align-items: stretch; }
  .ql-refcol { width: 100%; align-items: flex-start; }
  .ql-sign { grid-template-columns: 1fr; }
  .ql-sig-client { text-align: left; }
  .ql-break { margin: 22px -16px; }
}
@media print {
  @page { size: A4; margin: 9mm 0; }
  /* Quotation pages print on a zero-margin page: the browser then has no room for its own header / footer
     (URL, date, title, page number). The white border is padding inside the paper, repeated on every page. */
  @page quote { size: A4; margin: 0; }
  .qpaper { page: quote; box-shadow: none; border-radius: 0; max-width: none; padding: 10mm 12mm; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .qpaper.pp, .qpaper.pr { padding: 0; }
  .ql-break { margin: 0; border: 0; }
  .ql-break span { display: none; }
  .ql-tbl tr { break-inside: avoid; }
}
.qm-stampset { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.qm-stampset > img { border: 1px dashed var(--line); border-radius: 12px; padding: 8px; background: #fff; }

/* ---------- Intercool company format: parts quotation / tax invoice ---------- */
.qpaper.pp { padding: 0; background: transparent; box-shadow: none; border-radius: 0; display: flex; flex-direction: column; gap: 18px; }
.pp-page { position: relative; background: #fff; box-shadow: var(--sh-2); border-radius: 4px; padding: 26px 30px 18px; aspect-ratio: 210 / 297; display: flex; flex-direction: column; overflow: hidden; }
.pp-wm { position: absolute; left: 0; right: 0; top: 47%; text-align: center; font: 800 34px/1 Georgia, 'Times New Roman', serif; letter-spacing: .02em; color: rgba(34, 64, 154, .07); pointer-events: none; white-space: nowrap; }
.pp-head { border-bottom: 1px solid #222; padding-bottom: 6px; }
.pp-logo { height: 60px; width: auto; display: block; }
.pp-titlebar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; margin-top: 8px; }
.pp-titlebar b { font: 700 14px Georgia, 'Times New Roman', serif; color: #22409A; letter-spacing: .03em; }
.pp-trn { text-align: right; font: 700 11px Georgia, 'Times New Roman', serif; color: #22409A; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pp-trn em { font-style: normal; color: #111; font-family: Arial, sans-serif; font-size: 11px; }
.pp-party { display: grid; grid-template-columns: 1.15fr 1fr; border-bottom: 1px solid #222; font-family: Arial, Helvetica, sans-serif; font-size: 11.5px; }
.pp-to { padding: 10px 10px 8px 6px; border-right: 1px solid #222; display: flex; flex-direction: column; gap: 3px; }
.pp-ms { font-size: 12.5px; margin-bottom: 8px; }
.pp-meta { display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; margin: 0; padding: 10px 12px; font-weight: 700; font-size: 11.5px; align-content: start; }
.pp-meta dt::after { content: " -"; } .pp-meta dd { margin: 0; }
.pp-tbl { width: 100%; border-collapse: collapse; font-family: Arial, Helvetica, sans-serif; font-size: 10.5px; }
.pp-tbl th { font-weight: 500; font-size: 12px; padding: 5px 6px; border-bottom: 1px solid #222; border-left: 1px solid #222; text-align: left; }
.pp-tbl th:first-child, .pp-tbl td:first-child { border-left: 0; }
.pp-tbl td { padding: 8px 6px; border-left: 1px solid #222; vertical-align: middle; }
.pp-tbl tr.pp-fill td { height: 25px; padding: 0; }
.pp-tbl tbody tr:last-child td { border-bottom: 1px solid #222; }
.pp-tbl .c { text-align: center; } .pp-tbl .r { text-align: right; white-space: nowrap; } .pp-tbl th.c { text-align: center; } .pp-tbl th.r { text-align: right; }
.pp-cf { display: flex; justify-content: flex-end; gap: 46px; padding: 6px 14px 0 0; font: 700 11.5px Arial, sans-serif; }
.pp-cf b { font-weight: 500; min-width: 80px; text-align: right; letter-spacing: .03em; }
.pp-cont { text-align: right; padding: 22px 150px 0 0; font: 700 14px Arial, sans-serif; }
.pp-sum { display: grid; grid-template-columns: 1fr 250px; border-bottom: 1px solid #222; font-family: Arial, Helvetica, sans-serif; }
.pp-words { align-self: end; font-size: 10.5px; padding: 0 6px 4px; }
.pp-tot { font-size: 11.5px; }
.pp-tot > div { display: flex; justify-content: space-between; padding: 3px 8px 2px 14px; }
.pp-tot span { font-weight: 700; } .pp-tot b { font-weight: 500; letter-spacing: .03em; }
.pp-tot .g { border-top: 1px solid #222; font-size: 12.5px; } .pp-tot .g b { font-weight: 800; }
.pp-terms { font: 12px Arial, Helvetica, sans-serif; padding: 12px 8px 0; }
.pp-terms h4 { font-size: 12.5px; font-weight: 400; text-decoration: underline; margin: 0 0 10px; }
.pp-terms p { margin: 0 0 6px; }
.pp-bank { color: #444; font-size: 11px; }
.pp-sign { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 14px 6px 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12.5px; letter-spacing: .06em; }
.pp-for { position: relative; text-align: center; display: flex; flex-direction: column; gap: 66px; align-items: center; min-width: 280px; }
.pp-for small { font-size: 12.5px; letter-spacing: .06em; }
.pp-stamp { position: absolute; width: 86px; height: 86px; left: 50%; top: 14px; transform: translate(-50%, 0) rotate(-8deg); opacity: .85; }
.pp-client { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; letter-spacing: 0; }
.pp-client img { height: 50px; width: auto; align-self: flex-start; }
.pp-foot { text-align: center; font-family: Arial, Helvetica, sans-serif; }
.pp-brands { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 4px 6px; flex-wrap: wrap; }
.pp-brands span { font: 800 italic 15px/1 'Arial Black', Arial, sans-serif; color: #22409A; letter-spacing: -.01em; }
.pp-brands span:nth-child(3n+2) { color: #1a7f3b; } .pp-brands span:nth-child(3n) { color: #E31E24; }
.pp-contact { font-size: 13px; color: #222; line-height: 1.35; padding-top: 2px; letter-spacing: .01em; }
.qpaper.pp.ql-pdf { gap: 0; width: 794px; }
.ql-pdf .pp-page { box-shadow: none; border-radius: 0; aspect-ratio: auto; height: 1121px; }
@media (max-width: 700px) { .pp-page { aspect-ratio: auto; padding: 16px 12px; overflow-x: auto; } .pp-party, .pp-sum { grid-template-columns: 1fr; } .pp-to { border-right: 0; } .pp-cont { padding-right: 0; } }
@media print {
  .qpaper.pp { gap: 0; }
  .pp-page { box-shadow: none; border-radius: 0; aspect-ratio: auto; height: 297mm; padding: 15mm 9mm 13mm; }   /* full A4 (zero-margin page) with the old 9 mm margins inside */
  .pp-break { break-before: page; page-break-before: always; }
}
/* letter quotation: watermark + brand strip */
.ql-wm { position: absolute; left: 0; right: 0; top: 46%; text-align: center; font: 800 36px/1 Georgia, 'Times New Roman', serif; color: rgba(34, 64, 154, .06); pointer-events: none; white-space: nowrap; }
.ql-foot .pp-brands { border-bottom: 1px solid #e1e5f0; margin-bottom: 6px; }
.ql-foot .pp-brands span { font-size: 13px; }
.pp-brands-img { display: block; padding: 6px 2px; }
.pp-brands-img img { display: block; width: 100%; height: auto; max-height: 34px; object-fit: contain; }
.pp-tbl { table-layout: fixed; }
.pp-tbl th:nth-child(1) { width: 34px; } .pp-tbl th:nth-child(3) { width: 52px; } .pp-tbl th:nth-child(4) { width: 42px; } .pp-tbl th:nth-child(5) { width: 80px; } .pp-tbl th:nth-child(6) { width: 66px; } .pp-tbl th:nth-child(7) { width: 54px; } .pp-tbl th:nth-child(8) { width: 74px; }
.pp-tbl td:nth-child(2) { overflow-wrap: anywhere; }

/* =====================================================================
   Project proposal (from drawing) — editor, elements panel, print
   ===================================================================== */
.qm-chip-pro { background: #FFF1E0; color: #B45309; padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: 12px; }
.pr-main { display: grid; gap: 16px; align-content: start; min-width: 0; }
.pr-main.with-drawing { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
.pr-main .pr-fields { min-width: 0; }
.pr-viewer { position: sticky; top: calc(var(--top-h) + 14px); overflow: hidden; animation: rise .3s var(--ease); }
.pr-viewer-body { height: calc(100vh - var(--top-h) - 110px); min-height: 420px; background: #2b2f38; }
.pr-viewer-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.pr-img { width: 100%; height: 100%; overflow: auto; cursor: zoom-in; } .pr-img img { display: block; max-width: none; width: 100%; } .pr-img:active img { width: 200%; }
.pr-viewer-body .empty-state { color: #cfd3dc; } .pr-viewer-body .empty-state h3 { color: #fff; }
.pr-drop { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: var(--r); background: var(--brand-soft); cursor: pointer; transition: background .2s, border-color .2s; }
.pr-drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--panel)); }
.pr-drop > .ic { width: 30px; height: 30px; color: var(--brand); }
.pr-drop span { display: flex; flex-direction: column; } .pr-drop small { color: var(--muted); }
.pr-drop input { display: none; }
.pr-dlist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pr-dfile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.pr-dfile > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pr-floors { display: flex; flex-direction: column; gap: 12px; }
.pr-floor { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; animation: rise .25s var(--ease); }
.pr-floor-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--brand-soft); }
.pr-floor-name { max-width: 260px; font-weight: 800; text-transform: uppercase; color: var(--brand-ink); background: var(--panel) !important; }
.pr-floor-sum { flex: 1; color: var(--brand-ink); font-size: 12.5px; font-weight: 600; }
.pr-rooms td, .pr-scope td { padding: 5px 6px !important; vertical-align: top; }
.pr-rooms .input, .pr-scope .input { height: 34px; padding: 0 8px; }
.pr-scope textarea.input { height: auto; min-height: 34px; padding: 6px 8px; line-height: 1.4; resize: vertical; }
.pr-rooms input[data-r=room], .pr-rooms input[data-r=type] { text-transform: uppercase; }
.pr-counts { margin-top: 10px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pr-scope tr.pr-merged td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.pr-scope tr.pr-lead td { border-top: 2px solid var(--line); }
.pr-scope tr.pr-same td { border-top: 0; }
.pr-ditto { font-size: 12px; font-style: italic; }
.pr-auto { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--success); background: var(--success-bg); padding: 1px 6px; border-radius: 99px; margin-top: 3px; }
.pr-qty, .pr-amt { display: flex; align-items: center; gap: 4px; }
.pr-amt .input { text-align: right; font-weight: 700; }
.pr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0 4px; }
.pr-kpis div { text-align: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 4px; }
.pr-kpis b { display: block; font-size: 16px; color: var(--brand-ink); } .pr-kpis small { color: var(--muted); font-size: 11px; }
.pr-sections { display: flex; flex-direction: column; gap: 6px; }
.pr-sec { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: opacity .2s, background .2s; font-size: 13px; }
.pr-sec .qm-check { flex: 1; min-width: 0; }
.pr-sec.off { opacity: .55; background: var(--panel-2); }
.pr-np { display: inline-flex; gap: 4px; align-items: center; font-size: 11.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.pel-tbl td { vertical-align: top; padding: 6px !important; } .pel-tbl .input { height: 34px; } .pel-tbl textarea.input { height: auto; }
.pel-qty { margin-top: 6px; }
@media (max-width: 1200px) { .pr-main.with-drawing { grid-template-columns: minmax(0, 1fr); } .pr-viewer { position: relative; top: 0; } .pr-viewer-body { height: 60vh; } }

/* ---------- printed proposal ---------- */
.qpaper.pr { padding: 0; background: transparent; box-shadow: none; border-radius: 0; display: flex; flex-direction: column; gap: 18px; font-family: Cambria, Georgia, 'Times New Roman', serif; color: #111; }
.pr-page { position: relative; background: #fff; box-shadow: var(--sh-2); border-radius: 4px; padding: 26px 44px 16px; min-height: 0; aspect-ratio: 210 / 297; display: flex; flex-direction: column; overflow: hidden; font-size: 12px; }
.pr-head img { height: 52px; width: auto; }
.pr-doctitle { text-align: center; font-size: 21px; font-weight: 800; text-decoration: underline; letter-spacing: .02em; margin: 10px 0 4px; color: #111; }
.pr-to { font-family: Arial, sans-serif; font-size: 11px; }
.pr-box { width: 100%; border: 2px solid #111; border-collapse: collapse; margin-bottom: 8px; }
.pr-box > tbody > tr > td, .pr-box > tr > td { vertical-align: top; padding: 6px 8px; }
.pr-box table { border-collapse: collapse; } .pr-box th { text-align: left; padding: 4px 6px 4px 0; font-family: Arial, sans-serif; white-space: nowrap; font-size: 12px; }
.pr-box td td { padding: 4px 4px; font-size: 12.5px; }
.pr-box .pr-meta { width: 38%; } .pr-box .pr-meta th { padding-right: 10px; }
.pr-sub td { font-family: Arial, sans-serif; font-size: 12px; } .pr-sub span { font-weight: 700; padding-left: 22px; }
.pr-blue { color: #1f5fa8; }
.pr-red { color: #E31E24 !important; font-weight: 800; }
.pr-dear { font-family: Arial, sans-serif; font-weight: 700; margin: 6px 0 4px; font-size: 12px; }
.pr-open { font-family: Arial, sans-serif; font-weight: 700; margin: 0 0 8px; font-size: 12px; line-height: 1.55; }
.pr-body { flex: 1; }
.pr-title { text-align: center; font-family: Calibri, 'Segoe UI', Arial, sans-serif; font-weight: 500; font-size: 15px; margin: 6px 0 4px; letter-spacing: .02em; }
.pr-tbl { width: 100%; border-collapse: collapse; border: 2px solid #111; font-size: 11.5px; margin-bottom: 10px; }
.pr-tbl th { background: #eee; font-weight: 800; padding: 5px 6px; border: 1px solid #111; text-align: center; }
.pr-tbl td { border: 1px solid #333; padding: 6px; font-family: Calibri, 'Segoe UI', Arial, sans-serif; }
.pr-tbl .c { text-align: center; }
.pr-sched .pr-floorrow td { text-align: left; font-weight: 600; padding: 4px 6px; }
.pr-sched tfoot td { background: #dde8f3; font-weight: 800; font-family: Cambria, Georgia, serif; font-size: 12.5px; }
.pr-scopet td { font-family: Cambria, Georgia, serif; font-size: 12px; } .pr-scopet .pr-desc { font-weight: 700; line-height: 1.35; }
.pr-tot { margin-left: auto; border-collapse: collapse; border: 2px solid #111; min-width: 300px; margin-top: -10px; font-size: 12.5px; }
.pr-tot th { text-align: center; padding: 5px 16px; border: 1px solid #111; font-weight: 800; } .pr-tot td { text-align: center; padding: 5px 14px; border: 1px solid #111; font-weight: 800; min-width: 110px; }
.pr-words { font-family: Arial, sans-serif; font-size: 10.5px; color: #444; margin: 6px 0 10px; text-align: right; }
.pr-kv p { margin: 4px 0 6px; font-size: 13.5px; } .pr-kv b { display: inline-block; min-width: 70px; }
.pr-h { color: #E31E24; text-decoration: underline; font-size: 14px; margin: 10px 0 6px; font-weight: 800; }
.pr-bul { margin: 2px 0 6px; font-weight: 700; font-size: 12.5px; line-height: 1.4; }
.pr-para { font-weight: 700; font-size: 12.5px; line-height: 1.45; margin: 10px 0; }
.pr-close { font-family: Calibri, 'Segoe UI', Arial, sans-serif; font-size: 12.5px; margin: 8px 0; line-height: 1.45; }
.pr-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 8px; }
.pr-sig b { font-size: 13px; line-height: 1.6; } .pr-sig-name { color: #111; }
.pr-sig-space { position: relative; height: 64px; }
.pr-stamp { position: absolute; left: 150px; top: -16px; width: 96px; height: 96px; opacity: .85; transform: rotate(-10deg); }
.pr-acc { text-align: right; font-family: Arial, sans-serif; font-size: 11px; } .pr-acc img { display: block; height: 52px; margin: 4px 0 4px auto; }
.pr-acc .ql-line { display: block; border-top: 1px solid #9aa0b4; margin: 0 0 0 auto; width: 200px; padding-top: 3px; color: #6b6b78; text-align: center; }
.pr-foot { margin-top: 10px; text-align: center; font-family: Arial, sans-serif; font-size: 10.5px; color: #333; }
.pr-pg { display: block; text-align: right; font-size: 11.5px; padding-bottom: 4px; border-bottom: 2px solid #22409A; margin-bottom: 4px; }
.qpaper.pr.ql-pdf { gap: 0; width: 794px; }
.ql-pdf .pr-page { box-shadow: none; border-radius: 0; aspect-ratio: auto; min-height: 1121px; }
@media (max-width: 700px) { .pr-page { aspect-ratio: auto; padding: 16px 12px; overflow-x: auto; } .pr-box .pr-meta { width: auto; } .pr-sign { grid-template-columns: 1fr; } }
@media print {
  .qpaper.pr { gap: 0; }
  .pr-page { box-shadow: none; border-radius: 0; aspect-ratio: auto; min-height: 297mm; padding: 14mm 12mm 12mm; }
  .pp-break { break-before: page; page-break-before: always; }
  .pr-tbl tr { break-inside: avoid; }
}

.doc-editor.has-drawing { grid-template-columns: minmax(0, 1fr); }
.doc-editor.has-drawing .sticky-side { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.pr-main.with-drawing { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
.with-drawing .qm .form-grid.qm-g4, .with-drawing .form-grid.qm-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) { .doc-editor.has-drawing .sticky-side { grid-template-columns: minmax(0, 1fr); } }

.pr-main { grid-template-columns: minmax(0, 1fr); }
.pr-main > .pr-fields { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.pr-main.with-drawing { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }

#pelScope textarea { min-width: 260px; } #pelScope select[data-f=basis] { min-width: 100px; } #pelScope select[data-f=rule] { min-width: 190px; }

.qm-fontprev { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: #111; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.qm-fontprev b { font-size: 20px; letter-spacing: .12em; color: #22409A; } .qm-fontprev .n { font-weight: 800; font-size: 15px; color: #22409A; }
