:root {
  --bg: #f3f5ff;
  --panel: #ffffff;
  --line: #e7e9f7;
  --text: #152033;
  --muted: #69748f;
  --brand: #ff666d;
  --brand-strong: #ff515f;
  --brand-soft: #fff0f1;
  --success: #1e9e66;
  --warning: #e2a100;
  --danger: #d6455a;
  --shadow: 0 14px 30px rgba(12, 20, 49, 0.08);
  --radius: 4px;
  --radius-tight: 2px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0 24px, rgba(241, 244, 255, 0.95) 24px 48px),
    linear-gradient(180deg, #f7f8ff 0%, #edf0ff 100%);
  color: var(--text);
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(255, 102, 109, 0.2), transparent 25%),
    radial-gradient(circle at bottom right, rgba(105, 116, 143, 0.16), transparent 22%),
    linear-gradient(180deg, #fdfdff 0%, #f2f4ff 100%);
}

.login-card {
  width: min(100%, 460px);
  background: var(--panel);
  border-radius: 4px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 102, 109, 0.14);
}

.mode-chip,
.brand-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 2px;
  background: rgba(255, 102, 109, 0.12);
  color: var(--brand-strong);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.login-card h1 {
  margin: 14px 0 8px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form.dense {
  gap: 12px;
}

.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 102, 109, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 102, 109, 0.12);
}

.primary-btn,
.ghost-btn,
.status-btn {
  min-height: 40px;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  transition: 0.18s ease;
  font-size: 12px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  font-weight: 800;
}

.ghost-btn,
.status-btn {
  background: #fff;
  border: 1px solid rgba(255, 102, 109, 0.2);
  color: var(--brand-strong);
  font-weight: 700;
}

.primary-btn:hover,
.ghost-btn:hover,
.status-btn:hover,
.nav-item:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.status-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.login-help {
  min-height: 22px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
}

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

.sidebar {
  background:
    linear-gradient(180deg, #141b2d 0%, #101625 100%);
  color: #fff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.brand-block {
  padding: 10px 10px 18px;
}

.brand-title {
  font-size: 20px;
  font-weight: 900;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  text-align: left;
  min-height: 42px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  padding: 0 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 102, 109, 0.28), rgba(255, 81, 95, 0.4));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.full-btn {
  width: 100%;
}

.main-shell {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(244, 246, 255, 0.12) 100%),
    repeating-linear-gradient(90deg, rgba(221, 227, 248, 0.18) 0 1px, transparent 1px 72px);
}

.topbar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(252, 253, 255, 0.96) 100%);
  border: 1px solid rgba(225, 230, 248, 0.95);
  border-radius: 2px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0 0 2px;
  font-size: 22px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.metric-grid,
.double-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.double-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.stack-panels {
  display: grid;
  gap: 12px;
}

.slim-head {
  margin-bottom: 10px;
}

.segment-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.segment-row-large {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.segment-row-large-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment-row-large-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment-row-sub {
  margin-bottom: 12px;
}

.panel-head-stack {
  display: grid;
  justify-content: stretch;
  align-items: stretch;
}

.segment-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 102, 109, 0.16);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.segment-row-large .segment-btn {
  min-height: 52px;
  font-size: 14px;
  justify-content: center;
}

.segment-btn-sub {
  min-width: 0;
  min-height: 42px;
  font-size: 12px;
}

.segment-btn.active {
  background: linear-gradient(135deg, rgba(255, 102, 109, 0.14), rgba(255, 81, 95, 0.22));
  color: var(--brand-strong);
  border-color: rgba(255, 81, 95, 0.28);
}

.metric-card,
.panel-card {
  background: var(--panel);
  border: 1px solid rgba(223, 228, 248, 0.95);
  border-radius: 2px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 14px;
}

.metric-card.rank-card {
  background:
    linear-gradient(135deg, rgba(255, 102, 109, 0.08), rgba(255, 255, 255, 0.98)),
    #fff;
}

.metric-card.rank-card.rank-clickable {
  cursor: pointer;
}

.referral-ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ranking-board {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fbfcff;
  padding: 12px;
}

.ranking-board-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.ranking-board .metric-card {
  box-shadow: none;
  border-color: rgba(223, 228, 248, 0.82);
}

.rank-stack {
  display: grid;
  gap: 8px;
}

.rank-badge {
  display: inline-flex;
  min-height: 24px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: rgba(255, 102, 109, 0.12);
  color: var(--brand-strong);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
}

.panel-card {
  padding: 14px;
}

.panel-subtext {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.deposit-control-card {
  padding: 16px;
}

.lottery-shell {
  display: grid;
  gap: 14px;
}

.lottery-control-card {
  padding: 16px;
}

.lottery-tab-row {
  margin-top: 6px;
}

.lottery-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.lottery-filter-row {
  margin-bottom: 12px;
}

.lottery-control-strip,
.lottery-decision-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.lottery-game-row,
.lottery-room-row {
  display: grid;
  gap: 8px;
}

.lottery-game-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lottery-room-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lottery-decision-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.45fr);
  align-items: start;
}

.lottery-result-board,
.lottery-result-group {
  display: grid;
  gap: 12px;
}

.lottery-result-board {
  grid-template-columns: 1fr;
}

.lottery-result-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
}

.lottery-result-group {
  border: 1px solid rgba(223, 228, 248, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.96));
  padding: 12px;
}

.lottery-area-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.lottery-area-title {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: 0.04em;
}

.lottery-pick-btn {
  min-height: 54px;
  border: 1px solid rgba(255, 102, 109, 0.18);
  background: #fff;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.lottery-pick-btn span {
  position: relative;
  z-index: 1;
}

.lottery-pick-btn.active {
  border-color: rgba(255, 81, 95, 0.72);
  box-shadow: inset 0 0 0 2px rgba(255, 81, 95, 0.18);
}

.lottery-option-color {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.lottery-option-green {
  background: linear-gradient(135deg, #25b875, #119358);
}

.lottery-option-violet {
  background: linear-gradient(135deg, #9b5cff, #7b32d8);
}

.lottery-option-red {
  background: linear-gradient(135deg, #ff6969, #de364d);
}

.lottery-option-size {
  min-height: 60px;
  font-size: 15px;
}

.lottery-option-big {
  background: linear-gradient(135deg, #fff4dc, #ffd482);
  color: #9b5b00;
}

.lottery-option-small {
  background: linear-gradient(135deg, #eaf6ff, #a7d4ff);
  color: #175c8e;
}

.lottery-option-parity {
  background: linear-gradient(135deg, #f8f9ff, #e8edff);
  color: #38446a;
}

.lottery-option-ball {
  min-height: 58px;
  border-radius: 50%;
  aspect-ratio: 1;
  width: 58px;
  justify-self: center;
  padding: 0;
  border-color: rgba(255, 81, 95, 0.26);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.95) 0 11%, transparent 12%),
    radial-gradient(circle at 50% 52%, #ffffff 0 37%, transparent 38%),
    linear-gradient(135deg, #ff7b7f, #ff4f5e);
  color: #ff394a;
  box-shadow: 0 8px 16px rgba(255, 81, 95, 0.18);
}

.lottery-option-ball span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: #ff394a;
  font-size: 15px;
}

.lottery-auto-preview {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.lottery-auto-main {
  border: 1px solid rgba(223, 228, 248, 0.95);
  background: #fbfcff;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.lottery-auto-result {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}

.lottery-auto-kv {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lottery-exposure-list {
  display: grid;
  gap: 6px;
}

.lottery-exposure-row {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
}

.lottery-exposure-row.active {
  border-color: rgba(30, 158, 102, 0.32);
  background: rgba(30, 158, 102, 0.08);
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.panel-head h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.deposit-scope-row {
  margin-top: 6px;
}

.deposit-method-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: 10px;
  margin-bottom: 14px;
}

.deposit-method-row .segment-btn {
  min-height: 44px;
  font-size: 12px;
  justify-content: center;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.date-label {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.date-label span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.filter-row input,
.filter-row select {
  min-width: 180px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  background: #f8f9ff;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: none;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-active,
.status-approved,
.status-successful,
.status-open,
.status-live,
.status-clear {
  background: rgba(30, 158, 102, 0.12);
  color: var(--success);
}

.status-pending,
.status-hold,
.status-locked,
.status-paused {
  background: rgba(226, 161, 0, 0.13);
  color: #946400;
}

.status-blocked,
.status-rejected,
.status-closed,
.status-failed,
.status-flagged {
  background: rgba(214, 69, 90, 0.12);
  color: var(--danger);
}

.mini-action-row {
  margin-top: 8px;
}

.copy-mini-btn {
  min-height: 28px;
  padding: 0 8px;
  font-size: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  background: #fbfcff;
}

.detail-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 900;
}

.note-line {
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.empty-box {
  border: 1px dashed var(--line);
  border-radius: 2px;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.card-list {
  display: grid;
  gap: 12px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  background: #fcfdff;
}

.mini-title {
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
}

.mini-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.settings-list {
  display: grid;
  gap: 12px;
}

.settings-item {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  background: #fbfcff;
}

.gift-result {
  margin-top: 14px;
  border: 1px solid rgba(255, 102, 109, 0.2);
  border-radius: 2px;
  background: linear-gradient(180deg, #fffdfd 0%, #fff 100%);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.gift-result-code {
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8faff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.45;
  word-break: break-all;
}

.gift-shell {
  display: grid;
  gap: 14px;
}

.gift-create-card {
  padding: 18px;
}

.gift-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gift-form-span-2 {
  grid-column: 1 / -1;
}

.gift-history-panel {
  padding: 14px;
}

.gift-history-panel .table-wrap {
  margin-top: 6px;
}

.gift-create-card .panel-head,
.gift-history-panel .panel-head {
  align-items: flex-start;
}

.quick-panel {
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(255, 102, 109, 0.08), rgba(255, 255, 255, 0.96)),
    #fff;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-btn,
.export-btn {
  white-space: nowrap;
}

.quick-btn {
  min-height: 42px;
  justify-content: center;
}

.gateway-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px;
}

.gateway-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 102, 109, 0.08), transparent 36%),
    #fff;
  border-radius: 2px;
  padding: 14px;
  display: grid;
  gap: 14px;
}

.gateway-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.gateway-card h4 {
  margin: 4px 0 0;
  font-size: 14px;
}

.gateway-type {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.gateway-maintenance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--danger);
  white-space: nowrap;
}

.gateway-maintenance input {
  width: auto;
  min-height: auto;
}

.gateway-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gateway-form-grid label {
  display: grid;
  gap: 7px;
}

.gateway-form-grid span {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gateway-span-2 {
  grid-column: 1 / -1;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 21, 43, 0.42);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 520px);
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid var(--line);
  box-shadow: -26px 0 50px rgba(17, 25, 59, 0.16);
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

.drawer-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: linear-gradient(180deg, #fff9fa 0%, #fff 100%);
}

.drawer-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-strong);
}

.drawer-head h3 {
  margin: 6px 0 0;
  font-size: 20px;
}

.drawer-close {
  min-width: 90px;
}

.drawer-body {
  padding: 14px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.drawer-section {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  background: #fcfdff;
}

.drawer-section h4 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv-item {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px;
  background: #fff;
}

.kv-key {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.kv-value {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mini-line-list {
  display: grid;
  gap: 8px;
}

.mini-line {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 9px 10px;
  background: #fff;
  font-size: 12px;
}

.mini-line strong {
  display: block;
  margin-bottom: 4px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 14px 16px;
  border-radius: 2px;
  background: #20283f;
  color: #fff;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.18);
  z-index: 1000;
}

@media (max-width: 1200px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-radius: 0 0 24px 24px;
  }

  .double-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions,
  .kv-grid,
  .referral-ranking-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .main-shell {
    padding: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .detail-drawer {
    width: 100%;
  }

  .search-inline {
    width: 100%;
    flex-direction: column;
  }

  .search-inline input {
    min-width: 0;
  }

  .filter-row input,
  .filter-row select {
    min-width: 0;
    width: 100%;
  }
}
