/*
 * Every rule this app has, hand-written.
 *
 * In the PHP this lived inline in header.php, because a stylesheet would have
 * needed Bagisto's asset pipeline and those pages existed to stay out of it.
 * That reason is gone -- this service has its own wwwroot and no build step --
 * so it is a real file now. Still no framework and still no CDN: the
 * warehouse's dashboard should not be behind somebody else's uptime.
 */
:root {
    --ink: #1f2933;
    --muted: #6b7280;
    --line: #e2e6ea;
    --bg: #f6f7f9;
    --accent: #2563eb;
    --good: #047857;
    --bad: #b91c1c;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

nav .brand { font-weight: 600; margin-right: 12px; }

nav a {
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--ink);
}

nav a[aria-current] { background: var(--accent); color: #fff; }

nav .who { margin-left: auto; color: var(--muted); font-size: 13px; }

main { padding: 16px 12px 48px; max-width: 1200px; margin: 0 auto; }

h1, h2 { margin: 0 0 16px; font-size: 21px; }

h3 { font-size: 16px; margin: 24px 0 8px; }

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid;
}

.flash.success { background: #ecfdf5; border-color: #a7f3d0; color: var(--good); }

.flash.error { background: #fef2f2; border-color: #fecaca; color: var(--bad); }

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

/* Search bar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.toolbar input[type=search], .toolbar select {
    flex: 1 1 200px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
}

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

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

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

th { background: #fbfcfd; font-size: 13px; color: var(--muted); white-space: nowrap; }

th a { color: inherit; text-decoration: none; }

tbody tr:last-child td { border-bottom: 0; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 24px; text-align: center; color: var(--muted); }

.muted { color: var(--muted); font-size: 14px; }

/* Buttons and inputs */
button, .button {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

button.danger { border-color: #fecaca; color: var(--bad); }

button[disabled] { opacity: .5; cursor: not-allowed; }

input[type=number], input[type=text], input[type=email], input[type=password], select {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

form.inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }

form.inline input[type=number] { width: 90px; }

/* Sign in */
nav form.signout { margin-left: 10px; }

.signin { max-width: 360px; display: flex; flex-direction: column; gap: 6px; }

.signin label { font-size: 13px; color: var(--muted); }

.signin button { margin-top: 10px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }

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

.kpi .label { color: var(--muted); font-size: 13px; }

.kpi .value { font-size: 26px; font-weight: 600; margin-top: 4px; }

.kpi.alert .value { color: var(--bad); }

/* Pager */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 14px; }

.pager .spacer { flex: 1; }

/*
 * Under 640px the tables stop being tables: each row becomes a card and
 * every cell carries its own heading, taken from the data-label the page
 * puts on it. That is the whole phone story -- one breakpoint, no second
 * set of templates to keep in step with the first.
 */
@media (max-width: 640px) {
    .table-wrap { border: 0; border-radius: 0; overflow: visible; }

    table, tbody, tr, td { display: block; width: 100%; }

    thead { display: none; }

    tr {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 4px 0;
    }

    td { border-bottom: 0; display: flex; gap: 12px; padding: 7px 12px; }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 13px;
        flex: 0 0 40%;
    }

    td.num { text-align: left; }

    td:empty { display: none; }

    nav .who { flex-basis: 100%; margin-left: 0; }
}
