:root {
  --bg: #000;
  --panel: #090909;
  --panel-2: #0f0f0f;
  --white: #fff;
  --text: #e8e8e8;
  --muted: #7d7d7d;
  --line: #242424;
  --line-strong: #3c3c3c;
  --danger: #ff8a8a;
  --success: #bfffc2;
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 25px 18px 18px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #030303; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--white); font-size: 12px; font-weight: 800; letter-spacing: .13em; }
.brand > span { display: grid; place-items: center; width: 33px; height: 33px; background: var(--white); color: var(--bg); letter-spacing: -.08em; font-size: 11px; }
.brand small { display: block; margin-top: 4px; color: #555; font-size: 7px; letter-spacing: .18em; }
.sidebar nav { display: grid; gap: 4px; margin-top: 48px; }
.nav-button { width: 100%; height: 45px; padding: 0 12px; display: flex; align-items: center; gap: 12px; border: 1px solid transparent; background: transparent; color: #777; text-align: left; font-size: 11px; }
.nav-button span { color: #3f3f3f; font-size: 8px; }
.nav-button.active { border-color: var(--line); background: var(--panel-2); color: var(--white); }
.nav-button.active span { color: var(--white); }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); color: #666; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-footer button { display: block; margin-top: 15px; padding: 0; border: 0; background: transparent; color: #999; font-size: 9px; text-transform: uppercase; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 9px rgba(191,255,194,.5); }

.content { min-width: 0; width: min(100%, 1440px); padding: 38px 40px 70px; }
.mobile-header { display: none; }
.panel-section { display: none; animation: section-in .2s ease; }
.panel-section.active { display: block; }
@keyframes section-in { from { opacity: 0; transform: translateY(4px); } }
.page-head { min-height: 74px; margin-bottom: 25px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 6px 0 24px; color: var(--white); font-size: clamp(27px, 3vw, 38px); letter-spacing: -.05em; }
.kicker { color: #666; font-size: 8px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.head-actions { display: flex; gap: 8px; }

input, select, textarea { width: 100%; border: 1px solid var(--line); outline: 0; background: #050505; color: var(--text); transition: border-color .15s ease; }
input, select { height: 42px; padding: 0 12px; }
textarea { resize: vertical; padding: 11px 12px; line-height: 1.5; }
select[multiple] { height: auto; min-height: 92px; padding: 7px; }
select[multiple] option { padding: 6px; }
input:focus, select:focus, textarea:focus { border-color: #777; }
input::placeholder, textarea::placeholder { color: #4d4d4d; }
select { color-scheme: dark; }
.primary-button, .outline-button, .text-button { min-height: 40px; padding: 0 15px; border: 1px solid var(--white); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.primary-button { background: var(--white); color: var(--bg); }
.outline-button { background: transparent; color: var(--white); }
.text-button { min-height: auto; padding: 0; border: 0; background: transparent; color: #777; }
.wide { width: 100%; min-height: 47px; }
.danger-button { border-color: #562f2f; color: var(--danger); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stats-grid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { min-height: 132px; padding: 17px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); background: var(--panel); }
.stat-label { color: #707070; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.stat-value { color: var(--white); font-size: clamp(24px, 3vw, 34px); font-weight: 700; letter-spacing: -.045em; }
.stat-note { color: #555; font-size: 9px; }

.card { min-width: 0; padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.card.spaced { margin-top: 18px; }
.card-head { min-height: 42px; margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 5px 0 17px; color: var(--white); font-size: 15px; letter-spacing: -.02em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; margin-bottom: 18px; }
.chart-card { min-height: 340px; }
.bar-chart { height: 245px; display: flex; align-items: end; gap: 4px; padding-top: 20px; overflow: hidden; }
.chart-column { flex: 1; min-width: 5px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.chart-bar { width: 100%; min-height: 2px; background: #e8e8e8; opacity: .86; transition: height .25s ease; }
.chart-column:hover .chart-bar { opacity: 1; }
.chart-label { color: #4c4c4c; font-size: 7px; transform: rotate(-55deg); transform-origin: center; white-space: nowrap; }
.rank-list { display: grid; gap: 4px; }
.rank-row { min-height: 44px; padding: 8px 0; display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; border-bottom: 1px solid #191919; font-size: 10px; }
.rank-row span:first-child { color: #4e4e4e; }
.rank-row strong { font-size: 10px; font-weight: 500; }
.rank-row small { color: #777; }

.split-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 18px; align-items: start; }
.split-layout.narrow-form { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.stack { min-width: 0; display: grid; gap: 18px; }
.form-card { padding: 22px; }
.field { margin-bottom: 15px; }
.field label, .promo-label { display: block; margin-bottom: 7px; color: #777; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-field { min-height: 42px; margin-bottom: 15px; display: flex; flex-direction: column; justify-content: center; gap: 9px; }
.check-field.single { min-height: auto; }
.check-field label { display: flex; align-items: center; gap: 8px; color: #999; font-size: 10px; }
.check-field input { width: 14px; height: 14px; accent-color: white; }
.form-note { margin: 0; color: #5f5f5f; font-size: 9px; line-height: 1.6; }
.uppercase { text-transform: uppercase; }
.inline-form, .toolbar { display: flex; gap: 8px; }
.inline-form input, .toolbar input { flex: 1; min-width: 0; }
.toolbar { margin-bottom: 17px; }
.toolbar select { width: 180px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.tag { padding: 7px 9px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); color: #aaa; font-size: 9px; }
.tag button { padding: 0; border: 0; background: transparent; color: #555; }

.product-list, .order-list, .promo-list, .user-list { display: grid; gap: 7px; }
.product-row { padding: 11px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid #1d1d1d; background: #070707; }
.product-row img, .product-thumb { width: 52px; height: 52px; object-fit: cover; filter: grayscale(1); background: #111; }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ddd; font-size: 11px; font-weight: 600; }
.row-meta { margin-top: 5px; color: #626262; font-size: 9px; }
.row-actions { display: flex; gap: 5px; }
.mini-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); background: transparent; color: #999; font-size: 8px; text-transform: uppercase; }

.order-card { padding: 16px; border: 1px solid #1d1d1d; background: #070707; }
.order-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-id { color: var(--white); font-size: 12px; font-weight: 700; }
.order-user { margin-top: 5px; color: #666; font-size: 9px; }
.status-badge { padding: 6px 8px; border: 1px solid var(--line-strong); color: #aaa; font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.status-badge.paid, .status-badge.processing, .status-badge.completed { color: var(--success); border-color: #355438; }
.status-badge.cancelled, .status-badge.refunded { color: var(--danger); border-color: #563535; }
.order-items { margin: 14px 0; padding: 11px 0; border-block: 1px solid #1b1b1b; color: #888; font-size: 9px; line-height: 1.7; }
.order-bottom { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.order-total { color: var(--white); font-size: 19px; font-weight: 700; }
.order-discount { margin-top: 4px; color: #666; font-size: 8px; }
.order-status-select { width: 155px; height: 34px; font-size: 9px; }

.promo-row-card { padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid #1e1e1e; }
.promo-code { color: var(--white); font-size: 16px; font-weight: 800; letter-spacing: .08em; }
.promo-meta { margin-top: 7px; color: #676767; font-size: 9px; line-height: 1.6; }

.user-row, .compact-row { min-height: 52px; padding: 10px 4px; display: grid; gap: 10px; align-items: center; border-bottom: 1px solid #1c1c1c; font-size: 9px; }
.user-row { grid-template-columns: minmax(140px, 1.4fr) 110px 110px 110px; }
.compact-row { grid-template-columns: minmax(150px, 1.4fr) 1fr 1fr auto; }
.user-row strong, .compact-row strong { color: #ddd; font-size: 10px; font-weight: 500; }
.user-row span, .compact-row span { color: #686868; }
.table-head { color: #484848 !important; font-size: 7px !important; text-transform: uppercase; letter-spacing: .1em; }

.inventory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inventory-card { padding: 14px; border: 1px solid #1d1d1d; background: #070707; }
.inventory-card h3 { height: 30px; margin: 0 0 10px; overflow: hidden; color: #ddd; font-size: 10px; line-height: 1.45; }
.inventory-counts { display: flex; justify-content: space-between; gap: 8px; color: #666; font-size: 8px; }
.inventory-counts strong { display: block; margin-top: 4px; color: var(--white); font-size: 18px; }
.inventory-actions { display: flex; gap: 5px; margin-top: 13px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-submit { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.settings-submit button { min-width: 220px; }

.lock-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: #000; }
.lock-screen.hidden { display: none; }
.lock-card { width: min(100%, 410px); padding: 34px; border: 1px solid var(--line); background: #070707; }
.lock-logo { width: 46px; height: 46px; margin-bottom: 24px; display: grid; place-items: center; background: var(--white); color: var(--bg); font-size: 13px; font-weight: 800; letter-spacing: -.08em; }
.lock-card h1 { margin: 8px 0 10px; color: var(--white); font-size: 27px; letter-spacing: -.045em; }
.lock-card > p { margin: 0 0 25px; color: #777; font-size: 10px; line-height: 1.6; }
.login-error { min-height: 18px; margin-top: 12px; color: var(--danger); font-size: 9px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 120; transform: translate(-50%, 15px); padding: 11px 15px; border: 1px solid var(--line-strong); background: #111; color: var(--white); font-size: 9px; opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 32px 15px; color: #5c5c5c; font-size: 10px; text-align: center; }

@media (max-width: 1050px) {
  .admin-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .content { padding-inline: 25px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 20; height: 65px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.92); }
  .mobile-header select { width: 145px; height: 36px; font-size: 9px; }
  .content { width: 100%; padding: 25px 14px 60px; }
  .page-head { min-height: 65px; }
  .page-head h1 { font-size: 27px; }
  .head-actions { flex-direction: column; }
  .split-layout, .split-layout.narrow-form, .settings-grid { grid-template-columns: 1fr; }
  .split-layout .form-card { order: 2; }
  .stats-grid, .stats-grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 112px; }
  .inventory-grid { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr 1fr; }
  .compact-row { grid-template-columns: 1fr 1fr; }
  .table-head { display: none; }
  .toolbar { flex-direction: column; }
  .toolbar select { width: 100%; }
}

@media (max-width: 430px) {
  .stats-grid, .stats-grid.small { grid-template-columns: 1fr 1fr; gap: 7px; }
  .stat-card { padding: 13px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .page-head { align-items: start; }
  .page-head > .primary-button { padding-inline: 10px; }
  .product-row { grid-template-columns: 45px minmax(0, 1fr); }
  .product-row img, .product-thumb { width: 45px; height: 45px; }
  .product-row .row-actions { grid-column: 1 / -1; }
  .order-bottom { align-items: start; flex-direction: column; }
  .order-status-select { width: 100%; }
}
