/* ==========================================================================
   Socivana — application design system
   ========================================================================== */

:root {
    color-scheme: light;

    /* Brand (from the logo: violet → blue → cyan) */
    --brand: #6a3ff0;
    --brand-strong: #5329d8;
    --brand-soft: #f2eeff;
    --brand-softer: #f8f6ff;
    --brand-line: #ddd3ff;
    --blue: #2f6bf5;
    --cyan: #14b4ea;
    --gradient: linear-gradient(120deg, #7a3ff0 0%, #4d5ff4 55%, #1d9ef0 100%);

    /* Neutrals */
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --surface-3: #f1f3f8;
    --border: #e5e8f0;
    --border-strong: #d3d8e4;
    --text: #131a38;
    --text-2: #475170;
    --text-3: #7b849d;
    --text-inverse: #ffffff;

    /* Status */
    --success: #0f7a58;
    --success-bg: #e7f6ef;
    --success-line: #bfe6d3;
    --warning: #9a5b08;
    --warning-bg: #fff4e0;
    --warning-line: #f3d9a8;
    --danger: #be3535;
    --danger-bg: #fdeeee;
    --danger-line: #f4cccc;
    --info: #2459c4;
    --info-bg: #eaf1ff;
    --info-line: #cbdafc;

    /* Shape */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(19, 26, 56, .05);
    --shadow-sm: 0 1px 3px rgba(19, 26, 56, .06), 0 1px 2px rgba(19, 26, 56, .04);
    --shadow: 0 6px 20px rgba(19, 26, 56, .07);
    --shadow-lg: 0 24px 60px rgba(19, 26, 56, .18);
    --focus: 0 0 0 3px rgba(106, 63, 240, .22);

    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Manrope", "Inter", "Segoe UI", sans-serif;
    --sidebar-width: 264px;
    --topbar-height: 64px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-height) + 16px); }
body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font: 400 14px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand-strong); text-decoration: none; }
a:hover { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); letter-spacing: -.01em; }
strong { font-weight: 600; }
code { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); font-size: .9em; }
::selection { background: #e5dcff; color: #2d1a72; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; z-index: 200; top: -60px; left: 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--text); color: #fff; }
.skip-link:focus { top: 12px; color: #fff; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    gap: 6px;
    padding: 18px 14px 14px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 14px; }
.sidebar-brand, .topbar-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.sidebar-brand:hover, .topbar-brand:hover { color: var(--text); }
.brand-mark { position: relative; display: block; width: 32px; height: 32px; flex: 0 0 auto; overflow: hidden; border-radius: 9px; background: #fff; }
.brand-mark img { position: absolute; top: -9px; left: -16px; width: 64px; max-width: none; }
.brand-word { font: 800 19px/1 var(--font-display); letter-spacing: -.03em; }
.sidebar .sidebar-close { display: none; }
.sidebar-society {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 2px 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.society-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    background: var(--gradient);
    color: #fff;
    font: 800 15px/1 var(--font-display);
}
.society-meta { display: grid; min-width: 0; line-height: 1.3; }
.society-meta strong { overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.society-meta span { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { display: grid; gap: 2px; }
.sidebar-bottom { display: grid; gap: 2px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-bottom form { margin: 0; }
.nav-link {
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.nav-icon { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-link.is-active .nav-icon { color: var(--brand); }
.nav-badge {
    min-width: 20px;
    margin-left: auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
}
.sidebar-backdrop { display: none; }

.app-main { display: flex; min-width: 0; flex: 1; flex-direction: column; margin-left: var(--sidebar-width); }
.topbar {
    position: sticky;
    z-index: 40;
    top: 0;
    display: flex;
    height: var(--topbar-height);
    align-items: center;
    gap: 12px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.4) blur(10px);
}
.topbar-spacer { flex: 1; }
.topbar .menu-button, .topbar .topbar-brand { display: none; }
.content { width: 100%; max-width: 1320px; flex: 1; margin: 0 auto; padding: 28px 32px 48px; outline: none; }
.app-footer { padding: 18px 32px 24px; color: var(--text-3); font-size: 12.5px; text-align: center; }

/* User menu */
.user-menu { position: relative; }
.user-menu > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px 5px 5px;
    border: 1px solid transparent;
    border-radius: 999px;
    list-style: none;
    cursor: pointer;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { border-color: var(--border); background: var(--surface-2); }
.user-menu-name { display: grid; line-height: 1.25; }
.user-menu-name strong { font-size: 13.5px; }
.user-menu-name span { color: var(--text-3); font-size: 12px; }
.menu-panel {
    position: absolute;
    z-index: 70;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: pop-in .14s ease-out;
}
.menu-header { display: grid; gap: 2px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-header strong { font-size: 14px; }
.menu-header span { overflow: hidden; color: var(--text-3); font-size: 12.5px; text-overflow: ellipsis; }
.menu-panel form { margin: 0; }
.menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font-size: 14px;
    text-align: left;
}
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item.danger { color: var(--danger); }
.menu-item .icon { color: var(--text-3); }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.page-heading { min-width: 0; max-width: 760px; }
.eyebrow { margin-bottom: 6px; color: var(--brand); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.page-header h1 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; line-height: 1.2; letter-spacing: -.025em; }
.page-subtitle { margin-top: 6px; color: var(--text-2); font-size: 15px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--text-3); font-size: 13.5px; font-weight: 500; }
.back-link:hover { color: var(--brand-strong); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { border-color: #c2c8d6; background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { border-color: transparent; background: var(--brand); box-shadow: 0 1px 2px rgba(83, 41, 216, .3), inset 0 1px 0 rgba(255, 255, 255, .12); color: #fff; }
.btn-primary:hover { border-color: transparent; background: var(--brand-strong); color: #fff; }
.btn-gradient { border-color: transparent; background: var(--gradient); color: #fff; box-shadow: 0 6px 16px rgba(83, 61, 240, .25); }
.btn-gradient:hover { border-color: transparent; color: #fff; filter: brightness(1.05); background: var(--gradient); }
.btn-soft { border-color: transparent; background: var(--brand-soft); box-shadow: none; color: var(--brand-strong); }
.btn-soft:hover { border-color: transparent; background: #e8e1ff; color: var(--brand-strong); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { border-color: transparent; background: var(--surface-3); }
.btn-danger { border-color: transparent; background: var(--danger); color: #fff; }
.btn-danger:hover { border-color: transparent; background: #a32b2b; color: #fff; }
.btn-danger-soft { border-color: var(--danger-line); background: var(--danger-bg); box-shadow: none; color: var(--danger); }
.btn-danger-soft:hover { border-color: #eab7b7; background: #fbe3e3; color: var(--danger); }
.btn-success { border-color: transparent; background: var(--success); color: #fff; }
.btn-success:hover { border-color: transparent; background: #0b6247; color: #fff; }
.btn-success-soft { border-color: var(--success-line); background: var(--success-bg); box-shadow: none; color: var(--success); }
.btn-success-soft:hover { border-color: #a5dbc2; background: #d9f1e6; color: var(--success); }
.btn-sm { min-height: 32px; gap: 6px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text-2);
}
.icon-button:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.icon-button.danger:hover { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.link-button { padding: 0; border: 0; background: none; color: var(--brand-strong); font-weight: 600; }
.link-button:hover { color: var(--brand); text-decoration: underline; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
form.inline { display: inline; margin: 0; }

/* ---------- Cards ---------- */
.card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 20px; }
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-header.plain { border-bottom: 0; padding-bottom: 4px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.card-subtitle { margin-top: 3px; color: var(--text-3); font-size: 13.5px; }
.card-body { padding: 20px 22px; }
.card-body.tight { padding: 12px 22px; }
.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-flush .card-body { padding: 0; }
.card-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; }

/* ---------- Layout helpers ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-aside { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-aside-main { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.stack-sm { display: grid; gap: 10px; align-content: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row > .select, .row > .input { width: auto; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.muted { color: var(--text-3); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { margin: 28px 0 12px; font-size: 15px; font-weight: 700; }
.section-title:first-child { margin-top: 0; }
.divider { height: 1px; margin: 18px 0; border: 0; background: var(--border); }
.sticky-aside { position: sticky; top: calc(var(--topbar-height) + 20px); }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
a.stat-card:hover { border-color: var(--brand-line); color: var(--text); box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.stat-icon { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.stat-icon .icon { width: 19px; height: 19px; }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-value { margin-top: 6px; font: 800 28px/1.1 var(--font-display); letter-spacing: -.03em; }
.stat-value small { color: var(--text-3); font-size: 15px; font-weight: 600; letter-spacing: 0; }
.stat-caption { color: var(--text-3); font-size: 13px; }

/* ---------- Progress ---------- */
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--gradient); transition: width .3s ease; }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: #e39a2d; }
.progress.danger > span { background: var(--danger); }
.progress-stack { display: flex; height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress-stack > span { display: block; height: 100%; }
.progress-stack .seg-present { background: #22a477; }
.progress-stack .seg-maybe { background: #eaa53d; }
.progress-stack .seg-absent { background: #e06363; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--text-3); }
.legend-dot.present, .dot-present { background: #22a477; }
.legend-dot.maybe, .dot-maybe { background: #eaa53d; }
.legend-dot.absent, .dot-absent { background: #e06363; }
.legend-dot.pending, .dot-pending { background: #a3abbd; }
.legend-dot.brand { background: var(--brand); }
.legend-dot.cyan { background: var(--cyan); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.field > label, .field-label { color: var(--text); font-size: 13.5px; font-weight: 600; }
.field-optional { color: var(--text-3); font-weight: 400; }
.field-hint { color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.input, .select, .textarea,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field select, .select {
    padding-right: 36px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b849d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px;
}
.field textarea, .textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover,
.field input:not([type="checkbox"]):not([type="radio"]):hover, .field select:hover, .field textarea:hover { border-color: #bfc6d5; }
.input:focus, .select:focus, .textarea:focus,
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field select:focus, .field textarea:focus { border-color: var(--brand); outline: none; box-shadow: var(--focus); }
.field input:disabled, .field select:disabled { background: var(--surface-3); color: var(--text-3); }
::placeholder { color: #9aa2b6; opacity: 1; }
input[type="date"], input[type="time"] { min-width: 0; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.input-group .input { padding-left: 38px; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; top: 50%; left: 12px; color: var(--text-3); font-size: 13.5px; transform: translateY(-50%); pointer-events: none; }
.input-prefix > input { padding-left: 46px !important; }
.check { display: flex; align-items: flex-start; gap: 10px; color: var(--text); font-size: 14px; line-height: 1.4; cursor: pointer; }
.check input { width: 17px; height: 17px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; }
.check small { display: block; margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 4px 12px;
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.check-list .check { padding: 5px 0; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-section + .form-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-section-title { margin-bottom: 12px; font-size: 14px; font-weight: 700; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

/* Segmented control (radio buttons styled as pills) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-3); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented span .icon { width: 16px; height: 16px; }
.segmented label:hover span { color: var(--text); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }
.segmented input:checked + span { background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border-strong); color: var(--brand-strong); }
.segmented input[value="present"]:checked + span { background: var(--success-bg); box-shadow: inset 0 0 0 1px var(--success-line); color: var(--success); }
.segmented input[value="maybe"]:checked + span { background: var(--warning-bg); box-shadow: inset 0 0 0 1px var(--warning-line); color: var(--warning); }
.segmented input[value="absent"]:checked + span { background: var(--danger-bg); box-shadow: inset 0 0 0 1px var(--danger-line); color: var(--danger); }

/* ---------- Tabs & chips ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -1px;
    padding: 10px 14px 12px;
    border-bottom: 2px solid transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { border-bottom-color: var(--brand); color: var(--brand-strong); }
.tab .icon { width: 17px; height: 17px; }
.tab-count { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; text-align: center; }
.tab.active .tab-count { background: var(--brand-soft); color: var(--brand-strong); }
.tab-count.is-alert, .tab.active .tab-count.is-alert { background: var(--danger); color: #fff; }
.table .person-meta { min-width: 150px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.chip .count { color: var(--text-3); font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.toolbar .input-group { min-width: 220px; flex: 1; max-width: 360px; }
.toolbar .select { width: auto; min-width: 150px; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .03em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: var(--brand-softer); }
.table td strong, .table .cell-title { color: var(--text); font-weight: 600; }
.table .cell-sub { display: block; margin-top: 2px; color: var(--text-3); font-size: 13px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { width: 1%; text-align: right; white-space: nowrap; }
.table .actions .row { flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
.table-row-link { cursor: pointer; }
.person { display: flex; min-width: 0; align-items: center; gap: 12px; }
.person-meta { display: grid; min-width: 0; line-height: 1.3; }
.person-meta strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.person-meta span { overflow: hidden; color: var(--text-3); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
a.person:hover strong { color: var(--brand-strong); }
.table-empty td { padding: 32px 16px; color: var(--text-3); text-align: center; }

/* ---------- Badges & avatars ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge-success { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.badge-warning { border-color: var(--warning-line); background: var(--warning-bg); color: var(--warning); }
.badge-danger { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.badge-info { border-color: var(--info-line); background: var(--info-bg); color: var(--info); }
.badge-brand { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-strong); }
.badge-neutral { border-color: var(--border); background: var(--surface-2); color: var(--text-2); }
.badge-dot::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.avatar {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #ece6ff, #ddeeff);
    color: var(--brand-strong);
    font: 700 13.5px/1 var(--font);
    letter-spacing: .02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 21px; }
.avatar-xl { width: 80px; height: 80px; font-size: 26px; }
.avatar.c1 { background: linear-gradient(135deg, #ece6ff, #e4dcff); color: #5329d8; }
.avatar.c2 { background: linear-gradient(135deg, #dff3ff, #cfe9ff); color: #1d6fc2; }
.avatar.c3 { background: linear-gradient(135deg, #defaef, #ccf0e1); color: #0f7a58; }
.avatar.c4 { background: linear-gradient(135deg, #fff0db, #ffe5c2); color: #a05b06; }
.avatar.c5 { background: linear-gradient(135deg, #ffe4ec, #ffd5e1); color: #b32857; }

/* ---------- Alerts ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--info-line);
    border-radius: var(--radius);
    background: var(--info-bg);
    color: #1b3f86;
    font-size: 14px;
    line-height: 1.5;
    animation: pop-in .2s ease-out;
}
.alert-icon { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 1px; }
.alert-success { border-color: var(--success-line); background: var(--success-bg); color: #0b5a41; }
.alert-error { border-color: var(--danger-line); background: var(--danger-bg); color: #8e2424; }
.alert-warning { border-color: var(--warning-line); background: var(--warning-bg); color: #774506; }
.callout { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 13.5px; }
.callout strong { color: var(--text); }
.callout-brand { border-color: var(--brand-line); background: var(--brand-softer); }

/* ---------- Empty states ---------- */
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 44px 24px; color: var(--text-2); text-align: center; }
.empty-state-icon { width: 46px; height: 46px; margin-bottom: 6px; padding: 11px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.empty-state h2, .empty-state h3, .empty-state h1 { font-size: 17px; }
.empty-state p { max-width: 420px; color: var(--text-3); }
.empty-state .btn { margin-top: 10px; }
.empty-state-page { margin: 8vh auto; max-width: 520px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-sm); }
.empty-state-page h1 { font-size: 22px; }
.empty-inline { padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3); font-size: 13.5px; text-align: center; }

/* ---------- Lists ---------- */
.list { display: grid; margin: 0; padding: 0; list-style: none; }
.list-item { display: flex; min-width: 0; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); color: var(--text); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--brand-softer); color: var(--text); }
.list-item-main { display: grid; min-width: 0; flex: 1; gap: 2px; }
.list-item-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-main span { overflow: hidden; color: var(--text-3); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.list-item-icon { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.list-item-icon.orange { background: var(--warning-bg); color: var(--warning); }
.list-item-icon.blue { background: var(--info-bg); color: var(--info); }
.list-item-icon.green { background: var(--success-bg); color: var(--success); }
.list-item-icon.red { background: var(--danger-bg); color: var(--danger); }
.date-tile { display: grid; width: 48px; height: 52px; flex: 0 0 auto; align-content: center; justify-items: center; border: 1px solid var(--brand-line); border-radius: 12px; background: var(--brand-softer); color: var(--brand-strong); line-height: 1.05; }
.date-tile strong { font: 800 19px/1 var(--font-display); }
.date-tile span { margin-top: 3px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--text-3); font-size: 13px; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-item .icon { width: 15px; height: 15px; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { min-width: 0; margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* ---------- Modals ---------- */
dialog.modal {
    width: min(640px, calc(100% - 24px));
    max-height: min(90vh, 880px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .18s ease-out; }
dialog.modal-lg { width: min(860px, calc(100% - 24px)); }
dialog.modal-sm { width: min(460px, calc(100% - 24px)); }
dialog.modal::backdrop { background: rgba(15, 20, 45, .5); backdrop-filter: blur(2px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 19px; font-weight: 800; }
.modal-header p { margin-top: 4px; color: var(--text-3); font-size: 13.5px; }
.modal-body { flex: 1; min-height: 0; padding: 20px 22px; overflow-y: auto; }
.modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal form { display: flex; min-height: 0; flex: 1; flex-direction: column; margin: 0; }
.modal-body > .alert:first-child { margin-top: 0; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Charts ---------- */
.bar-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 8px; height: 200px; padding-top: 12px; }
.bar-col { display: flex; height: 100%; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.bar-pair { display: flex; width: 100%; height: 100%; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: min(14px, 40%); min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--brand); }
.bar.alt { background: var(--cyan); }
.bar.empty { background: var(--surface-3); }
.bar-label { color: var(--text-3); font-size: 11.5px; }
.hbar-list { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 54px; align-items: center; gap: 12px; font-size: 13.5px; }
.hbar-label { overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.donut { position: relative; display: grid; width: 132px; height: 132px; flex: 0 0 auto; place-items: center; border-radius: 50%; }
.donut::after { position: absolute; inset: 16px; border-radius: 50%; background: var(--surface); content: ""; }
.donut-label { position: relative; z-index: 1; display: grid; justify-items: center; line-height: 1.1; }
.donut-label strong { font: 800 24px/1 var(--font-display); }
.donut-label span { margin-top: 4px; color: var(--text-3); font-size: 12px; }

/* ---------- Poll / event cards ---------- */
.event-card { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.event-card:last-child { border-bottom: 0; }
.event-card-head { display: flex; align-items: flex-start; gap: 14px; }
.event-card-body { min-width: 0; flex: 1; }
.event-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; font-size: 15.5px; font-weight: 700; }
.event-card-title a { color: var(--text); }
.event-card-title a:hover { color: var(--brand-strong); }
.event-card-desc { margin-top: 8px; color: var(--text-2); font-size: 14px; white-space: pre-line; }
.response-box { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.response-box .form-actions { margin-top: 12px; }
.response-box .field + .field { margin-top: 12px; }
.response-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.response-summary .progress-stack { width: 180px; }

/* ---------- Calendar ---------- */
.calendar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.calendar-head h2 { font-size: 19px; font-weight: 800; text-transform: capitalize; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.calendar-weekdays span { padding: 9px 10px; color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.calendar-day { position: relative; min-height: 118px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: var(--surface-2); }
.calendar-day.outside .day-number { color: #b6bccb; }
.calendar-day.is-selected { background: var(--brand-softer); box-shadow: inset 0 0 0 2px var(--brand-line); }
.day-number { display: inline-grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
button.day-number:hover { background: var(--surface-3); }
.calendar-day.is-today .day-number { background: var(--brand); color: #fff; }
.day-events { display: grid; gap: 4px; margin-top: 4px; }
.day-event {
    display: block;
    width: 100%;
    overflow: hidden;
    padding: 4px 7px;
    border: 0;
    border-left: 3px solid var(--text-3);
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.day-event:hover { filter: brightness(.97); }
.day-event .time { color: var(--text-3); font-weight: 600; margin-right: 4px; }
.day-event.present { border-left-color: #22a477; background: #e9f7f0; }
.day-event.maybe { border-left-color: #eaa53d; background: #fff4e2; }
.day-event.absent { border-left-color: #e06363; background: #fdeeee; }
.day-event.pending { border-left-color: var(--brand); background: var(--brand-soft); }
.day-event.not-invited { border-left-color: #a3abbd; background: var(--surface-3); color: var(--text-2); }
.day-more { padding: 0 6px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.day-dots { display: none; justify-content: center; gap: 3px; margin-top: 2px; }
.day-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }

/* ---------- Misc components ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; letter-spacing: .02em; }
.danger-text { color: var(--danger) !important; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { min-height: 34px; font-size: 13px; background: rgba(255, 255, 255, .7); }
.address-field { position: relative; }
.suggestions { position: absolute; z-index: 20; top: 70px; right: 0; left: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.suggestion { display: block; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font-size: 14px; text-align: left; }
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover, .suggestion[aria-selected="true"] { background: var(--brand-softer); }
.input-prefix.suffix > input { padding-left: 12px !important; padding-right: 56px !important; }
.input-prefix .suffix-label { position: absolute; top: 50%; right: 12px; color: var(--text-3); font-size: 13.5px; transform: translateY(-50%); pointer-events: none; }
.rate { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rate-bar { display: block; width: 56px; height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.rate-bar > span { display: block; height: 100%; border-radius: inherit; }
.rate-success .rate-bar > span { background: #22a477; }
.rate-warning .rate-bar > span { background: #eaa53d; }
.rate-danger .rate-bar > span { background: #e06363; }
.mini-stat { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.mini-stat-label { color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.mini-stat-value { font: 800 26px/1 var(--font-display); letter-spacing: -.02em; }
.mini-stat-caption { color: var(--text-3); font-size: 12.5px; }
.bar.wide { width: min(22px, 70%); }
.donut-row { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; }
.donut-legend { display: grid; flex: 1; gap: 12px; min-width: 180px; margin: 0; padding: 0; list-style: none; }
.donut-legend li { display: grid; grid-template-columns: 12px 1fr auto 44px; align-items: center; gap: 10px; font-size: 14px; }
.donut-legend li .muted { text-align: right; }
.fee-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fee-summary > div { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.fee-summary span { color: var(--text-3); font-size: 12.5px; }
.fee-summary strong { font-size: 15px; }
.fee-summary small { color: var(--text-3); font-size: 12px; }
.permission-group { display: grid; gap: 8px; }
.permission-group + .permission-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.permission-group legend { margin-bottom: 8px; color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.role-card { display: flex; flex-direction: column; }
.role-card + .role-card { margin-top: 0; }
.role-card form { display: flex; flex: 1; flex-direction: column; }
.role-card .card-body { flex: 1; }
.role-name-field { flex: 1; min-width: 160px; }
.role-name-field input { font-weight: 700; font-size: 15px !important; }
.role-name-field input[readonly] { border-color: transparent !important; background: transparent !important; box-shadow: none !important; padding-left: 0 !important; }
.role-admin { background: linear-gradient(160deg, var(--brand-softer), var(--surface) 60%); }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.member-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; }
.member-hero-main { display: flex; min-width: 0; align-items: center; gap: 18px; }
.member-hero-text { min-width: 0; }
.member-hero h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.member-hero .meta a { color: var(--text-2); }
.member-hero .meta a:hover { color: var(--brand-strong); }
.invoice-list .list-item { padding-top: 12px; padding-bottom: 12px; }

.select-sm { min-height: 32px !important; padding: 4px 30px 4px 10px !important; font-size: 13px !important; background-position: right 8px center !important; }
.link-reset { padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.link-reset:hover strong { color: var(--brand-strong); }
.event-accent { width: 4px; align-self: stretch; min-height: 36px; flex: 0 0 auto; border-radius: 4px; background: var(--brand); }
.event-accent.present { background: #22a477; }
.event-accent.maybe { background: #eaa53d; }
.event-accent.absent { background: #e06363; }
.event-accent.not-invited { background: #a3abbd; }
.excuse-quote { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--brand-line); border-radius: 0 8px 8px 0; background: var(--brand-softer); color: var(--text-2); font-size: 13.5px; font-style: italic; white-space: normal; }
.excuse-quote small { display: block; margin-top: 4px; color: var(--text-3); font-size: 12px; font-style: normal; }
.invitee-item, .excuse-item { align-items: flex-start; }
.invitee-item .list-item-main span, .excuse-item .list-item-main span { white-space: normal; }
.invitee-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; max-width: 60%; }
.stat-inline { font: 800 18px/1 var(--font-display); }
.group-details summary { color: var(--text-2); font-size: 14px; list-style: none; cursor: pointer; }
.group-details summary::-webkit-details-marker { display: none; }
.group-details[open] .link-button { display: none; }
.callout .icon { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.calendar-card { overflow: hidden; }
@media (max-width: 1360px) { .day-event .time { display: none; } }
.calendar-legend { justify-content: flex-start; }
@media (max-width: 560px) {
    .invitee-item { flex-wrap: wrap; }
    .invitee-actions { max-width: none; width: 100%; justify-content: flex-start; padding-left: 46px; }
    .excuse-item { flex-wrap: wrap; }
}

/* ---------- Pictures ---------- */
img.avatar { object-fit: cover; background: var(--surface-3); }
img.society-avatar, img.society-logo { object-fit: cover; background: #fff; border: 1px solid var(--border); }
.photo-uploader { display: grid; flex: 0 0 auto; justify-items: center; gap: 6px; }
.photo-uploader form { margin: 0; }
.photo-frame { position: relative; display: block; border-radius: 50%; cursor: pointer; }
.photo-square .photo-frame { border-radius: 22px; }
.photo-frame .photo-overlay { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: rgba(15, 20, 45, .45); color: #fff; opacity: 0; transition: opacity .15s ease; }
.photo-frame:hover .photo-overlay, .photo-uploader form:focus-within .photo-overlay { opacity: 1; }
.photo-frame .photo-overlay .icon { width: 24px; height: 24px; }
.is-uploading .photo-frame { opacity: .55; pointer-events: none; }
.is-uploading .photo-overlay { opacity: 1; }
.photo-hint, .photo-remove .link-button { color: var(--text-3); }
.society-logo-xl { display: grid; width: 96px; height: 96px; place-items: center; border-radius: 22px; background: var(--gradient); color: #fff; font: 800 38px/1 var(--font-display); }
img.society-logo-xl { background: #fff; }

/* ---------- Dashboard ---------- */
.app-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app-tile { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: border-color .15s ease, background-color .15s ease; }
.app-tile:hover { border-color: var(--brand-line); background: var(--brand-softer); color: var(--text); }
.app-tile > span:last-child { display: grid; min-width: 0; line-height: 1.3; }
.app-tile strong { font-size: 14px; }
.app-tile small { overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1180px) { .app-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .app-tiles { grid-template-columns: 1fr 1fr; } }

/* ---------- Volunteering ---------- */
.shift-builder { display: grid; gap: 12px; }
.shift-row { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.shift-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
.shift-day { display: flex; align-items: center; gap: 8px; padding: 10px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.shift-item { align-items: flex-start; }
.shift-item.is-mine { background: linear-gradient(90deg, var(--success-bg), transparent 45%); }
.shift-time { display: grid; width: 56px; flex: 0 0 auto; padding-top: 1px; line-height: 1.3; }
.shift-time strong { font: 700 15px/1.2 var(--font-display); }
.shift-time span { color: var(--text-3); font-size: 13px; }
.shift-item .list-item-main strong, .shift-item .list-item-main > span { white-space: normal; }
.shift-side { display: grid; width: 150px; flex: 0 0 auto; justify-items: end; gap: 8px; }
.shift-side .progress { width: 100%; height: 6px; }
.capacity { color: var(--text-3); font-size: 13px; }
.capacity strong { color: var(--text); font-size: 15px; }
.volunteer-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.person-chip.empty { padding: 3px 10px; border-style: dashed; background: transparent; color: var(--text-3); }
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }
.chip-remove { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); font-size: 15px; line-height: 1; }
.chip-remove:hover { background: var(--danger-bg); color: var(--danger); }
@media (max-width: 560px) {
    .shift-item { flex-wrap: wrap; }
    .shift-side { width: 100%; grid-template-columns: auto 1fr auto; align-items: center; justify-items: stretch; }
}

/* ---------- Tournament ---------- */
.page-tournament .layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); align-items: start; gap: 20px; }
.page-tournament .layout > aside { display: grid; gap: 16px; }
.page-tournament .panel { min-width: 0; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.page-tournament .panel h2 { margin-bottom: 6px; font-size: 16px; font-weight: 700; }
.page-tournament .panel-intro { margin: 0 0 16px; color: var(--text-3); font-size: 13.5px; }
.page-tournament .field { margin-bottom: 14px; }
.page-tournament .field-help { margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.page-tournament .grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.page-tournament .check { margin: 10px 0; font-size: 13.5px; }
.page-tournament .primary-button, .page-tournament .secondary-button, .page-tournament .danger-button,
.page-tournament .timer-start-all, .page-tournament .timer-start {
    display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px;
    border: 0; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color .15s ease;
}
.page-tournament .primary-button { width: 100%; background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(83, 41, 216, .3); }
.page-tournament .primary-button:hover { background: var(--brand-strong); }
.page-tournament .primary-button:disabled { background: #b8bdcc; box-shadow: none; cursor: not-allowed; }
.page-tournament .secondary-button { background: var(--brand-soft); color: var(--brand-strong); }
.page-tournament .secondary-button:hover { background: #e8e1ff; }
.page-tournament .danger-button { min-height: 30px; padding: 0 10px; background: var(--danger-bg); color: var(--danger); font-size: 13px; }
.page-tournament .danger-button:hover { background: #fbe0e0; }
.page-tournament .full { width: 100%; }
.page-tournament .tournament-list h2 { margin-bottom: 10px; }
.page-tournament .tournament-entry { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.page-tournament .tournament-link { display: flex; flex: 1; min-width: 0; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; color: var(--text); font-size: 14px; font-weight: 600; }
.page-tournament .tournament-link:hover { background: var(--surface-2); }
.page-tournament .tournament-link.active { border-color: var(--brand-line); background: var(--brand-softer); color: var(--brand-strong); }
.page-tournament .tournament-link small { color: var(--text-3); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.page-tournament .tournament-delete { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); font-size: 18px; cursor: pointer; }
.page-tournament .tournament-delete:hover { background: var(--danger-bg); color: var(--danger); }
.page-tournament .empty-list { color: var(--text-3); font-size: 13.5px; }
.page-tournament .placeholder { padding: 48px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.page-tournament .placeholder h2 { margin-bottom: 6px; font-size: 18px; }
.page-tournament .placeholder p { max-width: 460px; margin: 0 auto; color: var(--text-3); }
.page-tournament .tournament-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-tournament .tournament-heading h2 { font-size: 19px; font-weight: 800; }
.page-tournament .tournament-heading p { color: var(--text-3); font-size: 13.5px; }
.page-tournament .badge { padding: 5px 11px; }
.page-tournament .stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.page-tournament .stat { padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.page-tournament .stat strong { color: var(--text); }
.page-tournament .team-list { display: grid; gap: 6px; max-height: 300px; overflow: auto; padding-right: 3px; }
.page-tournament .participant-management .team-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-tournament .team-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.page-tournament .team-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.page-tournament .team-meta { display: flex; align-items: center; gap: 6px; }
.page-tournament .team-row select { min-height: 32px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 13px; }
.page-tournament .disqualified { color: var(--danger); text-decoration: line-through; }
.page-tournament .status-tag { padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.page-tournament .team-roster { margin: 12px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.page-tournament .team-roster summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--text); font-size: 14px; font-weight: 600; list-style: none; cursor: pointer; }
.page-tournament .team-roster summary::-webkit-details-marker { display: none; }
.page-tournament .team-roster summary span { color: var(--brand-strong); font-size: 13px; }
.page-tournament .team-roster-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 0 10px 10px; }
.page-tournament .team-chip { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-size: 13.5px; }
.page-tournament .team-chip .danger-button { min-width: 26px; min-height: 26px; padding: 0; font-size: 16px; }
.page-tournament .pool-recommendation { margin: -2px 0 14px; padding: 12px 14px; border: 1px solid var(--brand-line); border-radius: var(--radius); background: var(--brand-softer); }
.page-tournament .pool-recommendation p { margin: 0 0 8px; color: var(--text-2); font-size: 13px; }
.page-tournament .pool-recommendation strong { color: var(--brand-strong); }
.page-tournament .recommendation-button { padding: 0; border: 0; background: none; color: var(--brand-strong); font-size: 13px; font-weight: 600; cursor: pointer; }
.page-tournament .phase-transition { display: flex; align-items: flex-start; gap: 12px; margin: 10px 0 16px; padding: 16px; border: 1px solid var(--success-line); border-radius: var(--radius); background: linear-gradient(115deg, var(--success-bg), var(--info-bg)); color: #0b5a41; }
.page-tournament .phase-transition strong { display: block; margin-bottom: 4px; font: 700 15px var(--font-display); }
.page-tournament .phase-transition p { color: var(--text-2); font-size: 13.5px; }
.page-tournament .phase-icon { font-size: 24px; }
.page-tournament .qualification-choice { border-color: var(--brand-line); background: linear-gradient(115deg, var(--brand-softer), var(--info-bg)); color: var(--brand-strong); }
.page-tournament .advancement-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.page-tournament .advancement-option { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.page-tournament .advancement-option h3 { margin-bottom: 4px; font-size: 14px; }
.page-tournament .advancement-option p { margin-bottom: 10px; color: var(--text-3); font-size: 13px; }
.page-tournament .qualifier-pool { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.page-tournament .qualifier-pool legend { padding: 0 6px; color: var(--brand-strong); font-size: 13px; font-weight: 700; }
.page-tournament .qualifier-choice { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 8px; padding: 7px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.page-tournament .qualifier-choice input { grid-row: span 2; accent-color: var(--brand); }
.page-tournament .qualifier-choice span { overflow-wrap: anywhere; font-weight: 600; }
.page-tournament .qualifier-choice small { color: var(--text-3); font-size: 12px; }
.page-tournament .round { margin-top: 22px; }
.page-tournament .round h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.page-tournament .round-count { padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font: 600 12.5px var(--font); }
.page-tournament .matches { display: grid; gap: 10px; }
.page-tournament .match { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.page-tournament .match-active { border-color: var(--brand-line); box-shadow: 0 6px 18px rgba(83, 41, 216, .08); }
.page-tournament .match-details { min-width: 0; }
.page-tournament .match-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.page-tournament .match-teams { display: grid; gap: 6px; }
.page-tournament .match-team { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 15px; }
.page-tournament .match-team.winner { color: var(--success); font-weight: 700; }
.page-tournament .match-team strong { min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.page-tournament .court-tag { display: inline-flex; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.page-tournament .match-note { grid-column: 1 / -1; color: var(--success); font-size: 13px; font-weight: 600; }
.page-tournament .match-score { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.page-tournament .match-score input[type=number] { width: 62px; height: 50px; border: 2px solid var(--border-strong); border-radius: 10px; background: #fff; color: var(--text); font-size: 22px; font-weight: 800; text-align: center; }
.page-tournament .match-score input[type=number]:focus { border-color: var(--brand); outline: none; box-shadow: var(--focus); }
.page-tournament .match-timer-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.page-tournament .match-timer { min-width: 86px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font: 700 14px var(--font-display); font-variant-numeric: tabular-nums; }
.page-tournament .match-timer.running { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.page-tournament .match-timer.expired { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.page-tournament .timer-start { min-height: 32px; padding: 0 12px; background: var(--brand); color: #fff; font-size: 13px; }
.page-tournament .timer-start:hover { background: var(--brand-strong); }
.page-tournament .timer-start-all { margin: 0 0 12px; background: var(--success); color: #fff; }
.page-tournament .timer-start-all:hover { background: #0b6247; }
.page-tournament .timer-pause-all { background: var(--danger); }
.page-tournament .timer-pause-all:hover { background: #a32b2b; }
.page-tournament .validate-scores { margin-top: 12px; }
.page-tournament .next-round { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.page-tournament .score-edit-form { display: flex; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.page-tournament .score-edit-form label { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.page-tournament .score-edit-form input { width: 52px; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; text-align: center; font-weight: 700; }
.page-tournament .score-edit-form .secondary-button { min-height: 34px; font-size: 13px; }
.page-tournament .pool-standings { margin: 12px 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.page-tournament .pool-standings h4 { margin-bottom: 8px; font-size: 14px; }
.page-tournament .standings-wrap { overflow-x: auto; }
.page-tournament .standings { width: 100%; border-collapse: collapse; font-size: 14px; text-align: center; white-space: nowrap; }
.page-tournament .standings th { padding: 9px 8px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.page-tournament .standings td { padding: 9px 8px; border-top: 1px solid var(--border); color: var(--text-2); }
.page-tournament .standings td:first-child, .page-tournament .standings th:first-child { text-align: left; }
.page-tournament .standings td:first-child { color: var(--text); font-weight: 600; }
.page-tournament .standings td:last-child { color: var(--brand-strong); font-weight: 800; }
.page-tournament .podium-section { margin-top: 18px; padding: 18px; border: 1px solid var(--brand-line); border-radius: var(--radius-lg); background: linear-gradient(115deg, var(--brand-softer), var(--info-bg)); }
.page-tournament .podium-section h3 { margin-bottom: 12px; font-size: 16px; }
.page-tournament .podium-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.page-tournament .podium-place { display: flex; min-height: 76px; flex-direction: column; justify-content: center; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.page-tournament .podium-rank { color: var(--text-3); font: 800 16px var(--font-display); }
.page-tournament .podium-name { overflow-wrap: anywhere; color: var(--text); font-size: 14px; font-weight: 700; }
.page-tournament .place-1 { border-color: #e8cf75; background: #fffbea; }
.page-tournament .place-1 .podium-rank { color: #a47d08; }
.page-tournament .place-3 { border-color: #e4b28b; background: #fff7f1; }
.page-tournament .step-indicator { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.page-tournament .step-indicator span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-size: 13px; font-weight: 600; }
.page-tournament .step-indicator span.active { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-strong); }
.page-tournament .step-indicator span.done { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.page-tournament .subheading { margin: 20px 0 10px; font-size: 15px; }
.page-tournament .previous-results, .page-tournament .participant-management { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.page-tournament .previous-results summary, .page-tournament .participant-management summary { color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; }
.page-tournament .previous-results .matches, .page-tournament .participant-management .team-list { margin-top: 12px; }
.page-tournament .rules { margin-top: 10px; color: var(--text-3); font-size: 13px; }
.page-tournament .winner-banner { margin-top: 16px; padding: 14px; border: 1px solid var(--brand-line); border-radius: var(--radius); background: var(--brand-softer); color: var(--brand-strong); font-weight: 600; }
@media (max-width: 1180px) { .page-tournament .layout { grid-template-columns: minmax(0, 1fr); } .page-tournament .workspace { order: -1; } }
@media (max-width: 560px) {
    .page-tournament .match { grid-template-columns: 1fr; }
    .page-tournament .podium-list, .page-tournament .advancement-options { grid-template-columns: 1fr 1fr; }
    .page-tournament .team-roster-list, .page-tournament .qualifier-pool, .page-tournament .participant-management .team-list { grid-template-columns: 1fr; }
}

/* ---------- Volunteering wizard ---------- */
.wizard-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; counter-reset: none; }
.wizard-steps li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-3); font-size: 14px; font-weight: 600; cursor: pointer; }
.wizard-steps li span { display: grid; width: 26px; height: 26px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; font-size: 13px; }
.wizard-steps li.active { border-color: var(--brand-line); background: var(--brand-softer); color: var(--brand-strong); box-shadow: var(--focus); }
.wizard-steps li.active span { border-color: var(--brand); background: var(--brand); color: #fff; }
.wizard-steps li.done { color: var(--success); }
.wizard-steps li.done span { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.wizard-footer { position: sticky; z-index: 5; bottom: 0; display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 14px 0; border-top: 1px solid var(--border); background: linear-gradient(transparent, var(--bg) 30%); }
.wizard-footer #wz-next, .wizard-footer #wz-publish { margin-left: auto; }
.wizard-error { flex: 1; color: var(--danger); font-size: 14px; font-weight: 600; text-align: right; }
.day-rows { display: grid; gap: 6px; }
.day-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.day-row.is-closed { background: var(--surface-2); }
.day-row.is-closed strong { color: var(--text-3); }
.day-toggle { width: 230px; }
.day-times { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px; }
.day-times .input { width: 120px; min-height: 36px; }
.day-length { font-size: 13px; }
.post-card .card-title { gap: 10px; }
.post-number { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; }
.wizard-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.slot-day { display: grid; gap: 16px; }
.slot-post + .slot-post { padding-top: 16px; border-top: 1px solid var(--border); }
.slot-post-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.slot-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.slot-chip { position: relative; display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.slot-chip .input { width: 88px; min-height: 32px; padding: 4px 6px; font-size: 13px; }
.slot-limit { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--text-3); }
.slot-limit .input { width: 56px; }
.slot-next-day { position: absolute; top: -8px; right: 8px; padding: 0 6px; border-radius: 6px; background: var(--info-bg); color: var(--info); font-size: 10.5px; font-weight: 600; }
.shift-admin { gap: 10px; justify-content: flex-end; }
@media (max-width: 760px) {
    .wizard-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
    .wizard-steps li { justify-content: center; padding: 8px; font-size: 0; }
    .wizard-steps li span { font-size: 13px; }
    .wizard-summary { grid-template-columns: 1fr 1fr; }
    .day-toggle { width: 100%; }
    .wizard-error { order: -1; flex-basis: 100%; text-align: left; }
    .wizard-footer { flex-wrap: wrap; }
}

/* ---------- Shared stat tiles and dropdowns ---------- */
.seat-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.seat-stat { display: grid; gap: 4px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); }
.seat-stat span { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.seat-stat strong { font: 800 22px/1.1 var(--font-display); }
.seat-stat strong small { color: var(--text-3); font-size: 14px; }
.seat-stat em { color: var(--danger); font-size: 12px; font-style: normal; font-weight: 600; }
.seat-stat .progress { height: 6px; }
.seat-stat.is-warning { border-color: var(--danger-line); background: var(--danger-bg); }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
@media (max-width: 640px) {
    .seat-stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- Auth pages ---------- */
body.auth { min-height: 100vh; background: radial-gradient(ellipse at 0% 0%, rgba(122, 63, 240, .09), transparent 40%), radial-gradient(ellipse at 100% 100%, rgba(20, 180, 234, .09), transparent 40%), var(--bg); }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 40px clamp(28px, 5vw, 72px); overflow: hidden; background: linear-gradient(160deg, #1b1446 0%, #2a1c78 45%, #1f4fc9 100%); color: #fff; }
.auth-aside::before { position: absolute; top: -120px; right: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(20, 180, 234, .45), transparent 65%); content: ""; }
.auth-aside::after { position: absolute; bottom: -160px; left: -100px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(160, 90, 255, .4), transparent 65%); content: ""; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; }
.auth-brand:hover { color: #fff; }
.auth-brand .brand-word { font-size: 21px; }
.auth-pitch h1 { max-width: 520px; color: #fff; font-size: clamp(32px, 3.6vw, 46px); font-weight: 800; line-height: 1.12; letter-spacing: -.03em; }
.auth-pitch p { max-width: 460px; margin-top: 16px; color: rgba(255, 255, 255, .78); font-size: 16px; line-height: 1.65; }
.auth-features { display: grid; gap: 14px; margin: 32px 0 0; padding: 0; list-style: none; }
.auth-features li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .9); font-size: 15px; }
.auth-features .icon { width: 36px; height: 36px; padding: 8px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; background: rgba(255, 255, 255, .08); }
.auth-aside-footer { color: rgba(255, 255, 255, .6); font-size: 13px; }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(20px, 5vw, 64px); }
.auth-card { width: 100%; max-width: 440px; margin: 0 auto; }
.auth-card h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.auth-card .lead { margin: 6px 0 24px; color: var(--text-2); font-size: 15px; }
.auth-card .field + .field { margin-top: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 26px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-3); }
.auth-tabs button { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600; }
.auth-tabs button[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
.auth-switch { margin-top: 20px; color: var(--text-3); font-size: 14px; text-align: center; }
.password-field { position: relative; }
.password-field input { padding-right: 44px !important; }
.password-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); }
.steps { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.step { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13.5px; font-weight: 600; }
.step-num { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); font-size: 12px; }
.step.active { color: var(--brand-strong); }
.step.active .step-num { border-color: var(--brand); background: var(--brand); color: #fff; }
.step.done { color: var(--success); }
.step.done .step-num { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.step-line { height: 1px; flex: 1; background: var(--border); }
.auth-mobile-brand { display: none; margin-bottom: 28px; color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main-aside { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1020px) {
    .sidebar { box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .22s ease; }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { position: fixed; z-index: 55; inset: 0; display: block; background: rgba(15, 20, 45, .45); }
    body.sidebar-open { overflow: hidden; }
    .sidebar .sidebar-close { display: inline-grid; }
    .app-main { margin-left: 0; }
    .topbar .menu-button { display: inline-grid; }
    .topbar .topbar-brand { display: inline-flex; }
    .topbar { padding: 0 16px; }
    .content { padding: 22px 20px 40px; }
    .grid-main-aside, .grid-aside-main { grid-template-columns: minmax(0, 1fr); }
    .sticky-aside { position: static; }
}
@media (max-width: 760px) {
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .user-menu-name { display: none; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .page-actions { width: 100%; }
    .calendar-day { min-height: 64px; padding: 4px; }
    .day-events { display: none; }
    .day-dots { display: flex; }
    .calendar-weekdays span { padding: 8px 4px; font-size: 11px; text-align: center; }
    .day-number { width: 26px; height: 26px; margin: 0 auto; display: grid; font-size: 13px; }
    .calendar-day > .day-number { margin: 0 auto; }
    .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kv dd { margin-bottom: 10px; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-aside { display: none; }
    .auth-mobile-brand { display: inline-flex; }
    .hbar { grid-template-columns: 96px minmax(0, 1fr) 46px; }
}
@media (max-width: 560px) {
    .content { padding: 18px 14px 36px; }
    .stats-grid { gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 23px; }
    .card-header, .card-body, .card-footer, .toolbar, .list-item, .event-card { padding-left: 16px; padding-right: 16px; }
    .table th, .table td { padding-left: 12px; padding-right: 12px; }
    .hide-sm { display: none !important; }
    .toolbar .input-group { max-width: none; min-width: 100%; }
    .page-actions .btn { flex: 1; }
    .bar-chart { gap: 3px; }
    .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .segmented { display: flex; }
    .segmented label { flex: 1; }
    .segmented span { justify-content: center; padding: 0 8px; }
}
@media (max-width: 900px) { .hide-md { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
    .sidebar, .topbar, .app-footer, .page-actions, .no-print, .tabs { display: none !important; }
    .app-main { margin: 0; }
    .content { max-width: none; padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Volunteering: filters, statistics, registrations ---------- */
.mb-1 { margin-bottom: 8px; }
.pre-line { white-space: pre-line; }
.stats-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.shift-filters { display: grid; gap: 12px; padding: 14px 18px; }
.shift-filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.shift-filters-row .input-group { flex: 1 1 220px; }
.shift-filters-row .select { width: auto; min-width: 160px; flex: 0 1 auto; }
.shift-filters-count { margin-left: auto; color: var(--text-3); font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 13.5px; font-weight: 500; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 36px; height: 20px; flex: 0 0 auto; border-radius: 999px; background: var(--border-strong); transition: background-color .15s ease; }
.switch-track::after { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); content: ""; transition: transform .15s ease; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch input:checked ~ * { color: var(--text); }
.event-meter { display: flex; align-items: center; gap: 12px; padding: 0 22px 14px; color: var(--text-3); font-size: 13px; }
.event-meter .progress { width: 160px; flex: 0 0 auto; }
.event-meter strong { color: var(--text); }
.card-title .badge { margin-left: 6px; vertical-align: 2px; font-family: var(--font-body, inherit); }
.shift-item.is-full .shift-time strong { color: var(--text-3); }
.person-chip.external { border-style: solid; background: var(--surface-2); }
.person-chip.group { border-color: var(--info-line); background: var(--info-bg); color: var(--info); }
.person-chip .chip-icon { display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.person-chip.group .chip-icon { background: #fff; color: var(--info); }
.chip-open { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.chip-open:hover { text-decoration: underline; }
.public-toggle { padding: 12px 14px; border: 1px solid var(--brand-line); border-radius: var(--radius); background: var(--brand-softer); }
.copy-field { display: flex; gap: 8px; margin-top: 10px; }
.copy-field .input { min-width: 0; flex: 1; font-size: 12.5px; }
.stat-bar { display: grid; gap: 6px; }
.stat-bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.stat-bar-head strong { color: var(--text); }
.stat-bar-head small { display: block; color: var(--text-3); font-size: 12px; }
.stat-bar-value { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-bar-value small { color: var(--text-3); }
.people-table td { vertical-align: top; }
.people-contact { display: grid; gap: 4px; min-width: 180px; font-size: 13px; }
.people-contact a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.people-contact a:hover { color: var(--brand-strong); }
.people-message { font-style: italic; }
.people-shifts { display: grid; gap: 3px; margin: 0; padding: 0; color: var(--text-2); font-size: 12.5px; list-style: none; }
.people-shifts li { white-space: nowrap; }
.registration-title { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font: 700 18px/1.3 var(--font-display); }
.registration-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.registration-facts dt { color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.registration-facts dd { margin: 2px 0 0; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.registration-facts [data-reg-row] { grid-column: 1 / -1; }
.registration-card .people-shifts { font-size: 13.5px; }

/* ---------- Public volunteering page ---------- */
body.public { min-height: 100vh; background: var(--surface-2); }
.public-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); }
.public-header-inner, .public-main, .public-footer { width: min(1180px, 100% - 32px); margin: 0 auto; }
.public-header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.public-header-inner .spacer { flex: 1; }
.public-hero { padding: 44px 0 28px; }
.public-hero h1 { margin: 6px 0 8px; font: 800 clamp(28px, 4vw, 40px)/1.1 var(--font-display); letter-spacing: -.02em; }
.public-hero p { max-width: 620px; margin: 0; color: var(--text-2); font-size: 16px; }
.public-search { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.public-search .input-group { flex: 1 1 280px; max-width: 460px; }
.public-search .select { width: auto; min-width: 180px; }
.public-main { padding-bottom: 60px; }
.public-footer { padding: 24px 0 40px; color: var(--text-3); font-size: 13px; text-align: center; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.event-tile { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.event-tile:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md, 0 12px 30px rgba(31, 44, 94, .12)); transform: translateY(-2px); }
.event-tile-top { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; color: var(--text-2); font-size: 13px; }
.event-tile-top .society-avatar { width: 34px; height: 34px; font-size: 14px; }
.event-tile-top strong { display: block; color: var(--text); font-size: 13.5px; }
.event-tile-body { display: grid; flex: 1; gap: 8px; padding: 14px 18px 16px; }
.event-tile h2 { margin: 0; font: 700 19px/1.25 var(--font-display); }
.event-tile-meta { display: grid; gap: 4px; color: var(--text-2); font-size: 13.5px; }
.event-tile-meta span { display: flex; align-items: center; gap: 7px; }
.event-tile-meta .icon { width: 15px; height: 15px; color: var(--text-3); }
.event-tile-posts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.event-tile-posts span { padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.event-tile-foot { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.event-tile-foot .progress { flex: 1; }
.event-tile-foot strong { color: var(--brand-strong); white-space: nowrap; }
.public-event-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; padding: 28px 0 22px; }
.public-event-head .society-avatar { width: 56px; height: 56px; border-radius: 14px; font-size: 22px; }
.public-event-head h1 { margin: 2px 0 6px; font: 800 clamp(24px, 3.4vw, 34px)/1.15 var(--font-display); }
.public-event-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); font-size: 14px; }
.public-event-meta span { display: inline-flex; align-items: center; gap: 6px; }
.public-shift { cursor: pointer; }
.public-shift input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); cursor: pointer; }
.public-shift.is-selected { background: var(--brand-softer); box-shadow: inset 3px 0 0 var(--brand); }
.public-shift.is-disabled { cursor: default; opacity: .62; }
.public-shift .free { color: var(--success); font-weight: 600; }
.public-shift.is-low .free { color: var(--warning); }
.selection-bar { position: sticky; bottom: 16px; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 18px; border: 1px solid var(--brand-line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 18px 40px rgba(31, 44, 94, .18); }
.selection-bar .spacer { flex: 1; }
.selection-bar strong { color: var(--brand-strong); }
.signup-kind { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.signup-kind label { position: relative; cursor: pointer; }
.signup-kind input { position: absolute; opacity: 0; }
.signup-kind span { display: grid; gap: 2px; height: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-2); font-size: 13px; }
.signup-kind span strong { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.signup-kind input:checked + span { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 3px var(--brand-soft); }
.signup-kind input:focus-visible + span { box-shadow: var(--focus); }
.chosen-shifts { display: grid; gap: 6px; margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; list-style: none; }
.chosen-shifts li { display: flex; align-items: center; gap: 8px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.confirmation { max-width: 680px; margin: 40px auto; }
.confirmation .check-badge { display: grid; width: 60px; height: 60px; margin: 0 auto 14px; place-items: center; border-radius: 50%; background: var(--success-bg); color: var(--success); }
.confirmation .check-badge .icon { width: 30px; height: 30px; }
@media (max-width: 1100px) { .stats-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
    .stats-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .shift-filters-row .select { flex: 1 1 140px; }
    .shift-filters-count { margin-left: 0; }
    .event-meter .progress { width: 90px; }
    .registration-facts { grid-template-columns: 1fr; }
    .signup-kind { grid-template-columns: 1fr; }
    .event-grid { grid-template-columns: 1fr; }
    .public-header-inner .hide-mobile { display: none; }
}
@media print { .public-header, .selection-bar { display: none !important; } }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.bordered-list { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); }
.confirmation h1 { font: 800 24px/1.25 var(--font-display); }
.modal-footer > form.inline { flex: 0 0 auto; margin-right: auto; }
@media (max-width: 720px) { .selection-bar { flex-wrap: nowrap; gap: 10px; padding: 10px 12px; font-size: 13px; } .selection-bar .spacer { display: none; } .selection-bar > span:first-child { flex: 1; min-width: 0; } .selection-bar .btn-lg { min-height: 42px; padding: 0 14px; white-space: nowrap; } }

/* ---------- Password reset ---------- */
.forgot-link { justify-self: end; margin-left: auto; color: var(--brand-strong); font-weight: 600; text-align: right; text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }
.auth-icon { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.auth-icon .icon { width: 26px; height: 26px; }
.auth-icon.is-warning { background: var(--warning-bg); color: var(--warning); }
.auth-help { margin: 6px 0 0; padding-left: 18px; }
.auth-help li + li { margin-top: 3px; }
.field-hint.is-ok { color: var(--success); }.auth-card .lead { color: var(--text-2); }

/* ---------- E-mail settings ---------- */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.provider-grid label { position: relative; cursor: pointer; }
.provider-grid input { position: absolute; opacity: 0; }
.provider-grid span { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 600; text-align: center; transition: border-color .12s ease, background-color .12s ease; }
.provider-grid label:hover span { border-color: var(--border-strong); color: var(--text); }
.provider-grid input:checked + span { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 3px var(--brand-soft); color: var(--brand-strong); }
.provider-grid input:focus-visible + span { box-shadow: var(--focus); }
.mail-advanced { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.mail-advanced summary { color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.mail-advanced input[readonly], .mail-advanced select[style*="none"] { background: var(--surface-3) !important; color: var(--text-2); }
.mail-status { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13.5px; }
.mail-status .icon { color: var(--success); }.mail-example { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }
.mail-example strong { color: var(--text-3); font-weight: 600; }
/* ---------- Socivana administration ---------- */
.nav-admin .nav-icon { color: var(--brand); }
.site-announcement { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 16px; border: 1px solid var(--info-line); border-radius: var(--radius); background: var(--info-bg); color: var(--info); font-size: 14px; font-weight: 500; }
.site-announcement.is-warning { border-color: var(--warning-line); background: var(--warning-bg); color: var(--warning); }
.site-announcement .icon { flex: 0 0 auto; }
.site-announcement span { color: var(--text); }
.chart-card .card-header { align-items: flex-start; }
.chart-total { color: var(--text-3); font-size: 13px; white-space: nowrap; }
.chart-total strong { color: var(--text); font: 700 20px/1 var(--font-display); }
.vchart { position: relative; height: 220px; margin: 6px 0 4px 28px; }
.vchart-grid { position: absolute; inset: 0 0 22px 0; pointer-events: none; }
.vchart-grid span { position: absolute; right: 0; left: 0; border-top: 1px solid var(--border); }
.vchart-grid span:first-child { border-top-style: dashed; }
.vchart-grid span:last-child { border-top: 1px solid var(--border-strong); }
.vchart-grid em { position: absolute; top: -8px; left: -28px; width: 22px; color: var(--text-3); font-size: 11px; font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.vchart-bars { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.vchart-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 3px 22px; outline: none; cursor: default; }
.vchart-col:hover, .vchart-col:focus-visible { background: linear-gradient(to top, transparent 22px, var(--brand-softer) 22px); border-radius: 6px 6px 0 0; }
.vchart-col:focus-visible { box-shadow: var(--focus); }
.vchart-bar { position: relative; display: block; width: 100%; max-width: 34px; margin: 0 auto; border-radius: 4px 4px 0 0; background: var(--brand); transition: height .3s ease; }
.vchart-col:hover .vchart-bar, .vchart-col:focus-visible .vchart-bar { background: var(--brand-strong); }
.vchart-bar b { position: absolute; bottom: 100%; left: 50%; margin-bottom: 4px; color: var(--text); font-size: 12px; transform: translateX(-50%); }
.vchart-label { position: absolute; right: 0; bottom: 0; left: 0; overflow: hidden; color: var(--text-3); font-size: 11px; line-height: 18px; text-align: center; white-space: nowrap; }
.chart-table { margin-top: 12px; font-size: 13px; }
.chart-table summary { color: var(--text-3); cursor: pointer; }
.chart-table .table { margin-top: 8px; }
.chart-table .table td, .chart-table .table th { padding: 6px 10px; }
.chart-tip { position: fixed; z-index: 100; padding: 6px 10px; border-radius: 8px; background: #1d2238; box-shadow: var(--shadow-sm); color: #fff; font-size: 12.5px; font-weight: 600; pointer-events: none; white-space: nowrap; }
.hchart { display: grid; gap: 10px; }
.hchart-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 36px; align-items: center; gap: 10px; padding: 2px 4px; border-radius: 6px; font-size: 13.5px; outline: none; }
.hchart-row:hover, .hchart-row:focus-visible { background: var(--brand-softer); }
.hchart-row:focus-visible { box-shadow: var(--focus); }
.hchart-label { display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.hchart-label .icon { flex: 0 0 auto; color: var(--text-3); }
.hchart-track { height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.hchart-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); }
.hchart-value { color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .vchart { height: 180px; } .vchart-label { font-size: 9.5px; } }
/* ---------- Presidency & deletions ---------- */
.presidency-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.presidency-row .field { flex: 1 1 240px; }
.presidency-action { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.presidency-action > div { flex: 1; min-width: 0; }
.presidency-action strong { color: var(--text); font-size: 14px; }
.presidency-action.is-danger { border-color: var(--danger-line); background: var(--danger-bg); }
.danger-card .card-title .icon { color: var(--danger); }
.deletion-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.deletion-list li { display: flex; align-items: flex-start; gap: 8px; color: var(--text-2); }
.deletion-list .icon { flex: 0 0 auto; margin-top: 2px; color: var(--danger); }
.deletion-list li.is-ok .icon { color: var(--success); }
.deletion-list li.is-warning { color: var(--warning); font-weight: 600; }
.deletion-list li.is-warning .icon { color: var(--warning); }
@media (max-width: 720px) { .presidency-action { flex-wrap: wrap; } }
/* ---------- Accounting ---------- */
.amount-in { color: #1b8a5a !important; }
.amount-out { color: #c0392b !important; }
.amount-move { color: var(--info); }
.receipt-link { display: inline-flex; margin-left: 6px; color: var(--text-3); vertical-align: -2px; }
.receipt-link:hover { color: var(--brand); }
.chart-legend { display: flex; gap: 14px; color: var(--text-2); font-size: 12.5px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend-in, .bar-in { background: var(--brand); }
.legend-out, .bar-out { background: #9aa3b8; }
.pair-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; height: 200px; padding-bottom: 20px; border-bottom: 1px solid var(--border-strong); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--border) calc(25% - 1px), var(--border) 25%); background-size: 100% calc(100% - 20px); background-repeat: no-repeat; }
.pair-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; outline: none; border-radius: 6px 6px 0 0; }
.pair-col:hover, .pair-col:focus-visible { background: var(--brand-softer); }
.pair-col:focus-visible { box-shadow: var(--focus); }
.pair-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.pair-bars span { width: 42%; max-width: 16px; border-radius: 4px 4px 0 0; }
.pair-label { position: absolute; bottom: -20px; left: 0; right: 0; color: var(--text-3); font-size: 11px; text-align: center; }
.entry-item .list-item-main strong { display: flex; align-items: center; }
.money-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 56px; }
.entry-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.entry-kinds label { position: relative; cursor: pointer; }
.entry-kinds input { position: absolute; opacity: 0; }
.entry-kinds span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-2); font-weight: 600; }
.entry-kinds input:focus-visible + span { box-shadow: var(--focus); }
.entry-kinds input:checked + .kind-out { border-color: #e2a9a2; background: #fdf1ef; color: #c0392b; }
.entry-kinds input:checked + .kind-in { border-color: #9fd6bd; background: #ecf8f2; color: #1b8a5a; }
.entry-kinds input:checked + .kind-move { border-color: var(--info-line); background: var(--info-bg); color: var(--info); }
.import-list { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 13px; list-style: none; }
.import-list li { display: flex; justify-content: space-between; gap: 10px; }
.journal-table tfoot td { padding: 12px 16px; border-top: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.doc-kind { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.doc-kind.quote { background: var(--info-bg); color: var(--info); }
.doc-kind.invoice { background: var(--brand-soft); color: var(--brand-strong); }
.list-item.is-muted, .category-chip.is-muted { opacity: .55; }
.category-columns { display: grid; gap: 18px; }
.category-chip { gap: 4px; padding-right: 4px; }
.category-chip .link-button { color: var(--text); font-weight: 500; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 52px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.budget-grid { display: grid; gap: 8px; }
.budget-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 10px; font-size: 13.5px; }
.report-table td, .report-table th { padding: 9px 14px; }
.report-table tfoot td { border-top: 2px solid var(--border-strong); color: var(--text); font-weight: 700; }
.result-card.is-positive { border-color: #9fd6bd; background: #ecf8f2; }
.result-card.is-negative { border-color: #e2a9a2; background: #fdf1ef; }
.result-value { font: 800 22px/1.2 var(--font-display); }
.result-card.is-positive .result-value { color: #1b8a5a; }
.result-card.is-negative .result-value { color: #c0392b; }
.report-print-title, .report-signatures { display: none; }
.doc-fieldset { display: contents; margin: 0; padding: 0; border: 0; }
.doc-lines { display: grid; }
.doc-line { display: grid; grid-template-columns: 26px minmax(0, 1fr) 78px 74px 140px 112px 36px; align-items: center; gap: 8px; padding: 8px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.doc-line input { width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.doc-line input:focus { border-color: var(--brand); outline: none; box-shadow: var(--focus); }
.doc-line [data-qty] { text-align: right; }
.doc-line .input-prefix input { padding-left: 42px !important; text-align: right; }
.doc-line-head { padding-top: 10px; padding-bottom: 6px; background: var(--surface-2); color: var(--text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.doc-line-head span:nth-child(3), .doc-line-head span:nth-child(5) { text-align: right; }
.doc-handle { display: grid; place-items: center; color: var(--text-3); cursor: grab; }
.doc-line.is-dragging { opacity: .5; background: var(--brand-softer); }
.doc-line [data-line-total] { color: var(--text); font-size: 14px; }
.doc-summary .doc-total { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 18px; }
.doc-summary .doc-total strong:last-child { color: var(--brand-strong); font-family: var(--font-display); }
.doc-more { flex-wrap: wrap; justify-content: flex-start; gap: 4px; }
@media (max-width: 900px) {
    .doc-line { grid-template-columns: 22px minmax(0, 1fr) 110px 36px; grid-template-areas: "h d d x" "h q u u" "h p t t"; padding: 10px 14px; }
    .doc-line > :nth-child(1) { grid-area: h; }
    .doc-line > :nth-child(2) { grid-area: d; }
    .doc-line > :nth-child(3) { grid-area: q; }
    .doc-line > :nth-child(4) { grid-area: u; }
    .doc-line > :nth-child(5) { grid-area: p; }
    .doc-line > :nth-child(6) { grid-area: t; text-align: right; }
    .doc-line > :nth-child(7) { grid-area: x; }
    .doc-line-head { display: none; }
    .budget-row { grid-template-columns: minmax(0, 1fr) 130px; }
    .pair-label { font-size: 9.5px; }
    .entry-kinds span { flex-direction: column; gap: 2px; min-height: 56px; font-size: 13px; }
}
@media print {
    .page-accounting .report-print-title { display: block; margin-bottom: 14px; }
    .page-accounting .report-print-title h1 { margin: 0; font-size: 20px; }
    .page-accounting .report-print-title p { margin: 2px 0 0; color: #666; font-size: 12px; }
    .page-accounting .report-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
    .page-accounting .report-signatures div { padding-top: 40px; border-bottom: 1px solid #999; font-size: 12px; }
    .page-accounting .report-signatures span { position: relative; top: 22px; color: #666; }
    .page-accounting .tabs, .page-accounting .page-header, .page-accounting .report-head { display: none !important; }
    .page-accounting .report .card { break-inside: avoid; box-shadow: none; }
}
/* Accounting editor fixes: prefix/suffix fields take the full width; lines adapt to the column width. */
.field > .input-prefix, .doc-line .input-prefix, .budget-row .input-prefix { display: block; position: relative; }
.field > .input-prefix > input, .doc-line .input-prefix > input, .budget-row .input-prefix > input { width: 100%; }
.doc-lines { container-type: inline-size; }
@container (max-width: 760px) {
    .doc-line { grid-template-columns: 22px minmax(0, 1fr) 110px 36px; grid-template-areas: "h d d x" "h q u u" "h p t t"; padding: 10px 14px; }
    .doc-line > :nth-child(1) { grid-area: h; }
    .doc-line > :nth-child(2) { grid-area: d; }
    .doc-line > :nth-child(3) { grid-area: q; }
    .doc-line > :nth-child(4) { grid-area: u; }
    .doc-line > :nth-child(5) { grid-area: p; }
    .doc-line > :nth-child(6) { grid-area: t; text-align: right; }
    .doc-line > :nth-child(7) { grid-area: x; }
    .doc-line-head { display: none; }
}
/* ---------- Mobile: installable app and Socivana app ---------- */
.in-app-only { display: none; }
html.in-app .in-app-only { display: block; }
html.in-app .app-footer { display: none; }
@supports (padding: max(0px)) {
    .app-main, .public-main, .auth-main { padding-left: max(0px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); }
    .content { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* ---------- Dashboard widgets ---------- */
.dw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 16px; align-items: stretch; }
.dw { position: relative; display: flex; min-width: 0; flex-direction: column; }
.dw[hidden] { display: none; }
.dw-s { grid-column: span 1; }
.dw-m { grid-column: span 2; }
.dw-l { grid-column: 1 / -1; }
.dw-body { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.dw-body > .card, .dw-body > .stat-card { flex: 1; margin: 0; }
.dw-card .list { max-height: 360px; overflow-y: auto; }
.dw-s .app-tiles { grid-template-columns: 1fr; }
.dw-m .app-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dw-l .app-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dw-note { color: var(--text-2); font-size: 15px; line-height: 1.6; white-space: normal; }
.dw-progress { display: block; height: 5px; margin-top: 6px; max-width: 220px; }
.dw-accounts { display: grid; gap: 8px; }
.dw-accounts p { display: flex; justify-content: space-between; gap: 10px; margin: 0; color: var(--text-2); font-size: 14px; }
.dw-accounts strong { color: var(--text); font-variant-numeric: tabular-nums; }
.dw-accounts .dw-total { padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 15px; }
.dw-accounts .dw-total strong { font-size: 18px; }

/* Edit mode */
.dw-tools { display: none; }
.dw-editing .dw-tools { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; padding: 4px 4px 4px 10px; border-radius: 10px; background: var(--brand-softer); color: var(--brand-strong); font-size: 12.5px; font-weight: 700; }
.dw-grip { display: inline-flex; flex: 1; min-width: 0; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; }
.dw-sizes { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface); }
.dw-size-btn { min-width: 26px; height: 24px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--text-3); font: inherit; font-size: 11.5px; cursor: pointer; }
.dw-size-btn.is-on { background: var(--brand); color: #fff; }
.dw-tools .icon-button { width: 28px; height: 28px; }
.dw-editing .dw-body { outline: 2px dashed var(--brand-line, #cfc4fb); outline-offset: 3px; border-radius: var(--radius-lg); cursor: grab; }
.dw-editing .dw-body a { cursor: grab; }
.dw.is-dragging { opacity: .45; }
.dw-editbar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid var(--brand-line, #d8cffd); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.dw-editbar strong { display: block; }
.dw-editbar span { display: block; color: var(--text-3); font-size: 13px; }
.dw-empty { margin-top: 0; }

/* Catalogue */
.dw-catalog { display: grid; gap: 8px; }
.dw-cat { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.dw-cat:hover { border-color: var(--brand); background: var(--brand-softer); }
.dw-cat[hidden] { display: none; }
.dw-cat > span:nth-child(2) { flex: 1; }
.dw-cat strong { display: block; }
.dw-cat small { display: block; color: var(--text-3); font-size: 13px; }
.dw-cat-plus { color: var(--brand); }
.dw-catalog .empty-inline[hidden] { display: none; }

/* Access settings (president) */
.dw-access { display: grid; gap: 10px; max-height: 65vh; overflow-y: auto; }
.dw-rule { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.dw-rule header { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px); align-items: center; gap: 12px; }
.dw-rule header strong { display: block; }
.dw-rule header small { display: block; color: var(--text-3); font-size: 12.5px; }
.dw-rule-custom { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.dw-rule-custom[hidden] { display: none; }
.dw-rule-custom .field-label { margin: 0; }
.dw-chips, .dw-member-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dw-member-list { max-height: 150px; overflow-y: auto; }
.dw-members { display: grid; gap: 8px; }
.dw-chip { position: relative; cursor: pointer; }
.dw-chip[hidden] { display: none; }
.dw-chip input { position: absolute; opacity: 0; pointer-events: none; }
.dw-chip span { display: inline-block; padding: 5px 11px; border: 1.5px solid var(--border); border-radius: 99px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.dw-chip input:checked + span { border-color: var(--brand); background: var(--brand-softer); color: var(--brand-strong); }
.dw-chip input:focus-visible + span { box-shadow: var(--focus); }

@media (max-width: 1180px) {
    .dw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dw-m, .dw-l { grid-column: 1 / -1; }
    .dw-l .app-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .dw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .dw-s, .dw-m, .dw-l { grid-column: 1 / -1; }
    .dw-s:has(> .dw-body > .dw-stat) { grid-column: span 1; }
    .dw-m .app-tiles, .dw-l .app-tiles { grid-template-columns: 1fr 1fr; }
    .dw-rule header { grid-template-columns: auto minmax(0, 1fr); }
    .dw-rule header .select { grid-column: 1 / -1; }
}
.dw:has(> .dw-body > .dw-stat) { align-self: start; }
@media (pointer: fine) { .dw-tools .dw-move { display: none; } }
@media (max-width: 640px) { .dw-editing .dw-tools .dw-sizes { display: none; } .dw-editing .dw-tools { padding-left: 8px; } }
@media (max-width: 640px) { .dw-editbar { position: static; } }

/* Volunteering: show/hide chips (time slots, days, places) */
.sf-toggles { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.sf-toggle-group { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: start; gap: 8px 12px; }
.sf-toggle-label { display: inline-flex; align-items: center; gap: 6px; padding-top: 6px; color: var(--text-3); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.sf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px; border: 1.5px dashed var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text-3); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; text-decoration: line-through; transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
.sf-chip:hover { border-color: var(--brand); }
.sf-chip:focus-visible { outline: none; box-shadow: var(--focus); }
.sf-chip.is-on { border-style: solid; border-color: var(--brand-line, #cfc4fb); background: var(--brand-softer); color: var(--brand-strong); text-decoration: none; }
.sf-chip-check { display: inline-grid; place-items: center; width: 15px; height: 15px; border: 1.5px solid currentColor; border-radius: 4px; opacity: .6; }
.sf-chip.is-on .sf-chip-check { border-color: var(--brand); background: var(--brand); opacity: 1; }
.sf-chip.is-on .sf-chip-check::after { width: 7px; height: 4px; margin-top: -2px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; transform: rotate(-45deg); content: ""; }
.sf-chip-count { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.sf-toggle-actions { display: inline-flex; gap: 10px; padding-top: 6px; white-space: nowrap; }
.sf-toggle-actions [hidden] { display: none; }
@media (max-width: 640px) {
    .sf-toggle-group { grid-template-columns: minmax(0, 1fr) auto; }
    .sf-toggle-label { padding-top: 0; }
    .sf-chips { grid-column: 1 / -1; grid-row: 2; }
    .sf-toggle-actions { padding-top: 0; }
}
@media print { .sf-toggles { display: none; } }

/* ==========================================================================
   Mobile app: loading screen, bottom bar, phone-sized layouts
   ========================================================================== */
:root { --tabbar-height: 0px; --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-top: env(safe-area-inset-top, 0px); }
html { -webkit-tap-highlight-color: transparent; }
a, button, label, summary, select, [data-href] { touch-action: manipulation; }

/* ---------- Loading screen (opening the app on a phone) ---------- */
.app-splash {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #fff;
    transition: opacity .45s ease, visibility .45s ease;
}
.app-splash[hidden] { display: none; }
html.is-splashing, html.is-splashing body { overflow: hidden; }
.app-splash-glow {
    position: absolute;
    width: 140vmax;
    height: 140vmax;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(122, 63, 240, .14) 0%, rgba(77, 95, 244, .08) 28%, rgba(29, 158, 240, .03) 48%, transparent 62%);
    animation: splash-glow 2.4s ease-in-out infinite alternate;
}
.app-splash-center { position: relative; display: grid; justify-items: center; gap: 10px; padding: 0 32px; text-align: center; transition: transform .45s ease; }
.app-splash-logo { width: 104px; height: 104px; margin-bottom: 12px; padding: 6px; border-radius: 28px; background: #fff; box-shadow: 0 18px 40px rgba(83, 41, 216, .22), 0 2px 6px rgba(19, 26, 56, .06); animation: splash-logo .7s cubic-bezier(.2, .9, .3, 1.25) both, splash-float 2.6s ease-in-out .7s infinite; }
.app-splash-word { color: var(--text); font: 800 30px/1 var(--font-display); letter-spacing: -.035em; animation: splash-rise .5s ease-out .18s both; }
.app-splash-sub { max-width: 260px; color: var(--text-3); font-size: 14.5px; font-weight: 500; animation: splash-rise .5s ease-out .3s both; }
.app-splash-bar {
    position: absolute;
    bottom: calc(64px + var(--safe-bottom));
    left: calc(50% - 66px);
    width: 132px;
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--surface-3);
    animation: splash-rise .4s ease-out .4s both;
}
.app-splash-bar span { position: absolute; top: 0; bottom: 0; width: 45%; border-radius: inherit; background: var(--gradient); animation: splash-bar 1.1s ease-in-out infinite; }
.app-splash.is-done { opacity: 0; visibility: hidden; }
.app-splash.is-done .app-splash-center { transform: scale(1.06); }
@keyframes splash-logo { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes splash-float { 50% { transform: translateY(-6px); } }
@keyframes splash-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes splash-bar { from { left: -45%; } to { left: 100%; } }
@keyframes splash-glow { from { transform: scale(.92); } to { transform: scale(1.06); } }

/* ---------- Page loading bar (between two pages) ---------- */
.nav-progress { position: fixed; z-index: 90; top: 0; left: 0; width: 100%; height: 3px; pointer-events: none; opacity: 0; transform: scaleX(0); transform-origin: left; background: var(--gradient); transition: opacity .3s ease; }
html.is-navigating .nav-progress { opacity: 1; animation: nav-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes nav-progress { 0% { transform: scaleX(0); } 10% { transform: scaleX(.35); } 40% { transform: scaleX(.7); } 100% { transform: scaleX(.94); } }

/* ---------- Bottom bar ---------- */
.tabbar { display: none; }
@media (max-width: 1020px) {
    :root { --tabbar-height: 62px; --topbar-height: 58px; }
    .tabbar {
        position: fixed;
        z-index: 50;
        inset: auto 0 0 0;
        display: grid;
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
        height: calc(var(--tabbar-height) + var(--safe-bottom));
        padding: 0 max(4px, env(safe-area-inset-right)) var(--safe-bottom) max(4px, env(safe-area-inset-left));
        border-top: 1px solid var(--border);
        background: rgba(255, 255, 255, .94);
        backdrop-filter: saturate(1.6) blur(14px);
        -webkit-backdrop-filter: saturate(1.6) blur(14px);
    }
    .tabbar-item {
        position: relative;
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 2px 4px;
        border: 0;
        background: none;
        color: var(--text-3);
        font: 600 11px/1.1 var(--font);
        text-decoration: none;
    }
    .tabbar-item:hover { color: var(--text-2); }
    .tabbar-icon { position: relative; display: grid; width: 48px; height: 30px; place-items: center; border-radius: 99px; transition: background-color .2s ease, color .2s ease, transform .15s ease; }
    .tabbar-icon .icon { width: 22px; height: 22px; }
    .tabbar-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tabbar-item.is-active { color: var(--brand-strong); }
    .tabbar-item.is-active .tabbar-icon { background: var(--brand-soft); color: var(--brand); }
    .tabbar-item:active .tabbar-icon { transform: scale(.92); }
    .tabbar-badge { position: absolute; top: -3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid #fff; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; }

    /* Room for the bar at the bottom of every page */
    .app-main { padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom)); }
    .app-footer { display: none; }
    .content { padding-bottom: 28px; }
    .selection-bar { bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 10px); }
    .topbar .menu-button { display: none; }

    /* Top bar: compact, under the phone's status bar */
    .topbar { height: calc(var(--topbar-height) + var(--safe-top)); padding-top: var(--safe-top); }
    .topbar .brand-word { font-size: 18px; }
    html { scroll-padding-top: calc(var(--topbar-height) + 12px); scroll-padding-bottom: calc(var(--tabbar-height) + 12px); }

    /* Side menu slides in as a panel */
    .sidebar { width: min(86vw, 320px); padding-top: calc(18px + var(--safe-top)); padding-bottom: calc(14px + var(--safe-bottom)); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
    .sidebar .nav-link { min-height: 46px; font-size: 15px; }

    /* Each page fades in */
    .content { animation: page-in .25s ease-out; }
}
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Phones: comfortable sizes ---------- */
@media (max-width: 760px) {
    .page-header { gap: 14px; margin-bottom: 18px; }
    .page-header h1 { font-size: 25px; }
    .page-actions { gap: 8px; }
    .page-actions > *, .page-actions .btn { min-width: 0; flex: 1 1 auto; }
    .page-actions > form > .btn, .page-actions > .select { width: 100%; }
    .page-actions > .icon-button, .page-actions > form:has(> .icon-button:only-of-type) { flex: 0 0 auto; }
    .page-actions > form:has(> .icon-button:only-of-type) .icon-button, .page-actions > .icon-button { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
    .page-actions > span:not(.btn) { flex-basis: 100%; }
    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }
    .icon-button { min-width: 38px; min-height: 38px; }
    .input, .select, .textarea, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { min-height: 44px; }
    .content > .tabs { margin-left: -14px; margin-right: -14px; padding: 0 14px; scroll-padding: 0 14px; }
    .tab { min-height: 44px; white-space: nowrap; }
    .toolbar { gap: 8px; }
    .toolbar .chips { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px; }
    .toolbar .chips::-webkit-scrollbar { display: none; }
    .toolbar .chip { flex: 0 0 auto; }
    .stat-card { min-width: 0; }
}
/* iPhone: 16px fields so the page does not zoom in when typing */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 1020px) {
        input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea { font-size: 16px !important; }
    }
}

/* ---------- Dialogs become bottom sheets on phones ---------- */
@media (max-width: 640px) {
    dialog.modal, dialog.modal-lg, dialog.modal-sm {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - var(--safe-top) - 24px);
        margin: auto 0 0;
        border-radius: 22px 22px 0 0;
    }
    dialog.modal[open] { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
    dialog.modal .modal-header { position: relative; padding-top: 24px; }
    dialog.modal .modal-header::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 99px; background: var(--border-strong); }
    dialog.modal .modal-footer { padding-bottom: calc(14px + var(--safe-bottom)); }
    dialog.modal .modal-footer > .btn { flex: 1 1 auto; }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Tables become cards on phones (class .table-cards) ---------- */
@media (max-width: 640px) {
    .table-wrap:has(> .table-cards) { overflow: visible; }
    .table-cards, .table-cards tbody, .table-cards tfoot { display: block; width: 100%; }
    .table-cards thead { display: none; }
    .table-cards tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
    .table-cards tbody tr:last-child { border-bottom: 0; }
    .table-cards tr[hidden] { display: none; }
    .table-cards td { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 0 !important; border: 0; text-align: right; }
    .table-cards td::before { content: attr(data-label); flex: 0 0 auto; color: var(--text-3); font-size: 12.5px; font-weight: 600; text-align: left; }
    .table-cards td[data-label=""]::before, .table-cards td:not([data-label])::before, .table-cards td.cell-main::before, .table-cards td.actions::before, .table-cards tfoot td::before { display: none; }
    .table-cards td.cell-main { order: -1; display: block; margin-bottom: 2px; text-align: left; }
    .table-cards td.actions { width: auto; justify-content: flex-end; margin-top: 2px; }
    .table-cards td:empty { display: none; }
    .table-cards .table-empty td { display: block; text-align: center; }
    .table-cards tfoot tr { display: flex; justify-content: space-between; background: var(--surface-2); }
    .table-cards .hide-sm, .table-cards .hide-md { display: none !important; }
    .table-cards .person-meta { min-width: 0; }
}

/* Print: no app chrome */
@media print { .tabbar, .nav-progress, .app-splash { display: none !important; } .app-main { padding-bottom: 0; } }
@media (max-width: 560px) {
    .page-actions > .row { flex-wrap: nowrap; width: 100%; }
    .page-actions .btn:has(> .hide-sm):not(:has(> :not(.hide-sm):not(svg))) { flex: 0 0 46px; padding: 0; }
}
@media (max-width: 440px) {
    .segmented span:has(> .icon) { flex-direction: column; gap: 3px; min-height: 52px; padding: 6px 4px; font-size: 12.5px; white-space: nowrap; }
    .segmented span .icon { width: 18px; height: 18px; }
}
@media (max-width: 640px) {
    .table-cards td > * { min-width: 0; max-width: 100%; }
    .table-cards td > ul, .table-cards td > div:not(.row) { flex: 1 1 auto; }
    .table-cards td .cell-sub, .table-cards td strong { overflow-wrap: anywhere; }
    .table-cards .people-shifts { justify-items: end; }
    .table-cards .people-shifts li { white-space: normal; }
    .table-cards td.cell-main > .cell-sub { text-align: left; }
}
/* Phones: "more actions" menus open as a panel at the bottom of the screen */
@media (max-width: 640px) {
    details.dropdown[open] > summary::before { content: ""; position: fixed; z-index: 70; inset: 0; background: rgba(15, 20, 45, .4); cursor: default; }
    details.dropdown[open] > .menu-panel {
        position: fixed;
        z-index: 71;
        inset: auto 10px calc(10px + var(--safe-bottom)) 10px;
        width: auto;
        min-width: 0;
        max-height: 70dvh;
        overflow-y: auto;
        padding: 8px;
        border-radius: 18px;
        animation: sheet-in .24s cubic-bezier(.2, .8, .2, 1);
    }
    details.dropdown[open] > .menu-panel .menu-item { min-height: 48px; font-size: 15px; }
}
@media (max-width: 640px) {
    .table-cards td { flex-wrap: wrap; white-space: normal; }
    .table-cards td:not(.cell-main) > .cell-sub { flex-basis: 100%; margin-top: -4px; }
}
