:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --ink: #18181b;
  --muted: #71717a;
  --soft: #a1a1aa;
  --line: #e4e4e7;
  --line-soft: #f4f4f5;
  --brand: #ea580c;
  --brand-soft: #fff7ed;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --dark: #18181b;
  --radius: 10px;
  --shadow: 0 18px 45px rgba(24, 24, 27, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { min-height: 100%; }
body {
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea { outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(234, 88, 12, .12); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }

.shell { display: flex; width: 100%; height: 100vh; overflow: hidden; }
.shell.operator-shell .main { width: 100%; }
.shell.operator-shell .content { padding: 0; }
.shell.operator-shell .page { max-width: none; min-height: calc(100vh - 74px); padding: 24px; }
.sidebar {
  width: 248px;
  flex: 0 0 auto;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  transition: width .18s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 76px; }
.brand { height: 64px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid #27272a; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 17px; font-weight: 800; flex: none; }
.brand-title { color: #fafafa; font-weight: 800; letter-spacing: -.3px; }
.brand-sub { color: #71717a; font-size: 11px; font-weight: 600; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { color: #52525b; font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; padding: 14px 11px 6px; }
.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 9px;
  color: #a1a1aa;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 700;
}
.nav button:hover { background: rgba(255,255,255,.06); }
.nav button.active { background: rgba(234,88,12,.14); color: #fb923c; border-left-color: var(--brand); }
.nav .ico { width: 20px; flex: none; text-align: center; font-weight: 800; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  flex: none;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: #52525b;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.icon-btn:hover, .soft-btn:hover { background: #fafafa; }
.search { position: relative; flex: 1; max-width: 460px; }
.search span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--soft); }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; padding: 0 13px 0 38px; color: var(--ink); }
.branch-picker { position: relative; }
.branch { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; font-size: 13px; font-weight: 700; color: #3f3f46; white-space: nowrap; }
.branch-switch:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.branch-caret { color: var(--soft); font-size: 11px; margin-left: 3px; }
.branch-menu {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 3px;
  min-width: 220px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}
.branch-menu button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #3f3f46;
  display: flex;
  gap: 8px;
  height: 34px;
  padding: 0 9px;
  text-align: left;
  white-space: nowrap;
}
.branch-menu button:hover,
.branch-menu button.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green); display: inline-block; }
.user { display: flex; align-items: center; gap: 9px; padding-left: 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--dark); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.user strong { display: block; font-size: 13px; }
.user small { display: block; color: var(--soft); font-size: 11px; }
.content { flex: 1; overflow: auto; }
.page { padding: 28px 30px 60px; max-width: 1480px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.eyebrow { font-size: 12.5px; font-weight: 800; color: var(--brand); letter-spacing: .3px; margin-bottom: 5px; text-transform: uppercase; }
h1 { font-size: 26px; line-height: 1.12; letter-spacing: -.6px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.actions, .row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #3f3f46;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn.primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.soft-btn { height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #3f3f46; font-size: 12.5px; font-weight: 800; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.two { grid-template-columns: minmax(0, 1.45fr) minmax(320px, .95fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.card.pad { padding: 20px; }
.kpi { padding: 18px; position: relative; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--bar, var(--brand)); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 800; line-height: 1.3; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--ico-bg); color: var(--bar); font-weight: 800; }
.metric { font-family: "JetBrains Mono", monospace; font-size: 29px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.sub { font-size: 12px; margin-top: 9px; color: var(--sub-color, var(--muted)); font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.card-head h3, .section-title { font-size: 15px; font-weight: 800; }
.list { display: flex; flex-direction: column; gap: 9px; }
.alert-row, .mini-row { display: flex; align-items: center; gap: 13px; padding: 12px 13px; border-radius: 11px; border: 1px solid var(--row-border, var(--line)); background: var(--row-bg, #fff); }
.tile-ico { width: 38px; height: 38px; border-radius: 9px; background: #fff; display: grid; place-items: center; font-weight: 800; border: 1px solid var(--row-border, var(--line)); flex: none; }
.mono { font-family: "JetBrains Mono", monospace; }
.status { display: inline-flex; align-items: center; gap: 5px; border-radius: 7px; padding: 4px 10px; font-size: 11.5px; font-weight: 800; background: var(--status-bg); color: var(--status-color); white-space: nowrap; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.quick {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  text-align: left;
  font-weight: 800;
}
.quick:hover { border-color: var(--brand); background: #fff; }
.quick span:first-child { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--q-bg); color: var(--q-color); font-weight: 900; }
.bar-row { margin-bottom: 14px; }
.bar-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; font-weight: 800; }
.track { height: 9px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: var(--pct); background: var(--color); border-radius: inherit; }
.tabs { display: flex; background: var(--line-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { height: 34px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent; color: #52525b; font-size: 13px; font-weight: 800; }
.tabs button.active { background: var(--dark); color: #fff; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter { height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #52525b; font-size: 13px; font-weight: 800; }
.filter.active { background: var(--dark); border-color: var(--dark); color: #fff; }
.cat-pills { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 18px; }
.cat-pill { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--cat-color); border-radius: 10px; background: var(--cat-bg); color: var(--cat-color); font-size: 13px; font-weight: 800; }
.table { width: 100%; overflow-x: auto; }
.thead, .trow { display: grid; align-items: center; gap: 12px; min-width: 880px; }
.thead { padding: 13px 18px; background: #fafafa; border-bottom: 1px solid var(--line); }
.thead span { color: var(--soft); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .35px; }
.trow { padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.trow:hover { background: #fafafa; }
.product { display: flex; align-items: center; gap: 11px; min-width: 0; }
.product .tile-ico { background: var(--cat-bg, #fafafa); border: 0; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field.full { grid-column: 1 / -1; }
label { display: block; color: #3f3f46; font-size: 12.5px; font-weight: 800; margin-bottom: 6px; }
.field input, .field select, .field textarea, .form-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  min-height: 42px;
  padding: 0 13px;
  color: var(--ink);
}
.field textarea { min-height: 76px; padding-top: 11px; resize: vertical; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  display: grid;
  place-items: center;
}
.password-toggle svg { display: block; }
.password-toggle:hover { background: var(--line-soft); color: var(--ink); }
.form-footer { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.notice { background: var(--brand-soft); border: 1px solid #fed7aa; border-radius: 14px; padding: 16px; color: #9a3412; font-size: 12.5px; line-height: 1.5; }
.dropzone { border: 2px dashed #d4d4d8; border-radius: 16px; background: #fff; padding: 34px 24px; text-align: center; }
.dropzone strong { display: block; font-size: 17px; margin-bottom: 6px; }
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.reason-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.reason-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 11.5px; font-weight: 800; }
.reason-grid button.active, .reason-grid button:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.tablet {
  background: #0a0a0a;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.tablet-row { display: flex; align-items: center; gap: 18px; padding: 18px 20px; background: #18181b; border: 1px solid #27272a; border-radius: 14px; color: #fafafa; }
.tablet input { background: #0a0a0a; color: #fde047; border: 2px solid #3f3f46; border-radius: 12px; text-align: center; font-family: "JetBrains Mono", monospace; font-size: 24px; font-weight: 800; height: 58px; width: 110px; }
.counter { display: flex; align-items: center; gap: 12px; }
.counter button { width: 54px; height: 54px; border: 0; border-radius: 12px; background: #27272a; color: #fff; font-size: 28px; font-weight: 800; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  min-width: 260px;
  max-width: 420px;
  border-radius: 12px;
  background: #18181b;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 13px 15px;
  font-size: 13px;
  font-weight: 700;
}
.empty { padding: 34px; text-align: center; color: var(--muted); }

@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.pulse { animation: pulseDot 1.6s infinite; }

@media (max-width: 1180px) {
  .kpis, .four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .three { grid-template-columns: 1fr; }
  .branch, .user small, .user strong { display: none; }
}

@media (max-width: 760px) {
  .shell { height: auto; min-height: 100vh; }
  .sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { min-height: 100vh; }
  .topbar { padding: 0 12px; }
  .page { padding: 20px 14px 42px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .kpis, .four, .form-grid, .form-grid.four, .quick-grid { grid-template-columns: 1fr; }
  .reason-grid { grid-template-columns: repeat(2, 1fr); }
  .tablet { margin: 0 -8px; padding: 14px; border-radius: 14px; }
  .tablet-row { align-items: flex-start; flex-direction: column; }
}
