/* DinePOS Web Admin - a small, deliberately plain stylesheet.
   No build step: this file is served straight from public/, so the admin can
   be deployed to Hostinger without npm, node or a compiled asset pipeline. */

:root {
    --bg: #0f1216;
    --panel: #171b21;
    --panel-2: #1e242c;
    --line: #2a323d;
    --ink: #e7ecf2;
    --muted: #93a1b1;
    --accent: #2f9e6d;
    --danger: #d9534f;

    /* ------------------------------------------------------------------
       SEMANTIC PALETTE.

       A colour on this dashboard always means one thing. That constraint is
       the whole reason the board is readable at a glance: green is a healthy,
       settled number; amber is something a person must act on; blue is money or
       information; purple is the catalogue; red is a failure.

       They are named for meaning, not for hue, so a theme change cannot quietly
       repaint "awaiting payment" as something reassuring. Every colour is also
       paired with a text label on the element that uses it, so the board is
       still readable without colour at all.
       ------------------------------------------------------------------ */
    --ok: #2f9e6d;        /* available, paid, settled, healthy */
    --ok-soft: rgba(47, 158, 109, .14);
    --warn: #d99a2b;      /* pending, bill requested, needs attention */
    --warn-soft: rgba(217, 154, 43, .14);
    --bad: #d9534f;       /* failed, void, unavailable, error */
    --bad-soft: rgba(217, 83, 79, .14);
    --info: #3b8ede;      /* orders, sales, information */
    --info-soft: rgba(59, 142, 222, .14);
    --purple: #8b6cd4;    /* menu and product */
    --purple-soft: rgba(139, 108, 212, .14);

    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.small { font-size: 12px; }

/* --- chrome ------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; gap: 20px;
    padding: 12px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); }
.brand span { color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
    padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 14px;
}
.nav a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--panel-2); color: var(--ink); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { font-size: 13px; color: var(--muted); }
.who em { color: var(--accent); font-style: normal; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; }

.foot {
    max-width: 1100px; margin: 0 auto; padding: 16px 20px 40px;
    color: var(--muted); font-size: 12px;
}

/* --- tiles -------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.tile {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-size: 24px; font-weight: 600; }
.tile.small .v { font-size: 19px; }

/* --- tables ------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }

.pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: var(--panel-2); border: 1px solid var(--line); font-size: 12px;
}

.row-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }

.head-row { display: flex; align-items: center; gap: 14px; }
.head-row .btn, .head-row .muted { margin-left: auto; }

.search { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.search input { max-width: 320px; }

/* --- forms -------------------------------------------------------------- */
.card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 12px; padding: 20px;
}
.login-wrap { display: flex; justify-content: center; padding-top: 40px; }
.login { width: 100%; max-width: 380px; }
.login h1 { margin-bottom: 2px; }
.login button { width: 100%; margin-top: 14px; }

.form { max-width: 520px; margin-top: 16px; }
label { display: block; margin: 14px 0 5px; font-size: 13px; color: var(--muted); }
label + input[type=checkbox] { margin-bottom: 0; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

input[type=text], input[type=number], input[type=password], input:not([type]), select {
    width: 100%; padding: 8px 10px;
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.actions { display: flex; gap: 14px; align-items: center; margin-top: 22px; }

button, .btn {
    font: inherit; padding: 8px 14px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #06210f; font-weight: 600; }

button.link, .link {
    background: none; border: 0; padding: 0; color: var(--accent);
    cursor: pointer; font: inherit; font-size: 14px;
}
button.link.danger, .link.danger { color: var(--danger); }

/* --- flash -------------------------------------------------------------- */
.flash { padding: 9px 12px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.flash.ok { background: rgba(47, 158, 109, .15); border: 1px solid var(--accent); }
.flash.bad { background: rgba(217, 83, 79, .15); border: 1px solid var(--danger); }

.pagination { display: flex; gap: 8px; margin-top: 14px; list-style: none; padding: 0; }
.pagination li { font-size: 13px; }

/* ======================================================================
   DASHBOARD
   ======================================================================
   Additive: everything above still styles the resource pages, the login
   form and the CRUD tables. Nothing here changes an existing selector, so a
   page that has not been redesigned cannot be affected by it.
   ====================================================================== */

/* --- page header ------------------------------------------------------ */
.page-head {
    display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.page-sub {
    margin: 4px 0 0; color: var(--muted); font-size: 13px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.page-sub .sep { opacity: .4; }
.dot-live {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft);
}
.page-head-right {
    margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-date { color: var(--muted); font-size: 13px; }

/* The environment badge is a hard-coded STAGING marker, matching the footer.
   It is deliberately not a variable: a build that reached production must show
   it in a way nobody can theme away. */
.env-badge {
    padding: 3px 9px; border-radius: 999px;
    background: var(--warn-soft); border: 1px solid var(--warn);
    color: var(--warn); font-size: 11px; font-weight: 700; letter-spacing: .08em;
}

/* --- KPI cards -------------------------------------------------------- */
.kpi-grid {
    display: grid; gap: 14px; margin-bottom: 14px;
    /* auto-fit + minmax, so the row reflows from 4 across on a desktop to a
       single column on a phone with no breakpoint table to maintain. */
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.kpi-grid-sm { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.kpi {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 17px;
    display: flex; flex-direction: column; gap: 4px;
    min-width: 0;                 /* lets the grid shrink instead of forcing overflow */
    transition: border-color .12s ease, transform .12s ease;
}
.kpi:hover { transform: translateY(-1px); border-color: #3a4553; }

.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-label {
    color: var(--muted); font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
}
.kpi-ico { margin-left: auto; color: var(--muted); display: flex; }
.kpi-value {
    font-size: 27px; font-weight: 650; line-height: 1.15;
    font-variant-numeric: tabular-nums;   /* digits stop jittering as they change */
    overflow-wrap: anywhere;             /* a long number wraps rather than overflowing */
}
.kpi-of { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi-foot { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* Accent colours. Each pairs with a text label, so colour is never the only
   carrier of meaning. */
.kpi-money  { border-left-color: var(--info); }
.kpi-money .kpi-ico { color: var(--info); }
.kpi-info   { border-left-color: var(--info); }
.kpi-info .kpi-ico { color: var(--info); }
.kpi-ok     { border-left-color: var(--ok); }
.kpi-ok .kpi-ico { color: var(--ok); }
.kpi-warn   { border-left-color: var(--warn); }
.kpi-warn .kpi-ico { color: var(--warn); }
.kpi-purple { border-left-color: var(--purple); }
.kpi-purple .kpi-value { color: #c3b0ec; }

/* --- panels ----------------------------------------------------------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 14px;
    min-width: 0;
}
.panel-head {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head .muted { margin-left: auto; }

.grid-2 {
    display: grid; gap: 14px; margin-bottom: 14px;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

/* --- chart ------------------------------------------------------------ */
.chart {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 8px; align-items: end; height: 190px; padding-top: 8px;
}
.chart-col { display: flex; flex-direction: column; height: 100%; min-width: 0; }
.chart-bar-wrap {
    flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
    align-items: center; gap: 5px; min-height: 0;
}
.chart-val { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-bar {
    width: 100%; max-width: 46px; min-height: 2px;
    background: linear-gradient(180deg, var(--info), #2f6fb0);
    border-radius: 5px 5px 2px 2px;
}
.chart-label {
    text-align: center; font-size: 12px; color: var(--muted);
    padding-top: 6px; border-top: 1px solid var(--line);
}

/* --- meters ----------------------------------------------------------- */
.meter {
    height: 6px; background: var(--bg); border-radius: 999px;
    overflow: hidden; margin: 5px 0;
}
.meter-thin { height: 4px; margin: 0; }
.meter-fill { display: block; height: 100%; background: var(--info); border-radius: 999px; }

/* --- payment mix ------------------------------------------------------ */
.mix { list-style: none; margin: 0; padding: 0; }
.mix-row + .mix-row { margin-top: 13px; }
.mix-top { display: flex; align-items: baseline; gap: 8px; }
.mix-mode { font-weight: 600; font-size: 13.5px; letter-spacing: .02em; }
.mix-fig { margin-left: auto; font-variant-numeric: tabular-nums; }
.mix-fig em { margin-left: 6px; font-style: normal; }
.mix-foot { margin-top: 1px; }

/* --- status list ------------------------------------------------------ */
.statuses { list-style: none; margin: 0; padding: 0; }
.status-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 0; border-bottom: 1px solid var(--line);
}
.status-row:last-child { border-bottom: 0; }
.status-n { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.status-pct { min-width: 40px; text-align: right; }

/* Status badges. The label text carries the meaning; the colour only speeds
   up recognition. */
.tag {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
    text-transform: uppercase;
    border: 1px solid transparent;
}
.tag-ok    { background: var(--ok-soft);    border-color: var(--ok);    color: #6fd6a4; }
.tag-warn  { background: var(--warn-soft);  border-color: var(--warn);  color: #ecc06a; }
.tag-bad   { background: var(--bad-soft);   border-color: var(--bad);   color: #f08a86; }
.tag-info  { background: var(--info-soft);  border-color: var(--info);  color: #7fb6f0; }
.tag-muted { background: var(--panel-2);    border-color: var(--line);  color: var(--muted); }

/* --- rank list -------------------------------------------------------- */
.rank { list-style: none; margin: 0; padding: 0; }
.rank-row {
    display: grid; grid-template-columns: 22px 1fr auto;
    gap: 4px 10px; align-items: baseline; padding: 7px 0;
    border-bottom: 1px solid var(--line);
}
.rank-row:last-child { border-bottom: 0; }
.rank-n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rank-name { font-size: 14px; overflow-wrap: anywhere; }
.rank-qty { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.rank-row .meter { grid-column: 2 / -1; }
.rank-row .meter-fill { background: var(--purple); }

/* --- data table ------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.data { margin-top: 0; background: transparent; border: 0; border-radius: 0; }
table.data th, table.data td { padding: 8px 10px; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- empty states ----------------------------------------------------- */
.empty {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 26px 14px; text-align: center;
    border: 1px dashed var(--line); border-radius: var(--radius-sm);
    background: var(--bg);
}
.empty-ico { color: var(--muted); opacity: .7; margin-bottom: 2px; }
.empty-title { margin: 0; font-weight: 600; font-size: 14px; }
.empty .muted { margin: 0; }

/* --- responsive -------------------------------------------------------
   Two deliberate overrides rather than a device matrix. The KPI grid and the
   two-column panels are already fluid via auto-fit; these tighten the gutters
   on a small screen so nothing is clipped, and stop the header controls from
   colliding. */
@media (max-width: 720px) {
    main { padding: 18px 14px 48px; }
    .foot { padding: 14px; }
    .page-head-right { margin-left: 0; width: 100%; }
    .kpi-value { font-size: 24px; }
    .grid-2 { grid-template-columns: 1fr; }
    .chart { height: 160px; }
    .topbar { padding: 10px 14px; }
    .brand { font-size: 16px; }
}
@media (max-width: 420px) {
    .kpi-grid, .kpi-grid-sm { grid-template-columns: 1fr; }
    .page-date { width: 100%; order: 3; }
}
