:root {
  --ink: #252525;
  --ink-soft: #60605d;
  --deep: #222b2d;
  --deep-2: #344143;
  --ivory: #f5f2ec;
  --paper: #fffdf9;
  --line: #e7e2d9;
  --champagne: #b18a55;
  --champagne-light: #efe3cf;
  --sage: #61766d;
  --sage-light: #e4ede8;
  --rose: #9b6261;
  --rose-light: #f3e6e2;
  --amber: #a97832;
  --amber-light: #f7ecd9;
  --shadow: 0 16px 45px rgba(48, 42, 34, .06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ivory); color: var(--ink); font-family: "DM Sans", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; background: var(--deep); color: #fff; padding: 28px 17px 20px; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { display: block; padding: 0 8px 46px; text-align: center; }
.brand-logo { display: block; width: 174px; height: auto; margin: 0 auto 7px; filter: invert(1); }
.brand small { display: block; color: #aeb9b7; font-size: 10px; letter-spacing: .7px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item { position: relative; border: 0; background: transparent; color: #aeb9b7; text-align: left; padding: 13px 15px; border-radius: 6px; font-size: 12px; letter-spacing: .2px; display: flex; align-items: center; gap: 13px; transition: .2s ease; }
.nav-item span { color: #d0a667; width: 18px; font-size: 17px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #f7f3eb; color: var(--deep); box-shadow: 0 8px 18px rgba(0,0,0,.12); }
.nav-item.active span { color: var(--champagne); }
.sidebar-footer { margin-top: auto; padding: 17px 12px 0; color: #e9edea; font-size: 11px; line-height: 1.8; border-top: 1px solid rgba(255,255,255,.13); }
.sidebar-footer small { color: #94a39f; font-size: 10px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7bb795; margin-right: 7px; }
.signout-button { display: block; margin-top: 8px; padding: 0; border: 0; color: #aeb9b7; background: none; font-size: 10px; text-decoration: underline; }
.signout-button:hover { color: #fff; }

.main-content { width: 100%; max-width: 1640px; padding: 34px 54px 52px; }
.topbar, .welcome-row, .section-intro, .panel-heading, .table-meta { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar { margin-bottom: 34px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.top-signout-button { color: var(--rose); border-color: #e7d3cf; }
.top-signout-button:hover { color: #fff; border-color: var(--rose); background: var(--rose); }
.eyebrow { margin: 0 0 8px; color: var(--champagne); text-transform: uppercase; letter-spacing: 2px; font-size: 9px; font-weight: 700; }
.topbar h1 { margin: 0; color: var(--deep); font: 600 30px/1.1 "Playfair Display", Georgia, serif; letter-spacing: -.3px; }
.welcome-row { position: relative; overflow: hidden; min-height: 155px; margin-bottom: 20px; padding: 29px 32px; border-radius: 13px; background: linear-gradient(115deg, #273335, #3b4a4b); box-shadow: var(--shadow); }
.welcome-row::after { position: absolute; content: ""; width: 270px; height: 270px; right: -70px; top: -110px; border: 1px solid rgba(222, 192, 143, .22); border-radius: 50%; box-shadow: 0 0 0 28px rgba(222, 192, 143, .05), 0 0 0 57px rgba(222, 192, 143, .04); }
.welcome-row > * { position: relative; z-index: 1; }
.welcome-row h2 { margin: 0 0 7px; color: #fff; font: 600 29px/1 "Playfair Display", Georgia, serif; }
.welcome-row p { margin: 0; color: #c6d0cd; font-size: 12px; }
.gold { color: #d7b477; }
.date-pill { padding: 10px 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 5px; color: #e0e7e3; background: rgba(255,255,255,.07); font-size: 11px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 20px; }
.metric-card { display: flex; align-items: center; gap: 14px; padding: 18px 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 5px 15px rgba(56, 48, 38, .025); }
.metric-icon { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 700; }
.metric-icon.navy { color: var(--deep); background: #e7ecec; }
.metric-icon.green { color: var(--sage); background: var(--sage-light); }
.metric-icon.amber { color: var(--amber); background: var(--amber-light); }
.metric-icon.rose { color: var(--rose); background: var(--rose-light); }
.metric-card span, .metric-card small { display: block; color: var(--ink-soft); font-size: 10px; }
.metric-card strong { display: block; margin: 2px 0 1px; color: var(--deep); font-size: 25px; line-height: 1.15; font-weight: 600; }
.metric-card small { color: #9b9a95; font-size: 9px; }

.dashboard-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 17px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 5px 18px rgba(56,48,38,.025); }
.panel-heading { margin-bottom: 18px; }
.panel-heading h3 { margin: 0 0 5px; color: var(--deep); font-size: 14px; font-weight: 700; }
.panel-heading p { margin: 0; color: #989791; font-size: 10px; }
.text-button, .small-button { border: 0; background: none; color: var(--champagne); font-size: 10px; font-weight: 600; }
.text-button:hover, .small-button:hover { color: #866334; }
.low-stock-list, .movement-list { display: grid; gap: 8px; }
.stock-row, .movement-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid #eeeae3; border-radius: 7px; background: #fffefa; }
.stock-row strong, .movement-row strong { display: block; color: var(--deep); font-size: 11px; font-weight: 700; }
.stock-row small, .movement-row small { display: block; margin-top: 3px; color: #9b9a95; font-size: 9px; }
.stock-number { color: var(--amber); font-size: 11px; font-weight: 700; white-space: nowrap; }
.movement-row { justify-content: flex-start; }
.movement-row > div:nth-child(2) { flex: 1; min-width: 0; }
.movement-sign { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.movement-sign.add { color: var(--sage); background: var(--sage-light); }
.movement-sign.remove { color: var(--rose); background: var(--rose-light); }
.movement-amount { color: var(--deep); font-size: 11px; font-weight: 700; }

.view { display: none; }
.active-view { display: block; }
.section-intro { align-items: flex-start; margin-bottom: 24px; }
.section-intro h2 { margin: 0 0 6px; color: var(--deep); font: 600 27px/1 "Playfair Display", Georgia, serif; }
.section-intro p { margin: 0; color: #898984; font-size: 11px; }
.metrics-actions { display: flex; align-items: center; gap: 8px; }
.metrics-actions select { padding: 10px 11px; border: 1px solid var(--line); border-radius: 5px; color: #6f716d; background: var(--paper); font-size: 11px; outline: 0; }
.metrics-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; margin-bottom: 17px; }
.analytics-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 17px; margin-bottom: 17px; }
.chart-panel { min-width: 0; }
.chart-wrap { width: 100%; min-height: 300px; }
#stock-chart { display: block; width: 100%; height: 300px; }
.chart-legend { color: #999791; font-size: 10px; }
.chart-legend i { display: inline-block; width: 15px; height: 3px; margin-right: 5px; vertical-align: middle; border-radius: 3px; background: var(--champagne); }
.ranking-list { display: grid; gap: 7px; }
.ranking-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid #f0ede8; }
.ranking-row:last-child { border-bottom: 0; }
.ranking-number { color: #b6b2aa; font-size: 10px; font-weight: 700; }
.ranking-label { flex: 1; min-width: 0; }
.ranking-label strong { display: block; overflow: hidden; color: var(--deep); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-label small { display: block; margin-top: 3px; color: #9b9a95; font-size: 9px; }
.ranking-value { color: var(--champagne); font-size: 12px; font-weight: 700; }
.ranking-value small { color: #9b9a95; font-size: 8px; font-weight: 400; }
.seasonal-panel { margin-bottom: 17px; }
.reports-panel { margin-bottom: 17px; }
.report-list { display: grid; gap: 8px; }
.report-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 13px; border: 1px solid #eeeae3; border-radius: 7px; background: #fffefa; }
.report-row strong { display: block; color: var(--deep); font-size: 11px; }
.report-row small { display: block; margin-top: 4px; color: #9b9a95; font-size: 9px; }
.report-row .small-button { flex-shrink: 0; }
.session-modal { text-align: center; }
.session-symbol { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 17px; border-radius: 50%; color: var(--amber); background: var(--amber-light); font-size: 20px; }
.session-modal .modal-heading { margin-bottom: 12px; }
.session-countdown { margin: 0; color: #8c8b84; font-size: 11px; }
.session-countdown strong { color: var(--rose); font-variant-numeric: tabular-nums; }
.session-modal .modal-actions { justify-content: center; }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.search-box { display: flex; align-items: center; flex: 1; min-width: 250px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.search-box span { margin-right: 8px; color: var(--champagne); font-size: 21px; }
.search-box input { width: 100%; padding: 11px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.toolbar select { min-width: 145px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; color: #6f716d; background: var(--paper); font-size: 11px; outline: 0; }
.toolbar select:focus, input:focus, textarea:focus { border-color: var(--champagne); box-shadow: 0 0 0 3px rgba(177,138,85,.12); }
.table-panel { padding: 18px 20px 13px; }
.table-meta { justify-content: flex-start; margin-bottom: 11px; color: #999791; font-size: 10px; }
.table-meta .small-button { margin-left: auto; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 10px 9px; border-bottom: 1px solid var(--line); color: #a29f98; text-align: left; text-transform: uppercase; letter-spacing: 1px; font-size: 8px; font-weight: 700; }
td { padding: 13px 9px; border-bottom: 1px solid #f0ede8; color: #686b67; font-size: 10px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fffcf5; }
td:first-child { color: var(--deep); font-size: 11px; font-weight: 700; }
td small { color: #9a9994; font-size: 9px; }
.stock-badge { display: inline-block; padding: 4px 8px; border-radius: 20px; font-size: 9px; font-weight: 700; }
.stock-badge.ok { color: var(--sage); background: var(--sage-light); }
.stock-badge.low { color: var(--amber); background: var(--amber-light); }
.stock-badge.empty { color: var(--rose); background: var(--rose-light); }
.row-actions { display: flex; gap: 5px; }
.icon-button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--deep); background: var(--paper); font-size: 11px; }
.icon-button:hover { border-color: #ccb58d; color: var(--champagne); background: #fffaf0; }

.primary-button, .secondary-button { padding: 10px 15px; border-radius: 5px; font-size: 11px; font-weight: 600; transition: .2s ease; }
.primary-button { border: 1px solid var(--deep); color: #fff; background: var(--deep); }
.primary-button:hover { border-color: #435254; background: #435254; }
.primary-button:disabled { cursor: wait; opacity: .7; }
.secondary-button { border: 1px solid var(--line); color: var(--deep); background: var(--paper); }
.secondary-button:hover { border-color: #cdb68f; background: #fffaf1; }

.modal-backdrop { display: none; position: fixed; inset: 0; z-index: 5; align-items: center; justify-content: center; padding: 20px; background: rgba(27,35,36,.57); }
.modal-backdrop.open { display: flex; }
.modal { position: relative; width: min(680px,100%); padding: 31px; border: 1px solid rgba(255,255,255,.25); border-radius: 11px; background: var(--paper); box-shadow: 0 25px 80px rgba(22,28,29,.25); }
.modal.compact { width: min(470px,100%); }
.close-button { position: absolute; top: 13px; right: 17px; border: 0; color: #9b9991; background: none; font-size: 24px; }
.close-button:hover { color: var(--deep); }
.modal-heading { margin-bottom: 22px; }
.modal-heading h2 { margin: 0 0 7px; color: var(--deep); font: 600 24px/1 "Playfair Display", Georgia, serif; }
.modal-heading > p:last-child { margin: 0; color: #8c8b84; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: #70736d; font-size: 10px; font-weight: 700; }
input, select, textarea { padding: 10px 11px; border: 1px solid #e1ddd5; border-radius: 5px; outline: 0; color: var(--ink); background: #fffefa; font-size: 11px; }
textarea { resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 25px; }
.adjust-type { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 17px; }
.adjust-choice { padding: 10px; border: 1px solid var(--line); border-radius: 5px; color: #88877f; background: var(--paper); font-size: 11px; }
.adjust-choice.selected { border-color: #b7d1c3; color: var(--sage); background: var(--sage-light); font-weight: 700; }
.compact form { display: grid; gap: 14px; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 10; padding: 12px 16px; border-radius: 6px; color: #fff; background: var(--deep); font-size: 11px; opacity: 0; transform: translateY(8px); transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.empty-state { padding: 28px 10px; color: #999791; text-align: center; font-size: 11px; }
.danger-text { color: var(--rose); }
[hidden] { display: none !important; }
.auth-gate { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, rgba(34,43,45,.96), rgba(49,61,62,.96)); }
.auth-card { width: min(390px,100%); padding: 37px 35px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; color: var(--ink); background: var(--paper); box-shadow: 0 28px 90px rgba(0,0,0,.25); }
.auth-logo { display: block; width: min(245px, 100%); height: auto; margin: 0 auto 23px; }
.auth-card h2 { margin: 0 0 8px; color: var(--deep); font: 600 28px/1 "Playfair Display", Georgia, serif; }
.auth-copy { margin: 0 0 24px; color: #8c8b84; font-size: 11px; line-height: 1.6; }
.auth-card form { display: grid; gap: 15px; }
.auth-card form .primary-button { margin-top: 5px; }
.auth-error { min-height: 15px; margin: 0; color: var(--rose); font-size: 10px; }

@media (max-width: 950px) { .sidebar { width: 205px; } .main-content { padding: 28px 27px 45px; } .metric-grid, .metrics-summary { grid-template-columns: repeat(2,1fr); } .dashboard-grid, .analytics-grid { grid-template-columns: 1fr; } }
@media (max-width: 650px) { .app-shell { display: block; } .sidebar { width: 100%; padding: 15px 13px; } .brand { padding: 0 5px 16px; } .sidebar nav { display: flex; overflow-x: auto; } .nav-item { padding: 9px 11px; font-size: 11px; } .nav-item span { font-size: 15px; } .sidebar-footer { display: none; } .main-content { padding: 22px 14px 35px; } .topbar { align-items: flex-start; margin-bottom: 25px; } .topbar h1 { font-size: 25px; } .topbar .primary-button { padding: 9px 10px; font-size: 10px; } .welcome-row { display: block; min-height: 170px; padding: 24px; } .date-pill { display: inline-block; margin-top: 20px; } .metric-grid, .metrics-summary { gap: 9px; } .metric-card { padding: 13px 11px; gap: 8px; } .metric-card strong { font-size: 21px; } .metric-card span { font-size: 9px; } .metric-card small { display: none; } .metric-icon { width: 30px; height: 30px; font-size: 13px; } .section-intro { display: block; } .section-intro .secondary-button { margin-top: 14px; } .metrics-actions { align-items: stretch; flex-direction: column; margin-top: 14px; } .metrics-actions select { height: 38px; } .toolbar select { flex: 1; height: 38px; } .panel { padding: 15px; } .table-panel { padding: 13px; } .form-grid { grid-template-columns: 1fr; } .form-grid .wide { grid-column: auto; } .report-row { align-items: flex-start; flex-direction: column; } .modal { padding: 25px 19px; } }
