﻿/* MG Apparel Coffee Corner - shared tokens and bento components */
:root {
  --brand: #29AAE1;
  --brand-ink: #0A7BB3;
  --brand-soft: #E2F3FB;
  --chart: #1E96D1;
  --on-brand: #FFFFFF;
  --coffee: #8A5A3B;
  --coffee-soft: #F4EAE2;

  --bg: #EDF2F6;
  --card: #FFFFFF;
  --card-2: #F5F8FB;
  --line: #E1E8EE;
  --ink: #0F1E2B;
  --ink-2: #47596A;
  --ink-3: #7F90A0;

  --good: #15803D;
  --good-soft: #DCFCE7;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --bad: #B91C1C;
  --bad-soft: #FEE2E2;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(15, 30, 43, .04), 0 10px 30px rgba(15, 30, 43, .06);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-ink: #5CC3EE; --brand-soft: #0E2E40; --chart: #4DB6E8; --on-brand: #062231;
    --coffee: #D5A27F; --coffee-soft: #3A2A20;
    --bg: #0A131B; --card: #111D28; --card-2: #172633; --line: #213343;
    --ink: #E8F0F6; --ink-2: #A9BACA; --ink-3: #6F8496;
    --good: #4ADE80; --good-soft: #0F2E1C; --warn: #FBBF24; --warn-soft: #33270B; --bad: #F87171; --bad-soft: #3A1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-ink: #5CC3EE; --brand-soft: #0E2E40; --chart: #4DB6E8; --on-brand: #062231;
  --coffee: #D5A27F; --coffee-soft: #3A2A20;
  --bg: #0A131B; --card: #111D28; --card-2: #172633; --line: #213343;
  --ink: #E8F0F6; --ink-2: #A9BACA; --ink-3: #6F8496;
  --good: #4ADE80; --good-soft: #0F2E1C; --warn: #FBBF24; --warn-soft: #33270B; --bad: #F87171; --bad-soft: #3A1414;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--brand-ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; min-width: 0; position: relative;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 28px; }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.card-head .sub { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.tile-ico {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 18px; flex: none;
}
.tile-ico.coffee { background: var(--coffee-soft); color: var(--coffee); }
.big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.empty { padding: 26px 8px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ------------------------------------------------------------ buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.06); background: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--card-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, select.input, textarea.input {
  height: 40px; width: 100%; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .input { padding-left: 38px; }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 13px; background: var(--card-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 30, 43, .12); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 650; background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }

.delta { font-size: 12.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }

/* ------------------------------------------------------------ avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: var(--brand-soft);
  color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; overflow: hidden;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }

/* ------------------------------------------------------------ list rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* horizontal bars */
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 7px 0; }
.hbar .name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .val { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: var(--chart); min-width: 4px; transition: width .5s ease; }

/* ------------------------------------------------------------ charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--chart); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hl { fill: var(--brand-ink); }
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--card);
  padding: 7px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.35; box-shadow: var(--shadow);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; opacity: 0; transition: opacity .1s;
}
.tooltip.on { opacity: 1; }
.tooltip b { font-weight: 700; }

.heat { display: grid; gap: 3px; font-size: 11px; color: var(--ink-3); }
.heat .cell { border-radius: 4px; height: 26px; background: var(--card-2); min-width: 0; }
.heat .lbl { display: flex; align-items: center; white-space: nowrap; }

/* ------------------------------------------------------------ table */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* ------------------------------------------------------------ toast & modal */
.toasts { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; max-width: 380px;
  background: var(--ink); color: var(--card); box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  animation: toast-in .2s ease;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(6, 14, 20, .55); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg); border-radius: 26px; width: min(1040px, 100%); max-height: calc(100vh - 32px);
  overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); padding: 22px;
}
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head .btn { margin-left: auto; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--card-2), var(--line), var(--card-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
