@font-face { font-family: "Cairo"; font-weight: 400 1000; font-display: swap; src: url("../assets/fonts/cairo.woff2") format("woff2"); }

:root {
  --bg: #231F1F; --s1: #2A2525; --s2: #302B2B; --s3: #3A3434; --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.16);
  --fg: #FFFFFF; --fg2: rgba(255,255,255,.72); --fg3: rgba(255,255,255,.48);
  --teal: #14A599; --teal2: #2BC0B3; --teal-dk: #0F7F76; --gold: #E9C46A; --danger: #FF8A7A;
  --r: 14px; --r-sm: 10px; --ease: cubic-bezier(.22,1,.36,1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg); font: 15px/1.6 "Cairo", "Segoe UI", Tahoma, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2 { margin: 0; font-weight: 700; }
.muted { color: var(--fg2); margin: 0; } .small { font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: transparent; font-weight: 700; cursor: pointer; transition: transform .12s var(--ease), background .15s; white-space: nowrap; }
.btn:hover { background: var(--s3); } .btn:active { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--teal2); outline-offset: 2px; }
.btn.primary { background: var(--teal); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--teal2); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 36px 32px; border-radius: 22px; background: var(--s1); border: 1px solid var(--line); box-shadow: 0 30px 70px -30px rgba(0,0,0,.7); }
.login-logo { height: 88px; align-self: center; margin-bottom: 4px; }
.login-card h1 { font-size: 22px; text-align: center; } .login-card > .muted { text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--fg2); }
.field input { min-height: 48px; padding: 0 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line2); background: rgba(0,0,0,.25); font-size: 17px; letter-spacing: .04em; color: var(--fg); }
.remember { display: flex; gap: 8px; align-items: center; color: var(--fg2); font-size: 14px; }
.err { min-height: 1.4em; margin: 0; color: var(--danger); font-size: 14px; }
.login .btn { min-height: 50px; font-size: 17px; }

/* app */
.app { max-width: 1440px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 32px) 48px; display: flex; flex-direction: column; gap: 18px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bar-start { display: flex; align-items: center; gap: 16px; }
.bar-logo { height: 80px; }
.bar h1 { font-size: 22px; font-weight: 900; }
.bar-end { display: flex; gap: 8px; flex-wrap: wrap; }
.live { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--fg3); font-size: 13px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(20,165,153,.6); animation: pulse 2s infinite; }
.live.off i { background: var(--gold); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(20,165,153,0); } 100% { box-shadow: 0 0 0 0 rgba(20,165,153,0); } }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filters .search { flex: 1 1 280px; }
.filters input, .filters select { min-height: 42px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--bg); }
.filters select { min-width: 150px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; border-radius: var(--r); background: var(--s1); border: 1px solid var(--line); }
.kpi .k { color: var(--fg2); font-size: 13px; font-weight: 500; }
.kpi .v { font-size: 34px; font-weight: 900; line-height: 1.25; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .d { color: var(--fg3); font-size: 12px; }
.kpi.hero { border-color: rgba(20,165,153,.45); box-shadow: inset 0 3px 0 var(--teal); }

.charts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
@media (max-width: 980px) { .charts { grid-template-columns: 1fr; } }
.panel { padding: 18px; border-radius: var(--r); background: var(--s1); border: 1px solid var(--line); min-width: 0; }
.panel > header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.panel h2 { font-size: 16px; }
.chart { position: relative; width: 100%; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: rgba(255,255,255,.07); }
.chart .axis text { fill: var(--fg3); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--teal); transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.on { fill: var(--teal2); }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--fg3); border: 1px dashed var(--line2); border-radius: var(--r-sm); }

.prizes { display: flex; flex-direction: column; gap: 12px; }
.prow { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.prow img { width: 36px; height: 36px; object-fit: contain; }
.pname { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; }
.pname .muted { font-weight: 400; font-size: 12px; white-space: nowrap; }
.ptrack { height: 10px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; margin-top: 6px; }
.pfill { height: 100%; border-radius: 99px; background: var(--teal); transform-origin: right; transition: width .4s var(--ease); }
.pcount { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: end; }
.stock-out { color: var(--gold); }

.table-head { flex-direction: row !important; justify-content: space-between; align-items: baseline; }
.table-wrap { overflow: auto; border-radius: var(--r-sm); border: 1px solid var(--line); max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: var(--s1); color: var(--fg2); font-weight: 600; font-size: 13px; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
tr.fresh td { animation: fresh 2.4s var(--ease); }
@keyframes fresh { from { background: rgba(20,165,153,.22); } }
td.ltr { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
td.code b { letter-spacing: .08em; color: var(--fg); }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.07); color: var(--fg2); margin-inline-start: 6px; vertical-align: middle; }
.tag.warn { background: rgba(233,196,106,.14); color: var(--gold); }
.src { display: inline-flex; align-items: center; gap: 6px; }
.src::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.src.qr::before { background: var(--fg2); }
.empty { text-align: center; color: var(--fg3); padding: 32px; margin: 0; }
.more { display: flex; margin: 12px auto 0; }
input[type="checkbox"].sw { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.16); position: relative; cursor: pointer; transition: background .2s; vertical-align: middle; }
input[type="checkbox"].sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
input[type="checkbox"].sw:checked { background: var(--teal); }
input[type="checkbox"].sw:checked::after { transform: translateX(-18px); }

.tip { position: fixed; z-index: 50; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: var(--s2); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 13px; white-space: nowrap; }
.tip b { font-size: 16px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 20px; border-radius: 14px; background: var(--s2); border: 1px solid var(--line2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .bar-end { width: 100%; } .bar-end .btn { flex: 1; }
  .filters select { flex: 1 1 45%; min-width: 0; }
  .kpi .v { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
