/* =========================================================================
   АТБ · Hub — design system
   Redesign: visual layer only. All selectors match the existing markup
   and app.js hooks (data-date-*, #ids, .classes) — nothing structural
   was renamed, so no template or script changes were required.
   ========================================================================= */

:root {
  /* Ink & neutrals */
  --ink: #0f2431;
  --ink-soft: #34566a;
  --muted: #66808f;
  --surface: #ffffff;
  --surface-subtle: #f4f9fa;
  --canvas: #eef4f7;
  --line: #dde7ec;
  --line-strong: #c2d4dd;

  /* Brand */
  --brand: #0c93ad;
  --brand-light: #35b8cf;
  --brand-dark: #0a6f83;
  --navy: #0b273c;
  --navy-soft: #143a55;
  --focus: #22b8d4;
  --accent: #f6b93b;
  --accent-dark: #e0a324;

  /* Semantic */
  --danger: #d5404f;
  --danger-dark: #ad2e3c;
  --success: #1f9d6f;
  --warning: #c07a0a;

  /* Shape & motion */
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 19px;
  --radius-xl: 26px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow-xs: 0 1px 2px rgb(15 45 60 / 6%);
  --shadow-sm: 0 6px 16px rgb(14 52 68 / 8%);
  --shadow-md: 0 16px 32px rgb(14 52 68 / 13%);
  --shadow-lg: 0 28px 56px rgb(10 42 58 / 20%);

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(1100px 520px at 6% -8%, rgb(12 147 173 / 10%), transparent 60%),
    radial-gradient(900px 480px at 108% 4%, rgb(246 185 59 / 10%), transparent 55%),
    linear-gradient(180deg, #f7fbfc, var(--canvas) 45%, #eaf2f2);
  background-attachment: fixed;
}

a { color: var(--brand-dark); text-decoration: none; transition: color 180ms var(--ease); }
button, input, select, textarea { font: inherit; }

::selection { background: rgb(12 147 173 / 22%); color: var(--navy); }

/* Scrollbar polish (WebKit) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c2d4dd; border: 3px solid var(--canvas); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #9fb8c4; }

/* -------------------------------------------------------------------------
   Buttons & controls
   ---------------------------------------------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface); color: #17495f;
  font-weight: 700; line-height: 1.25; letter-spacing: -.005em;
  cursor: pointer; user-select: none;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms var(--ease),
              background-color 220ms var(--ease), background-position 480ms var(--ease), color 220ms var(--ease), opacity 220ms var(--ease);
}
button:hover, .button:hover { transform: translateY(-2px); border-color: #9dc0cc; box-shadow: var(--shadow-sm); }
button:active, .button:active { transform: translateY(0) scale(.97); transition-duration: 90ms; }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 0; box-shadow: 0 0 0 4px rgb(34 184 212 / 26%);
}
button:disabled, .button[aria-disabled="true"], .busy { cursor: not-allowed; opacity: .5; pointer-events: none; transform: none; box-shadow: none; }

.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-dark) 55%, #0d8098 100%);
  background-size: 180% 180%; background-position: 0% 50%;
  box-shadow: 0 10px 20px rgb(12 147 173 / 26%);
}
.primary:hover { background-position: 100% 50%; box-shadow: 0 16px 28px rgb(12 147 173 / 34%); border-color: transparent; color: #fff; }

.secondary { border-color: #b8d3db; background: #fff; color: #1f6a80; }
.secondary:hover { border-color: #7fb3c3; background: #eaf6f8; color: var(--brand-dark); }

.wide { width: 100%; }

.quiet { min-height: auto; padding: 9px 10px; border-color: transparent; background: transparent; box-shadow: none; color: #1f6a80; }
.quiet:hover { background: #e8f4f6; box-shadow: none; transform: none; }

.danger { color: var(--danger) !important; }
.danger-button { border-color: #f0c6cc; background: #fff5f6; color: #9a2e3b; }
.danger-button:hover { border-color: #e0a6b1; background: #ffeaed; color: var(--danger-dark); }

input:not([type="checkbox"]), select, textarea {
  display: block; width: 100%; min-height: 44px; padding: 10px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), background-color 200ms var(--ease);
}
input:not([type="checkbox"]):hover, select:hover, textarea:hover { border-color: #9dc0cc; }
input:not([type="checkbox"]):focus, select:focus, textarea:focus { border-color: var(--focus); background: #fff; outline: 0; box-shadow: 0 0 0 4px rgb(34 184 212 / 18%); }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .55; background: #edf3f5; }

label { display: block; margin-bottom: 5px; color: var(--ink-soft); font-size: .875rem; font-weight: 700; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); cursor: pointer; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.08; letter-spacing: -.04em; font-weight: 800; }
h2 { margin-bottom: 8px; font-size: 1.25rem; line-height: 1.25; letter-spacing: -.018em; font-weight: 800; }

/* -------------------------------------------------------------------------
   Header
   ---------------------------------------------------------------------- */
.top {
  display: flex; align-items: center; gap: 24px; min-height: 78px;
  padding: 14px max(32px, 4vw);
  background: linear-gradient(120deg, #0a2136, var(--navy) 55%, #0d3450);
  color: #fff; box-shadow: 0 4px 20px rgb(6 30 45 / 22%);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 1.125rem; font-weight: 850; letter-spacing: -.02em; }
.brand:hover { color: #fff; opacity: .92; }
.mark {
  display: grid; width: 40px; height: 40px; place-items: center;
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, #8ce8dc, #2a9fca 60%, var(--brand-dark));
  color: #06283a; font-weight: 900;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%), 0 6px 14px rgb(8 90 110 / 35%);
  transition: transform 260ms var(--ease-spring);
}
.brand:hover .mark { transform: rotate(-6deg) scale(1.05); }
.brand-sub { margin-left: 8px; padding-left: 16px; border-left: 1px solid #43647a; color: #bcdae2; font-size: .8125rem; font-weight: 550; }
.top nav { display: flex; gap: 4px; }
.top nav a { position: relative; padding: 10px 13px; border-radius: var(--radius-sm); color: #d7e8ed; font-size: .9375rem; font-weight: 700; transition: background-color 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease); }
.top nav a:hover { background: rgb(255 255 255 / 10%); color: #fff; transform: translateY(-1px); }
.top nav a::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 6px; height: 2px;
  background: var(--accent); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform 220ms var(--ease);
}
.top nav a:hover::after { transform: scaleX(1); }
.account { display: flex; align-items: center; gap: 12px; margin-left: auto; color: #d1e2e8; font-size: .875rem; }
.account form { margin: 0; }
.account .quiet { color: #fff; }
.account .quiet:hover { background: rgb(255 255 255 / 12%); }

main { max-width: 1440px; min-height: calc(100vh - 150px); margin: auto; padding: 32px max(32px, 4vw) 48px; }
footer { padding: 16px max(32px, 4vw); border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }

.field-hint { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.eyebrow { display: block; margin-bottom: 8px; color: #567c8e; font-size: .6875rem; font-weight: 850; letter-spacing: .14em; line-height: 1.25; text-transform: uppercase; }
.light { color: #a9dadd; }
.lead, .muted { color: var(--muted); }
.lead { margin-bottom: 0; }
.count { display: inline-grid; min-width: 28px; min-height: 28px; margin-left: 8px; padding: 4px 8px; place-items: center; border-radius: 999px; background: #e7f0f3; color: #4d7182; font-size: .8125rem; vertical-align: middle; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* -------------------------------------------------------------------------
   Entrance motion (subtle, applied to top-level sections in main)
   ---------------------------------------------------------------------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
main > section, main > div.page-heading, main > form, main > .login {
  animation: fade-up 460ms var(--ease) both;
}
main > section:nth-of-type(2) { animation-delay: 40ms; }
main > section:nth-of-type(3) { animation-delay: 80ms; }
main > section:nth-of-type(4) { animation-delay: 120ms; }

/* -------------------------------------------------------------------------
   Cards & tables
   ---------------------------------------------------------------------- */
.card {
  padding: 24px; margin-bottom: 24px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.table-wrap { overflow-x: auto; border: 1px solid #e2eaed; border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-subtle); color: #56727f; font-size: .6875rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { padding: 15px 16px; border-bottom: 1px solid #e6eef1; font-size: .9375rem; vertical-align: middle; }
tbody tr { position: relative; transition: background-color 200ms var(--ease); }
tbody tr:hover { background: #f4fbfc; }
tbody tr:last-child td { border-bottom: 0; }

.strong { font-weight: 850; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 4px 12px 4px 10px;
  border-radius: 999px; font-size: .75rem; font-weight: 800; line-height: 1.25; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; opacity: .8; }
.draft { background: #eaf1f3; color: #4d6a79; }
.correction { background: #fff1d9; color: #8a5900; }
.approved { background: #e4effc; color: #1d5f8f; }
.shipped { background: #ddf3e8; color: #157a52; }
.deleted { background: #f9e5e8; color: #97303e; }

.message { padding: 16px 20px; margin-bottom: 24px; border: 1px solid #c4e9d8; border-radius: var(--radius-md); background: #e6f5ed; color: #176443; box-shadow: var(--shadow-sm); }
.message.warning { border-color: #f2d39a; background: #fff4df; color: #885800; }
.message.error { border-color: #f1c9d1; background: #ffebee; color: #a12d3b; }

.back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: .9375rem; font-weight: 750; transition: transform 200ms var(--ease), color 200ms var(--ease); }
.back:hover { color: var(--brand); transform: translateX(-3px); }
.empty { padding: 48px 16px; text-align: center; }
.empty p { max-width: 420px; margin: 0 auto 20px; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 24px 0 0; }
.compact { min-height: 36px; padding: 8px 13px; font-size: .8125rem; }

/* -------------------------------------------------------------------------
   Dashboard hero
   ---------------------------------------------------------------------- */
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-14px, 10px) scale(1.05); }
}
.dashboard-hero {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: 42px 44px; margin-bottom: 24px; overflow: hidden;
  border-radius: var(--radius-xl); color: #fff;
  background: linear-gradient(125deg, #08243a, #0e6079 58%, #17a99b);
  box-shadow: var(--shadow-lg);
}
.dashboard-hero::after {
  position: absolute; top: -110px; right: -80px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgb(120 226 214 / 34%), transparent 68%);
  content: ""; animation: drift 9s ease-in-out infinite;
}
.dashboard-hero::before {
  position: absolute; bottom: -120px; left: 12%; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgb(246 185 59 / 18%), transparent 70%);
  content: ""; animation: drift 11s ease-in-out infinite reverse;
}
.dashboard-hero > * { position: relative; z-index: 1; }
.dashboard-hero h1 { margin-bottom: 12px; }
.dashboard-hero p { max-width: 640px; margin-bottom: 0; color: #d5eaed; }
.hero-action {
  min-height: 52px; border-color: transparent; color: #17313d; white-space: nowrap;
  background: linear-gradient(120deg, var(--accent), #ffd88a 60%, var(--accent));
  background-size: 200% 100%; background-position: 0% 50%;
  box-shadow: 0 14px 26px rgb(0 0 0 / 20%);
}
.hero-action:hover { background-position: 100% 50%; border-color: transparent; color: #17313d; box-shadow: 0 18px 32px rgb(0 0 0 / 24%); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric {
  position: relative; min-height: 104px; padding: 20px 20px 20px 24px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}
.metric:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.metric::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: #7b99a8; content: ""; }
.metric.pending::before { background: #4d96b8; }
.metric.editing::before { background: var(--warning); }
.metric.completed::before { background: var(--success); }
.metric span { display: block; margin-bottom: 8px; color: #6a8492; font-size: .6875rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.metric strong { font-size: 2rem; letter-spacing: -.06em; line-height: 1; font-weight: 850; }

/* -------------------------------------------------------------------------
   Workspace / filters / order table
   ---------------------------------------------------------------------- */
.workspace { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.workspace-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.workspace-title h2 { margin-bottom: 0; }
.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 16px; margin-bottom: 20px; border: 1px solid #dce8ec; border-radius: var(--radius-md); background: #f2f8f9; }
.filters label { flex: 1 1 144px; margin: 0; }
.filters .search { flex: 2 1 240px; }
.filters label span { display: block; margin-bottom: 4px; color: #5f7a89; font-size: .6875rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.filters input, .filters select { min-height: 40px; }
.filters select { height: 44px; }
.filters > button, .filters > .reset { align-self: flex-end; min-height: 44px; height: 44px; white-space: nowrap; }
.reset { align-self: center; }

.order-table table { min-width: 800px; }
.table-wrap:has(.empty) table { min-width: 0; width: 100%; }
.table-wrap:has(.empty) thead { display: none; }
.order-table th { background: var(--surface); }
.order-link { color: #10394f; font-weight: 850; transition: color 180ms var(--ease); }
.order-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.line-count { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: #e7f3f5; color: #176781; font-weight: 850; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.row-actions > a { padding: 8px; font-size: .875rem; font-weight: 800; }
.row-actions form { margin: 0; }

/* -------------------------------------------------------------------------
   Page heading / order top / flow
   ---------------------------------------------------------------------- */
.page-heading, .order-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading h1, .order-top h1 { margin-bottom: 8px; }
.order-top .lead span { padding: 0 4px; color: #9cadb5; }

.flow-card { display: flex; align-items: center; padding: 20px 24px; margin-bottom: 24px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.flow-step { display: flex; align-items: center; gap: 12px; min-width: 184px; color: #7b919c; }
.flow-step i { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border: 2px solid #c8d7dd; border-radius: 50%; background: #fff; font-style: normal; font-weight: 850; transition: all 260ms var(--ease); }
.flow-step strong, .flow-step span { display: block; font-size: .8125rem; line-height: 1.25; }
.flow-step span { margin-top: 4px; color: #7b929d; font-size: .75rem; }
.flow-step.done { color: #166e68; }
.flow-step.done i { border-color: #1b8d85; background: #1b8d85; color: #fff; box-shadow: 0 4px 10px rgb(27 141 133 / 30%); }
.flow-step.current { color: #a5680d; }
.flow-step.current i { border-color: #e7a72e; background: #fff6df; box-shadow: 0 0 0 4px rgb(231 167 46 / 18%); }
.flow-line { min-width: 32px; height: 2px; flex: 1; background: #dce7eb; }

/* -------------------------------------------------------------------------
   Detail grid / facts / action panel
   ---------------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 24px; align-items: start; margin-bottom: 24px; }
.detail-grid .order-card { margin-bottom: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 0; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.facts > div { min-width: 0; padding: 12px; border: 1px solid #e1ebee; border-radius: var(--radius-sm); background: var(--surface-subtle); transition: border-color 200ms var(--ease); }
.facts > div:hover { border-color: #b9d4dc; }
.facts dt { color: #6a8492; font-size: .6875rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.facts dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 750; }

.action-panel { align-self: start; height: auto; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.action-main { padding: 20px; margin-bottom: 12px; border: 1px solid #cce7e4; border-radius: var(--radius-md); background: linear-gradient(155deg, #e7f6f5, #f8fbfb); }
.action-main h2 { margin-bottom: 8px; }
.action-main p { margin-bottom: 16px; color: #52707d; font-size: .875rem; }

.secondary-action { display: flex; align-items: center; gap: 12px; padding: 16px; margin-bottom: 12px; border: 1px solid #e0e9ed; border-radius: var(--radius-md); color: #254d60; transition: transform 220ms var(--ease), border-color 220ms var(--ease), background-color 220ms var(--ease), box-shadow 220ms var(--ease); }
.secondary-action:hover { transform: translateY(-2px); border-color: #a9ccd5; background: #f0f8f9; box-shadow: var(--shadow-sm); }
.secondary-action > span:first-child { color: #147b90; font-size: 1.25rem; }
.secondary-action strong, .secondary-action small { display: block; }
.secondary-action small { margin-top: 4px; color: #718995; font-size: .75rem; line-height: 1.35; }
.secondary-arrow { margin-left: auto; color: #7192a0; transition: transform 220ms var(--ease); }
.secondary-action:hover .secondary-arrow { transform: translateX(3px); }

.return { padding-top: 16px; margin-top: 16px; border-top: 1px solid #dce8ed; }
.return summary { display: flex; align-items: center; min-height: 32px; color: #286b83; font-size: .875rem; font-weight: 750; cursor: pointer; transition: color 180ms var(--ease); }
.return summary:hover { color: var(--brand); }
.return form { margin-top: 16px; animation: fade-up 260ms var(--ease) both; }
.check { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0; font-size: .875rem; font-weight: 550; }
.danger-area summary { color: var(--danger); }

/* -------------------------------------------------------------------------
   History / tabs / login
   ---------------------------------------------------------------------- */
.history { padding: 0; list-style: none; }
.history li { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid #e5edf1; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs a { padding: 10px 13px; border-radius: var(--radius-sm); color: #4a6c7a; font-size: .9375rem; font-weight: 750; transition: background-color 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease); }
.tabs a:hover { background: #e9f3f5; transform: translateY(-1px); }
.tabs .active { background: var(--navy); color: #fff; box-shadow: 0 6px 14px rgb(9 47 71 / 22%); }

.login {
  max-width: 440px; margin: 48px auto; position: relative; overflow: hidden;
}
.login::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

/* -------------------------------------------------------------------------
   Order form / save bar
   ---------------------------------------------------------------------- */
.save-bar {
  position: sticky; bottom: 16px; z-index: 3; display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 16px 20px; border: 1px solid #29506a; border-radius: var(--radius-md);
  background: rgb(15 47 67 / 92%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; box-shadow: var(--shadow-lg);
}
.save-bar p { margin: 0 auto 0 0; max-width: 620px; color: #d0e2e9; font-size: .875rem; }
.save-bar .muted { color: #d0e2e9; }

.line-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(128px, 1fr) auto; gap: 16px; align-items: end; padding: 16px 0; border-top: 1px solid #e6eef1; animation: fade-up 260ms var(--ease) both; }
.remove { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; margin: 0; font-size: .875rem; font-weight: 550; white-space: nowrap; }

.form-grid { display: grid; grid-template-columns: minmax(144px, 1fr) minmax(176px, 1.5fr) minmax(208px, 2fr); gap: 16px; }
.errorlist { padding: 0; margin: 8px 0 0; color: #a1283b; font-size: .875rem; list-style: none; }
.approval-card { max-width: 1040px; }
.notice { display: flex; flex-direction: column; gap: 4px; padding: 16px; margin-bottom: 24px; border: 1px solid #cce8ef; border-radius: var(--radius-sm); background: #eef8fb; color: #24556b; }
.action-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; }
.action-footer p { max-width: 600px; margin-bottom: 0; }

.selected-group { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: #587d8e; font-size: .8125rem; }
.selected-group span { color: #718995; }
.selected-group strong { padding: 2px 8px; border-radius: 999px; background: #e7f3f5; color: #176781; font-weight: 800; }

/* -------------------------------------------------------------------------
   SQL analytics dashboard
   ---------------------------------------------------------------------- */
.analytics-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 32px 36px; margin-bottom: 24px; border-radius: var(--radius-xl); color: #fff;
  background: linear-gradient(122deg, #0f2f42, #0c6a80 62%, #17a290);
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.analytics-hero::after {
  content: ""; position: absolute; top: -90px; right: -60px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgb(120 226 214 / 26%), transparent 68%); animation: drift 10s ease-in-out infinite;
}
.analytics-hero > * { position: relative; z-index: 1; }
.analytics-hero h1 { margin-bottom: 10px; }
.analytics-hero p { max-width: 720px; margin: 0; color: #d9eff0; }
.analytics-hero-note { display: grid; min-width: 210px; gap: 4px; padding: 16px 18px; border: 1px solid rgb(255 255 255 / 22%); border-radius: var(--radius-md); background: rgb(4 41 54 / 25%); }
.analytics-hero-note span { color: #abdde0; font-size: .6875rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.analytics-hero-note strong { font-size: 1rem; }
.analytics-hero-note small { color: #d3e9eb; font-size: .75rem; line-height: 1.35; }

.analytics-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.analytics-metrics .metric { min-height: 116px; }
.analytics-metrics .metric small { display: block; margin-top: 7px; color: #718995; font-size: .75rem; }
.analytics-metrics .metric.delta::before { background: #7657b8; }
.analytics-metrics .metric.delta strong { color: #46388a; }
.analytics-metrics .metric.delta.negative::before { background: #c0525a; }
.analytics-metrics .metric.delta.negative strong { color: #a13b43; }

.analytics-workspace { padding: 24px; }
.analytics-checkbox { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 0; white-space: nowrap; }
.analytics-checkbox span { margin: 0 !important; font-size: .75rem !important; text-transform: none !important; letter-spacing: 0 !important; }
.analytics-checkbox input { flex: 0 0 auto; }
.analytics-filters label { flex-basis: 150px; }
.analytics-filters .analytics-checkbox { flex: 0 0 auto; }

.analytics-layout { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 20px; }
.analytics-table table { min-width: 1020px; }
.analytics-table th { background: var(--surface); }
.analytics-side { height: max-content; padding: 18px; border: 1px solid #dce8ec; border-radius: var(--radius-md); background: linear-gradient(180deg, #f5fafb, #fff); }
.analytics-side h2 { margin-bottom: 16px; font-size: 1rem; }
.group-list { padding: 0; margin: 0; list-style: none; }
.group-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid #e0eaed; color: #57717f; font-size: .8125rem; transition: color 180ms var(--ease); }
.group-list li:first-child { border-top: 0; }
.group-list li:hover { color: var(--ink); }
.group-list strong { color: #16495d; white-space: nowrap; }

@media (max-width: 1120px) {
  .analytics-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-layout { grid-template-columns: 1fr; }
  .analytics-side { display: none; }
}
@media (max-width: 640px) {
  .analytics-hero { align-items: stretch; padding: 24px; flex-direction: column; }
  .analytics-hero-note { min-width: 0; }
  .analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-metrics .metric:last-child { grid-column: 1 / -1; }
  .analytics-filters .analytics-checkbox { width: 100%; }
  .analytics-workspace { padding: 16px; }
}

/* -------------------------------------------------------------------------
   Date picker
   ---------------------------------------------------------------------- */
.date-filter { position: relative; display: grid; flex: 1 1 230px; min-width: 220px; gap: 6px; }
.filter-label { color: #587d8e; font-size: .6875rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.date-picker-trigger {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; gap: 12px;
  padding: 10px 14px; border: 1px solid #cbdde5; border-radius: 13px; background: #fff; color: #173f53;
  font: inherit; font-weight: 750; text-align: left; box-shadow: var(--shadow-xs); cursor: pointer;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.date-picker-trigger:hover { border-color: #76aebc; box-shadow: 0 6px 14px rgb(20 95 118 / 12%); transform: translateY(-1px); }
.date-picker-trigger:focus-visible { outline: 0; border-color: #1592aa; box-shadow: 0 0 0 3px rgb(21 146 170 / 22%); }
.date-picker-trigger > span:last-child { color: #28738a; font-size: 1.1rem; line-height: 1; }

@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.date-picker-popover {
  position: absolute; z-index: 25; top: calc(100% + 8px); left: 0; width: min(336px, calc(100vw - 32px));
  padding: 12px; border: 1px solid #cfe0e6; border-radius: 17px; background: #fff;
  box-shadow: 0 20px 46px rgb(13 60 77 / 22%); animation: pop-in 180ms var(--ease-spring) both;
}
.date-picker-popover[hidden] { display: none; }

.date-picker-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 10px; background: #eef5f7; }
.date-picker-modes button { min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: #5a7583; font: inherit; font-size: .8125rem; font-weight: 800; cursor: pointer; transition: background 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease); }
.date-picker-modes button.is-active { background: #fff; color: #116f83; box-shadow: 0 2px 6px rgb(20 83 102 / 12%); }
.date-picker-modes button:focus-visible, .date-picker-header button:focus-visible, .date-picker-day:focus-visible, .date-picker-today:focus-visible { outline: 2px solid #1195ae; outline-offset: 2px; }

.date-picker-header { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; margin-bottom: 8px; }
.date-picker-header strong { color: #173f53; font-size: .875rem; text-align: center; text-transform: capitalize; }
.date-picker-header button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #176b82; font-size: 1.5rem; line-height: 1; cursor: pointer; transition: background 180ms var(--ease), transform 180ms var(--ease); }
.date-picker-header button:hover { background: #eaf5f6; transform: scale(1.08); }

.date-picker-weekdays, .date-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.date-picker-weekdays { margin-bottom: 2px; color: #78919c; font-size: .625rem; font-weight: 850; text-align: center; text-transform: uppercase; }
.date-picker-grid { gap: 2px; }
.date-picker-day { position: relative; min-width: 0; height: 36px; border: 0; border-radius: 8px; background: transparent; color: #173f53; font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer; transition: color 150ms var(--ease), background 150ms var(--ease), transform 150ms var(--ease); }
.date-picker-day:hover { background: #dff2f3; color: #0b7186; }
.date-picker-day.is-outside { color: #a9bac1; font-weight: 600; }
.date-picker-day.is-today::after { position: absolute; right: 6px; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-dark); content: ''; }
.date-picker-day.is-preview, .date-picker-day.is-in-range { border-radius: 0; background: #dff1f3; color: #116d80; }
.date-picker-day.is-start, .date-picker-day.is-end, .date-picker-day.is-selected { border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: 0 4px 10px rgb(5 102 122 / 28%); }
.date-picker-day.is-start.is-in-range { border-radius: 8px 0 0 8px; }
.date-picker-day.is-end.is-in-range { border-radius: 0 8px 8px 0; }
.date-picker-day.is-start.is-end { border-radius: 8px; }
.date-picker-day.is-start.is-preview { border-radius: 8px 0 0 8px; }
.date-picker-day.is-preview:last-child { border-radius: 0 8px 8px 0; }
.date-picker-day:active { transform: scale(.92); }

.date-picker-today { width: 100%; min-height: 34px; margin-top: 10px; border: 1px solid #d3e4e9; border-radius: 8px; background: #f8fcfc; color: #176d83; font: inherit; font-size: .75rem; font-weight: 800; cursor: pointer; transition: background 180ms var(--ease); }
.date-picker-today:hover { background: #eaf6f7; }

/* -------------------------------------------------------------------------
   Filter consistency and calmer typography
   ---------------------------------------------------------------------- */
/* Search, status and date fields share one hover, focus ring and chevron. */
body { font-weight: 400; }
h1, h2 { font-weight: 700; }
.strong, .order-link, .metric strong, .facts dd { font-weight: 700; }
button, .button, label, .badge, .back, .tabs a, .row-actions > a { font-weight: 600; }
.eyebrow, th, .filters label span, .filter-label, .metric span,
.date-picker-weekdays { font-weight: 700; }

.filters .date-filter {
  flex: 0 1 340px;
  min-width: 260px;
  max-width: 340px;
}
.filters input:not([type="checkbox"]),
.filters select,
.filters .date-picker-trigger {
  min-height: 48px;
  border-color: #cbdde5;
  box-shadow: var(--shadow-xs);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.filters select { height: 48px; }
.filters input:not([type="checkbox"]):hover,
.filters select:hover,
.filters .date-picker-trigger:hover {
  border-color: #76aebc;
  box-shadow: 0 6px 14px rgb(20 95 118 / 12%);
  transform: translateY(-1px);
}
.filters input:not([type="checkbox"]):focus,
.filters select:focus,
.filters .date-picker-trigger:focus-visible {
  border-color: #1592aa;
  box-shadow: 0 0 0 3px rgb(21 146 170 / 22%);
}
.filters select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='m1 1 6 6 6-6' fill='none' stroke='%23176b82' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.filters .date-picker-trigger > span:last-child {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-right: 2px solid #176b82;
  border-bottom: 2px solid #176b82;
  color: transparent;
  font-size: 0;
  transform: rotate(45deg) translate(-2px, -2px);
}

@media (max-width: 640px) {
  .date-filter, .filters .date-filter { flex-basis: 100%; max-width: none; }
  .date-picker-popover { position: fixed; top: 50%; left: 50%; width: min(336px, calc(100vw - 32px)); transform: translate(-50%, -50%); }
  .date-picker-popover::before { position: fixed; z-index: -1; inset: -200vmax; background: rgb(10 40 51 / 28%); content: ''; backdrop-filter: blur(2px); }
}

/* -------------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------- */
@media (max-width: 960px) {
  .brand-sub { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .flow-step { min-width: 168px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > div:last-child { grid-column: 1 / -1; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .top { gap: 16px; padding: 14px 16px; flex-wrap: wrap; }
  .top nav { width: 100%; order: 3; }
  .top nav a { flex: 1; text-align: center; }
  .account-name { display: none; }
  main { padding: 24px 16px 40px; }
  footer { padding: 16px; }
  .dashboard-hero { align-items: flex-start; padding: 24px; flex-direction: column; }
  .dashboard-hero h1 { font-size: 2.1rem; }
  .hero-action { width: 100%; }
  .metrics { gap: 12px; }
  .metric { min-height: 92px; padding: 16px 16px 16px 20px; }
  .metric strong { font-size: 1.625rem; }
  .workspace, .card { padding: 16px; }
  .filters { padding: 12px; }
  .filters label { flex-basis: 100%; }
  .filters button, .filters .reset { width: 100%; }
  .order-top, .page-heading, .section-heading, .action-footer { align-items: stretch; flex-direction: column; }
  .order-top > .badge, .page-heading > .badge { align-self: flex-start; }
  .facts, .form-grid { grid-template-columns: 1fr; }
  .flow-card { padding: 16px; }
  .flow-step { min-width: 160px; }
  .line-row { grid-template-columns: 1fr; gap: 12px; }
  .remove { padding-bottom: 0; }
  .save-bar { position: static; padding: 16px; flex-wrap: wrap; }
  .save-bar p, .save-bar button { width: 100%; }
  .action-footer .button { width: 100%; }
}
