/* Design tokens */
:root {
  color-scheme: dark;
  --bg-app: #0b1020;
  --bg-sidebar: #080d19;
  --bg-surface: #121a2a;
  --bg-surface-raised: #162033;
  --bg-surface-hover: #19253a;
  --bg-input: #0e1625;
  --border: #253249;
  --border-strong: #34445e;
  --text-primary: #f3f6fb;
  --text-secondary: #aab5c7;
  --text-muted: #738198;
  --primary: #5b8cff;
  --primary-hover: #729cff;
  --primary-soft: rgba(91, 140, 255, .14);
  --success: #42c98b;
  --success-soft: rgba(66, 201, 139, .13);
  --warning: #f2b84b;
  --warning-soft: rgba(242, 184, 75, .14);
  --danger: #ff6b78;
  --danger-soft: rgba(255, 107, 120, .13);
  --info: #55b7ff;
  --purple: #a78bfa;
  --nav: var(--bg-sidebar);
  --nav-soft: var(--bg-surface-raised);
  --primary-dark: var(--primary-hover);
  --bg: var(--bg-app);
  --surface: var(--bg-surface);
  --surface-soft: var(--bg-input);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --subtle: var(--text-muted);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .22);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, .34);
  --sidebar-width: 248px;
  --topbar-height: 64px;
  --control-height: 40px;
  --field-feedback-height: 19px;
}

/* Reset */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { scrollbar-color: #34445e transparent; scrollbar-width: thin; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--info); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(91, 140, 255, .28);
  outline-offset: 2px;
}

/* Layout */
.app-body { background: var(--bg); min-height: 100vh; }
.app-shell { min-height: 100vh; }
/* Sidebar */
.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 12px;
  background: var(--nav);
  border-right: 1px solid #1c2739;
  color: var(--text-primary);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text-primary); text-decoration: none; min-width: 0; }
.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(91, 140, 255, .24);
}
.brand > span:last-child { display: grid; line-height: 1.15; }
.brand strong { font-size: 17px; letter-spacing: .06em; }
.brand small { margin-top: 4px; color: var(--text-muted); font-size: 11px; letter-spacing: .02em; }
.sidebar-nav { display: grid; gap: 4px; margin-top: 32px; }
.nav-label { padding: 0 12px 8px; color: #526078; font-size: 10px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.nav-label-spaced { margin-top: 18px; }
.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #9ba8bc;
  font-weight: 600;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.055); color: var(--text-primary); transform: translateX(2px); }
.sidebar-nav a.active { background: var(--primary-soft); color: #dbe7ff; }
.sidebar-nav a.active::before { content: ""; position: absolute; left: -12px; width: 3px; height: 24px; border-radius: 0 3px 3px 0; background: var(--primary); }
.sidebar-nav svg, .logout-button svg, .topbar-logout svg, .mobile-header svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-nav svg:first-child path:first-child { vector-effect: non-scaling-stroke; }
.sidebar-nav a:first-of-type svg { fill: currentColor; stroke: none; }
.account {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 34px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 13px 9px;
  border-top: 1px solid rgba(255,255,255,.09);
}
.avatar, .mobile-avatar { display: grid; place-items: center; border-radius: 50%; background: #22314a; color: #dce8ff; font-weight: 800; text-decoration: none; }
.avatar { width: 38px; height: 38px; }
.account-copy { display: grid; min-width: 0; }
.account-copy { color: inherit; text-decoration: none; }
.account-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { color: var(--text-muted); font-size: 11px; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer; }
.icon-button:hover { background: rgba(255,255,255,.08); }
.logout-button { width: 34px; height: 34px; color: var(--text-muted); }
.sidebar-close, .mobile-header, .sidebar-overlay { display: none; }
.app-frame { min-height: 100vh; margin-left: var(--sidebar-width); }

/* Topbar */
.topbar {
  position: sticky;
  z-index: 34;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 8px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, .88);
  backdrop-filter: blur(16px);
}
.topbar-context { display: grid; line-height: 1.2; }
.topbar-kicker { color: var(--text-muted); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.topbar-context strong { margin-top: 3px; font-size: 14px; }
.topbar-account, .topbar-user { display: flex; align-items: center; }
.topbar-account { gap: 12px; }
.topbar-user { gap: 9px; padding-left: 12px; border-left: 1px solid var(--border); }
.topbar-user { color: inherit; text-decoration: none; }
.topbar-user > span:last-child { display: grid; line-height: 1.25; }
.topbar-user strong { max-width: 190px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user small { color: var(--text-muted); font-size: 10px; }
.avatar-small { width: 32px; height: 32px; font-size: 11px; }
.role-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 750; }
.role-ADMIN { border-color: rgba(167,139,250,.28); background: rgba(167,139,250,.11); color: #c7b6ff; }
.role-SA { border-color: rgba(85,183,255,.26); background: rgba(85,183,255,.1); color: #8bceff; }
.role-SX { border-color: rgba(66,201,139,.25); background: rgba(66,201,139,.1); color: #79dca9; }
.topbar-logout { color: var(--text-secondary); }
.topbar-logout:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.page-content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 28px 32px 64px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head-copy { flex: 1 1 420px; min-width: 0; }
.eyebrow { display: block; margin-bottom: 5px; color: #83a8ff; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-head h1 { margin: 0; font-size: clamp(24px, 2vw, 30px); line-height: 1.25; letter-spacing: -.025em; }
.page-head p { margin: 5px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.page-actions-group { display: flex; gap: 8px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 0 12px; }
.section-heading h2, .surface h2, .form-section h2 { margin: 0; font-size: 17px; line-height: 1.35; letter-spacing: -.01em; }
.section-heading p, .surface-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.section-heading a { font-weight: 650; text-decoration: none; }

/* Buttons */
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--control-height);
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.button:hover, button:hover { border-color: #4a5e7e; background: var(--bg-surface-hover); }
.button:active, button:active { transform: translateY(1px); }
.primary { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 0 0 1px rgba(255,255,255,.04) inset; }
.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.secondary { border-color: rgba(91,140,255,.3); background: var(--primary-soft); color: #adc5ff; }
.danger-button { border-color: rgba(255,107,120,.3); background: var(--danger-soft); color: var(--danger); }
.danger-button:hover { border-color: rgba(255,107,120,.55); background: rgba(255,107,120,.2); color: #ff9aa4; }
.large { min-height: 46px; padding: 12px 22px; }
.wide { width: 100%; }
.link { min-height: auto; padding: 2px; border: 0; background: transparent; box-shadow: none; color: var(--primary); }
.link:hover { border: 0; background: transparent; text-decoration: underline; }
.button svg, button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Cards */
.surface, .panel, .form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.surface { padding: 22px; }
.surface.flush { padding: 0; overflow: hidden; }
.surface-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.surface-head h2 { margin: 0; }
.muted { color: var(--muted); }
.danger-text, .debt { color: var(--danger) !important; }
.success-text { color: var(--success) !important; }
.nowrap { white-space: nowrap; }

.alert { display: flex; align-items: flex-start; gap: 10px; max-width: 100%; margin-bottom: 18px; padding: 12px 14px; border: 1px solid; border-radius: 11px; font-weight: 600; }
.alert-icon { display: inline-grid; flex: 0 0 auto; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 800; }
.alert.error { border-color: rgba(255,107,120,.3); background: var(--danger-soft); color: #ff9aa4; }
.alert.error .alert-icon { background: rgba(255,107,120,.16); }
.alert.success { border-color: rgba(66,201,139,.28); background: var(--success-soft); color: #7fe0af; }
.alert.success .alert-icon { background: rgba(66,201,139,.16); }
.alert.big { align-items: center; justify-content: center; padding: 15px; font-size: 16px; text-align: center; }

.metric-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
.metric-grid.money-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric-card { position: relative; display: grid; min-height: 132px; padding: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); }
.metric-card::after { content: ""; position: absolute; width: 72px; height: 72px; right: -23px; top: -25px; border-radius: 50%; background: rgba(255,255,255,.025); }
.metric-card:hover { border-color: #405373; background: var(--bg-surface-raised); box-shadow: 0 10px 28px rgba(0,0,0,.2); transform: translateY(-1px); }
.metric-card.urgent { border-color: rgba(255,107,120,.25); background: var(--bg-surface); }
.metric-card.urgent::after { background: rgba(255,107,120,.08); }
.metric-card.warning { border-color: rgba(242,184,75,.24); background: var(--bg-surface); }
.metric-card.warning::after { background: rgba(242,184,75,.08); }
.metric-card.success-card { border-color: rgba(66,201,139,.23); }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-value { align-self: end; margin-top: 12px; font-size: 29px; line-height: 1; letter-spacing: -.035em; }
.money-grid .metric-value { font-size: clamp(18px,1.5vw,24px); }
.metric-foot { margin-top: 9px; color: var(--subtle); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(280px,.85fr); gap: 16px; }
.pipeline { display: grid; gap: 16px; }
.pipeline-row { display: grid; grid-template-columns: minmax(110px,1fr) 2fr 34px; align-items: center; gap: 12px; }
.pipeline-row span:first-child { color: var(--muted); font-size: 12px; font-weight: 600; }
.pipeline-row strong { text-align: right; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #202d42; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.pipeline-row:nth-child(2) .progress > span { background: var(--warning); }
.pipeline-row:nth-child(3) .progress > span { background: var(--purple); }
.pipeline-row:nth-child(4) .progress > span { background: var(--success); }
.order-compact-list { display: grid; }
.order-compact { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.order-compact:first-child { padding-top: 2px; }
.order-compact:last-child { padding-bottom: 0; border-bottom: 0; }
.order-compact:hover .order-code { color: var(--primary); }
.order-compact-main { display: grid; min-width: 0; }
.order-compact-main span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.order-code { font-weight: 800; transition: color .15s ease; }
.order-deadline { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Orders */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input); scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; min-height: 38px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 650; text-decoration: none; }
.tabs a:hover { color: var(--text); background: var(--bg-surface-hover); }
.tabs a.active { background: var(--bg-surface-raised); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs b { display: inline-grid; min-width: 23px; height: 21px; padding: 0 6px; place-items: center; border-radius: 999px; background: #202d42; font-size: 11px; }
.tabs a.active b { background: var(--primary-soft); color: var(--primary); }
.orders-toolbar { margin-bottom: 12px; padding: 12px; }
.order-date-filter { margin-bottom: 14px; padding: 4px 4px 16px; border-bottom: 1px solid var(--border); }
.order-date-filter .surface-head { align-items: flex-start; margin-bottom: 12px; }
.order-date-filter .surface-head h2 { margin: 0; font-size: 15px; }
.order-date-filter .surface-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.order-date-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: start; }
.order-date-controls > button { margin-top: 25px; }
.search-row { display: grid; grid-template-columns: minmax(260px,1fr) auto auto; gap: 8px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--subtle); stroke-width: 2; stroke-linecap: round; }
.search-box input { padding-left: 41px; }
.customer-combobox { position: relative; }
.customer-suggestions { position: absolute; z-index: 20; top: calc(100% + 5px); right: 0; left: 0; max-height: 270px; overflow: auto; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--bg-surface-raised); box-shadow: var(--shadow-md); }
.customer-suggestion { display: grid; width: 100%; min-height: 0; gap: 2px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: var(--bg-surface-raised); box-shadow: none; color: var(--text); text-align: left; }
.customer-suggestion:last-child { border-bottom: 0; }
.customer-suggestion:hover, .customer-suggestion[aria-selected="true"] { background: var(--primary-soft); color: #c6d6ff; }
.customer-suggestion strong { font-size: 13px; }
.customer-suggestion span { color: var(--muted); font-size: 12px; font-weight: 500; }
.filter-toggle[aria-expanded="true"] { border-color: rgba(91,140,255,.35); background: var(--primary-soft); color: #b7ccff; }
.filter-count { display: inline-grid; min-width: 20px; height: 20px; padding: 0 6px; place-items: center; border-radius: 999px; background: var(--primary); color: white; font-size: 11px; }
.advanced-filters { display: grid; grid-template-columns: repeat(3,minmax(150px,1fr)); gap: 12px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.advanced-filters[hidden] { display: none; }
.filter-actions { display: flex; align-items: flex-end; gap: 8px; }
.quick-filters, .active-filters { display: flex; align-items: center; gap: 7px; margin: 10px 0 16px; overflow-x: auto; }
.quick-filters > span { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 650; }
.filter-chip { display: inline-flex; align-items: center; flex: 0 0 auto; min-height: 31px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-surface); color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.filter-chip:hover, .filter-chip.active { border-color: rgba(91,140,255,.35); background: var(--primary-soft); color: #b7ccff; }
.quick-filters .filter-chip b { display: inline-grid; min-width: 20px; height: 19px; margin-left: 2px; padding: 0 5px; place-items: center; border-radius: 999px; background: #202d42; color: var(--text-secondary); font-size: 10px; }
.quick-filters .filter-chip.active b { background: rgba(91,140,255,.2); color: #c6d6ff; }
.list-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 8px; color: var(--muted); font-size: 12px; }
.list-summary strong { color: var(--text-secondary); font-size: 13px; }

/* Forms */
input, select, textarea, .editor {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input, select, textarea { min-height: var(--control-height); padding: 9px 11px; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover, select:hover, textarea:hover, .editor:hover { border-color: #4a5e7e; }
input:focus, select:focus, textarea:focus, .editor:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px rgba(91,140,255,.16); }
input:disabled, select:disabled, textarea:disabled { background: #111a29; color: var(--text-muted); cursor: not-allowed; }
input[readonly], textarea[readonly] { background: #101827; color: var(--text-secondary); }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text-primary); box-shadow: 0 0 0 1000px var(--bg-input) inset; caret-color: var(--text-primary); }
textarea { min-height: 84px; resize: vertical; }
label { display: grid; min-width: 0; align-content: start; gap: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 650; }
.field-label { display: block; min-width: 0; }
.field-label .muted { font-weight: 500; }
.check { display: flex; align-items: center; align-self: center; gap: 9px; min-height: 42px; color: var(--text); }
.check input { flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.input-action { position: relative; }
.input-action input { padding-right: 45px; }
.input-action button { position: absolute; right: 4px; bottom: 4px; width: 34px; min-height: 34px; padding: 0; border: 0; background: transparent; box-shadow: none; color: var(--muted); }
.field-hint { margin: 2px 0 10px; color: var(--muted); font-size: 12px; font-weight: 400; }
.field-error { display: block; color: var(--danger); font-size: 12px; font-weight: 650; line-height: 1.35; }
.validated-form label:not(.check):has(> input, > select, > textarea, > .input-action),
.field-shell {
  position: relative;
  padding-bottom: var(--field-feedback-height);
}
.validated-form label:not(.check) > .field-error,
.field-shell > .field-error {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-shell { min-width: 0; }
.group-feedback { min-height: var(--field-feedback-height); margin-top: 5px; }
.group-feedback:empty { margin-top: 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .editor[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,120,.12); }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-surface); }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { position: sticky; z-index: 2; top: 0; background: #101827; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .065em; text-transform: uppercase; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: var(--bg-surface-hover); }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: var(--muted); }
td a { text-decoration: none; }
.money-column { text-align: right; white-space: nowrap; }
.record-number-column { width: 54px; color: var(--muted); text-align: center; white-space: nowrap; }
.record-number { color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.order-card-identity { display: flex; align-items: center; gap: 8px; }
.order-row .order-code-link { color: var(--text); }
.order-row:hover .order-code-link { color: var(--primary); }
.desc { max-width: 250px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-form { display: flex; align-items: center; gap: 5px; }
.status-form select { min-width: 146px; min-height: 35px; padding: 6px 28px 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-input); font-size: 12px; font-weight: 700; }
.status-form button { min-height: 33px; padding: 6px 9px; font-size: 11px; box-shadow: none; }
.status-form.saving select { opacity: .65; cursor: wait; }
/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid transparent; border-radius: 999px; background: #202b3e; color: var(--text-secondary); font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-TASK { border-color: #34445e; background: #202b3e; color: #b2bed0; }
.status-CHECKING_MAKET { border-color: rgba(242,184,75,.24); background: var(--warning-soft); color: #f5c96d; }
.status-MAKET_CONFIRMED { border-color: rgba(85,183,255,.24); background: rgba(85,183,255,.12); color: #82cbff; }
.status-IN_PROGRESS { border-color: rgba(167,139,250,.25); background: rgba(167,139,250,.12); color: #c0adff; }
.status-COMPLETED { border-color: rgba(66,201,139,.24); background: var(--success-soft); color: #75dba6; }
.status-DELIVERED { border-color: rgba(45,212,191,.24); background: rgba(45,212,191,.11); color: #69dfcf; }
.status-form select[data-current="TASK"] { color: #b2bed0; }
.status-form select[data-current="CHECKING_MAKET"] { border-color: rgba(242,184,75,.28); color: #f5c96d; }
.status-form select[data-current="MAKET_CONFIRMED"] { border-color: rgba(85,183,255,.28); color: #82cbff; }
.status-form select[data-current="IN_PROGRESS"] { border-color: rgba(167,139,250,.28); color: #c0adff; }
.status-form select[data-current="COMPLETED"] { border-color: rgba(66,201,139,.28); color: #75dba6; }
.status-form select[data-current="DELIVERED"] { border-color: rgba(45,212,191,.28); color: #69dfcf; }
.overdue { color: var(--danger) !important; font-weight: 750; }
.due-soon { color: var(--warning) !important; font-weight: 700; }
.deadline { display: grid; gap: 2px; white-space: nowrap; }
.deadline small { margin: 0; }
.empty { padding: 50px 20px !important; color: var(--muted); text-align: center; }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 44px 20px; color: var(--muted); text-align: center; }
.empty-state-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--bg-input); color: var(--subtle); font-size: 22px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.pagination span { color: var(--muted); font-size: 13px; }
.mobile-list { display: none; }

/* Order form */
.order-form-layout { display: grid; grid-template-columns: 216px minmax(0,1080px); align-items: start; gap: 22px; }
.form-rail { position: sticky; top: calc(var(--topbar-height) + 20px); display: grid; gap: 5px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: rgba(18,26,42,.9); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); }
.form-rail span { padding: 8px 10px 5px; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.form-rail a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; }
.form-rail a:hover { background: var(--primary-soft); color: #b7ccff; }
.step-dot { display: inline-grid; flex: 0 0 auto; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: #202d42; color: var(--text-secondary); font-size: 10px; }
.form-rail a:hover .step-dot { background: rgba(91,140,255,.2); color: #c6d6ff; }
.order-form { display: grid; gap: 16px; }
.form-section { padding: 24px; scroll-margin-top: 20px; }
.form-section-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.form-section-head > div { flex: 1 1 240px; }
.form-section-head > .button { margin-left: auto; }
.form-section-head .step-dot { width: 30px; height: 30px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; }
.form-section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.grid2, .grid3 { display: grid; column-gap: 16px; row-gap: 6px; align-items: start; }
.grid2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field-span-2 { grid-column: 1 / -1; }
.editor-tools { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 7px; border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 9px 9px 0 0; background: #111b2b; }
.editor-tools button { min-width: 34px; min-height: 32px; padding: 5px 8px; box-shadow: none; font-size: 12px; }
.editor { min-height: 210px; padding: 14px; border-radius: 0 0 9px 9px; overflow-wrap: anywhere; }
.editor-status { min-height: 20px; margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.image-tools { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-left: auto; }
.image-tools[hidden] { display: none !important; }
.image-tools > span { color: var(--muted); font-size: 11px; }
.form-actions { position: sticky; z-index: 10; bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 13px; background: rgba(18,26,42,.94); box-shadow: 0 14px 36px rgba(0,0,0,.34); backdrop-filter: blur(12px); }
.form-actions p { margin: 0; color: var(--muted); font-size: 12px; }

/* Detail views */
.detail-hero { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 24px; margin-bottom: 16px; padding: 22px 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title-row h1 { margin: 0; font-size: 27px; letter-spacing: -.02em; }
.detail-subtitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 12px; }
.detail-subtitle .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--subtle); }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(310px,.75fr); gap: 18px; align-items: start; }
.detail-stack { display: grid; gap: 16px; }
.info-list { display: grid; grid-template-columns: 155px minmax(0,1fr); gap: 0; margin: 0; }
.info-list dt, .info-list dd { padding: 11px 0; border-bottom: 1px solid var(--border); }
.info-list dt { color: var(--muted); font-size: 12px; }
.info-list dd { margin: 0; color: var(--text); }
.info-list dt:last-of-type, .info-list dd:last-of-type { border-bottom: 0; }
.info-list.compact { grid-template-columns: 130px minmax(0,1fr); }
.info-list dd { min-width: 0; overflow-wrap: anywhere; }
.copy-line { display: flex; align-items: flex-start; gap: 7px; }
.copy-button { width: 28px; min-height: 26px; padding: 3px; border: 0; box-shadow: none; color: var(--muted); }
.rich { overflow-wrap: anywhere; }
.financial-number { font-size: 18px; font-weight: 800; }
.payment-summary { margin-top: 14px; padding: 10px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.payment-summary.pending { background: var(--danger-soft); color: #ff9aa4; }
.payment-summary.paid { background: var(--success-soft); color: #79dca9; }
.status-update { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.assignee-update { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; align-items: start; }
.status-update.saving select, .assignee-update.saving select { opacity: .65; cursor: wait; }
.assignee-update .field-hint { margin: 0; align-self: end; padding-bottom: 11px; }
.payment-update { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: start; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.payment-update > button { margin-top: 25px; }
.payment-add-form { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.payment-add-form > button { grid-column: 1 / -1; width: 100%; margin-top: 0; }
.payment-add-form input[readonly] { background: var(--surface-soft); color: var(--muted); font-weight: 700; }
.files { display: grid; }
.file-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: 0; }
.file-link { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); font-weight: 650; text-decoration: none; }
.file-icon { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--primary-soft); }
.file-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-upload { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.timeline { position: relative; margin-left: 7px; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; top: 7px; bottom: 8px; left: 0; width: 2px; background: var(--border); }
.timeline article { position: relative; margin-bottom: 20px; }
.timeline article::before { content: ""; position: absolute; left: -29px; top: 5px; width: 10px; height: 10px; border: 3px solid var(--bg-surface); border-radius: 50%; background: var(--text-muted); box-shadow: 0 0 0 1px var(--border-strong); }
.timeline article:first-child::before { background: var(--primary); box-shadow: 0 0 0 1px rgba(91,140,255,.55); }
.timeline time { display: block; color: var(--subtle); font-size: 11px; }
.timeline strong { display: block; margin-top: 3px; font-size: 13px; }
.timeline p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

/* Employees */
.panel { margin-bottom: 16px; padding: 0; overflow: hidden; }
.panel summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; cursor: pointer; font-weight: 750; list-style: none; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: "+"; color: var(--primary); font-size: 20px; line-height: 1; }
.panel[open] summary { border-bottom: 1px solid var(--border); }
.panel[open] summary::after { content: "−"; }
.panel > form { padding: 18px; }
.management-table input, .management-table select, .management-table textarea { min-width: 140px; min-height: 38px; padding: 7px 9px; }
.management-table textarea { min-height: 58px; }
.management-table .button-cell { width: 1%; white-space: nowrap; }
.management-table td { vertical-align: top; }
.management-table .button-cell button { min-height: 38px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.row-actions form { margin: 0; }
.employee-create-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
.employee-create-actions { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 16px; padding-top: 2px; }
.employee-status { padding: 0 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-input); white-space: nowrap; }
.employee-status:has(input:checked) { border-color: rgba(66,201,139,.25); background: var(--success-soft); color: #79dca9; }
.role-pill, .active-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.role-pill { background: rgba(167,139,250,.12); color: #c0adff; }
.active-pill { background: var(--success-soft); color: var(--success); }
.active-pill.inactive { background: #202b3e; color: var(--muted); }

/* Profile */
.profile-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 18px; max-width: 1080px; }
.profile-card { min-width: 0; }
.profile-summary { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; align-items: center; gap: 13px; margin-bottom: 22px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input); }
.profile-avatar { width: 54px; height: 54px; font-size: 17px; }
.profile-summary > div { display: grid; min-width: 0; }
.profile-summary > div strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-summary > div span { color: var(--muted); font-size: 12px; }
.profile-form { display: grid; gap: 2px; }
.account-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 2px 0 18px; }
.account-meta span { display: grid; gap: 3px; padding: 10px 12px; border-radius: 9px; background: var(--bg-input); color: var(--muted); font-size: 11px; }
.account-meta strong { color: var(--text-secondary); font-size: 13px; }
.form-submit { display: flex; justify-content: flex-end; margin-top: 5px; }

/* Reports */
.report-presets { display: flex; gap: 7px; flex-wrap: wrap; }
.report-filter { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: start; }
.report-filter > button { margin-top: 25px; }
.report-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr); gap: 16px; }
.report-bar-list { display: grid; gap: 16px; }
.report-bar-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 12px; }
.report-bar-head span { color: var(--muted); }
.report-bar-head strong { font-size: 13px; }
.report-bar-list .progress { height: 9px; }
.report-bar:nth-child(2) .progress > span { background: var(--success); }
.report-bar:nth-child(3) .progress > span { background: var(--danger); }
.report-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.embedded-surface-head { padding: 20px 20px 0; }
.embedded-table { border: 0; border-radius: 0; box-shadow: none; }

/* Login */
.auth-body { min-height: 100vh; background: var(--bg-app); }
.public { min-height: 100vh; padding: 24px; }
.auth-shell { display: grid; grid-template-columns: minmax(420px,1.15fr) minmax(390px,.85fr); min-height: calc(100vh - 48px); overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: var(--bg-surface); box-shadow: 0 28px 90px rgba(0,0,0,.38); }
.auth-brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(38px,5vw,72px); overflow: hidden; background: var(--bg-sidebar); color: var(--text-primary); }
.auth-brand-panel::before, .auth-brand-panel::after { content: ""; position: absolute; border: 1px solid rgba(91,140,255,.14); border-radius: 50%; }
.auth-brand-panel::before { width: 420px; height: 420px; right: -170px; top: -160px; background: rgba(91,140,255,.09); }
.auth-brand-panel::after { width: 300px; height: 300px; left: -170px; bottom: -130px; background: rgba(85,183,255,.05); }
.auth-brand { position: relative; display: flex; align-items: center; gap: 12px; }
.auth-brand strong { font-size: 18px; letter-spacing: .04em; }
.auth-message { position: relative; z-index: 1; max-width: 590px; }
.auth-message span { color: #8ab0ff; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.auth-message h1 { margin: 12px 0 16px; font-size: clamp(34px,4vw,56px); line-height: 1.08; letter-spacing: -.04em; }
.auth-message p { max-width: 500px; margin: 0; color: var(--text-secondary); font-size: 16px; line-height: 1.7; }
.auth-proof { position: relative; display: flex; gap: 28px; color: var(--text-secondary); font-size: 12px; }
.auth-proof strong { display: block; margin-bottom: 3px; color: var(--text-primary); font-size: 18px; }
.auth-form-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(410px,100%); }
.login-card .mobile-login-brand { display: none; }
.login-card h2 { margin: 0; font-size: 29px; letter-spacing: -.025em; }
.login-card > p { margin: 7px 0 26px; color: var(--muted); }
.login-card form { display: grid; gap: 2px; }
.login-card .primary { margin-top: 3px; }
.auth-alert { position: fixed; z-index: 10; top: 36px; right: 36px; width: min(420px,calc(100% - 48px)); box-shadow: var(--shadow-md); }

/* Rich text, images and overlays */
.order-image, .rich img, .editor img { display: block; max-width: 100%; height: auto; margin: 10px 0; border-radius: 7px; cursor: zoom-in; }
.order-image.size-25 { width: 25%; }.order-image.size-50 { width: 50%; }.order-image.size-75 { width: 75%; }.order-image.size-100 { width: 100%; }
.editor .order-image.selected { outline: 3px solid #60a5fa; outline-offset: 2px; }
.image-uploading, .image-upload-error { display: inline-block; margin: 8px 0; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: 7px; background: var(--bg-input); color: var(--text-secondary); }
.image-upload-error { border-color: var(--danger); color: #ff9aa4; }
.image-lightbox { width: min(96vw,1400px); height: min(94vh,1000px); padding: 0; border: 0; border-radius: 12px; background: #070b13; overflow: hidden; }
.image-lightbox::backdrop { background: rgba(2,6,23,.86); }
.image-lightbox[open] { display: flex; flex-direction: column; }
.lightbox-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 8px 12px; background: var(--bg-sidebar); color: var(--text-primary); }
.lightbox-bar a { color: var(--text-primary); }
.lightbox-bar button { min-height: 34px; padding: 3px 10px; border-color: var(--border-strong); background: var(--bg-surface-raised); color: var(--text-primary); font-size: 22px; }
.image-lightbox > img { display: block; width: auto; max-width: 100%; height: auto; max-height: calc(94vh - 55px); margin: auto; object-fit: contain; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(360px,calc(100vw - 32px)); padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-surface-raised); color: var(--text-primary); box-shadow: var(--shadow-md); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.error { border-color: rgba(255,107,120,.35); color: #ff9aa4; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Confirmation modal */
.confirm-dialog { width: min(460px,calc(100vw - 32px)); max-width: none; padding: 0; border: 0; border-radius: 18px; overflow: visible; background: transparent; color: var(--text-primary); }
.confirm-dialog::backdrop { background: rgba(3,7,18,.78); backdrop-filter: blur(5px); }
.confirm-dialog[open] .confirm-modal { animation: confirm-modal-in .18s ease-out; }
.confirm-modal { position: relative; display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 16px; padding: 24px; border: 1px solid var(--border-strong); border-radius: 18px; overflow: hidden; background: var(--bg-surface-raised); box-shadow: 0 28px 80px rgba(0,0,0,.52); }
.confirm-modal::before { content: ""; position: absolute; top: -90px; left: -60px; width: 220px; height: 180px; border-radius: 50%; background: rgba(255,107,120,.1); filter: blur(10px); pointer-events: none; }
.confirm-modal-icon { position: relative; display: grid; place-items: center; width: 54px; height: 54px; border: 1px solid rgba(255,107,120,.28); border-radius: 15px; background: var(--danger-soft); color: var(--danger); }
.confirm-modal-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.confirm-modal-copy { position: relative; min-width: 0; }
.confirm-modal-copy .eyebrow { color: #ff929d; }
.confirm-modal-copy h2 { margin: 0; font-size: 21px; line-height: 1.3; }
.confirm-modal-copy p { margin: 7px 0 0; color: var(--text-secondary); line-height: 1.6; overflow-wrap: anywhere; }
.confirm-modal-warning { display: flex; grid-column: 1 / -1; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid rgba(242,184,75,.2); border-radius: 10px; background: var(--warning-soft); color: #f4c86a; font-size: 12px; }
.confirm-modal-warning > span:first-child { display: grid; flex: 0 0 auto; place-items: center; width: 20px; height: 20px; border: 1px solid rgba(242,184,75,.4); border-radius: 50%; font-weight: 800; }
.confirm-modal-actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 9px; margin-top: 2px; }
.confirm-delete-button { min-width: 104px; }
@keyframes confirm-modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .metric-grid.money-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid, .report-grid { grid-template-columns: 1fr; }
  .order-form-layout { grid-template-columns: 190px minmax(0,1fr); }
  .page-content { padding-inline: 24px; }
  .hide-laptop { display: none; }
}

.customer-form { max-width: 1040px; margin: 0 auto; padding: 26px; }
.customer-address-heading { margin-top: 24px; }
.customer-address-list, .address-cards { display: grid; gap: 12px; }
.customer-address-row { display: grid; grid-template-columns: 90px minmax(0,1fr) 110px; gap: 12px; align-items: center; }
.customer-address-row textarea { min-height: 74px; }
.address-card { position: relative; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.address-card.preferred { border-color: rgba(91,140,255,.45); background: var(--primary-soft); }
.address-card .badge { position: absolute; top: 10px; right: 10px; }
.address-card p { margin: 8px 0 0; white-space: pre-wrap; }
.customer-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 16px; }

.quick-address-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 12px 0; }
.quick-address-grid label { min-width: 0; }
.quick-address-grid textarea { min-height: 76px; }
.requirement-list { display: grid; gap: 16px; }
.requirement-row { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-input); }
.requirement-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.requirement-fields { display: grid; grid-template-columns: minmax(180px,2fr) minmax(120px,.65fr) minmax(150px,1fr) minmax(140px,1fr); gap: 12px; align-items: start; margin-bottom: 12px; }
.line-total-field { display: grid; min-width: 0; align-content: start; gap: 7px; padding-bottom: var(--field-feedback-height); color: var(--text-secondary); font-size: 13px; font-weight: 650; }
.line-total { display: flex; align-items: center; justify-content: flex-end; min-height: var(--control-height); padding: 9px 11px; border: 1px solid rgba(91,140,255,.28); border-radius: 9px; background: var(--primary-soft); color: var(--text-primary); font-weight: 750; white-space: nowrap; }
.editor.requirement-editor { min-height: 130px; max-height: 420px; overflow: auto; }
.editor-tools.compact { flex-wrap: wrap; }
.vat-payment-box { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
.vat-payment-box > .check { margin-bottom: 12px; }
.detail-requirements { width: 100%; box-shadow: none; }
.detail-requirements table { min-width: 760px; }
.detail-requirements th, .detail-requirements td { padding: 11px 12px; vertical-align: top; }
.detail-requirements .requirement-position { width: 54px; text-align: center; }
.detail-requirements .requirement-number { width: 82px; text-align: right; white-space: nowrap; }
.detail-requirements .requirement-money { width: 132px; text-align: right; white-space: nowrap; }
.requirement-content { min-width: 210px; }
.requirement-content .rich > :first-child { margin-top: 0; }
.requirement-content .rich > :last-child { margin-bottom: 0; }
.requirement-content .rich img { display: inline-block; width: 92px !important; height: 72px !important; margin: 3px 6px 3px 0; border: 1px solid var(--border); object-fit: cover; vertical-align: top; }

@media (max-width: 800px) {
  .customer-address-row, .requirement-fields { grid-template-columns: 1fr; }
  .quick-address-grid { grid-template-columns: 1fr; }
  .customer-metrics { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-summary { grid-template-columns: 48px minmax(0,1fr); }
  .profile-summary .role-badge { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 1040px) and (min-width: 901px) {
  .requirement-fields { grid-template-columns: minmax(180px,1.5fr) minmax(100px,.7fr); }
}

@media (max-width: 900px) {
  .sidebar { width: min(290px,86vw); transform: translateX(-105%); box-shadow: var(--shadow-md); transition: transform .22s ease; }
  .nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-grid; color: #cbd5e1; font-size: 24px; }
  .sidebar-overlay { position: fixed; z-index: 45; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(15,23,42,.55); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .nav-open .sidebar-overlay { display: block; opacity: 1; pointer-events: auto; }
  .app-frame { margin-left: 0; }
  .topbar { display: none; }
  .mobile-header { position: sticky; z-index: 35; top: 0; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; min-height: 62px; padding: 8px 16px; border-bottom: 1px solid var(--border); background: rgba(11,16,32,.92); color: var(--text); backdrop-filter: blur(12px); }
  .mobile-header .icon-button:hover { background: var(--bg-surface-hover); }
  .mobile-brand { display: flex; justify-self: center; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
  .mobile-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
  .mobile-brand strong { font-size: 14px; }
  .mobile-avatar { justify-self: end; width: 32px; height: 32px; }
  .page-content { padding: 24px 18px 48px; }
  .order-form-layout { display: block; }
  .form-rail { position: static; display: flex; margin-bottom: 12px; padding: 6px; overflow-x: auto; }
  .form-rail > span { display: none; }
  .form-rail a { flex: 0 0 auto; white-space: nowrap; }
  .detail-grid { grid-template-columns: 1fr; }
  .report-tables { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .page-head { align-items: stretch; margin-bottom: 20px; }
  .page-head h1 { font-size: 25px; }
  .page-actions .button-label-mobile-hide { display: none; }
  .metric-grid, .metric-grid.money-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-card { min-height: 116px; padding: 15px; }
  .metric-value { font-size: 25px; }
  .money-grid .metric-value { font-size: 17px; }
  .search-row { grid-template-columns: minmax(0,1fr) auto; }
  .search-row > .primary { grid-column: 1/-1; }
  .advanced-filters { grid-template-columns: 1fr 1fr; }
  .order-date-controls { grid-template-columns: 1fr 1fr; }
  .order-date-controls button { grid-column: 1 / -1; }
  .order-date-controls > button { margin-top: 0; }
  .filter-actions { grid-column: 1/-1; }
  .desktop-orders { display: none; }
  .mobile-list { display: grid; gap: 10px; }
  .order-card { padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--bg-surface); box-shadow: var(--shadow-sm); }
  .order-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .order-card-head a { color: var(--text); font-size: 15px; text-decoration: none; }
  .order-card h3 { margin: 10px 0 2px; font-size: 16px; }
  .order-card p { margin: 3px 0; color: var(--muted); font-size: 12px; }
  .order-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 13px 0; padding: 11px; border-radius: 9px; background: var(--bg-input); }
  .order-card-meta span { display: grid; color: var(--muted); font-size: 10px; text-transform: uppercase; }
  .order-card-meta strong { margin-top: 2px; color: var(--text); font-size: 12px; text-transform: none; }
  .order-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
  .order-card-actions .status-form { flex: 1; }
  .order-card-actions .status-form select { min-width: 0; }
  .responsive-data-table { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .responsive-data-table table, .responsive-data-table tbody { display: block; }
  .responsive-data-table thead { display: none; }
  .responsive-data-table tr { display: grid; gap: 11px; margin-bottom: 11px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--bg-surface); box-shadow: var(--shadow-sm); }
  .responsive-data-table td { display: grid; grid-template-columns: 92px minmax(0,1fr); align-items: center; gap: 10px; padding: 0; border: 0; }
  .responsive-data-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .responsive-data-table td.button-cell { display: flex; justify-content: flex-end; width: auto; padding-top: 5px; }
  .responsive-data-table td.button-cell::before { display: none; }
  .responsive-data-table .money-column { text-align: left; }
  .management-table input, .management-table select { min-width: 0; }
  .grid3 { grid-template-columns: 1fr; }
  .employee-create-form { grid-template-columns: 1fr; }
  .employee-create-actions { grid-column: auto; }
  .detail-hero { grid-template-columns: 1fr; padding: 17px; }
  .detail-hero .page-actions { justify-content: flex-start; }
  .file-upload { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; min-height: calc(100vh - 28px); }
  .auth-brand-panel { display: none; }
  .public { padding: 14px; }
  .auth-form-panel { padding: 28px 22px; }
  .login-card .mobile-login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 38px; }
  .auth-alert { top: 18px; right: 18px; }
}

@media (max-width: 520px) {
  .page-content { padding-inline: 14px; }
  .page-head { display: grid; gap: 14px; }
  .page-actions { justify-content: flex-start; }
  .page-actions .primary { flex: 1; }
  .metric-grid, .metric-grid.money-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 108px; }
  .metric-card:last-child:nth-child(odd) { grid-column: 1/-1; }
  .advanced-filters { grid-template-columns: 1fr; }
  .order-date-controls { grid-template-columns: 1fr; }
  .order-date-controls button { grid-column: auto; }
  .filter-actions { grid-column: auto; }
  .grid2 { grid-template-columns: 1fr; }
  .form-section { padding: 17px 15px; }
  .form-section-head > .button { width: 100%; margin-left: 0; }
  .form-actions { bottom: 8px; }
  .form-actions p { display: none; }
  .form-actions .primary { width: 100%; }
  .info-list { grid-template-columns: 1fr; }
  .info-list dt { padding: 11px 0 2px; border-bottom: 0; }
  .info-list dd { padding: 0 0 11px; }
  .status-update { grid-template-columns: 1fr; }
  .assignee-update { grid-template-columns: 1fr; }
  .payment-update { grid-template-columns: 1fr; }
  .payment-add-form { grid-template-columns: 1fr; }
  .assignee-update .field-hint { padding-bottom: 0; }
  .file-row { grid-template-columns: minmax(0,1fr) auto; }
  .file-row > small { display: none; }
  .report-filter { grid-template-columns: 1fr; }
  .report-filter > button, .order-date-controls > button { margin-top: 0; }
  .order-compact { grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
  .order-compact .badge { display: none; }
  .auth-form-panel { padding-inline: 18px; }
  .login-card h2 { font-size: 26px; }
  .image-lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
  .image-lightbox > img { max-height: calc(100vh - 55px); }
}

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