/*
 * The panel deliberately shares the kiosk's palette and its one structural device:
 * a solid accent rule down the leading edge of anything that belongs to a cause.
 * Someone who has seen the tablet should recognise this screen as the same product.
 */

:root {
    --paper: #EDEFF3;
    --card: #FFFFFF;
    --ink: #101B24;
    --muted: #55636E;
    --hairline: #D7DDE4;
    --ok: #14614F;
    --warn: #8A5A00;
    --danger: #8C2F2F;

    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 27, 36, .06), 0 4px 16px rgba(16, 27, 36, .04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a { color: inherit; }

/* Money and counts everywhere use lining tabular figures so columns align. */
.num { font-variant-numeric: tabular-nums; }

/* ---- shell ---- */

.topbar {
    background: var(--ink);
    color: #fff;
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 26px;
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.01em;
    text-decoration: none;
    white-space: nowrap;
}
.brand img { height: 28px; width: auto; display: block; }

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    padding: 7px 13px;
    border-radius: 9px;
    font-weight: 500;
    font-size: 14.5px;
}
.nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav a.on { background: rgba(255, 255, 255, .16); color: #fff; }

.whoami { color: rgba(255, 255, 255, .6); font-size: 13.5px; white-space: nowrap; }
.whoami a { color: rgba(255, 255, 255, .85); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 70px; }

h1 { font-size: 27px; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 18px; letter-spacing: -.01em; margin: 30px 0 12px; }
.lede { color: var(--muted); margin: 0 0 22px; }

/* ---- cards ---- */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}

.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.k2 { grid-template-columns: repeat(2, 1fr); }

.stat .label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--muted);
}
.stat .value {
    font-size: 29px;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-top: 5px;
}
.stat .sub { color: var(--muted); font-size: 13.5px; }

/* The accent rule: the one device shared with the kiosk cause cards. */
.ruled { border-left: 5px solid var(--hairline); padding-left: 13px; }

/* ---- the queue that needs a human ---- */

.alert {
    background: #FFF6E5;
    border: 1px solid #F0DCB4;
    border-left: 5px solid var(--warn);
    border-radius: var(--radius);
    padding: 15px 18px;
    margin-bottom: 20px;
}
.alert strong { color: var(--warn); }

/* ---- chart ---- */

.chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 130px;
    margin-top: 8px;
}
.chart .bar {
    flex: 1;
    background: var(--ink);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    opacity: .82;
    position: relative;
}
.chart .bar:hover { opacity: 1; }
.chart .bar::after {
    content: attr(data-label);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    margin-bottom: 5px;
}
.chart .bar:hover::after { opacity: 1; }

/* ---- table ---- */

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 13px 14px;
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid #EDF1F5; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F7F9FB; }

.cause-cell { display: flex; align-items: center; gap: 10px; }
.swatch { width: 5px; height: 30px; border-radius: 3px; flex: none; background: var(--hairline); }

.pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.pill.ok { background: #E2F0EC; color: var(--ok); }
.pill.warn { background: #FBEFD8; color: var(--warn); }
.pill.muted { background: #EDF1F5; color: var(--muted); }

/* ---- forms ---- */

label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.field { margin-bottom: 15px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=color], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--hairline);
    border-radius: 9px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--ink);
    outline-offset: 1px;
    border-color: transparent;
}
textarea { min-height: 220px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.6; }
input[type=color] { height: 42px; padding: 4px; }

.btn {
    display: inline-block;
    background: var(--ink);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 9px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #1d2f3f; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
.btn.ghost:hover { background: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: var(--danger); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.row > .tight { flex: 0 0 auto; min-width: 0; }

.inline { display: inline; }

/* ---- token reveal ---- */

.token {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 14px;
    background: var(--ink);
    color: #7BE3C0;
    padding: 13px 15px;
    border-radius: 9px;
    word-break: break-all;
    user-select: all;
    margin-top: 10px;
}

/* ---- login ---- */

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 24px; margin-bottom: 3px; }

.error {
    background: #FBE9E9;
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: 10px 13px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.pager { display: flex; gap: 8px; margin-top: 18px; align-items: center; }
.pager a, .pager span { padding: 7px 12px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.pager a { background: #fff; box-shadow: var(--shadow); }
.pager .current { background: var(--ink); color: #fff; }

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

@media (max-width: 900px) {
    .grid.k4 { grid-template-columns: repeat(2, 1fr); }
    .grid.k2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .grid.k4 { grid-template-columns: 1fr; }
    .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; }
    main { padding: 18px 14px 60px; }
}

/* ---- language tabs ----
 * Radio inputs plus sibling selectors, so switching languages needs no JavaScript
 * and every panel keeps its inputs in the DOM — a half-written Italian translation
 * survives a tab switch and still posts with the form.
 */

.tabs { margin-top: 2px; }
.tabs > input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }

.tabstrip {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 16px;
}
.tabstrip label {
    margin: 0;
    padding: 9px 15px;
    border-radius: 9px 9px 0 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 7px;
}
.tabstrip label:hover { background: #F3F6F9; }

.tabpanel { display: none; }

#lang-sq:checked ~ .tabstrip label[for=lang-sq],
#lang-en:checked ~ .tabstrip label[for=lang-en],
#lang-it:checked ~ .tabstrip label[for=lang-it] {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
#lang-sq:checked ~ .panels .tabpanel[data-lang=sq],
#lang-en:checked ~ .panels .tabpanel[data-lang=en],
#lang-it:checked ~ .panels .tabpanel[data-lang=it] { display: block; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hairline); flex: none; }
.dot.filled { background: var(--ok); }

.lang-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 3px 9px;
    border-radius: 999px;
    background: #EDF1F5;
    color: var(--muted);
}
