:root {
    --bg: #0f172a;
    --bg-soft: #16213e;
    --panel: rgba(17, 24, 39, 0.86);
    --panel-border: rgba(148, 163, 184, 0.18);
    --surface: rgba(17, 24, 39, 0.86);
    --surface-strong: rgba(8, 15, 30, 0.85);
    --surface-soft: rgba(15, 23, 42, 0.72);
    --border-soft: rgba(148, 163, 184, 0.14);
    --text: #e5eefc;
    --muted: #a7b4c8;
    --text-muted: #a7b4c8;
    --accent: #f59e0b;
    --accent-2: #38bdf8;
    --primary-soft: #fde68a;
    --success: #34d399;
    --shadow: 0 18px 50px rgba(2, 6, 23, 0.35);
    --radius-lg: 1.25rem;
    --radius-md: 0.95rem;
    --sidebar-width: 18rem;
    --content-width: 1180px;
    --nav-width: 18rem;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.shell {
    margin: 0;
    color: var(--text);
    font: 16px/1.5 "Segoe UI", Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.14), transparent 26%),
        linear-gradient(180deg, var(--bg) 0%, #0b1220 100%);
}

body.modal-open {
    overflow: hidden;
}

/* Authenticated application shell: persistent top navigation with module context. */
.app-authenticated {
    display: block;
}

.site-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(8, 15, 30, 0.96);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    width: 100%;
    min-height: 4.75rem;
    margin: 0 auto;
    padding: 0 0.75rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

.topbar-brand .brand {
    min-width: auto;
    color: var(--text);
    text-decoration: none;
}

.topbar-nav,
.topbar-nav-group,
.topbar-subnav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.topbar-nav {
    min-width: 0;
    justify-content: space-between;
    gap: 1rem;
}

.topbar-nav-context {
    justify-content: center;
    min-width: 0;
}

.topbar-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.45rem 0.72rem;
    border-radius: 0.7rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.topbar-nav a:hover,
.topbar-nav a:focus-visible,
.topbar-nav a.is-active {
    color: #fff7e8;
    background: rgba(245, 158, 11, 0.14);
    outline: 2px solid transparent;
}

.topbar-nav-context .topbar-subnav {
    padding: 0.2rem;
    border: 1px solid var(--border-soft);
    border-radius: 0.85rem;
    background: var(--surface-soft);
}

.topbar-logout {
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.topbar-nav .topbar-icon {
    justify-content: center;
    width: 2.6rem;
    padding: 0;
}

.topbar-nav .topbar-icon .material-symbols-outlined {
    margin: 0;
}

.topbar-context {
    width: 100%;
    margin: 0 auto;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.topbar-context strong { color: var(--text); }
.topbar-context a { color: var(--primary-soft); }
.topbar-toggle { display: none !important; }

.material-symbols-outlined {
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    font-size: 1.15em;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: "liga";
    -webkit-font-feature-settings: "liga";
    font-variant-ligatures: discretionary-ligatures;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.app-shell {
    min-height: 100vh;
}

.app-authenticated {
    display: block;
}

.app-public {
    display: flex;
    flex-direction: column;
}

.shell-sidebar-column {
    position: relative;
}

.mobile-shellbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem 0.25rem;
}

.brand-inline {
    min-width: 0;
}

.site-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.4rem 1.15rem;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    background: var(--surface-strong);
    backdrop-filter: blur(14px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.sidebar-subnav-wrap {
    display: grid;
    gap: 0.4rem;
    margin: -0.1rem 0 0.35rem 0.65rem;
    padding-left: 0.7rem;
    border-left: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-subnav-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-left: 0.25rem;
}

.sidebar-subnav {
    display: grid;
    gap: 0.3rem;
}

.sidebar-subnav a {
    display: block;
    padding: 0.7rem 0.85rem;
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.28);
    color: var(--muted);
    text-decoration: none;
    border: 1px solid transparent;
    margin-left: 0.1rem;
}

.sidebar-subnav a:hover,
.sidebar-subnav a:focus-visible,
.sidebar-subnav a.is-active {
    color: #fff7e8;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    outline: none;
}

.sidebar-nav a,
.sidebar-logout {
    display: block;
    color: var(--text);
    text-decoration: none;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    background: rgba(15, 23, 42, 0.48);
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus-visible,
.sidebar-nav a.is-active,
.sidebar-logout:hover,
.sidebar-logout:focus-visible {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
    color: #fff7e8;
    outline: none;
}

.sidebar-nav a:focus-visible,
.sidebar-logout:focus-visible,
.public-login-link:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.55);
    outline-offset: 2px;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 0.65rem;
}

.sidebar-note {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.shell-backdrop {
    display: none;
    appearance: none;
    position: fixed;
    inset: 0;
    z-index: 28;
    padding: 0;
    border: 0;
    background: rgba(2, 6, 23, 0.62);
    cursor: pointer;
}

.public-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    backdrop-filter: blur(14px);
    background: rgba(8, 15, 30, 0.7);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 13rem;
}

.brand-mark {
    width: 2.7rem;
    height: 2.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--accent), #fb7185);
    color: #101828;
    font-weight: 800;
    font-size: 1.15rem;
    box-shadow: var(--shadow);
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-tag {
    color: var(--muted);
    font-size: 0.88rem;
}

.content-shell {
    width: min(var(--content-width), calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
    flex: 1;
}

.app-authenticated .content-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.5rem 1.5rem 2.5rem;
}

.public-login-link {
    white-space: nowrap;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.95fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.panel,
.hero-panel,
.shell-card,
.section-card,
.status-card {
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-copy,
.hero-panel,
.shell-card,
.section-card,
.status-card {
    padding: 1.35rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.13);
    color: #cbeeff;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    margin-bottom: 1rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.04;
    margin-bottom: 0.9rem;
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 0.65rem;
}

h3 {
    font-size: 1.05rem;
    margin-bottom: 0.45rem;
}

.lede {
    max-width: 65ch;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-panel ul,
.checklist,
.micro-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
}

.hero-panel li + li,
.checklist li + li,
.micro-list li + li {
    margin-top: 0.45rem;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-grid {
    align-items: stretch;
}

.dashboard-lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.shell-card {
    min-height: 100%;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 100%;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.84rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-value {
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 800;
    line-height: 1.15;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.status-pill {
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #06222d;
    background: linear-gradient(135deg, var(--accent), var(--primary-soft));
    white-space: nowrap;
}

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

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

.callout .section-card {
    height: 100%;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.75rem 1.4rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.compact-form {
    display: grid;
    gap: 0.75rem;
}

.dashboard-toolbar {
    display: grid;
    gap: 0.75rem;
    align-items: end;
    grid-template-columns: minmax(240px, 320px) 1fr;
}

.panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.challenge-page-actions {
    margin-bottom: 1rem;
}

.challenge-create-button {
    min-width: 16rem;
}

.challenge-grid-wrap {
    display: grid;
    gap: 1rem;
}

.challenge-card {
    display: grid;
    gap: 0.85rem;
    height: 100%;
}

.challenge-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.challenge-card__title {
    margin-bottom: 0.35rem;
    font-size: 1.2rem;
}

.challenge-card__actions {
    flex: 0 0 auto;
}

.challenge-card__progress {
    margin-top: 0.15rem;
}

.challenge-card__details {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 0.4rem 0.85rem;
    margin: 0;
}

.challenge-card__details dt {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.76rem;
}

.challenge-card__details dd {
    margin: 0;
    text-align: right;
}

.items-control-bar {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.items-control-main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.items-challenge-control {
    min-width: 0;
}

.items-control-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.items-challenge-control .challenge-chip-row {
    margin-top: 0.45rem;
}

.items-primary-actions {
    justify-content: flex-end;
}

.item-status-nav {
    margin: 0;
}

.item-activity-panel {
    margin-bottom: 1rem;
}

.items-list-card {
    box-sizing: border-box;
    min-width: 0;
}

.items-list-card .item-summary-table {
    width: 100% !important;
    table-layout: fixed;
}

.page-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
}

.context-copy {
    display: grid;
    gap: 0.2rem;
    min-width: min(100%, 26rem);
}

.context-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.context-note {
    color: var(--text-muted);
}

.context-status {
    color: var(--text);
    font-weight: 700;
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.field-group {
    display: grid;
    gap: 0.35rem;
}

.field-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-select {
    width: 100%;
}

.dashboard-message {
    align-self: end;
}

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

.form-row + .form-row,
.compact-form > .field + .field,
.compact-form > .form-row + .field,
.compact-form > .field + .button-row,
.compact-form > .drawer-field + .drawer-field {
    margin-top: 0.35rem;
}

.field {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    color: var(--text);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 0.35rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    text-decoration: none;
    color: #0b1220;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-soft), var(--accent));
}

.button .material-symbols-outlined {
    margin-right: 0.45rem;
    font-size: 1.05em;
    min-width: 1em;
}

.button.secondary {
    color: var(--text);
    background: transparent;
    border-color: rgba(148, 163, 184, 0.22);
}

.shell-nav-toggle {
    display: none;
    min-width: 6.5rem;
}

.shell-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 0 0.9rem;
}

.drawer-stack {
    display: grid;
    gap: 0.65rem;
}

.field-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
    font-size: 0.95rem;
}

.field-checkbox input {
    width: 1rem;
    height: 1rem;
    margin: 0;
}

.item-photo-preview {
    display: block;
    max-width: 180px;
    max-height: 180px;
    object-fit: cover;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: var(--shadow);
}

.form-message {
    display: block;
    margin-top: 0.85rem;
    color: var(--primary-soft);
}

.data-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table--fluid {
    table-layout: fixed;
}

.app-authenticated .section-card { width: 100%; }

/* Module location is conveyed by the active top navigation, not repeated page chrome. */
.app-authenticated .eyebrow,
.app-authenticated .page-header > h1,
.app-authenticated .section-card > h1 {
    display: none;
}

.data-table th,
.data-table td {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-align: left;
}

.data-table th {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-table a {
    color: var(--primary-soft);
}

.data-table__cell--toggle,
.data-table__cell--shrink,
.data-table__cell--actions {
    width: 1%;
    white-space: nowrap;
}

.data-table__cell--actions,
.table-actions,
.item-action-cell {
    text-align: right;
}

.data-table__cell--grow {
    min-width: 0;
    overflow: hidden;
}

.data-table__text--truncate {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.challenge-progress-cell {
    min-width: 15rem;
}

.challenge-progress {
    min-width: 13rem;
}

.data-table__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: flex-end;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    justify-content: flex-end;
}

.table-action-link {
    color: var(--primary-soft);
}

.icon-button {
    min-width: 2.5rem;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

.icon-button .material-symbols-outlined {
    margin: 0;
    min-width: 1em;
    font-size: 1.1rem;
}

.collapsible-panel.is-collapsed {
    display: none;
}

.item-drawer {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    z-index: 45;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.item-drawer .modal-dialog {
    width: min(80vw, 600px);
    max-width: 600px;
    height: 100vh;
    max-height: 100vh;
    margin-left: auto;
    margin-right: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 1.25rem 1.1rem;
    box-shadow: var(--shadow);
}

.item-drawer .drawer-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 0.75rem;
    background: var(--surface);
}

.drawer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.drawer-form {
    display: grid;
    gap: 1rem;
}

.drawer-field {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.drawer-field label {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.drawer-field .field {
    width: 100%;
}

.drawer-field-textarea {
    align-items: start;
}

.drawer-textarea {
    min-height: 7rem;
    resize: vertical;
}

.drawer-buttons {
    margin-left: 150px;
    margin-top: 0.35rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    background: rgba(2, 6, 23, 0.72);
    z-index: 50;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.is-open {
    display: flex;
}

.modal-dialog {
    width: min(34rem, 100%);
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    max-height: calc(100vh - 1rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(9rem, 0.3fr) 1fr;
    gap: 0.7rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--text-muted);
}

.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0 0 1rem;
}

.item-status-nav {
    margin-top: 0.25rem;
}

.subnav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    text-decoration: none;
    color: var(--text);
    background: rgba(15, 23, 42, 0.4);
}

.subnav a:hover,
.subnav a:focus-visible,
.subnav a.is-active {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
    outline: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.9rem;
    padding: 0.18rem 0.7rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.14);
    color: #cbeeff;
    font-size: 0.8rem;
    white-space: nowrap;
}

.detail-list dd {
    margin: 0;
}

.challenge-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.challenge-chip-row .button {
    border-radius: 999px;
    min-height: 2.5rem;
}

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

.dashboard-head {
    display: grid;
    gap: 0.25rem;
}

.page-header {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.hidden-control {
    display: none;
}

.dashboard-head .form-message {
    margin-top: 0.4rem;
}

.run-options-button {
    min-width: 2.75rem;
}

.item-name-cell {
    min-width: 0;
    overflow: hidden;
}

.item-toggle-cell {
    padding-right: 0.35rem;
}

.item-action-row {
    gap: 0.4rem;
}

.item-detail-row td {
    padding: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.item-detail-card {
    padding: 1rem 0.8rem 1.05rem;
    display: grid;
    gap: 0.75rem;
}

.item-detail-grid {
    margin-bottom: 0;
}

.item-detail-actions {
    margin-top: 0.1rem;
}

.action-modal .modal-dialog {
    width: min(28rem, calc(100vw - 1.25rem));
    max-width: 28rem;
    margin: 0 auto;
}

.action-modal .compact-form {
    margin-top: 0.25rem;
}

.listing-create-modal .modal-dialog {
    width: min(40rem, calc(100vw - 1.25rem));
    max-width: 40rem;
}

.action-modal {
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-summary {
    display: grid;
    gap: 0.2rem;
    margin: 0 0 0.9rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.95rem;
    background: rgba(15, 23, 42, 0.36);
}

.modal-summary__label {
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.listing-lightbox {
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.listing-lightbox .modal-dialog {
    width: min(62rem, calc(100vw - 2rem));
    max-width: 62rem;
    max-height: calc(100vh - 2rem);
    margin: 0 auto;
    padding: 1.25rem 1.1rem;
}

.listing-lightbox-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 0.75rem;
    background: var(--surface);
}

.listing-preview-details {
    align-items: start;
}

.listing-preview-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.listing-drawer {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    z-index: 45;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.listing-drawer .modal-dialog {
    width: min(76vw, 820px);
    max-width: 820px;
    height: 100vh;
    max-height: 100vh;
    margin-left: auto;
    margin-right: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 1.25rem 1.1rem;
    box-shadow: var(--shadow);
}

.hero-single {
    grid-template-columns: minmax(0, 1fr);
}

.public-hero {
    display: grid;
    gap: 0.5rem;
}

.public-showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    max-width: 1120px;
    margin: 1rem auto 0;
    gap: 1rem;
}

.public-showcase-hero {
    display: grid;
    gap: 0.85rem;
    padding: 1.2rem;
}

.public-showcase-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
}

.public-showcase-source {
    margin: 0;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

.public-progress {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.public-progress-value {
    display: block;
    text-align: center;
    color: var(--text);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(2, 6, 23, 0.9);
}

.public-progress-track {
    height: 0.9rem;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.public-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #8b5cf6, #f59e0b);
}

.public-progress-foot {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.public-hero-copy {
    margin: 0.2rem auto 0;
    max-width: 60rem;
    color: var(--text);
    text-align: center;
    font-size: 1.03rem;
    line-height: 1.55;
}

.public-hero-actions {
    margin-top: 0.35rem;
    justify-content: center;
}

.public-hero-actions .button {
    min-width: min(24rem, 100%);
    padding: 1rem 1.4rem;
    font-size: 1.02rem;
}

.public-buy-button {
    width: 100%;
    justify-content: center;
}

.public-showcase-actions {
    margin-top: 0.55rem;
}

.public-showcase-actions .button {
    width: 100%;
}

.contribute-modal {
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.contribute-modal .modal-dialog {
    width: min(38rem, calc(100vw - 1.25rem));
    max-width: 38rem;
}

.glass-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.35rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(16, 24, 40, 0.78), rgba(7, 12, 24, 0.92)),
        rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 55px rgba(2, 6, 23, 0.4);
}

.public-showcase-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1rem;
    height: 100%;
}

.public-showcase-media {
    min-height: 15rem;
    border-radius: 1.05rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.36), transparent 40%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
}

.public-showcase-placeholder .material-symbols-outlined {
    font-size: 4.5rem;
    color: rgba(191, 219, 254, 0.78);
}

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

.public-showcase-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.3rem;
}

.public-showcase-body h2 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.1;
}

.public-showcase-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    align-items: stretch;
}

.public-showcase-actions > * {
    flex: 1 1 0;
    min-width: 0;
}

.public-showcase-actions .button {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font: inherit;
    font-weight: 700;
    letter-spacing: inherit;
    line-height: 1.15;
    justify-content: center;
}

.public-buy-wrapper {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
}

.public-trade-button {
    width: 100%;
}

.public-buy-button,
.public-trade-button {
    font: inherit;
}

.trade-modal .modal-dialog {
    width: min(40rem, calc(100vw - 1.25rem));
    max-width: 40rem;
}

.trade-modal-context {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
}

.notifications-grid {
    display: grid;
    gap: 1rem;
}

.notification-card {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
}

.notification-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.notification-head h2 {
    margin: 0.25rem 0 0;
    font-size: 1.3rem;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.85rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.18);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.notification-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.notification-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
}

.notification-details div {
    display: grid;
    gap: 0.25rem;
}

.notification-details dt {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.notification-details dd {
    margin: 0;
    color: var(--text);
}

.notification-body {
    margin: 0;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.52);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
}

@media (max-width: 960px) {
    .topbar-inner {
        width: 100%;
        padding: 0 0.75rem;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .topbar-toggle { display: inline-flex !important; }

    .has-js .topbar-nav {
        display: none;
        grid-column: 1 / -1;
        width: 100%;
        padding: 0.7rem 0 1rem;
        border-top: 1px solid var(--border-soft);
        align-items: stretch;
        flex-direction: column;
    }

    .has-js .app-shell.nav-open .topbar-nav { display: flex; }
    .topbar-nav-group,
    .topbar-nav-context,
    .topbar-nav-utility,
    .topbar-subnav { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .topbar-nav-utility { padding-top: 0.5rem; border-top: 1px solid var(--border-soft); }
    .topbar-context { width: 100%; padding: 0 0.75rem; }

    .public-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero,
    .callout,
    .section-grid,
    .dashboard-lists,
    .dashboard-toolbar,
    .form-row {
        grid-template-columns: 1fr;
    }

    .items-control-main {
        align-items: stretch;
        flex-direction: column;
    }

    .items-primary-actions {
        justify-content: flex-start;
    }

    .detail-list {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .content-shell {
        width: min(1180px, calc(100% - 1.25rem));
        padding-top: 1.25rem;
    }

    .app-authenticated .content-shell {
        padding: 0.75rem 1rem 2rem;
    }

    .dashboard-toolbar,
    .form-row {
        grid-template-columns: 1fr;
    }

    .public-showcase-details {
        grid-template-columns: 1fr;
    }

    .public-showcase-grid {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .page-context {
        align-items: stretch;
    }

    .item-drawer {
        justify-content: stretch;
        align-items: stretch;
    }

    .item-drawer .modal-dialog {
        width: min(100vw, 600px);
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
    }

    .data-table td.table-actions,
    .item-action-cell {
        text-align: left;
    }
}

@media (max-width: 640px) {
    .hero,
    .callout,
    .section-grid,
    .dashboard-lists {
        grid-template-columns: 1fr;
    }

    .hero-copy,
    .hero-panel,
    .shell-card,
    .section-card,
    .status-card {
        padding: 1rem;
    }

    .button-row,
    .subnav {
        gap: 0.45rem;
    }

    .public-showcase-card {
        padding: 0.85rem;
    }

    .public-showcase-hero {
        padding: 1rem;
    }

    .drawer-field {
        grid-template-columns: 1fr;
    }

    .drawer-buttons {
        margin-left: 0;
        display: grid;
        grid-template-columns: 1fr;
    }

    .notification-head {
        flex-direction: column;
    }

    .modal-overlay {
        align-items: flex-start;
    }

    .modal-dialog {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        margin: 0.5rem auto;
    }

    .listing-lightbox {
        align-items: flex-start;
        padding: 0.5rem;
    }

    .listing-lightbox .modal-dialog {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        margin: 0 auto;
        padding: 1rem 0.9rem 1.25rem;
    }

    .listing-drawer .modal-dialog {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        padding: 1rem 0.9rem 1.25rem;
    }

    .item-drawer .modal-dialog {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        padding: 1rem 0.9rem 1.25rem;
    }

    .item-drawer .drawer-header {
        flex-direction: column;
        align-items: stretch;
    }

    .listing-lightbox-header {
        flex-direction: column;
        align-items: stretch;
    }

    .drawer-actions {
        width: 100%;
    }

    .drawer-actions > * {
        flex: 1 1 auto;
    }
}
