/* =========================================================
   Open Teamwork — styles
   Visual language inspired by GitHub (Primer). Every color comes from the
   theme variables below; js/theme.js sets <html data-theme="light|dark">.

   1. Theme tokens          7. Cards and chips
   2. Base                  8. Explore (project grid)
   3. Layout                9. Modals
   4. Header and navigation 10. My projects
   5. Buttons              11. Login and profile
   6. Forms                12. People and public profile
                           13. About
                           14. Utilities
   ========================================================= */

/* 1. THEME TOKENS ---------------------------------------- */
:root,
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1117;
    --bg-header: #010409;
    --bg-card: #161b22;
    --bg-inset: #0d1117;
    --bg-muted: #21262d;
    --bg-muted-hover: #30363d;
    --bg-hover: #1c2128;
    --border: #30363d;
    --border-muted: #21262d;
    --skeleton: #21262d;
    --skeleton-shine: #2d333b;
    --fg: #e6edf3;
    --fg-muted: #8b949e;
    --fg-subtle: #6e7681;
    --fg-on-emphasis: #ffffff;
    --brand: #40a83a;
    --accent: #58a6ff;
    --accent-emphasis: #1f6feb;
    --accent-hover: #388bfd;
    --accent-subtle: rgba(56, 139, 253, 0.15);
    --accent-muted: rgba(56, 139, 253, 0.4);
    --success: #3fb950;
    --success-emphasis: #238636;
    --success-hover: #2ea043;
    --success-subtle: rgba(46, 160, 67, 0.15);
    --success-muted: rgba(46, 160, 67, 0.4);
    --danger: #f85149;
    --danger-emphasis: #da3633;
    --danger-hover: #b62324;
    --danger-subtle: rgba(248, 81, 73, 0.1);
    --danger-muted: rgba(248, 81, 73, 0.4);
    --attention: #d29922;
    --attention-subtle: rgba(187, 128, 9, 0.15);
    --overlay: rgba(1, 4, 9, 0.7);
    --shadow-sm: 0 1px 0 rgba(1, 4, 9, 0.3);
    --shadow-lg: 0 8px 24px rgba(1, 4, 9, 0.6);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f8fa;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-inset: #f6f8fa;
    --bg-muted: #f6f8fa;
    --bg-muted-hover: #eaeef2;
    --bg-hover: #f3f6f9;
    --border: #d0d7de;
    --border-muted: #d8dee4;
    --skeleton: #eaeef2;
    --skeleton-shine: #f6f8fa;
    --fg: #1f2328;
    --fg-muted: #59636e;
    --fg-subtle: #6e7781;
    --fg-on-emphasis: #ffffff;
    --brand: #1a7f37;
    --accent: #0969da;
    --accent-emphasis: #0969da;
    --accent-hover: #0860ca;
    --accent-subtle: #ddf4ff;
    --accent-muted: rgba(84, 174, 255, 0.4);
    --success: #1a7f37;
    --success-emphasis: #1f883d;
    --success-hover: #1a7f37;
    --success-subtle: #dafbe1;
    --success-muted: rgba(74, 194, 107, 0.5);
    --danger: #d1242f;
    --danger-emphasis: #cf222e;
    --danger-hover: #a40e26;
    --danger-subtle: #ffebe9;
    --danger-muted: rgba(255, 129, 130, 0.5);
    --attention: #9a6700;
    --attention-subtle: #fff8c5;
    --overlay: rgba(31, 35, 40, 0.5);
    --shadow-sm: 0 1px 0 rgba(31, 35, 40, 0.04);
    --shadow-lg: 0 8px 24px rgba(140, 149, 159, 0.25);
}

:root {
    --radius: 6px;
    --radius-lg: 12px;
    --header-height: 60px;
    --bottom-nav-height: 0px;
    --focus-ring: 0 0 0 3px var(--accent-muted);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* 2. BASE ------------------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-padding-top: calc(var(--header-height) + 12px);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: break-word;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

svg {
    fill: currentColor;
    flex-shrink: 0;
}

button {
    font: inherit;
    color: inherit;
}

h1 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: 15px;
    font-weight: 600;
}

:focus-visible {
    outline: 2px solid var(--accent-emphasis);
    outline-offset: 2px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    border-radius: var(--radius);
    background: var(--bg-muted);
}

/* 3. LAYOUT ----------------------------------------------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.page {
    padding-top: 24px;
    padding-bottom: calc(48px + var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.page-lead {
    max-width: 720px;
    margin: -8px 0 20px;
    color: var(--fg-muted);
    font-size: 15px;
}

.page-section {
    margin-bottom: 32px;
}

.page-section > h2 {
    margin-bottom: 12px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.result-counter {
    color: var(--fg-muted);
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 300;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--accent-emphasis);
    color: var(--fg-on-emphasis);
}

.skip-link:focus {
    top: 12px;
}

@media (max-width: 600px) {
    .container {
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }

    .page {
        padding-top: 16px;
    }

    h1 {
        font-size: 22px;
    }
}

/* 4. HEADER AND NAVIGATION ------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: env(safe-area-inset-top);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-muted);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: var(--header-height);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--brand);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.brand:hover {
    text-decoration: none;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.site-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius);
    color: var(--fg-muted);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--bg-muted-hover);
    color: var(--fg);
    text-decoration: none;
}

.nav-link.active {
    color: var(--fg);
    background: var(--bg-muted);
    box-shadow: inset 0 -2px 0 var(--accent-emphasis);
}

.nav-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Below 900px the icons go away so the five labels still fit. */
@media (max-width: 900px) and (min-width: 721px) {
    .nav-link .nav-icon {
        display: none;
    }

    .nav-link {
        padding: 6px 8px;
    }
}

/* Phones: the menu becomes a tab bar at the bottom, like a native app. */
@media (max-width: 720px) {
    :root {
        --header-height: 54px;
        --bottom-nav-height: 62px;
    }

    .header-actions {
        margin-left: auto;
    }

    .site-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0;
        margin: 0;
        padding: 4px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
        background: var(--bg-header);
        border-top: 1px solid var(--border-muted);
    }

    .nav-link {
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        height: calc(var(--bottom-nav-height) - 8px);
        padding: 4px 2px;
        font-size: 11px;
        letter-spacing: -0.01em;
    }

    .nav-link span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-link .nav-icon {
        width: 22px;
        height: 22px;
    }

    .nav-link:hover {
        background: transparent;
    }

    .nav-link.active {
        background: transparent;
        box-shadow: none;
        color: var(--accent);
    }

    .nav-link.active .nav-icon {
        stroke-width: 2.4;
    }
}

/* Theme switcher (built by js/theme.js) */
.theme-switcher {
    position: relative;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg-muted);
    cursor: pointer;
}

.icon-button:hover {
    background: var(--bg-muted-hover);
    color: var(--fg);
}

.theme-icon,
.theme-check {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 200;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
}

.theme-menu[hidden] {
    display: none;
}

.theme-menu-title {
    padding: 6px 10px 4px;
    color: var(--fg-muted);
    font-size: 12px;
    font-weight: 600;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg);
    text-align: left;
    cursor: pointer;
}

.theme-option:hover,
.theme-option:focus-visible {
    background: var(--bg-muted-hover);
    outline: none;
}

.theme-option span {
    flex: 1;
}

.theme-option .theme-check {
    visibility: hidden;
    color: var(--accent);
}

.theme-option[aria-checked="true"] .theme-check {
    visibility: visible;
}

/* 5. BUTTONS ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-muted);
    color: var(--fg);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    background: var(--bg-muted-hover);
    text-decoration: none;
}

.btn:disabled,
.btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:hover {
    background: var(--bg-muted);
}

.btn-primary {
    background: var(--success-emphasis);
    border-color: var(--success-hover);
    color: var(--fg-on-emphasis);
}

.btn-primary:hover {
    background: var(--success-hover);
}

.btn-primary:disabled:hover {
    background: var(--success-emphasis);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent-subtle);
    border-color: var(--accent-muted);
}

.btn-danger {
    background: var(--danger-emphasis);
    border-color: var(--danger-emphasis);
    color: var(--fg-on-emphasis);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger-subtle);
    border-color: var(--danger-muted);
}

.btn-success-outline {
    background: transparent;
    color: var(--success);
}

.btn-success-outline:hover {
    background: var(--success-subtle);
    border-color: var(--success-muted);
}

.btn-small {
    min-height: 28px;
    padding: 3px 10px;
    font-size: 12px;
}

.btn-large {
    min-height: 40px;
    padding: 8px 18px;
    font-size: 15px;
}

.btn-icon {
    width: 32px;
    padding: 0;
    background: transparent;
    color: var(--fg-muted);
}

.btn-icon:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.btn-icon-danger:hover {
    color: var(--danger);
    background: var(--danger-subtle);
}

.apply-button.applied {
    background: var(--accent-emphasis);
    border-color: var(--accent-emphasis);
}

.apply-button.applied:hover {
    background: var(--accent-hover);
}

.apply-button.own {
    background: transparent;
    border-color: var(--border);
    color: var(--fg-muted);
}

.apply-button.own:hover {
    background: var(--bg-muted-hover);
    color: var(--fg);
}

.apply-button.accepted {
    background: var(--success-subtle);
    border-color: var(--success-muted);
    color: var(--success);
}

.apply-button.full,
.apply-button.full:hover {
    background: var(--bg-muted);
    border-color: var(--border);
    color: var(--fg-muted);
}

.close-button {
    width: 32px;
    min-height: 32px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    color: var(--fg-muted);
}

.close-button:hover {
    color: var(--fg);
}

@media (pointer: coarse) {
    .btn {
        min-height: 40px;
    }

    .btn-icon,
    .close-button {
        width: 40px;
    }

    .btn-small {
        min-height: 36px;
    }
}

/* 6. FORMS ------------------------------------------------ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group > label,
.form-label {
    color: var(--fg);
    font-size: 14px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.span-2 {
    grid-column: 1 / -1;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-inset);
    color: var(--fg);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--fg-subtle);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-emphasis);
    box-shadow: var(--focus-ring);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--success-emphasis);
    cursor: pointer;
}

.input-hint {
    color: var(--fg-muted);
    font-size: 12px;
}

.input-hint.is-good {
    color: var(--success);
}

.input-hint.is-bad {
    color: var(--danger);
}

/* Input with a fixed prefix ("https://github.com/" or "@") */
.prefixed-field {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-inset);
    overflow: hidden;
}

.prefixed-field:focus-within {
    border-color: var(--accent-emphasis);
    box-shadow: var(--focus-ring);
}

.prefixed-field .field-prefix {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-right: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--fg-muted);
    font-size: 13px;
    white-space: nowrap;
}

.prefixed-field input {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
}

.form-message {
    padding: 10px 14px;
    border: 1px solid;
    border-radius: var(--radius);
}

.form-message.success {
    border-color: var(--success-muted);
    background: var(--success-subtle);
    color: var(--fg);
}

.form-message.error {
    border-color: var(--danger-muted);
    background: var(--danger-subtle);
    color: var(--danger);
}

/* E-mail confirmation and password reset steps */
.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.link-button:hover:not(:disabled) {
    text-decoration: underline;
}

.link-button:disabled {
    color: var(--fg-muted);
    cursor: default;
}

.auth-forgot {
    align-self: flex-end;
    margin-top: 2px;
    font-size: 13px;
}

.auth-step-text {
    color: var(--fg-muted);
    line-height: 1.5;
}

.auth-step-text strong {
    color: var(--fg);
    word-break: break-all;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
}

input.code-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 24px;
    letter-spacing: 0.4em;
    text-align: center;
}

/* Tag input (chips) in the project form */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-inset);
    cursor: text;
}

.tag-input:focus-within {
    border-color: var(--accent-emphasis);
    box-shadow: var(--focus-ring);
}

.tag-input input.tag-input-field {
    flex: 1 1 120px;
    width: auto;
    min-width: 0;
    min-height: 28px;
    padding: 2px 4px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding: 2px 3px 2px 10px;
    white-space: normal;
    animation: tag-pop 0.16s ease-out;
}

.tag-chip-label {
    overflow-wrap: anywhere;
}

.tag-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.tag-chip-remove:hover,
.tag-chip-remove:focus-visible {
    background: var(--danger-subtle);
    color: var(--danger);
    outline: none;
}

@keyframes tag-pop {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* 16px stops iOS from zooming in when a field gets focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    textarea {
        font-size: 16px;
    }
}

@media (pointer: coarse) {
    .tag-chip-remove {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

/* 7. CARDS AND CHIPS ------------------------------------- */
.card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.card > h2 {
    margin-bottom: 16px;
}

.card > .card-hint {
    margin: -10px 0 16px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.qualification-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 4px 3px 8px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--success-emphasis);
    border-radius: var(--radius);
    color: var(--fg-muted);
    font-size: 12px;
}

.qualification-chip .person-icon {
    color: var(--fg-subtle);
}

.qualification-chip .qualification-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qualification-count,
.counter {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bg-muted-hover);
    color: var(--fg);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.qualification-chip.full {
    border-left-color: var(--border);
    opacity: 0.6;
}

.qualification-chip.full .qualification-name {
    text-decoration: line-through;
}

.topic-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
}

.status-badge {
    display: inline-flex;
    padding: 1px 8px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    border-color: var(--attention);
    color: var(--attention);
    background: var(--attention-subtle);
}

.status-accepted {
    border-color: var(--success-muted);
    color: var(--success);
    background: var(--success-subtle);
}

.status-rejected {
    border-color: var(--danger-muted);
    color: var(--danger);
    background: var(--danger-subtle);
}

/* Round photo (or default icon) next to people's names */
.user-avatar {
    --avatar-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--avatar-size);
    height: var(--avatar-size);
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-muted);
    color: var(--fg-subtle);
    overflow: hidden;
}

.user-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar svg {
    width: 60%;
    height: 60%;
}

.owner-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--fg-muted);
}

a.owner-link:hover {
    color: var(--accent);
}

.owner-email {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    color: var(--fg-muted);
}

.owner-email span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owner-email:hover {
    color: var(--accent);
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--fg-muted);
    text-align: center;
}

.empty-state h3 {
    color: var(--fg);
    font-size: 16px;
}

.empty-state .btn {
    margin-top: 8px;
}

.empty-state.error h3 {
    color: var(--danger);
}

/* 8. EXPLORE (project grid) ------------------------------- */
.search-field {
    position: relative;
    flex: 1 1 320px;
    max-width: 560px;
}

.search-field svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-subtle);
    pointer-events: none;
}

.search-field input {
    padding-left: 36px;
}

/* Search + filter side by side; the result counter stays on the right. */
.toolbar-controls {
    display: flex;
    flex: 1 1 520px;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 800px;
}

.filter-menu {
    position: relative;
    flex: 0 0 auto;
}

.filter-toggle {
    min-height: 40px;
}

.filter-toggle.is-active {
    border-color: var(--accent-emphasis);
    color: var(--accent);
}

.filter-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    width: 280px;
    padding: 8px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: 0 8px 24px rgba(1, 4, 9, 0.35);
}

.filter-group + .filter-group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border-muted);
}

.filter-group-title {
    padding: 6px 16px 4px;
    color: var(--fg-muted);
    font-size: 12px;
    font-weight: 600;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

.filter-option:hover {
    background: var(--bg-hover);
}

.filter-option.is-disabled {
    color: var(--fg-subtle);
    cursor: not-allowed;
}

.filter-option.is-disabled:hover {
    background: none;
}

.filter-option input:disabled {
    cursor: not-allowed;
}

.filter-note {
    padding: 4px 16px 6px;
    color: var(--fg-muted);
    font-size: 12px;
}

.filter-clear {
    display: block;
    width: calc(100% - 16px);
    margin: 6px 8px 0;
}

.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
}

.repo-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease;
}

.repo-card:hover {
    border-color: var(--accent-muted);
}

.repo-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.repo-icon {
    margin-top: 2px;
    color: var(--fg-muted);
}

.repo-name {
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

.repo-owner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    font-size: 13px;
}

.repo-description {
    color: var(--fg-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.repo-qualifications {
    margin-top: auto;
}

.more-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--fg-muted);
    font-size: 12px;
}

.repo-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-muted);
}

@media (max-width: 600px) {
    .repo-grid {
        gap: 12px;
    }

    .search-field {
        max-width: none;
    }

    .toolbar-controls {
        max-width: none;
    }

    .filter-panel {
        left: 0;
        right: auto;
        width: min(320px, calc(100vw - 32px));
    }

    .repo-footer .btn {
        flex: 1;
    }
}

/* 9. MODALS ----------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--overlay);
}

.modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.16s ease-out;
}

.modal-content:focus {
    outline: none;
}

.modal-large {
    max-width: 760px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-muted);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
}

.modal-subtitle {
    margin-bottom: 12px;
    color: var(--fg-muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-muted);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Phones: the modal is a sheet that comes from the bottom */
@media (max-width: 600px) {
    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content,
    .modal-large {
        max-width: none;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top));
        border-radius: 16px 16px 0 0;
        border-bottom: 0;
        animation-name: sheet-in;
        animation-duration: 0.2s;
    }

    .modal-header,
    .modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .modal-actions {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }

    .modal-actions .btn {
        flex: 1;
    }
}

@keyframes sheet-in {
    from {
        transform: translateY(40px);
        opacity: 0.6;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

/* Project details */
.details-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-muted);
}

.details-owner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    min-width: 0;
}

.details-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.details-section + .details-section {
    margin-top: 20px;
}

.details-section h3 {
    margin-bottom: 10px;
}

.details-description {
    color: var(--fg-muted);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-line;
}

/* Choosing qualifications when applying */
.qualifications-list {
    display: grid;
    gap: 8px;
}

.qualification-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.qualification-option:hover {
    border-color: var(--accent-muted);
    background: var(--bg-hover);
}

.qualification-option:has(input:checked) {
    border-color: var(--success-muted);
    background: var(--success-subtle);
}

.qualification-option .person-icon {
    color: var(--accent);
}

.qualification-option .qualification-name {
    flex: 1;
}

.qualification-option.locked {
    cursor: not-allowed;
    opacity: 0.7;
}

.qualification-option.locked:hover {
    border-color: var(--border);
    background: transparent;
}

.qualification-option.accepted {
    border-color: var(--success-muted);
}

.qualification-option.rejected {
    border-color: var(--danger-muted);
}

.qualification-note {
    color: var(--fg-muted);
    font-size: 12px;
    font-weight: 600;
}

.qualification-note.accepted {
    color: var(--success);
}

.qualification-note.rejected {
    color: var(--danger);
}

/* 10. MY PROJECTS ----------------------------------------- */
.project-list {
    display: grid;
    gap: 16px;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.project-card-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.project-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 16px;
}

.project-card-title a {
    color: inherit;
}

.project-card-url {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: 12px;
}

.project-card-url span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-description {
    color: var(--fg-muted);
    white-space: pre-line;
}

.project-card-actions {
    display: flex;
    flex-shrink: 0;
    gap: 6px;
}

.applications-panel {
    padding-top: 12px;
    border-top: 1px solid var(--border-muted);
}

.applications-panel h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px;
    font-size: 14px;
}

.applications-panel.error {
    color: var(--danger);
}

.application-list {
    list-style: none;
    margin-bottom: 12px;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius);
}

.application-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    flex-wrap: wrap;
    padding: 10px 12px;
}

.application-item + .application-item {
    border-top: 1px solid var(--border-muted);
}

.application-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--fg-muted);
    font-size: 13px;
}

.application-info strong {
    color: var(--fg);
    font-size: 14px;
}

.application-info strong a {
    color: inherit;
}

.applicant-nick {
    margin-left: 6px;
    color: var(--fg-muted);
    font-weight: 400;
}

.application-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Project form */
.qualification-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px auto;
    gap: 8px;
    margin-bottom: 8px;
}

.qualification-row .btn-icon {
    height: 40px;
    width: 40px;
}

@media (max-width: 600px) {
    .project-card {
        padding: 14px;
    }

    .project-card-header {
        flex-direction: column;
    }

    .project-card-actions {
        width: 100%;
    }

    .project-card-actions [data-action="applications"] {
        flex: 1;
    }

    .qualification-row {
        grid-template-columns: minmax(0, 1fr) 68px auto;
    }
}

/* 11. LOGIN AND PROFILE ----------------------------------- */
.auth-panel {
    max-width: 520px;
}

/* Signed-out profile page: a narrow centred column, like the GitHub sign-in. */
.auth-logo {
    display: none;
}

body.auth-mode .page {
    max-width: 440px;
    padding-top: 40px;
}

body.auth-mode .auth-logo {
    display: block;
    margin: 0 auto 16px;
}

body.auth-mode .page-header {
    justify-content: center;
    margin-bottom: 8px;
    text-align: center;
}

body.auth-mode .page-lead {
    margin: 0 auto 24px;
    text-align: center;
}

/* Steps without the intro text (code, password reset) still need the gap. */
body.auth-mode .page-header:has(+ .page-lead.hidden) {
    margin-bottom: 24px;
}

body.auth-mode .auth-panel {
    max-width: none;
}

.segmented {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-inset);
}

.segmented-item {
    min-height: 36px;
    padding: 6px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fg-muted);
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

.segmented-item:hover {
    color: var(--fg);
}

.segmented-item.active {
    background: var(--bg-card);
    color: var(--fg);
    box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}

.auth-panel .segmented {
    display: grid;
    width: 100%;
    margin-bottom: 20px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-header p {
    color: var(--fg-muted);
}

.auth-panel .form-message {
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.auth-form .form-actions .btn {
    width: 100%;
}

/* Profile page: one centred column (880px of content + the page padding). */
.profile-page {
    max-width: 920px;
}

.profile-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.profile-identity h2 {
    font-size: 20px;
    overflow-wrap: anywhere;
}

.profile-identity p {
    color: var(--fg-muted);
    overflow-wrap: anywhere;
}

.profile-main {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.avatar-uploader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.avatar-preview .user-avatar {
    border-width: 2px;
}

.avatar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 128px;
    height: 128px;
    border: 2px dashed var(--border);
    border-radius: 50%;
    color: var(--fg-subtle);
    font-size: 12px;
}

.avatar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.avatar-remove-button {
    border-color: transparent;
    background: transparent;
    color: var(--danger);
}

.avatar-remove-button:hover {
    background: var(--danger-subtle);
}

/* Save bar: stays visible while the long form scrolls */
.profile-actions {
    position: sticky;
    bottom: calc(12px + var(--bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
}

.profile-actions-note {
    margin-right: auto;
    color: var(--fg-muted);
}

@media (max-width: 720px) {
    .profile-main {
        grid-template-columns: 1fr;
    }

    .avatar-uploader {
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border-muted);
    }
}

@media (max-width: 600px) {
    .card {
        padding: 16px;
    }

    .profile-summary .btn {
        width: 100%;
    }

    .profile-actions-note {
        display: none;
    }

    .profile-actions .btn {
        flex: 1;
    }

    /* The long prefixes go above the field instead of squeezing it */
    .prefixed-field.long-prefix {
        flex-direction: column;
    }

    .prefixed-field.long-prefix .field-prefix {
        padding: 6px 10px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        font-size: 12px;
    }
}

/* 12. PEOPLE AND PUBLIC PROFILE --------------------------- */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 12px;
}

.person-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease;
}

.person-card:hover,
.person-card:focus-visible {
    border-color: var(--accent-muted);
    text-decoration: none;
}

.person-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.person-name {
    color: var(--fg);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.person-nick {
    color: var(--accent);
    font-size: 13px;
}

.person-bio {
    margin-top: 4px;
    color: var(--fg-muted);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.load-more {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.back-link {
    display: inline-block;
    margin-bottom: 12px;
}

.user-state {
    padding: 40px 12px;
    color: var(--fg-muted);
    text-align: center;
}

.user-state.error {
    color: var(--danger);
}

.user-hero-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.user-hero {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-hero-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 26px;
    overflow-wrap: anywhere;
}

.user-nick {
    color: var(--fg-muted);
    font-size: 18px;
    font-weight: 300;
}

.user-since {
    margin-top: 4px;
    color: var(--fg-muted);
    font-size: 13px;
}

.user-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.user-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
}

.user-link:hover {
    border-color: var(--accent-muted);
    background: var(--accent-subtle);
    text-decoration: none;
}

.user-edit-link {
    align-self: flex-start;
}

.user-bio {
    font-size: 15px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.user-section {
    margin-bottom: 16px;
}

.user-section > h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.contact-list {
    display: grid;
    gap: 8px;
    list-style: none;
}

.contact-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    overflow-wrap: anywhere;
}

.contact-label {
    min-width: 72px;
    color: var(--fg-muted);
}

@media (max-width: 600px) {
    .user-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .user-name {
        font-size: 22px;
    }

    .user-edit-link {
        align-self: stretch;
    }
}

/* 13. ABOUT ----------------------------------------------- */
.about-content {
    max-width: 820px;
}

.video-tabs {
    display: grid;
    width: 100%;
    margin-bottom: 16px;
}

.video-tabs .segmented-item {
    min-height: 44px;
    text-align: center;
    white-space: normal;
}

.video-panel h3 {
    margin-bottom: 4px;
}

.video-description {
    margin-bottom: 14px;
    color: var(--fg-muted);
    line-height: 1.6;
}

.video-embed {
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #000;
    overflow: hidden;
}

.video-embed iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.app-download {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.app-download-icon {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 16px;
}

.app-download-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.app-download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-download-help {
    color: var(--fg-muted);
    font-size: 13px;
    line-height: 1.6;
}

.app-download-help summary {
    width: fit-content;
    color: var(--accent);
    cursor: pointer;
}

.app-download-help ol {
    margin-top: 8px;
    padding-left: 18px;
}

.app-download-help li + li {
    margin-top: 6px;
}

.quote {
    padding-left: 14px;
    border-left: 3px solid var(--accent-emphasis);
    font-size: 16px;
}

.quote cite {
    display: block;
    margin-top: 4px;
    color: var(--fg-muted);
    font-size: 14px;
}

@media (max-width: 560px) {
    .video-tabs {
        grid-auto-flow: row;
    }

    .app-download {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .app-download-actions .btn {
        width: 100%;
    }

    .app-download-help {
        text-align: left;
    }
}

/* 14. UTILITIES ------------------------------------------- */
.hidden {
    display: none !important;
}

.muted {
    color: var(--fg-muted);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

.skeleton {
    display: block;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-shine) 50%, var(--skeleton) 75%);
    background-size: 200% 100%;
    animation: skeleton-shine 1.4s ease-in-out infinite;
}

@keyframes skeleton-shine {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.skeleton-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.skeleton-line { height: 12px; max-width: 100%; }
.skeleton-title { height: 16px; }
.skeleton-heading { height: 24px; }
.skeleton-chip { height: 24px; border-radius: 999px; }
.skeleton-button { height: 32px; }
.skeleton-circle { border-radius: 50%; }

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.skeleton-footer {
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-muted);
}

.skeleton-stack {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.skeleton-hero { gap: 20px; margin-bottom: 8px; }
.skeleton-panel { padding: 16px 0; }
.person-card.skeleton-card { flex-direction: row; }

.skeleton-user {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Spinner shared by busy buttons and the slow-server notice. */
.spinner {
    display: inline-block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.is-busy {
    position: relative;
    color: transparent !important;
    cursor: progress;
}

.btn.is-busy > * { visibility: hidden; }

.btn.is-busy::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid var(--fg);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-primary.is-busy::after,
.btn-danger.is-busy::after { border-color: #ffffff; border-right-color: transparent; }

.slow-notice {
    position: fixed;
    left: 50%;
    bottom: calc(16px + var(--bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: 0 8px 24px rgba(1, 4, 9, 0.35);
    color: var(--fg-muted);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.slow-notice.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.slow-notice strong { color: var(--fg); }
.slow-notice .spinner { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Admin (pages/admin.html) ---------- */
.admin-card {
    max-width: 420px;
    margin: 0 auto;
}

.admin-search {
    margin: 16px 0 8px;
}

.admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.admin-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 13px;
    color: var(--fg-muted);
}

.admin-row-info strong {
    color: var(--fg);
    font-size: 15px;
}

.admin-row-info span {
    overflow-wrap: anywhere;
}

.admin-row .btn {
    flex-shrink: 0;
}

.admin-empty {
    color: var(--fg-muted);
    padding: 12px 0;
}

/* ---------- Página não encontrada (404.html) ---------- */
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 12vh;
}

.not-found-code {
    margin: 0;
    font-size: clamp(72px, 22vw, 140px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--success-emphasis);
}

.not-found h1 {
    margin: 12px 0 8px;
}

.not-found-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}
