:root {
  --ink: #17212b;
  --muted: #68727d;
  --line: #dfe4e8;
  --paper: #f5f4f1;
  --white: #ffffff;
  --navy: #17324d;
  --navy-2: #244b6d;
  --denim: #37688f;
  --cream: #ebe6dc;
  --amber: #bc7422;
  --red: #b73b3b;
  --green: #277553;
  --shadow: 0 16px 45px rgba(23, 50, 77, .10);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, .95fr);
  background: var(--white);
}
.login-brand {
  position: relative;
  overflow: hidden;
  padding: clamp(40px, 8vw, 110px);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(23,50,77,.96), rgba(36,75,109,.91)),
    radial-gradient(circle at 20% 20%, #7297b4, transparent 48%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  right: -150px;
  bottom: -170px;
  box-shadow: 0 0 0 70px rgba(255,255,255,.035), 0 0 0 140px rgba(255,255,255,.025);
}
.brand-pair { position: relative; z-index: 1; }
.brand-wordmarks {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  letter-spacing: .12em;
}
.brand-wordmarks .x { opacity: .48; font: 400 1rem Inter, sans-serif; }
.brand-title { margin: 52px 0 14px; font-size: clamp(2.7rem, 5vw, 5.2rem); line-height: .98; max-width: 720px; letter-spacing: -.045em; }
.brand-copy { max-width: 580px; font-size: 1.12rem; line-height: 1.65; color: rgba(255,255,255,.75); }
.brand-foot { position: relative; z-index: 1; color: rgba(255,255,255,.62); font-size: .9rem; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(430px, 100%); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; font-weight: 800; color: var(--denim); }
.login-card h2 { margin: 10px 0 8px; font-size: 2rem; letter-spacing: -.03em; }
.login-card > p { margin: 0 0 32px; color: var(--muted); line-height: 1.55; }
.login-card .login-alert { color: #9f2828; background: #fff1f1; border: 1px solid #efc3c3; border-radius: 10px; padding: 10px 12px; }
.demo-note { margin-top: 18px; padding: 14px 16px; background: #eff4f7; border: 1px solid #d8e3ea; color: #466277; border-radius: 12px; font-size: .88rem; line-height: 1.5; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: .88rem; font-weight: 720; color: #34414e; }
.field small { color: var(--muted); line-height: 1.4; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #ccd4da;
  background: var(--white);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 44px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--denim); box-shadow: 0 0 0 3px rgba(55,104,143,.13); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.btn {
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 10px 15px;
  font-weight: 760;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .14s, opacity .14s, background .14s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-secondary { background: #e8edf1; color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-danger { background: #f7e8e8; color: var(--red); }
.btn-wide { width: 100%; }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: .84rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  color: #fff;
  background: var(--navy);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.side-brand { padding: 0 12px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand strong { display: block; font-family: Georgia, serif; letter-spacing: .11em; font-size: .92rem; }
.side-brand span { display: block; margin-top: 6px; font-size: 1.12rem; font-weight: 760; }
.nav { display: grid; gap: 5px; padding: 22px 0; }
.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.7);
  padding: 11px 12px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  font-weight: 650;
}
.nav button:hover, .nav button.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-icon { width: 21px; text-align: center; opacity: .9; }
.sidebar-user { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user strong { display: block; }
.sidebar-user small { display: block; color: rgba(255,255,255,.58); margin: 4px 0 12px; }
.sidebar-user button { border: 0; background: transparent; color: rgba(255,255,255,.78); padding: 0; }

.main { min-width: 0; }
.topbar {
  min-height: 74px;
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(20px, 3vw, 42px);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}
.topbar h1 { margin: 0; font-size: 1.35rem; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; min-width: 42px; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; display: grid; place-items: center; }
.content { padding: 30px clamp(20px, 3vw, 42px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-head h2 { margin: 0 0 5px; font-size: 1.65rem; letter-spacing: -.03em; }
.page-head p { margin: 0; color: var(--muted); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 24px; }
.metric { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 8px 25px rgba(23,50,77,.04); }
.metric-label { color: var(--muted); font-size: .86rem; font-weight: 650; }
.metric-value { margin-top: 8px; font-size: 2rem; font-weight: 820; letter-spacing: -.04em; }
.metric-note { margin-top: 5px; color: var(--muted); font-size: .78rem; }
.metric.urgent { border-top: 3px solid var(--red); }
.metric.analysis { border-top: 3px solid var(--denim); }
.metric.delivery { border-top: 3px solid var(--amber); }
.metric.done { border-top: 3px solid var(--green); }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 25px rgba(23,50,77,.035); }
.card-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: 1.05rem; }
.card-body { padding: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters input, .filters select { min-height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid #edf0f2; vertical-align: middle; font-size: .9rem; }
tbody tr:hover { background: #fafbfb; }
.row-new td:first-child { box-shadow: inset 3px 0 var(--denim); }
.product-name { font-weight: 760; }
.meta { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: .75rem; font-weight: 760; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-blue { background: #e8f0f6; color: #2c6289; }
.badge-amber { background: #f8efe2; color: #99601e; }
.badge-green { background: #e7f3ed; color: #226a4b; }
.badge-red { background: #f7e8e8; color: #a83535; }
.badge-gray { background: #edf0f2; color: #5f6871; }
.priority { font-weight: 780; }
.priority.urgent { color: var(--red); }
.priority.normal { color: var(--navy); }
.priority.low { color: var(--muted); }

.empty { padding: 58px 24px; text-align: center; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: #eef2f4; color: var(--navy); margin: 0 auto 15px; font-size: 1.55rem; }
.empty h3 { color: var(--ink); margin: 0 0 7px; }
.empty p { max-width: 480px; margin: 0 auto 18px; line-height: 1.55; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(12,23,34,.58); padding: 24px; display: grid; place-items: center; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--white); border-radius: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.26); }
.modal-lg { width: min(980px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 19px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.modal-head h3 { margin: 0; }
.modal-close { border: 0; background: #edf0f2; width: 36px; height: 36px; border-radius: 9px; font-size: 1.2rem; }
.modal-body { padding: 22px; }
.modal-actions { padding: 16px 22px 22px; display: flex; justify-content: flex-end; gap: 10px; }
.section-title { font-size: .83rem; text-transform: uppercase; letter-spacing: .08em; color: var(--denim); font-weight: 820; margin: 20px 0 12px; }
.section-title:first-child { margin-top: 0; }
.info-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.info-box { padding: 13px 14px; background: #f7f8f8; border: 1px solid #e7eaec; border-radius: 10px; }
.info-box small { display: block; color: var(--muted); margin-bottom: 5px; }
.info-box strong { display: block; line-height: 1.4; }
.timeline { display: grid; gap: 10px; }
.timeline-item { display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; }
.timeline-dot { margin-top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--denim); }
.timeline-item p { margin: 0; line-height: 1.5; }
.timeline-item small { color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { padding: 18px; border: 1px solid var(--line); background: #fff; border-radius: 12px; text-align: left; }
.choice:hover { border-color: var(--denim); background: #f7fafc; }
.choice strong { display: block; margin-bottom: 6px; }
.choice span { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0f2; }
.stat-line:last-child { border-bottom: 0; }
.money-positive { color: var(--green); font-weight: 800; }

.toast { position: fixed; z-index: 300; bottom: 24px; right: 24px; max-width: 360px; background: #17212b; color: #fff; padding: 13px 16px; border-radius: 11px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-menu { display: none; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .field-row.three, .info-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 320px; padding: 38px 28px; }
  .brand-title { margin-top: 35px; }
  .brand-foot { display: none; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 80; inset: 0 auto 0 0; width: 265px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 22px 16px 50px; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .metric-grid, .field-row, .field-row.three, .info-grid, .choice-grid { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; flex-direction: column; }
  .topbar-actions .btn-primary span { display: none; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); border-radius: 14px; }
}
#print-sheet {display:none}
.print-options {width:min(620px,94vw);max-height:88vh;overflow:auto;border:1px solid #ccd4da;border-radius:16px;padding:22px;color:#17212b}
.print-options::backdrop {background:#17212ba8}
.print-options fieldset {margin:16px 0;border:1px solid #dfe4e8;border-radius:8px;padding:12px}
.print-options label {display:inline-flex;align-items:center;gap:5px;margin:5px 14px 5px 0}
.print-options footer {position:sticky;bottom:0;background:white;padding:8px}
@page {size:A4;margin:15mm}
@media print {
  body:has(#print-sheet)>:not(#print-sheet) {display:none!important}
  body {background:white}
  #print-sheet {display:block;font-size:10pt}
  #print-sheet header {border-bottom:2px solid #17324d;padding-bottom:8pt}
  #print-sheet article {border-bottom:1px solid #999;padding:8pt 0}
  #print-sheet h3 {break-after:avoid;margin:8pt 0 4pt}
  #print-sheet dl {margin:0}
  #print-sheet dl div {display:grid;grid-template-columns:36% 1fr;gap:10pt;border-bottom:0.5pt solid #ddd;padding:3pt;break-inside:avoid}
  #print-sheet dd {margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
}
