/*
 * Design system architecture:
 * - Foundational tokens: surface, text, border, and semantic status colors.
 *   These are the primary knobs for reskinning the application.
 * - Compatibility/component aliases: app-shell and legacy volunteer aliases map
 *   to foundational tokens to preserve existing selectors during migration.
 * - New components should consume foundational tokens first, and avoid adding
 *   new global color variables unless there is a cross-app design need.
 * - Separation of concerns: visual presentation belongs in CSS tokens/selectors;
 *   JavaScript (including SwipeEngine) owns behavior only (motion/state/events).
 */
:root {
    color-scheme: light;
    --surface-0: #FCF9F5;
    --surface-1: #ffffff;
    --surface-2: #f9f7f4;
    --text-1: #222222;
    --text-2: #7a736b;
    --border-1: #EDE6D9;
    --border-2: #ebe5dd;
    --color-page-bg: #F7F1E8;
    --color-card-bg: #FCF9F5;
    --color-card-border: var(--border-1);
    --color-text-primary: var(--text-1);
    --color-text-secondary: var(--text-2);
    --color-divider: var(--border-2);
    --color-accent: #86796b;
    --color-success: #8da277;
    --color-warning: #cfb071;
    --color-danger: #c7897d;
    --radius-card: 6px;
    --border-width: 1px;
    --shadow-card: none;
    --font-primary: 'Inter', sans-serif;
    --color-on-accent: #ffffff;

    --v-bg: var(--color-page-bg);
    --v-surface: var(--surface-2);
    --v-card: var(--surface-1);
    --v-border: #ded8d0;
    --v-border-soft: var(--color-divider);
    --v-text: var(--color-text-primary);
    --v-muted: var(--color-text-secondary);
    --v-primary: var(--color-accent);
    --v-primary-hover: #73685c;
    --v-accent: #9f8f80;
    --v-success: var(--color-success);
    --v-warning: var(--color-warning);
    --v-danger: var(--color-danger);

    --app-shell-bg: rgba(255, 255, 255, 0.9);
    --app-shell-border: rgba(15, 23, 42, 0.1);
    --app-shell-card-border: rgba(15, 23, 42, 0.08);
    --app-shell-text: var(--color-text-primary);
    --app-shell-muted: #475569;
    --app-shell-primary: #0f766e;
    --app-shell-secondary: #334155;
    --app-shell-danger: #b91c1c;
}

.app-shell-page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 18px;
}

.app-shell-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    margin: 0 auto 16px;
    width: 100%;
    max-width: 1320px;
    background: var(--app-shell-bg);
    border: 1px solid var(--app-shell-border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.app-shell-brand {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.app-shell-kicker {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-shell-topline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.app-shell-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
}

.app-shell-role {
    font-size: 13px;
    font-weight: 700;
}

.app-shell-subtitle {
    margin: 0;
    max-width: 68ch;
}

.app-shell-user {
    font-size: 13px;
    font-weight: 700;
}

.app-shell-nav {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
}

.app-shell-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    font-weight: 800;
    color: inherit;
    background: var(--v-card);
    cursor: pointer;
    font: inherit;
    line-height: 1;
    white-space: nowrap;
}

.app-shell-nav-link:hover {
    background: #f8fafc;
}

.app-shell-nav-link.active {
    color: var(--color-on-accent);
    background: var(--app-shell-primary);
    border-color: var(--app-shell-primary);
}

.app-shell-nav-link.danger {
    color: var(--color-on-accent);
    background: var(--app-shell-danger);
    border-color: var(--app-shell-danger);
}

.app-shell-logout {
    margin: 0;
}

body:not(.auth-page) {
    background: var(--color-page-bg);
    color: var(--app-shell-text);
    font-family: var(--font-primary);
}

.app-card,
.card,
.auth-card,
.volunteer-header {
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.app-card,
.card {
    background: var(--v-card);
    border: 1px solid var(--app-shell-card-border);
}

@media (max-width: 860px) {
    .app-shell-nav {
        justify-content: flex-start;
    }

    .app-shell-topline {
        align-items: flex-start;
    }
}
