:root {
  --navy: #173451;
  --navy-2: #244b6f;
  --ink: #1b2a38;
  --muted: #67798a;
  --line: #d9e1e8;
  --soft: #f4f7fa;
  --soft-blue: #eaf1f7;
  --white: #ffffff;
  --green: #2f7d63;
  --red: #d9544d;
  --shadow: 0 10px 30px rgba(25, 54, 80, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { background: #eef2f6; }

body {
  margin: 0;
  min-width: 1000px;
  color: var(--ink);
  background: #f5f7fa;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.52; }

.auth-pending .app-shell,
.auth-pending .login-screen { visibility: hidden; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(430px, 0.92fr) minmax(520px, 1.08fr);
  background: white;
}
.login-panel { width: min(430px, calc(100% - 72px)); margin: auto; padding: 48px 0; }
.login-panel > img { width: 154px; display: block; margin-bottom: 44px; }
.login-panel h1 { margin: 8px 0 12px; color: var(--navy); font-size: 34px; letter-spacing: -0.8px; }
.login-intro { margin: 0 0 28px; color: var(--muted); line-height: 1.65; }
.login-panel form { display: grid; gap: 15px; }
.login-submit { width: 100%; min-height: 48px; margin-top: 4px; }
.login-panel > small { display: block; margin-top: 18px; color: var(--muted); line-height: 1.5; }
.login-brand-panel { position: relative; display: flex; align-items: flex-end; padding: 64px; overflow: hidden; color: white; background: #132d49 url("assets/keni-home-login-team.png") 82% center / cover no-repeat; }
.login-brand-panel::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9, 27, 44, 0.02) 30%, rgba(9, 27, 44, 0.42) 100%); }
.login-brand-panel > div { position: relative; max-width: 600px; }
.login-brand-panel span { font-size: 11px; font-weight: 800; letter-spacing: 2px; opacity: 0.78; }
.login-brand-panel h2 { margin: 18px 0; font-size: clamp(31px, 3.1vw, 50px); line-height: 1.12; letter-spacing: -1.5px; }
.login-brand-panel p { margin: 0; font-size: 14px; opacity: 0.76; }
.form-message { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; line-height: 1.45; }
.locked-message { padding: 10px 12px; border-radius: 7px; background: #fff1f0; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 25px 14px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  flex-direction: column;
}

.sidebar-logo-wrap { height: 112px; padding: 0 28px 22px; display: flex; align-items: center; }
.sidebar-logo { width: 108px; height: auto; display: block; }

.nav-list { display: grid; gap: 7px; }
.nav-item {
  width: 100%;
  height: 52px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #2d4357;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  text-align: left;
  transition: 160ms ease;
}
.nav-item:hover { background: var(--soft); color: var(--navy); }
.nav-item.active { background: var(--navy); color: white; box-shadow: 0 8px 22px rgba(23, 52, 81, 0.18); }
.nav-icon { width: 24px; font-size: 20px; line-height: 1; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 18px 10px 0;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--navy);
}
.sidebar-footer small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.status-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #43a77f; box-shadow: 0 0 0 4px #e5f5ee; }

.main-content { min-width: 0; padding: 0 28px 28px; }
.topbar { height: 105px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.topbar h1 { margin: 4px 0 0; color: var(--navy); font-size: 30px; line-height: 1; letter-spacing: -0.6px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.35px; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.search-box { width: 270px; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); }
.user-chip { height: 42px; padding: 0 12px 0 5px; border: 1px solid var(--line); border-radius: 22px; background: white; display: flex; align-items: center; gap: 8px; color: var(--navy); font-weight: 600; }
.avatar { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: white; }
.sign-out-button { height: 38px; padding: 0 11px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.sign-out-button:hover { color: var(--navy); }

.section-panel { display: block; }
.hidden { display: none !important; }

.company-card {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 1.25fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.company-card > div { min-width: 0; }
.company-brand { min-height: 116px; display: grid; place-items: center; border-right: 1px solid var(--line); }
.company-brand img { width: 150px; height: auto; }
.address-block { padding: 25px 28px 22px; border-right: 1px solid var(--line); }
.address-block:last-of-type { border-right: 0; }
.address-block h2 { margin: 0 0 11px; font-size: 13px; color: var(--navy); }
.address-block p { margin: 0; color: #526779; line-height: 1.55; font-size: 12.5px; }
.contact-row { grid-column: 1 / -1; display: flex; gap: 18px; padding: 12px 17px; border-top: 1px solid var(--line); background: linear-gradient(90deg, #fff, #fbfcfd); }
.select-with-icon { width: min(370px, 34vw); height: 43px; border: 1px solid #cfd9e2; border-radius: 7px; background: white; display: flex; align-items: center; padding-left: 12px; color: var(--navy); }
.field-icon { width: 26px; font-size: 18px; }
.select-with-icon select { flex: 1; height: 100%; border: 0; outline: 0; color: var(--navy); background: transparent; padding-right: 9px; }

.quick-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 14px 0; }
.quick-action { min-height: 76px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--navy); display: flex; align-items: center; gap: 12px; text-align: left; transition: 160ms ease; }
.quick-action span { width: 35px; height: 35px; border-radius: 7px; display: grid; place-items: center; background: var(--soft-blue); font-size: 21px; }
.quick-action strong { font-size: 12.5px; }
.quick-action:hover { transform: translateY(-1px); border-color: #b5c7d6; box-shadow: 0 7px 19px rgba(25, 54, 80, 0.08); }
.primary-quick { border-color: #c9d8e4; }

.quotation-layout { display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: 14px; align-items: start; }
.editor-card, .summary-card, .history-card, .empty-state { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.editor-card { padding: 20px; min-width: 0; }
.card-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.card-heading-row h2 { margin: 2px 0 0; font-size: 20px; color: var(--navy); }
.section-kicker { margin: 0; font-size: 10px; color: var(--muted); font-weight: 800; letter-spacing: 1.4px; }
.draft-badge { display: inline-flex; align-items: center; height: 27px; padding: 0 11px; border-radius: 14px; background: #eef3f7; color: var(--navy); font-weight: 700; font-size: 11px; }
.draft-badge.approved { color: #25664f; background: #e6f4ee; }

.fields-grid { display: grid; gap: 10px; }
.meta-grid { grid-template-columns: 1.22fr 1.25fr 1.17fr 0.86fr 0.86fr 1fr; }
.customer-grid { grid-template-columns: 1fr 1fr; margin-top: 13px; }
.field { min-width: 0; display: grid; gap: 6px; color: #415568; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #ced9e2; border-radius: 7px; background: white; color: var(--ink); outline: none; transition: 120ms ease; }
.field input, .field select { height: 39px; padding: 0 10px; }
.field textarea { resize: vertical; min-height: 61px; padding: 9px 10px; line-height: 1.35; }
.field input:focus, .field select:focus, .field textarea:focus, .table-input:focus { border-color: #7897b1; box-shadow: 0 0 0 3px rgba(82, 128, 165, 0.12); }

.items-heading { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.items-heading h2 { margin: 0; color: var(--navy); font-size: 16px; }
.items-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.items-table-wrap { margin-top: 12px; overflow-x: auto; }
.items-table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0 7px; table-layout: fixed; }
.items-table thead th { padding: 0 7px 3px; color: #526679; font-size: 10px; text-align: left; }
.items-table thead th:nth-child(1) { width: 8%; }
.items-table thead th:nth-child(2) { width: 18%; }
.items-table thead th:nth-child(3) { width: 29%; }
.items-table thead th:nth-child(4) { width: 12%; }
.items-table thead th:nth-child(5) { width: 9%; }
.items-table thead th:nth-child(6) { width: 16%; }
.items-table thead th:last-child { width: 8%; }
.item-row td { min-width: 0; padding: 0 6px; vertical-align: middle; }
.table-input { width: 100%; min-width: 0; max-width: 100%; height: 42px; border: 1px solid #cbd6df; border-radius: 6px; outline: 0; color: var(--ink); padding: 0 9px; background: white; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.numeric { appearance: textfield; -moz-appearance: textfield; }
.numeric::-webkit-inner-spin-button, .numeric::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.image-upload { position: relative; width: 52px; height: 44px; display: grid; place-items: center; border: 1px dashed #7c9ab3; border-radius: 7px; background: #f9fbfd; overflow: hidden; cursor: pointer; }
.image-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-placeholder { color: var(--navy-2); display: grid; place-items: center; line-height: 1; font-size: 17px; }
.image-placeholder small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.item-image-preview { width: 100%; height: 100%; object-fit: cover; display: none; }
.image-upload.has-image .item-image-preview { display: block; }
.image-upload.has-image .image-placeholder { display: none; }
.delete-row { width: 32px; height: 36px; border: 1px solid #f0b7b4; border-radius: 7px; background: #fff8f8; color: var(--red); font-size: 17px; }
.delete-row:hover { background: #fff0ef; border-color: #e9847e; }
.add-row-bar { display: flex; align-items: center; gap: 12px; padding-top: 6px; color: var(--muted); font-size: 11px; }
.terms-editor { display: grid; gap: 6px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.terms-editor-heading { color: var(--navy); font-size: 13px; font-weight: 800; }
.terms-editor small { color: var(--muted); font-size: 10px; }
.terms-editor textarea { width: 100%; min-height: 88px; resize: vertical; padding: 11px 12px; border: 1px solid #cbd6df; border-radius: 7px; outline: 0; color: var(--ink); background: #fff; line-height: 1.5; }
.terms-editor textarea:focus { border-color: #7897b1; box-shadow: 0 0 0 3px rgba(82, 128, 165, 0.12); }

.button { min-height: 40px; border-radius: 8px; padding: 0 16px; font-weight: 700; font-size: 12px; border: 1px solid transparent; transition: 150ms ease; }
.button.small { min-height: 35px; }
.button.secondary { color: var(--navy); border-color: #b9cad8; background: white; }
.button.secondary:hover { background: #f5f8fb; border-color: #8ba5bb; }
.button.primary { min-width: 155px; color: white; background: var(--navy); box-shadow: 0 8px 18px rgba(23, 52, 81, 0.17); }
.button.primary:hover { background: #214866; transform: translateY(-1px); }

.summary-card { position: sticky; top: 16px; padding: 19px 18px 18px; }
.summary-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 19px; color: var(--navy); font-weight: 800; }
.summary-title span:last-child { padding: 4px 7px; border-radius: 5px; background: var(--soft-blue); font-size: 10px; }
.include-total-toggle { margin-bottom: 14px; padding: 12px; border: 1px solid #cbd8e2; border-radius: 8px; background: #f7fafc; display: flex; align-items: flex-start; gap: 9px; color: var(--navy); cursor: pointer; }
.include-total-toggle input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--navy); }
.include-total-toggle span { display: grid; gap: 3px; }
.include-total-toggle strong { font-size: 12px; }
.include-total-toggle small { color: var(--muted); font-size: 9.5px; line-height: 1.35; }
.manual-total-field { display: grid; gap: 6px; padding-bottom: 13px; color: #415568; font-size: 10px; font-weight: 700; }
.manual-total-field input { width: 100%; height: 37px; border: 1px solid #ced9e2; border-radius: 6px; padding: 0 9px; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.manual-total-field input:disabled { color: #82909d; background: #f1f4f6; }
.summary-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.summary-row strong { color: var(--navy); font-variant-numeric: tabular-nums; }
.charge-row { padding: 12px 0; border-top: 1px solid #edf1f4; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.charge-row > label { display: flex; align-items: center; gap: 7px; color: var(--navy); font-weight: 700; }
.charge-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); }
.charge-controls { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 68px; gap: 6px; }
.charge-controls.single { grid-template-columns: 1fr; }
.charge-controls input, .charge-controls select { width: 100%; height: 34px; border: 1px solid #ced9e2; border-radius: 6px; padding: 0 8px; color: var(--ink); background: white; }
.charge-controls input:disabled, .charge-controls select:disabled { opacity: 0.5; background: #f3f5f7; }
.charge-row > strong { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 11px; }
.suffix { position: absolute; right: 26px; margin-top: 9px; color: var(--muted); pointer-events: none; }
.summary-divider { height: 1px; background: var(--line); margin: 8px 0 18px; }
.grand-total span { display: block; color: var(--navy); font-weight: 800; margin-bottom: 8px; }
.grand-total strong { display: block; color: var(--navy); font-size: 24px; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.calculation-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.summary-card.total-disabled .charge-row { opacity: 0.55; }

.action-bar { position: sticky; bottom: 0; z-index: 5; margin-top: 14px; min-height: 72px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.96); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: space-between; box-shadow: 0 -8px 25px rgba(25, 54, 80, 0.07); }
.save-state { color: var(--muted); font-size: 11px; }
.save-state.unsaved { color: #ad6b1f; }
.action-buttons { display: flex; gap: 10px; }

.dashboard-hero { min-height: 112px; padding: 24px 27px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(110deg, #fff 55%, #edf4f8); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.dashboard-hero h2, .orders-header h2, .order-attention-card h2 { margin: 3px 0 7px; color: var(--navy); font-size: 22px; }
.dashboard-hero p, .orders-header p { margin: 0; color: var(--muted); font-size: 12px; }
.order-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin: 14px 0; }
.order-stat-card { min-height: 112px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 13px; }
.stat-icon { width: 39px; height: 39px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.active-orders { color: #225980; background: #e7f0f7; }
.production-orders { color: #806224; background: #f7f0df; }
.ready-orders { color: #2f765d; background: #e6f3ed; }
.overdue-orders { color: #a44944; background: #f9e9e7; }
.order-stat-card small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.order-stat-card strong { display: block; margin: 4px 0 3px; color: var(--navy); font-size: 25px; line-height: 1; }
.order-stat-card p { margin: 0; color: #82909c; font-size: 9.5px; }
.dashboard-order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 275px; gap: 14px; }
.orders-card, .order-attention-card { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.orders-card { min-width: 0; padding: 22px; }
.orders-card .card-heading-row { margin-bottom: 13px; }
.order-attention-card { padding: 20px; }
.order-attention-card h2 { font-size: 17px; }
.attention-list { display: grid; gap: 9px; margin-top: 16px; }
.attention-item { padding: 11px; border: 1px solid #e1e7ec; border-radius: 8px; background: #fafbfd; }
.attention-item.overdue { border-color: #efc4c0; background: #fff8f7; }
.attention-item strong { display: block; color: var(--navy); font-size: 11.5px; }
.attention-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.attention-empty { padding: 25px 5px; color: var(--muted); text-align: center; font-size: 11px; }

.orders-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 17px; }
.order-toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid #e1e7ec; border-radius: 9px; background: #f7f9fb; }
.order-search { width: min(440px, 55%); height: 39px; padding: 0 11px; border: 1px solid #cfd9e2; border-radius: 7px; background: white; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.order-search input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; }
.order-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 700; }
.order-filter select { height: 39px; min-width: 175px; padding: 0 10px; border: 1px solid #cfd9e2; border-radius: 7px; color: var(--navy); background: white; }
.orders-table-wrap { overflow-x: auto; }
.orders-table { width: 100%; min-width: 980px; margin-top: 12px; border-collapse: collapse; table-layout: fixed; }
.orders-table th { padding: 10px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9.5px; text-align: left; }
.orders-table td { padding: 13px 9px; border-bottom: 1px solid #e7ecf0; color: #42586b; font-size: 10.5px; vertical-align: middle; }
.orders-table tbody tr:hover td { background: #fafcfd; }
.orders-table strong { color: var(--navy); }
.order-subtext { display: block; margin-top: 3px; color: #81909d; font-size: 9px; }
.country-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 27px; padding: 0 8px; border: 1px solid #dbe4eb; border-radius: 14px; background: #f6f9fb; white-space: nowrap; }
.country-flag { font-size: 16px; line-height: 1; }
.country-chip strong { max-width: 95px; overflow: hidden; text-overflow: ellipsis; font-size: 9.5px; letter-spacing: 0.04em; }
.status-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 12px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.status-order-confirmed { color: #315c7e; background: #e7f0f7; }
.status-in-production { color: #7c622c; background: #f7f0df; }
.status-quality-check { color: #6f4c83; background: #f0e8f4; }
.status-ready-to-ship { color: #2e7058; background: #e4f2eb; }
.status-shipped { color: #316c84; background: #e6f1f5; }
.status-delivered { color: #37644f; background: #e4efe9; }
.progress-cell { min-width: 100px; }
.progress-track { width: 100%; height: 6px; border-radius: 4px; background: #e7edf1; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--navy-2); }
.progress-label { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; text-align: right; }
.order-row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.order-row-actions button { height: 29px; padding: 0 8px; border: 1px solid #cdd8e1; border-radius: 6px; background: white; color: var(--navy); font-size: 9px; }
.order-row-actions .order-delete { color: var(--red); border-color: #efc2bf; background: #fffafa; }
.orders-empty { padding: 48px 20px !important; color: var(--muted) !important; text-align: center; }
.compact-orders-table { min-width: 720px; }
.compact-orders-table th:nth-child(1) { width: 16%; }
.compact-orders-table th:nth-child(2) { width: 20%; }
.compact-orders-table th:nth-child(3) { width: 10%; }
.compact-orders-table th:nth-child(4) { width: 16%; }
.compact-orders-table th:nth-child(5) { width: 18%; }
.compact-orders-table th:nth-child(6) { width: 15%; }

.order-dialog { width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 50px); padding: 0; border: 0; border-radius: 13px; color: var(--ink); box-shadow: 0 25px 80px rgba(11, 31, 48, 0.32); }
.order-dialog::backdrop { background: rgba(17, 34, 49, 0.45); backdrop-filter: blur(3px); }
.order-dialog form { padding: 24px; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.dialog-header h2 { margin: 3px 0 0; color: var(--navy); font-size: 22px; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--muted); font-size: 21px; }
.order-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.order-notes-field { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.password-dialog { width: min(520px, calc(100vw - 40px)); }
.password-policy { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.security-policy-banner { display: flex; gap: 14px; align-items: center; margin: 0 22px 16px; padding: 13px 15px; border: 1px solid #cbdce9; border-radius: 8px; color: #365c79; background: #edf5fa; font-size: 11px; }
.security-policy-banner strong { color: var(--navy); white-space: nowrap; }
.inline-role-select { min-width: 122px; height: 32px; border: 1px solid var(--line); border-radius: 6px; color: var(--navy); background: white; }
.employee-status { display: inline-flex; min-height: 24px; align-items: center; padding: 0 9px; border-radius: 12px; font-size: 9px; font-weight: 800; }
.employee-active { color: #28664f; background: #e4f2eb; }
.employee-locked { color: #9a3d36; background: #fbe9e7; }
.employee-inactive { color: #67798a; background: #edf1f4; }
.employee-actions { display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.employee-actions button { min-height: 29px; padding: 0 8px; border: 1px solid #cdd8e1; border-radius: 6px; background: white; color: var(--navy); font-size: 9px; }
.employee-table { min-width: 900px; }
.customer-table { min-width: 900px; }

.history-card { padding: 24px; }
.history-list { display: grid; gap: 10px; }
.history-item { border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; }
.history-item h3 { margin: 0 0 4px; color: var(--navy); font-size: 14px; }
.history-item p { margin: 0; color: var(--muted); font-size: 11px; }
.history-total { color: var(--navy); font-weight: 800; }
.history-actions { display: flex; gap: 6px; }
.history-actions button { height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--navy); }
.history-empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state { min-height: 500px; display: grid; place-items: center; text-align: center; padding: 40px; }
.empty-state h2 { color: var(--navy); margin: 0 0 8px; }
.empty-state p { color: var(--muted); margin: 0; max-width: 450px; line-height: 1.6; }

.toast { position: fixed; right: 26px; bottom: 26px; z-index: 50; min-width: 240px; max-width: 390px; padding: 13px 16px; border-radius: 8px; background: var(--navy); color: white; box-shadow: 0 12px 35px rgba(10, 31, 49, 0.28); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.print-sheet { display: none; }

@media (max-width: 1320px) {
  .main-content { padding-left: 20px; padding-right: 20px; }
  .company-card { grid-template-columns: 0.9fr 1.3fr 1.15fr; }
  .company-brand img { width: 130px; }
  .quick-action { padding: 11px 12px; }
  .quick-action strong { font-size: 11.5px; }
  .meta-grid { grid-template-columns: repeat(3, 1fr); }
  .order-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-order-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
  body:has(.login-screen:not(.hidden)) { min-width: 0; }
  .login-screen { grid-template-columns: 1fr; grid-template-rows: 250px auto; }
  .login-brand-panel { grid-row: 1; display: flex; min-height: 250px; padding: 26px 32px; background-position: 82% 43%; }
  .login-brand-panel h2 { max-width: 520px; margin: 9px 0; font-size: 25px; letter-spacing: -0.6px; }
  .login-brand-panel p { font-size: 11px; }
  .login-panel { grid-row: 2; width: min(430px, calc(100% - 42px)); padding: 34px 0 42px; }
  .login-panel > img { width: 116px; margin-bottom: 27px; }
}

@page { size: A4 portrait; margin: 0; }

@media print {
  body { min-width: 0; background: white; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .app-shell, .login-screen, .toast, .order-dialog { display: none !important; }
  .print-sheet {
    display: block;
    width: 210mm;
    min-height: 297mm;
    padding: 14mm 14mm 10mm;
    color: #172432;
    background: white;
    font-family: Arial, Helvetica, sans-serif;
  }
  .print-header { height: 31mm; display: flex; align-items: flex-start; justify-content: space-between; }
  .print-header img { width: 34mm; height: auto; }
  .print-header > div { text-align: right; }
  .print-header h1 { margin: 0; color: #173451; font-size: 24pt; font-weight: 600; }
  .print-header p { margin: 3mm 0 1mm; color: #5d6f7f; font-size: 8pt; }
  .print-header strong { color: #2f7d63; font-size: 7pt; }
  .print-rule { height: 0.6mm; background: #173451; margin-bottom: 5mm; }
  .print-addresses, .print-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
  .print-addresses > div, .print-parties > div { border: 0.3mm solid #d8e1e8; border-radius: 2mm; padding: 4mm; }
  .print-addresses > div { min-height: 27mm; background: #f4f7fa; }
  .print-parties > div { min-height: 28mm; }
  .print-addresses h2, .print-parties h2, .print-terms h2 { margin: 0 0 3mm; color: #173451; font-size: 9pt; }
  .print-addresses p, .print-parties p { margin: 0; color: #5c6e7e; font-size: 7.5pt; line-height: 1.42; white-space: pre-line; }
  .print-contact { height: 12mm; display: flex; align-items: center; gap: 32mm; padding: 0 2mm; color: #1b2a38; font-size: 8pt; }
  .print-contact b { color: #173451; margin-right: 4mm; }
  .print-meta { display: grid; grid-template-columns: 1.25fr 1fr 1fr 0.7fr 0.75fr 0.8fr; gap: 2mm; margin-bottom: 5mm; padding: 3.5mm 4mm; border: 0.3mm solid #e0e7ed; border-radius: 2mm; background: #f4f7fa; }
  .print-meta div small { display: block; color: #647789; font-size: 6pt; text-transform: uppercase; }
  .print-meta div strong { display: block; margin-top: 1.2mm; color: #173451; font-size: 8pt; }
  .print-parties { margin-bottom: 6mm; }
  .print-items { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 7.4pt; }
  .print-items th { padding: 3.5mm 2mm; color: white; background: #173451; font-size: 6.8pt; text-align: left; }
  .print-items th:nth-child(1) { width: 7%; }
  .print-items th:nth-child(2) { width: 21%; }
  .print-items th:nth-child(3) { width: 34%; }
  .print-items th:nth-child(4) { width: 12%; }
  .print-items th:nth-child(5) { width: 11%; text-align: right; }
  .print-items th:nth-child(6) { width: 15%; text-align: right; }
  .print-items td { padding: 4mm 2mm; border-bottom: 0.25mm solid #d8e1e8; vertical-align: top; }
  .print-items tr:nth-child(even) td { background: #f6f8fa; }
  .print-items td:nth-child(n+5) { text-align: right; }
  .print-bottom { display: grid; grid-template-columns: 1.45fr 0.95fr; gap: 5mm; margin-top: 6mm; break-inside: avoid; }
  .print-terms, .print-summary { min-height: 33mm; padding: 4mm; border: 0.3mm solid #d8e1e8; border-radius: 2mm; }
  .print-terms { background: #f4f7fa; }
  .print-terms p { margin: 1.6mm 0; color: #5c6e7e; font-size: 7.5pt; }
  .print-custom-terms { margin-top: 3mm !important; padding-top: 2.5mm; border-top: 0.25mm solid #d4dee6; white-space: pre-line; line-height: 1.45; }
  .print-custom-terms:empty { display: none; }
  .print-summary-row { display: flex; justify-content: space-between; margin-bottom: 2mm; color: #526677; font-size: 7.5pt; }
  .print-summary-row.grand { margin-top: 3mm; padding-top: 3mm; border-top: 0.3mm solid #ccd7df; color: #173451; font-weight: 800; font-size: 11pt; }
  .print-footer { position: fixed; left: 14mm; right: 14mm; bottom: 9mm; padding-top: 3mm; border-top: 0.5mm solid #173451; display: flex; justify-content: space-between; align-items: flex-end; color: #637586; font-size: 6.5pt; }
  .print-footer strong { color: #173451; font-size: 7.5pt; }
  .print-sheet.no-total .print-bottom { grid-template-columns: 1fr; }
  .print-sheet.no-total .print-summary { display: none; }
}
