/* SydLUG Ordering — shared design system ("Cupertino Clean").
   Token values are ported literally from SydLUGEvent's templates/base.html so
   the two SydLUG sites read as one visual family. --accent (#FECD01) is only
   ever a FILL colour (buttons, highlights) with dark text on top; --accent-ink
   (Marigold in light mode) is the colour for accent-coloured TEXT, links and
   borders, because any shade of the brand yellow dark enough to read as text on
   white looks brown. Dark mode follows prefers-color-scheme unless the nav toggle overrides it. */

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --text: #1d1d1f;
    --text-2: #6e6e73;
    --text-3: #86868b;
    --accent: #fecd01;
    --accent-text: #1a1a1a;
    --accent-ink: #c26100;
    --border: #e5e5e7;
    --border-strong: #d2d2d7;
    --ok: #1a8f4c;
    --ok-bg: #e9f7ee;
    --warn: #93691f;
    --warn-bg: #fdf1e2;
    --error: #c53929;
    --error-bg: #fbeae7;
    --neutral-pill: #f0f0f2;
    --neutral-pill-text: #6e6e73;
    --shadow: 0 1px 2px rgba(0,0,0,.04);
    --shadow-lift: 0 12px 28px rgba(0,0,0,.08);
    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 20px;
    --font-display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --label-w: 34%;
}
/* Dark palette applies when the OS prefers dark AND the user has not picked light,
   OR when the user explicitly picked dark via the nav toggle (data-theme on <html>).
   The two blocks below MUST be kept identical - plain CSS cannot share one rule set
   across a media query and an attribute selector. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #000000;
        --surface: #1c1c1e;
        --surface-2: #131314;
        --text: #f5f5f7;
        --text-2: #98989d;
        --text-3: #6e6e73;
        --accent: #fecd01;
        --accent-text: #1a1a1a;
        --accent-ink: #fecd01;
        --border: #38383a;
        --border-strong: #48484a;
        --ok: #32d74b;
        --ok-bg: #10281a;
        --warn: #ff9f0a;
        --warn-bg: #2c2210;
        --error: #ff6961;
        --error-bg: #2c1412;
        --neutral-pill: #2c2c2e;
        --neutral-pill-text: #98989d;
        --shadow: 0 1px 2px rgba(0,0,0,.4);
        --shadow-lift: 0 16px 32px rgba(0,0,0,.5);
    }
}
:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #131314;
    --text: #f5f5f7;
    --text-2: #98989d;
    --text-3: #6e6e73;
    --accent: #fecd01;
    --accent-text: #1a1a1a;
    --accent-ink: #fecd01;
    --border: #38383a;
    --border-strong: #48484a;
    --ok: #32d74b;
    --ok-bg: #10281a;
    --warn: #ff9f0a;
    --warn-bg: #2c2210;
    --error: #ff6961;
    --error-bg: #2c1412;
    --neutral-pill: #2c2c2e;
    --neutral-pill-text: #98989d;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-lift: 0 16px 32px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body { font-family: var(--font-body); margin: 0; padding: 0; color: var(--text); background: var(--bg); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.9rem; margin: 0 0 8px; }
h2 { font-size: 1.25rem; margin: 28px 0 8px; }
h3 { font-size: 1.05rem; margin: 22px 0 8px; }
a { color: var(--accent-ink); }
p { line-height: 1.55; }

/* ============ NAV HEADER ============ */
header.site-nav {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 14px 20px;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}
header.site-nav a { color: var(--text-2); text-decoration: none; margin-left: 18px; font-size: .92rem; }
header.site-nav a:hover { color: var(--text); }
header.site-nav .brand { display: flex; align-items: center; gap: 10px; }
header.site-nav .brand a { margin-left: 0; display: flex; }
header.site-nav .brand img { height: 30px; border-radius: 6px; }
header.site-nav .brand strong { font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em; color: var(--text); }
header.site-nav .nav-logout-form { display: inline; margin: 0; }
header.site-nav button.nav-logout-button {
    background: none; border: none; color: var(--text-2); margin-left: 18px; padding: 0;
    font: inherit; font-size: .92rem; font-weight: 400; cursor: pointer; transition: none;
}
header.site-nav button.nav-logout-button:hover { color: var(--text); filter: none; }
header.site-nav button.nav-logout-button:active { transform: none; }
header.site-nav button.theme-toggle {
    background: none; border: 1px solid var(--border-strong); color: var(--text-2);
    margin-left: 18px; padding: 3px 10px; border-radius: 999px;
    font: inherit; font-size: .85rem; font-weight: 400; cursor: pointer; transition: none;
}
header.site-nav button.theme-toggle:hover { color: var(--text); border-color: var(--text-3); background: none; filter: none; }
header.site-nav button.theme-toggle:active { transform: none; }

main { max-width: 900px; margin: 30px auto; padding: 0 20px 80px; }
main.wide { max-width: 1150px; }
main.mid { max-width: 1000px; }
main.narrow { max-width: 460px; }
main.form { max-width: 620px; }

/* ============ MESSAGES ============ */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.messages li { padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 8px; font-size: .92rem; }
.messages .error { background: var(--error-bg); color: var(--error); }
.messages .success { background: var(--ok-bg); color: var(--ok); }
.messages .warning { background: var(--warn-bg); color: var(--warn); }
.messages .info, .messages .debug { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.notice { padding: 12px 16px; border-radius: var(--radius-s); margin: 0 0 16px; font-size: .92rem;
          background: var(--warn-bg); color: var(--warn); }

/* ============ FORM CONTROLS ============ */
.field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
input, select, textarea, button { font-family: inherit; font-size: 1em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-s);
    background: var(--surface); color: var(--text); outline: none;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=search]:focus, textarea:focus, select:focus {
    border-color: var(--accent-ink);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-ink) 16%, transparent);
}
input[type=file] { width: auto; font-size: .85em; }
.errorlist { color: var(--error); font-size: .85em; list-style: none; padding: 0; margin: 4px 0 0; }
.help-text { font-size: .85rem; color: var(--text-3); margin: 0 0 14px; }

/* ============ BUTTONS ============
   Bare <button>/.button is the PRIMARY look (brand-yellow fill); .btn-ghost is
   secondary; .link-button is tertiary text. Inside table cells buttons shrink
   to a compact size so dense rows don't fill up with big yellow blocks. */
button, .button {
    font-family: var(--font-body); font-weight: 600; font-size: .92rem;
    padding: 10px 20px; border-radius: var(--radius-s); border: none; cursor: pointer;
    background: var(--accent); color: var(--accent-text);
    text-decoration: none; display: inline-block;
    transition: filter .15s ease, transform .15s ease;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:active, .button:active { transform: scale(.98); }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
td button, td .button, .compact-form button { padding: 5px 12px; font-size: .82rem; }
.btn-ghost, td button.btn-ghost {
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.link-button {
    background: none; border: none; padding: 0; margin: 0; color: var(--accent-ink);
    font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; display: inline;
}
.link-button:hover { text-decoration: underline; filter: none; }
.link-button.danger { color: var(--error); }
.link-csv { font-family: var(--font-mono); font-size: .82rem; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
.link-csv:hover { text-decoration: underline; }
.compact-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.compact-form select { width: auto; padding: 6px 10px; font-size: .85rem; }
form.inline { display: inline; margin: 0; }

/* ============ TABLES ============
   Below ~700px each row becomes a stacked card; data-label on each <td> supplies
   the label text through ::before (CSS can't read <th> content). */
table { width: 100%; border-collapse: collapse; background: var(--surface);
        border: 1px solid var(--border); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 8px; }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; font-size: .9rem; }
thead tr { background: var(--surface-2); }
th { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
tbody tr { border-top: 1px solid var(--border); }
tbody tr:first-child { border-top: none; }
.subtext { color: var(--text-3); font-size: .85rem; }

@media (max-width: 700px) {
    table, thead, tbody, tr, td { display: block; width: 100%; box-sizing: border-box; }
    thead { display: none; }
    table { border: none; background: none; }
    tbody tr { border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface);
               padding: 8px; margin-bottom: 12px; }
    tbody td { border-top: none; border-bottom: 1px solid var(--border);
               padding: 8px 4px 8px calc(var(--label-w) + 4px); position: relative; text-align: left; min-height: 1.4em; }
    tbody td:last-child { border-bottom: none; }
    tbody td::before { content: attr(data-label); position: absolute; left: 4px; top: 8px;
                       width: calc(var(--label-w) - 4px); font-weight: 700; color: var(--text-3); font-size: .78rem; }
    .search-bar { flex-direction: column; align-items: stretch; }
    .summary-grid { flex-direction: column; }
}

/* ============ PILLS / BADGES ============ */
.badge, .pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap;
}
a.badge { text-decoration: none; }
.badge-open, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.badge-upcoming, .badge-pending, .pill.warn { background: var(--warn-bg); color: var(--warn); }
.badge-closed, .badge-draft, .pill.neutral { background: var(--neutral-pill); color: var(--neutral-pill-text); }
.badge-warn, .pill.error { background: var(--error-bg); color: var(--error); }
.icon-yes { color: var(--ok); font-weight: 700; }
.icon-no { color: var(--error); font-weight: 700; }
.total-badge { display: inline-block; background: var(--accent); color: var(--accent-text);
               padding: 2px 10px; border-radius: 999px; font-weight: 700; }

/* ============ HERO ============ */
.hero-compact { padding: 6px 0 4px; }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
           color: var(--accent-ink); margin-bottom: 8px; }
.hero-compact h1 { margin: 0; }
.hero-compact .sub { margin-top: 8px; color: var(--text-2); font-size: 1rem; }
.back-link { display: inline-block; margin: 0 0 10px; font-size: .9rem; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ============ PANELS ============ */
.panel, .create-box, .summary-panel, .rate-info {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    box-shadow: var(--shadow); padding: 16px 20px; margin: 16px 0;
}
.panel.auth { margin-top: 20px; padding: 24px; }
.rate-info { display: inline-block; padding: 10px 16px; }
.rate-info span { margin-right: 20px; }
.summary-panel { display: flex; gap: 28px; flex-wrap: wrap; align-items: baseline; }
.summary-panel .value, .summary-stat .value { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; }
.summary-stat.over .value { color: var(--error); }
.commit-box {
    background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
    border-radius: var(--radius-m); padding: 16px 20px; margin: 20px 0;
}
.terms-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s);
             padding: 4px 18px; margin: 20px 0; max-height: 220px; overflow-y: auto; font-size: .92rem; }
.counter { margin: 14px 0; }
.summary-grid { display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.summary-slot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
                box-shadow: var(--shadow); padding: 12px 16px; flex: 1; min-width: 190px; }
.summary-slot .value { font-size: 1.1rem; font-weight: 700; }
.summary-item { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.summary-item-name { font-size: .9rem; line-height: 1.25; }

/* ============ TAB NAV ============ */
.tab-nav { margin: 20px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; }
.tab-nav a { display: inline-block; padding: 10px 4px; margin-right: 22px; text-decoration: none;
             color: var(--text-2); font-size: .9rem; font-weight: 500; border-bottom: 2px solid transparent; }
.tab-nav a:hover { color: var(--text); }
.tab-nav a.active { font-weight: 700; color: var(--text); border-bottom-color: var(--accent-ink); }

/* ============ SEARCH / PAGINATION / ITEM CELLS ============ */
.search-bar { margin: 16px 0; display: flex; gap: 8px; align-items: center; }
.search-bar input[type=text] { flex: 1; width: auto; }
.search-bar select { width: auto; }
.pagination { margin-top: 16px; font-size: .9rem; color: var(--text-2); }
.pagination a, .pagination span { margin-right: 10px; }
.item-thumb { height: 40px; display: block; flex-shrink: 0; border-radius: 4px; }
.item-thumb-small { height: 24px; display: block; border-radius: 3px; }
.item-cell { display: flex; align-items: center; gap: 10px; }
.qty-input { width: 64px; padding: 6px 8px; }
.qty-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qty-form label { font-size: .85em; color: var(--text-2); display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 500; }
.qty-form input[type=number] { width: 64px; padding: 5px 7px; }
.name-box { margin: 12px 0; }
.name-box input[type=text], .create-box input[type=text] { width: 100%; max-width: 320px; }

/* lists inside table cells */
.vote-list, .usage-list, .element-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: .9rem; }
.vote-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.vote-list .pv { display: inline-block; min-width: 1.8em; font-weight: 700; color: var(--accent-ink); }
.usage-list li { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.element-list-item { margin: 4px 0; display: flex; align-items: center; gap: 8px; }

/* row highlights */
tr.committed-row { background: var(--ok-bg); }
tr.over-limit-row, tr.unused-row { background: var(--error-bg); }

.text-error { color: var(--error); }

.banner { display: block; max-width: 100%; height: auto; border-radius: var(--radius-m); margin: 0 0 22px; }
