:root {
    --bg: #f6f2e8;
    --bg-alt: #fbf8f1;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #fffdf8;
    --surface-dark: #171717;
    --text: #1a1a1a;
    --text-soft: #6b655d;
    --line: rgba(26, 26, 26, 0.08);
    --accent: #ffd54a;
    --accent-strong: #ffc919;
    --accent-soft: rgba(255, 213, 74, 0.24);
    --ok: #219653;
    --info: #2f80ed;
    --warning: #b7791f;
    --danger: #d64528;
    --shadow: 0 24px 80px rgba(50, 42, 26, 0.12);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --font-main: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
    --font-mono: "SFMono-Regular", "JetBrains Mono", monospace;
    --page-background:
        radial-gradient(78rem 44rem at -10% -6%, rgba(255, 213, 74, 0.3) 0%, rgba(255, 213, 74, 0.18) 28%, rgba(255, 213, 74, 0.08) 46%, transparent 72%),
        radial-gradient(72rem 40rem at 108% 10%, rgba(255, 201, 25, 0.18) 0%, rgba(255, 201, 25, 0.1) 26%, rgba(255, 201, 25, 0.04) 42%, transparent 68%),
        linear-gradient(180deg, #fbf8f1 0%, #efe8da 100%);
    --header-border: rgba(255, 255, 255, 0.7);
    --header-background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 224, 0.9));
    --panel-background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 249, 228, 0.9));
    --auth-background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 249, 228, 0.92));
    --toolbar-background: rgba(255, 255, 255, 0.72);
    --field-background: rgba(255, 255, 255, 0.94);
    --shade-soft: rgba(23, 23, 23, 0.08);
    --button-muted-background: rgba(23, 23, 23, 0.12);
    --button-muted-text: var(--text-soft);
    --button-secondary-background: var(--surface-dark);
    --button-secondary-text: #fff9ed;
    --success-background: rgba(33, 150, 83, 0.08);
    --info-background: rgba(47, 128, 237, 0.08);
    --warning-background: rgba(183, 121, 31, 0.12);
    --danger-background: rgba(214, 69, 40, 0.08);
    --eyebrow-text: #fff7e6;
    --soft-panel-background: rgba(255, 255, 255, 0.52);
    --calendar-background: rgba(255, 255, 255, 0.62);
    --activity-cell-background: rgba(23, 23, 23, 0.08);
    --payload-background: #171717;
    --payload-text: #f6f1e8;
    --theme-toggle-track: #ffffff;
    --theme-toggle-track-shadow: 0 10px 24px rgba(184, 174, 154, 0.28);
    --theme-toggle-mask: #ffffff;
    --theme-toggle-knob: linear-gradient(180deg, #ffd54a 0%, #ffc919 100%);
    --theme-toggle-knob-checked: linear-gradient(180deg, #fffdf8 0%, #efe6d4 100%);
    --toast-shadow: 0 20px 48px rgba(50, 42, 26, 0.18);
}

:root[data-theme="dark"] {
    --bg: #141414;
    --bg-alt: #1b1b1b;
    --surface: rgba(29, 29, 29, 0.88);
    --surface-strong: #232323;
    --surface-dark: #faf3df;
    --text: #f7f2e7;
    --text-soft: #b7ad9a;
    --line: rgba(255, 245, 222, 0.1);
    --accent: #ffd44d;
    --accent-strong: #ffc919;
    --accent-soft: rgba(255, 213, 74, 0.2);
    --shadow: 0 28px 84px rgba(0, 0, 0, 0.42);
    --page-background:
        radial-gradient(78rem 46rem at -10% -4%, rgba(255, 201, 25, 0.12) 0%, rgba(255, 201, 25, 0.07) 32%, rgba(255, 201, 25, 0.03) 48%, transparent 74%),
        radial-gradient(72rem 42rem at 108% 14%, rgba(255, 213, 74, 0.08) 0%, rgba(255, 213, 74, 0.04) 30%, rgba(255, 213, 74, 0.02) 44%, transparent 70%),
        linear-gradient(180deg, #171717 0%, #0f0f0f 100%);
    --header-border: rgba(255, 255, 255, 0.06);
    --header-background: linear-gradient(135deg, rgba(31, 31, 31, 0.94), rgba(20, 20, 20, 0.92));
    --panel-background: linear-gradient(135deg, rgba(31, 31, 31, 0.94), rgba(19, 19, 19, 0.9));
    --auth-background: linear-gradient(135deg, rgba(31, 31, 31, 0.94), rgba(19, 19, 19, 0.92));
    --toolbar-background: rgba(32, 32, 32, 0.8);
    --field-background: rgba(24, 24, 24, 0.96);
    --shade-soft: rgba(255, 255, 255, 0.1);
    --button-muted-background: rgba(255, 255, 255, 0.08);
    --button-muted-text: var(--text);
    --button-secondary-background: rgba(255, 255, 255, 0.9);
    --button-secondary-text: #171717;
    --success-background: rgba(33, 150, 83, 0.18);
    --info-background: rgba(47, 128, 237, 0.2);
    --warning-background: rgba(183, 121, 31, 0.22);
    --danger-background: rgba(214, 69, 40, 0.18);
    --eyebrow-text: #171717;
    --soft-panel-background: rgba(255, 255, 255, 0.04);
    --calendar-background: rgba(255, 255, 255, 0.05);
    --activity-cell-background: rgba(255, 255, 255, 0.09);
    --payload-background: rgba(9, 9, 9, 0.94);
    --payload-text: #f7f2e7;
    --theme-toggle-track: #000000;
    --theme-toggle-track-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
    --theme-toggle-mask: #000000;
    --theme-toggle-knob: linear-gradient(180deg, #ffd44d 0%, #ffc919 100%);
    --theme-toggle-knob-checked: linear-gradient(180deg, #faf3df 0%, #d9ccb2 100%);
    --toast-shadow: 0 22px 52px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    font-family: var(--font-main);
}

html {
    background: var(--bg);
}

body {
    padding: clamp(10px, 1.6vw, 18px);
    position: relative;
    background: transparent;
    z-index: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--page-background);
    background-repeat: no-repeat;
    background-size: cover;
    z-index: -1;
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.hidden {
    display: none !important;
}

.app-shell {
    width: min(100%, 1580px);
    max-width: 1580px;
    margin: 0 auto;
}

.site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    border: 1px solid var(--header-border);
    border-radius: 34px;
    background: var(--header-background);
    box-shadow: var(--shadow);
}

.site-header__left,
.site-header__right,
.auth-actions,
.site-nav,
.page-topbar,
.room-toolbar,
.form-actions,
.action-strip,
.panel-card__head,
.annotator-row,
.annotator-row__meta,
.current-user-badge,
.brand-mark,
.hero-card,
.hero-card__stats,
.wide-card,
.create-layout,
.workspace-grid {
    display: flex;
}

.site-header__left {
    flex: 1 1 auto;
    align-items: center;
    flex-wrap: nowrap;
    gap: 18px;
    min-width: 0;
}

.site-header__right {
    flex: 0 0 auto;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    justify-self: end;
}

.brand-mark {
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
}

.brand-mark__logo {
    width: 58px;
    height: 58px;
    padding: 0;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.brand-mark__logo-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.brand-mark__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-mark__text strong {
    font-size: 1.1rem;
    letter-spacing: -0.04em;
    overflow-wrap: anywhere;
}

.brand-mark__text small {
    color: var(--text-soft);
}

.site-nav {
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
    min-width: 0;
}

.site-nav__link {
    padding: 12px 16px;
    border-radius: 999px;
    color: var(--text-soft);
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.site-nav__link:hover,
.site-nav__link.is-active {
    background: var(--shade-soft);
    color: var(--text);
    transform: translateY(-1px);
}

.auth-actions {
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
}

.room-card,
.metric-card,
.info-card,
.wide-card,
.form-card,
.panel-card,
.side-note,
.empty-card,
.current-user-badge {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
}

.field,
.inline-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span,
.inline-field span,
.header-note {
    color: var(--text-soft);
    font-size: 0.82rem;
}

.field--export-compact {
    width: fit-content;
    max-width: 100%;
}

.field--export-compact select {
    width: auto;
    min-width: 220px;
    max-width: min(100%, 320px);
    min-height: 58px;
    padding: 16px 44px 16px 18px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(26, 26, 26, 0.1);
    border-radius: 16px;
    padding: 14px 16px;
    background: var(--field-background);
    color: var(--text);
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(255, 201, 25, 0.84);
    box-shadow: 0 0 0 5px rgba(255, 213, 74, 0.18);
}

input[type="file"] {
    min-height: 54px;
    padding: 8px;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    margin-right: 12px;
    background: var(--button-muted-background);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, background 140ms ease;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
    transform: translateY(-1px);
    background: var(--accent-soft);
}

.btn {
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn--primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: var(--text);
    box-shadow: 0 14px 28px rgba(255, 201, 25, 0.22);
}

.btn--muted {
    background: var(--button-muted-background);
    color: var(--button-muted-text);
}

.btn--secondary {
    background: var(--button-secondary-background);
    color: var(--button-secondary-text);
}

.btn--danger {
    background: linear-gradient(180deg, #e05a3f 0%, #c43f24 100%);
    color: #fff8f4;
    box-shadow: 0 14px 28px rgba(214, 69, 40, 0.22);
}

.btn--compact {
    padding: 11px 14px;
}

.theme-toggle-shell {
    position: relative;
    display: block;
    width: 84px;
    min-width: 84px;
    height: 46px;
    min-height: 46px;
    flex: 0 0 auto;
}

.theme-toggle__checkbox {
    appearance: none;
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    z-index: 2;
}

.theme-toggle__checkbox:focus-visible + .theme-toggle__label {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 213, 74, 0.22);
}

.theme-toggle__label {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: var(--theme-toggle-track);
    overflow: hidden;
    cursor: pointer;
    transition: background 250ms ease, box-shadow 250ms ease, transform 180ms ease;
}

.theme-toggle-shell:hover .theme-toggle__label {
    transform: translateY(-1px);
    box-shadow: var(--theme-toggle-track-shadow);
}

.theme-toggle__label::before,
.theme-toggle__label::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 7px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: transform 500ms ease, background-color 250ms ease;
}

.theme-toggle__label::before {
    background: var(--theme-toggle-knob);
}

.theme-toggle__label::after {
    background-color: var(--theme-toggle-mask);
    left: -26px;
    transform: scale(0.00001);
}

.theme-toggle__checkbox:checked + .theme-toggle__label::before {
    background: var(--theme-toggle-knob-checked);
    transform: translateX(38px);
}

.theme-toggle__checkbox:checked + .theme-toggle__label::after {
    transform: translateX(57px) scale(1);
}

.current-user-badge {
    padding: 12px 14px;
    min-height: 48px;
    align-items: center;
    gap: 10px;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    align-self: flex-end;
    flex: 0 0 auto;
}

.logout-form {
    margin: 0;
}

.page-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
}

.toast-region {
    position: fixed;
    right: clamp(12px, 2vw, 20px);
    bottom: clamp(12px, 2vw, 20px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: min(360px, calc(100vw - 24px));
    max-height: min(46vh, 520px);
    padding: 4px;
    overflow-y: auto;
    pointer-events: auto;
    scrollbar-width: thin;
}

.toast-region:empty {
    display: none;
}

.toast-region::-webkit-scrollbar {
    width: 8px;
}

.toast-region::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(26, 26, 26, 0.16);
}

.toast-notification {
    --toast-accent: var(--accent-strong);
    --toast-progress-background: rgba(255, 201, 25, 0.16);
    --toast-progress-fill: linear-gradient(90deg, rgba(255, 201, 25, 0.38), var(--accent-strong));
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--toast-shadow);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast-notification.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-notification.is-leaving {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
}

.toast-notification--success {
    --toast-accent: var(--ok);
    --toast-progress-background: rgba(33, 150, 83, 0.14);
    --toast-progress-fill: linear-gradient(90deg, rgba(33, 150, 83, 0.36), var(--ok));
}

.toast-notification--info {
    --toast-accent: var(--info);
    --toast-progress-background: rgba(47, 128, 237, 0.14);
    --toast-progress-fill: linear-gradient(90deg, rgba(47, 128, 237, 0.32), var(--info));
}

.toast-notification--warning {
    --toast-accent: var(--warning);
    --toast-progress-background: rgba(183, 121, 31, 0.14);
    --toast-progress-fill: linear-gradient(90deg, rgba(183, 121, 31, 0.34), var(--warning));
}

.toast-notification--error {
    --toast-accent: var(--danger);
    --toast-progress-background: rgba(214, 69, 40, 0.14);
    --toast-progress-fill: linear-gradient(90deg, rgba(214, 69, 40, 0.34), var(--danger));
}

.toast-notification__body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px 14px 12px;
}

.toast-notification__accent {
    width: 8px;
    min-height: 54px;
    border-radius: 999px;
    background: var(--toast-accent);
    opacity: 0.96;
}

.toast-notification__content {
    min-width: 0;
    display: flex;
    align-items: center;
}

.toast-notification__message {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.toast-notification__close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--button-muted-background);
    color: var(--text-soft);
    cursor: pointer;
    transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.toast-notification__close:hover {
    transform: translateY(-1px);
    background: var(--shade-soft);
    color: var(--text);
}

.toast-notification__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 213, 74, 0.18);
}

.toast-notification__progress {
    height: 4px;
    background: var(--toast-progress-background);
}

.toast-notification__progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: var(--toast-progress-fill);
    animation: toast-progress var(--toast-duration, 5000ms) linear forwards;
}

.toast-notification.is-persistent .toast-notification__progress {
    display: none;
}

@keyframes toast-progress {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 8px 12px;
    width: fit-content;
    max-width: 100%;
    border-radius: 999px;
    background: var(--surface-dark);
    color: var(--eyebrow-text);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-card,
.page-topbar {
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: clamp(12px, 1.6vw, 18px);
    padding: clamp(16px, 1.6vw, 22px);
    border-radius: var(--radius-xl);
    background: var(--panel-background);
    box-shadow: var(--shadow);
}

.hero-card__main,
.page-topbar__copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.hero-card h1,
.page-topbar h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
    letter-spacing: -0.06em;
}

.hero-card p,
.page-topbar p,
.info-card p,
.wide-card p,
.empty-card,
.summary-stack,
.side-note li {
    color: var(--text-soft);
    line-height: 1.65;
}

.hero-card__main {
    max-width: 760px;
}

.hero-card__eyebrow {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    flex: 0 0 auto;
    align-self: flex-start;
}

.hero-card__main p,
.page-topbar__copy p {
    max-width: 60ch;
}

.room-header-meta__stack {
    width: min(100%, 320px);
}

.room-header-meta__delete {
    width: 100%;
    margin-top: 8px;
}

.page-topbar--room {
    align-items: stretch;
}

.page-topbar--room .page-topbar__copy {
    flex: 1 1 560px;
    max-width: 760px;
}

.room-header-side {
    flex: 0 1 720px;
    width: min(100%, 720px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.room-header-meta,
.room-header-metrics {
    min-width: 0;
}

.room-header-meta__stack {
    width: 100%;
}

.room-header-metrics {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.room-progress-chart {
    width: 100%;
    height: 100%;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    backdrop-filter: blur(16px);
    display: grid;
    grid-template-columns: minmax(160px, 200px) minmax(180px, 1fr);
    gap: 18px;
    align-items: center;
}

.room-progress-chart__visual {
    position: relative;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

.room-progress-chart__svg {
    display: block;
    width: 100%;
    height: auto;
    transform: rotate(-90deg);
}

.room-progress-chart__track,
.room-progress-chart__value {
    fill: none;
    stroke-width: 12;
}

.room-progress-chart__track {
    stroke: var(--activity-cell-background);
}

.room-progress-chart__value {
    stroke: var(--accent-strong);
    stroke-linecap: round;
    transition: stroke-dashoffset 220ms ease;
}

.room-progress-chart__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.room-progress-chart__center strong {
    font-size: 2rem;
    letter-spacing: -0.06em;
}

.room-progress-chart__center span {
    color: var(--text-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.room-progress-chart__legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding-right: 6px;
    min-width: 0;
    align-self: stretch;
    justify-content: center;
}

.room-progress-chart__legend-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 6px;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.room-progress-chart__legend-row span {
    color: var(--text-soft);
    min-width: 0;
    line-height: 1.15;
}

.room-progress-chart__legend-row strong {
    display: block;
    font-size: clamp(1.35rem, 2.2vw, 1.9rem);
    line-height: 1;
    white-space: nowrap;
    min-width: 0;
    text-align: left;
}

.hero-card__stats {
    gap: 12px;
    width: min(480px, 100%);
    align-items: stretch;
    flex: 1 1 320px;
    align-self: flex-start;
    flex-wrap: wrap;
}

.hero-card--landing {
    align-items: flex-start;
}

.hero-card--landing .hero-card__main {
    max-width: none;
    flex: 1 1 100%;
}

.hero-card--landing .hero-card__stats {
    width: 100%;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

@media (min-width: 981px) and (min-aspect-ratio: 1/1) {
    .hero-card--landing {
        display: grid;
        grid-template-columns: minmax(0, 1fr) max-content;
        column-gap: 24px;
        row-gap: 16px;
        align-items: start;
    }

    .hero-card--landing .hero-card__main {
        min-width: 0;
        max-width: none;
    }

    .hero-card--landing .hero-card__stats {
        width: max-content;
        max-width: none;
        justify-self: end;
        align-self: start;
        grid-template-columns: repeat(3, max-content);
        gap: 12px;
    }

    .hero-card--landing .metric-card {
        width: auto;
        min-width: 0;
        padding-right: 22px;
    }
}

.metric-card {
    flex: 1 1 150px;
    padding: 16px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-self: flex-start;
}

.metric-card span {
    color: var(--text-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-card strong {
    font-size: 2.45rem;
    letter-spacing: -0.08em;
}

.card-grid {
    display: grid;
    gap: 14px;
    align-items: start;
}

.card-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid--four {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.info-card,
.form-card,
.panel-card,
.side-note,
.empty-card {
    padding: 18px;
}

.card-grid--compact .info-card {
    height: fit-content;
    align-self: start;
}

.wide-card {
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    padding: 18px;
}

.wide-card--stack {
    align-items: stretch;
}

.wide-card__column {
    flex: 1 1 320px;
    min-width: min(100%, 320px);
    max-width: none;
}

.wide-card__column h2,
.info-card h2,
.form-card h2,
.panel-card h2,
.side-note h2 {
    margin: 0 0 10px;
    font-size: 1.22rem;
    letter-spacing: -0.03em;
}

.page-topbar--rooms {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.page-topbar--rooms .page-topbar__copy {
    flex: 1 1 420px;
    max-width: 560px;
}

.page-topbar--rooms .room-toolbar-card {
    flex: 0 1 820px;
    width: min(100%, 820px);
    margin-left: auto;
}

.page-topbar--profile {
    width: 100%;
    align-self: stretch;
    align-items: stretch;
    justify-content: space-between;
}

.page-topbar--profile .page-topbar__copy {
    flex: 1 1 560px;
    max-width: 760px;
}

.profile-metrics-grid {
    flex: 0 0 440px;
    width: min(100%, 440px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-chart-card {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-chart-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.profile-chart-card__head span {
    color: var(--text-soft);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.profile-chart-card__head strong {
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.06em;
}

.profile-chart-card__rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-chart-card__row {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.profile-chart-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.profile-chart-card__meta strong {
    color: var(--text);
    font-size: 1rem;
}

.profile-chart-card__track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--activity-cell-background);
    overflow: hidden;
}

.profile-chart-card__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.wide-card--profile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    row-gap: 16px;
    align-items: start;
}

.wide-card--profile .wide-card__column {
    min-width: 0;
}

.wide-card--profile .wide-card__column--activity {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-self: end;
    width: 100%;
}

.wide-card--profile .wide-card__column--activity h2 {
    align-self: flex-start;
    text-align: left;
}

.wide-card--profile .wide-card__column--activity .activity-board {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
}

.wide-card--profile .wide-card__column--activity .activity-board__legend {
    text-align: right;
}

.room-toolbar-card {
    border: 1px solid var(--line);
    background: var(--toolbar-background);
    border-radius: var(--radius-lg);
    padding: 14px;
    backdrop-filter: blur(16px);
    flex: 0 1 820px;
    max-width: 100%;
    width: min(100%, 820px);
}

.room-toolbar {
    align-items: flex-end;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}

.room-toolbar .inline-field {
    width: auto;
    flex: 1 1 180px;
    min-width: 0;
}

.room-toolbar .btn {
    flex: 0 1 auto;
    min-height: 52px;
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    align-items: stretch;
}

.room-grid-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

.room-card {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 210px;
    aspect-ratio: 1 / 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.room-card.is-pinned {
    border-color: rgba(255, 201, 25, 0.4);
    box-shadow: inset 0 0 0 1px rgba(255, 201, 25, 0.12);
}

.room-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 201, 25, 0.56);
}

.room-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.room-card__pin {
    border: 0;
    border-radius: 999px;
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    background: var(--button-muted-background);
    color: var(--text-soft);
    font: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.room-card__pin:hover {
    transform: translateY(-1px);
}

.room-card__pin[aria-pressed="true"] {
    background: rgba(255, 201, 25, 0.18);
    color: var(--text);
}

.room-card__title {
    margin-top: 10px;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.room-card__id {
    color: var(--text-soft);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.room-card__meta,
.room-card__footer {
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.55;
}

.room-card__meta {
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.room-card__footer {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.create-layout,
.workspace-grid {
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.form-card {
    flex: 1 1 auto;
    min-width: 0;
}

.side-note,
.workspace-grid__side {
    flex: 0 1 360px;
    max-width: 100%;
}

.workspace-grid__side--stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.workspace-grid__main {
    flex: 1 1 auto;
    min-width: 0;
}

.workspace-grid__main--room-annotator {
    flex: 1 1 540px;
}

.workspace-grid--room-top {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.workspace-grid--room-top .workspace-grid__main,
.workspace-grid--room-top .workspace-grid__side {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.workspace-grid--room-top .panel-card {
    height: 100%;
}

.workspace-grid__side--room-controls {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 14px;
    align-items: stretch;
}

.workspace-grid__side--stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.workspace-grid__side--room-work {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.workspace-grid__side--room-work .panel-card {
    flex: 1 1 auto;
}

.workspace-grid--owner-manage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-grid--owner-manage .workspace-grid__side--room-controls {
    height: 100%;
}

.workspace-grid--owner-manage .workspace-grid__main--room-annotator {
    height: 100%;
}

.workspace-grid--owner-manage .workspace-grid__side--room-controls .workspace-grid__side--stack {
    min-height: 0;
}

.workspace-grid:not(.workspace-grid--owner-manage) #annotator-manage-side {
    display: none !important;
}

.room-review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.room-review-grid__card {
    min-width: 0;
}

.room-review-grid__card--scroll {
    height: 540px;
    display: flex;
    flex-direction: column;
}

.annotators-list--scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.workspace-grid--single .workspace-grid__main {
    flex: 1 1 100%;
    width: 100%;
}

.panel-card--workscreen {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 1.6vw, 18px);
    padding: clamp(16px, 1.6vw, 22px);
    border-radius: var(--radius-xl);
    background: var(--panel-background);
    box-shadow: var(--shadow);
}

.panel-card--workscreen .hero-card__eyebrow {
    margin-bottom: 0;
}

.panel-card--workscreen .action-strip {
    margin-bottom: 0;
    margin-top: 2px;
}

.panel-card--workscreen .task-box,
.panel-card--workscreen .empty-card,
.panel-card--workscreen .stack-form {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 14px;
}

.auth-page {
    display: flex;
    justify-content: center;
    padding: clamp(12px, 2vw, 18px) 0 8px;
}

.auth-card {
    width: min(100%, 520px);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--auth-background);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 12px 0 8px;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.auth-card p {
    margin: 0 0 14px;
    color: var(--text-soft);
}

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

.auth-form .btn {
    width: 100%;
    margin-top: 4px;
}

.form-error {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--danger-background);
    color: var(--danger);
}

.field--full {
    grid-column: 1 / -1;
}

.field--checkbox {
    gap: 8px;
}

.field--checkbox__control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 14px 16px;
    border: 1px solid rgba(26, 26, 26, 0.1);
    border-radius: 16px;
    background: var(--field-background);
}

.field--checkbox__text {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.2;
}

.field--checkbox input[type="checkbox"] {
    width: auto;
    min-width: 22px;
    min-height: 22px;
    align-self: center;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    flex: 0 0 auto;
    box-shadow: none;
}

.field--checkbox > span {
    margin: 0;
}

.dataset-box {
    margin-top: 14px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--soft-panel-background);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border: 1px dashed rgba(26, 26, 26, 0.12);
}

.dataset-box__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: min(100%, 260px);
}

.form-actions {
    margin-top: 14px;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.summary-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.summary-row strong {
    color: var(--text);
}

.activity-board {
    margin-top: 14px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.activity-board__calendar {
    display: inline-block;
    overflow-x: auto;
    padding: 10px;
    max-width: 100%;
    border-radius: var(--radius-md);
    background: var(--calendar-background);
    vertical-align: top;
}

.activity-board__months {
    display: grid;
    grid-auto-flow: column;
    gap: 4px;
    align-items: end;
    min-width: fit-content;
    margin-bottom: 6px;
}

.activity-board__month {
    color: var(--text-soft);
    font-size: 0.76rem;
    line-height: 1;
    white-space: nowrap;
}

.activity-board__grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 14px);
    gap: 4px;
    min-width: fit-content;
}

.activity-board__cell {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--activity-cell-background);
}

.activity-board__cell[data-level="1"] {
    background: rgba(255, 213, 74, 0.38);
}

.activity-board__cell[data-level="2"] {
    background: rgba(255, 213, 74, 0.58);
}

.activity-board__cell[data-level="3"] {
    background: rgba(255, 201, 25, 0.82);
}

.activity-board__legend {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 0.84rem;
    text-align: right;
}

.annotators-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-task-detail {
    gap: 12px;
}

.review-media-preview {
    margin-top: 2px;
}

.review-comparison-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.review-comparison-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-comparison-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-comparison-actions {
    display: flex;
    justify-content: center;
}

.review-media-stage {
    min-height: 0;
    padding: 12px;
    justify-content: center;
}

.review-media-overlay {
    pointer-events: none;
    cursor: default;
}

.review-media-bbox {
    position: absolute;
    border: 2px solid var(--bbox-color, #b8b8b8);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: visible;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.review-media-bbox span {
    position: absolute;
    top: -2px;
    left: -2px;
    padding: 4px 8px;
    border-radius: 10px 0 10px 0;
    background: var(--bbox-color, #b8b8b8);
    color: #ffffff;
    font-size: 0.78rem;
    white-space: nowrap;
}

.review-task-preview {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: var(--soft-panel-background);
}

.review-annotation-card {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--soft-panel-background);
    border: 1px solid var(--line);
}

.review-annotation-card__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 8px;
    color: var(--text-soft);
}

.annotator-row {
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--calendar-background);
    border: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    transition: border-color 140ms ease, transform 140ms ease;
}

.annotator-row:hover,
.annotator-row.is-active {
    transform: translateY(-1px);
    border-color: rgba(255, 201, 25, 0.6);
}

.annotator-row__meta {
    flex-direction: column;
    gap: 4px;
}

.annotator-row__meta strong {
    color: var(--text);
}

.annotator-row__brief {
    color: var(--text-soft);
    text-align: right;
    font-size: 0.9rem;
}

.panel-card__head {
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.panel-search {
    margin-bottom: 12px;
}

.panel-search input {
    min-height: 52px;
}

.action-strip {
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.action-strip .btn {
    flex: 1 1 220px;
}

.action-strip .btn--workscreen-back {
    flex: 0 0 auto;
    width: fit-content;
    min-width: 0;
    align-self: flex-start;
    padding: 16px 24px;
    border-radius: 999px;
}

.action-strip .btn--workscreen-submit {
    flex: 0 0 auto;
    width: fit-content;
    min-width: 220px;
    margin-left: auto;
}

.task-box,
.payload-preview {
    margin-top: 10px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--soft-panel-background);
    color: var(--text-soft);
}

.payload-preview {
    background: var(--payload-background);
    color: var(--payload-text);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    white-space: pre-wrap;
    overflow: auto;
    max-width: 100%;
}

.stack-form {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stack-form .btn {
    width: 100%;
}

.stack-form--compact {
    margin-top: 0;
}

.panel-note {
    margin-top: 12px;
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.5;
}

@media (max-width: 1440px) {
    .room-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .card-grid--three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-aspect-ratio: 1/1) {
    .page-topbar--profile {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        align-content: start;
    }

    .page-topbar--profile .page-topbar__copy {
        flex: initial;
        width: 100%;
        max-width: none;
    }

    .profile-metrics-grid {
        flex: initial;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) and (max-aspect-ratio: 1/1) {
    .hero-card,
    .page-topbar,
    .wide-card,
    .create-layout,
    .workspace-grid {
        flex-direction: column;
        justify-content: flex-start;
    }

    .hero-card__main,
    .page-topbar__copy,
    .hero-card__stats,
    .site-nav,
    .room-toolbar-card,
    .side-note,
    .workspace-grid__side,
    .workspace-grid__main {
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
    }

    .workspace-grid__side--stack {
        grid-template-columns: 1fr;
    }

    .workspace-grid--room-top,
    .room-review-grid,
    .review-comparison-grid {
        grid-template-columns: 1fr;
    }

    .room-review-grid__card--scroll {
        height: auto;
    }

    .annotators-list--scroll {
        overflow: visible;
    }

    .page-topbar--rooms .page-topbar__copy {
        max-width: none;
        flex: initial;
        width: 100%;
    }

    .page-topbar--rooms .room-toolbar-card {
        flex: initial;
        margin-left: 0;
        width: 100%;
    }

    .page-topbar--rooms {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        align-content: start;
    }

    .page-topbar--room .page-topbar__copy,
    .room-header-side {
        width: 100%;
        max-width: none;
    }

    .room-header-side {
        grid-template-columns: 1fr;
    }

    .room-header-metrics {
        width: 100%;
    }

    .room-progress-chart {
        grid-template-columns: 1fr;
    }

    .room-grid-section {
        margin-top: 0;
    }

    .room-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .activity-board {
        align-items: flex-start;
    }

    .activity-board__legend {
        text-align: left;
    }

    .hero-card--landing .hero-card__stats,
    .card-grid--three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 900px) and (max-aspect-ratio: 1/1) {
    .site-header,
    .hero-card,
    .page-topbar,
    .wide-card,
    .info-card,
    .form-card,
    .panel-card,
    .side-note,
    .empty-card {
        padding: 16px;
        border-radius: 22px;
    }

    .site-header__left,
    .site-header__right,
    .auth-actions,
    .room-toolbar,
    .room-toolbar-card,
    .form-actions,
    .action-strip {
        width: 100%;
    }

    .site-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        justify-content: stretch;
        align-items: stretch;
        gap: 14px;
    }

    .site-header__left {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: auto;
    }

    .site-header__right {
        width: auto;
        justify-self: end;
        align-self: start;
        align-items: center;
    }

    .site-nav {
        width: auto;
        flex: 0 0 auto;
    }

    .auth-actions {
        width: auto;
        justify-content: flex-end;
        align-items: center;
        flex-direction: row;
    }

    .room-toolbar,
    .form-actions,
    .action-strip {
        flex-direction: column;
        align-items: stretch;
    }

    .room-toolbar .inline-field,
    .room-toolbar .btn,
    .action-strip .btn,
    .dataset-box__actions {
        width: 100%;
        flex-basis: auto;
    }

    .room-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-card--landing .hero-card__stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .hero-card--landing .metric-card {
        min-height: 120px;
        padding: 12px;
    }

    .hero-card--landing .metric-card strong {
        font-size: clamp(2.1rem, 7vw, 2.5rem);
    }

    .card-grid--three {
        grid-template-columns: 1fr;
    }

    .profile-metrics-grid {
        grid-template-columns: 1fr;
    }

    .room-card {
        min-height: 180px;
        aspect-ratio: auto;
    }

    .wide-card__column,
    .side-note,
    .workspace-grid__side {
        min-width: 0;
        flex-basis: 100%;
    }

    .wide-card--profile {
        grid-template-columns: 1fr;
        align-items: flex-start;
        row-gap: 18px;
    }

    .wide-card--profile .wide-card__column {
        width: 100%;
    }

    .wide-card--profile .wide-card__column--activity {
        justify-self: stretch;
        align-items: flex-start;
    }

    .wide-card--profile .wide-card__column--activity h2,
    .wide-card--profile .wide-card__column--activity .activity-board {
        align-self: flex-start;
    }

    .annotator-row,
    .summary-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .annotator-row__brief,
    .activity-board__legend {
        text-align: left;
    }

    .activity-board {
        align-items: stretch;
    }

    .wide-card--profile .activity-board {
        width: 100%;
    }

    .wide-card--profile .activity-board__calendar {
        width: fit-content;
    }
}

@media (max-width: 640px) and (max-aspect-ratio: 1/1) {
    .site-header {
        display: flex;
    }

    .brand-mark {
        align-items: flex-start;
    }

    .brand-mark__logo {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .brand-mark__text strong {
        font-size: 1rem;
    }

    .site-nav__link {
        padding: 10px 14px;
    }

    .auth-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .theme-toggle-shell {
        align-self: flex-end;
    }

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

    .hero-card--landing .metric-card {
        min-height: 108px;
        padding: 10px;
    }

    .hero-card--landing .metric-card span {
        font-size: 0.72rem;
    }

    .hero-card--landing .metric-card strong {
        font-size: clamp(1.9rem, 8vw, 2.2rem);
    }

    .room-grid {
        grid-template-columns: 1fr;
    }

    .room-toolbar-card,
    .auth-card {
        padding: 18px;
    }

    .btn,
    .room-toolbar .btn {
        width: 100%;
    }

    .metric-card strong {
        font-size: clamp(2rem, 10vw, 2.6rem);
    }
}

@media (max-width: 640px) {
    .toast-region {
        left: 10px;
        right: 10px;
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        max-height: min(34vh, 320px);
        gap: 8px;
    }

    .toast-notification__body {
        gap: 10px;
        padding: 12px 12px 10px;
    }

    .toast-notification__accent {
        width: 6px;
        min-height: 46px;
    }

    .toast-notification__message {
        font-size: 0.9rem;
    }

    .toast-notification__close {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }
}

@media (max-width: 560px) and (max-aspect-ratio: 1/1) {
    body {
        padding: 10px;
    }

    .site-header,
    .hero-card,
    .page-topbar,
    .wide-card,
    .info-card,
    .form-card,
    .panel-card,
    .side-note,
    .empty-card,
    .auth-card {
        padding: 14px;
        border-radius: 20px;
    }

    .hero-card h1,
    .page-topbar h1,
    .auth-card h1 {
        line-height: 1.04;
    }
}

@media (max-height: 760px) and (min-width: 821px) {
    .site-header {
        padding: 18px 20px;
    }

    .page-layout {
        gap: 16px;
        margin-top: 16px;
    }

    .hero-card,
    .page-topbar,
    .wide-card,
    .auth-card {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast-notification {
        transition: none;
    }

    .toast-notification__progress-bar {
        animation: none;
        transform: scaleX(1);
    }
}

.form-card--nested {
    margin-top: 24px;
    padding: 24px;
    background: var(--soft-panel-background);
}

.dataset-box__actions--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.field--color input {
    min-height: 54px;
    padding: 6px;
}

.label-editor-list,
.label-chip-list,
.annotation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.label-editor-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px auto;
    gap: 12px;
    align-items: end;
}

.label-chip-list {
    flex-direction: row;
    flex-wrap: wrap;
}

.label-chip-list--static {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.label-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--field-background);
    color: var(--text);
    flex: 0 0 auto;
    white-space: nowrap;
}

.label-chip i {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--label-color);
    display: inline-block;
    flex: 0 0 auto;
}

.label-chip--button {
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.label-chip--button.is-active {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 4px rgba(255, 213, 74, 0.18);
    transform: translateY(-1px);
}

.label-chip--static {
    pointer-events: none;
}

.media-tool {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.media-tool__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    align-items: start;
}

.media-tool__sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.media-stage {
    min-height: 320px;
    padding: 20px 22px 24px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 201, 25, 0.72) transparent;
    background: rgba(23, 23, 23, 0.04);
}

.media-stage::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.media-stage::-webkit-scrollbar-track {
    background: transparent;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.media-stage::-webkit-scrollbar-thumb {
    background: rgba(255, 201, 25, 0.72);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.media-stage::-webkit-scrollbar-corner {
    background: transparent;
}

.media-canvas {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    margin: 4px 6px 8px 4px;
}

.media-stage__asset {
    display: block;
    max-width: 100%;
    max-height: 65vh;
    border-radius: 18px;
}

.media-overlay {
    position: absolute;
    inset: 0;
    cursor: crosshair;
}

.media-bbox {
    position: absolute;
    border: 2px solid var(--bbox-color, #b8b8b8);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    cursor: grab;
    padding: 0;
    overflow: visible;
}

.media-bbox:active {
    cursor: grabbing;
}

.media-bbox span {
    position: absolute;
    top: -2px;
    left: -2px;
    padding: 4px 8px;
    border-radius: 10px 0 10px 0;
    background: var(--bbox-color, #b8b8b8);
    color: #ffffff;
    font-size: 0.78rem;
    white-space: nowrap;
}

.media-bbox__resize-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.96);
    background: var(--bbox-color, #b8b8b8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 140ms ease, transform 140ms ease;
    cursor: nwse-resize;
    z-index: 2;
}

.media-bbox:hover .media-bbox__resize-handle,
.media-bbox:focus-visible .media-bbox__resize-handle,
.media-bbox__resize-handle:hover {
    opacity: 1;
    transform: scale(1);
}

.media-bbox--draft {
    border-style: dashed;
}

.annotation-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--field-background);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annotation-row.is-current {
    border-color: rgba(255, 201, 25, 0.64);
    box-shadow: 0 0 0 4px rgba(255, 213, 74, 0.12);
}

.annotation-row__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.annotation-row__meta small {
    color: var(--text-soft);
}

.annotation-row__points {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

@media (max-width: 980px) {
    .media-tool__layout,
    .label-editor-row {
        grid-template-columns: 1fr;
    }
}
