:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --panel: rgba(255, 255, 255, 0.78);
    --panel-solid: #ffffff;
    --panel-2: rgba(246, 247, 249, 0.86);
    --line: rgba(60, 60, 67, 0.14);
    --line-strong: rgba(60, 60, 67, 0.24);
    --text: #1d1d1f;
    --muted: rgba(60, 60, 67, 0.68);
    --soft: rgba(118, 118, 128, 0.12);
    --primary: #0071e3;
    --primary-strong: #0066cc;
    --primary-soft: rgba(0, 113, 227, 0.11);
    --teal: #00796b;
    --teal-soft: rgba(0, 121, 107, 0.11);
    --amber: #ad5f00;
    --amber-soft: rgba(255, 159, 10, 0.14);
    --danger: #d70015;
    --danger-soft: rgba(255, 59, 48, 0.13);
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 26px 60px rgba(0, 0, 0, 0.12);
    --blur: blur(28px) saturate(180%);
    --radius: 14px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1014;
    --panel: rgba(30, 31, 36, 0.74);
    --panel-solid: #1c1d22;
    --panel-2: rgba(43, 44, 50, 0.72);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.2);
    --text: #f5f5f7;
    --muted: rgba(235, 235, 245, 0.62);
    --soft: rgba(118, 118, 128, 0.24);
    --primary: #0a84ff;
    --primary-strong: #409cff;
    --primary-soft: rgba(10, 132, 255, 0.18);
    --teal: #5de4d0;
    --teal-soft: rgba(93, 228, 208, 0.14);
    --amber: #ffd60a;
    --amber-soft: rgba(255, 214, 10, 0.13);
    --danger: #ff6961;
    --danger-soft: rgba(255, 105, 97, 0.14);
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
    --shadow-hover: 0 30px 70px rgba(0, 0, 0, 0.48);
}

* {
    box-sizing: border-box;
}

body.app-shell {
    min-height: 100vh;
    color: var(--text);
    background:
        linear-gradient(rgba(120, 120, 128, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 120, 128, 0.06) 1px, transparent 1px),
        var(--bg);
    background-size: 32px 32px;
}

a,
button,
input,
select,
textarea,
summary {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

svg {
    width: 17px;
    height: 17px;
    flex: none;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--panel-solid) 72%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: var(--blur);
}

.app-header__inner,
.app-main {
    width: min(1280px, calc(100vw - 40px));
    margin: 0 auto;
}

.app-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
}

.app-header__search {
    padding-top: 0;
    padding-bottom: 14px;
}

.app-brand__title {
    color: var(--text);
    font-size: 1.12rem;
    font-weight: 750;
}

.app-brand__subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
}

.app-nav--primary {
    align-items: center;
}

.nav-group {
    position: relative;
}

.nav-group__trigger {
    gap: 6px;
}

.nav-group__trigger svg {
    width: 14px;
    height: 14px;
    transition: transform 160ms ease;
}

.nav-group:hover .nav-group__trigger svg,
.nav-group:focus-within .nav-group__trigger svg {
    transform: rotate(180deg);
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 620;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.nav-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(2, minmax(172px, 1fr));
    gap: 6px;
    min-width: 380px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel-solid);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.48);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    pointer-events: none;
    transform-origin: top right;
}

.nav-menu--compact {
    grid-template-columns: 1fr;
    min-width: 250px;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 11px;
    border-radius: 13px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
    color: var(--primary);
    background: var(--primary-soft);
    outline: none;
}

.nav-pill:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-group:hover > .nav-group__trigger,
.nav-group:focus-within > .nav-group__trigger,
.nav-pill.is-active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 28%, transparent);
}

.theme-toggle {
    position: absolute;
    top: 16px;
    right: max(20px, calc((100vw - 1280px) / 2));
    z-index: 40;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    backdrop-filter: var(--blur);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.theme-toggle__moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
    display: block;
}

.app-searchbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
}

.app-context-nav {
    justify-content: flex-start;
    gap: 8px;
    padding-top: 0;
    padding-bottom: 14px;
}

.app-context-nav a,
.context-label {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel-solid) 68%, transparent);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 680;
}

.context-label {
    color: var(--text);
    background: var(--soft);
}

.app-context-nav a:hover,
.app-context-nav a.is-current {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
    color: var(--primary);
    background: var(--primary-soft);
}

.app-searchbar__input,
.field-input,
.field-select,
.feedback-form input,
.feedback-form select,
.feedback-form textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--panel-solid);
    color: var(--text);
    padding: 0 12px;
    font-size: 0.92rem;
    outline: none;
}

.feedback-form textarea {
    min-height: 92px;
    padding: 10px 12px;
    resize: vertical;
}

.app-searchbar__input:focus,
.field-input:focus,
.field-select:focus,
.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.app-searchbar__button,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-quiet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border-radius: var(--radius);
    padding: 0 14px;
    font-size: 0.9rem;
    font-weight: 680;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.app-searchbar__button,
.btn-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 24%, transparent);
}

.app-searchbar__button:hover,
.btn-primary:hover {
    background: var(--primary-strong);
    transform: translateY(-1px);
}

.app-searchbar__button:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-quiet:active,
.module-card:active,
.quick-link:active,
.list-card:active {
    transform: translateY(1px);
}

.btn-secondary {
    color: #fff;
    background: #1f2937;
}

.btn-secondary:hover {
    background: #111827;
}

.btn-ghost,
.btn-quiet {
    color: var(--text);
    background: var(--panel);
    border-color: var(--line);
}

.btn-ghost:hover,
.btn-quiet:hover {
    color: var(--primary);
    border-color: #b9c8ff;
    background: var(--primary-soft);
}

.app-main {
    padding: 26px 0 48px;
}

.workspace-shell,
.page-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 0 4px;
}

.workspace-head h1,
.page-hero__title {
    margin: 4px 0 0;
    font-size: 2rem;
    line-height: 1.18;
    font-weight: 780;
    letter-spacing: 0;
}

.workspace-head p,
.page-hero__desc {
    max-width: 720px;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.65;
    font-size: 0.96rem;
}

.eyebrow,
.page-hero__eyebrow {
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 760;
    letter-spacing: 0;
}

.workspace-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--muted);
    font-size: 0.84rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

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

.module-card,
.work-panel,
.surface-card,
.surface-table,
.surface-soft,
.page-hero,
.list-card,
.detail-card,
.overview-card,
.quick-link,
.stat-tile {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
}

.module-card {
    display: flex;
    min-height: 282px;
    flex-direction: column;
    padding: 22px;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    border-color: #9eb8ff;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.module-card--primary {
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 44%, transparent) 0%, transparent 100%),
        var(--panel);
}

.module-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.26), transparent 36%);
    opacity: 0.42;
}

:root[data-theme="dark"] .module-card::after {
    opacity: 0.08;
}

.module-card > * {
    position: relative;
    z-index: 1;
}

.module-card__top,
.feedback-item__head,
.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.module-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    color: var(--primary);
    background: var(--primary-soft);
}

.module-state,
.status-badge,
.tag,
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.module-state {
    color: var(--teal);
    border-color: #a7d8d3;
    background: var(--teal-soft);
}

.module-state--blue {
    color: var(--primary);
    border-color: #b9c8ff;
    background: var(--primary-soft);
}

.module-card h2 {
    margin-top: 22px;
    font-size: 1.42rem;
    font-weight: 760;
}

.module-card p {
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.65;
}

.metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.metric-row span {
    min-height: 32px;
    padding: 6px 10px;
    border-radius: var(--radius);
    background: var(--panel-solid);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.86rem;
}

.metric-row strong {
    color: var(--text);
    margin-right: 4px;
}

.module-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 22px;
    color: var(--primary);
    font-weight: 720;
}

.flow-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--line);
}

.flow-strip > div {
    background: var(--panel);
    padding: 16px;
}

.step-index {
    display: inline-block;
    color: var(--primary);
    font-weight: 780;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.flow-strip strong {
    display: block;
}

.flow-strip p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.86rem;
}

.page-hero,
.surface-card,
.surface-soft {
    padding: 20px;
}

.page-hero {
    box-shadow: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 16px;
}

.page-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.panel-grid,
.stats-grid,
.card-grid {
    display: grid;
    gap: 12px;
}

.panel-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

.overview-card,
.quick-link,
.list-card,
.detail-card,
.stat-tile {
    padding: 16px;
}

.quick-link {
    display: block;
    box-shadow: none;
}

.quick-link:hover,
.list-card:hover {
    border-color: #9eb8ff;
    background: #f8fbff;
    transform: translateY(-1px);
}

.quick-link__title,
.list-card__title,
.detail-card__title {
    font-weight: 730;
    line-height: 1.45;
}

.quick-link__desc,
.list-card__desc,
.detail-card__desc,
.inline-note {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.overview-card__label,
.list-card__meta,
.detail-card__meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.overview-card__value {
    margin-top: 8px;
    font-size: 1.7rem;
    line-height: 1.1;
    font-weight: 780;
}

.overview-card__hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.84rem;
}

.stat-tile {
    box-shadow: none;
}

.stat-tile span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.stat-tile strong {
    display: block;
    margin-top: 8px;
    font-size: 1.7rem;
}

.surface-table {
    overflow: hidden;
}

.surface-table__header,
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 750;
}

.section-desc {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.table-shell {
    overflow-x: auto;
    border-top: 1px solid var(--line);
}

.table-shell table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-shell thead {
    background: var(--soft);
}

.table-shell th,
.table-shell td {
    text-align: left;
    padding: 13px 16px;
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-shell tbody tr {
    border-top: 1px solid var(--line);
}

.table-shell tbody tr:hover {
    background: #f8fbff;
}

.link-primary {
    color: var(--primary);
    font-weight: 680;
}

.link-primary:hover {
    color: var(--primary-strong);
    text-decoration: underline;
}

.tag-accent {
    color: var(--teal);
    background: var(--teal-soft);
    border-color: #a7d8d3;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.filter-bar .field-select {
    min-width: 220px;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.image-grid img {
    width: 100%;
    height: 170px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-solid);
    padding: 8px;
}

.upload-dropzone {
    display: block;
    padding: 34px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--primary-soft) 48%, var(--panel-solid));
    text-align: center;
    cursor: pointer;
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.status-inline {
    min-height: 48px;
}

.collection-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
    gap: 16px;
    align-items: start;
}

.work-panel {
    padding: 18px;
}

.panel-title {
    justify-content: flex-start;
    margin-bottom: 16px;
}

.panel-title h2 {
    font-size: 1.1rem;
    font-weight: 750;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.feedback-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.feedback-form label span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 650;
}

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

.feedback-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feedback-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}

.feedback-item:hover {
    border-color: #9eb8ff;
    background: var(--panel-solid);
}

.feedback-item__head {
    align-items: flex-start;
}

.feedback-item h3 {
    font-weight: 730;
    line-height: 1.4;
}

.feedback-item p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.84rem;
}

.feedback-item__body {
    margin-top: 10px !important;
    color: var(--text) !important;
    line-height: 1.6;
}

.feedback-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.feedback-item__meta span {
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--panel-solid);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
}

.status-badge {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: #f3cf91;
}

.status-badge.is-done {
    background: var(--teal-soft);
    color: var(--teal);
    border-color: #a7d8d3;
}

.status-badge.is-hot {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}

.toast-success {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #a7d8d3;
    border-radius: var(--radius);
    background: var(--teal-soft);
    color: var(--teal);
    font-weight: 650;
}

.empty-panel,
.empty-state {
    padding: 36px 16px;
    text-align: center;
    color: var(--muted);
}

.empty-panel svg {
    margin: 0 auto 8px;
}

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

.review-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}

.review-card--right {
    background: color-mix(in srgb, var(--primary-soft) 42%, var(--panel-2));
}

summary::-webkit-details-marker {
    display: none;
}

@media (max-width: 980px) {
    .app-header__inner,
    .workspace-head {
        flex-direction: column;
        align-items: stretch;
    }

    .app-nav {
        justify-content: flex-start;
    }

    .module-grid,
    .hero-grid,
    .collection-layout,
    .split-panel {
        grid-template-columns: 1fr;
    }

    .stats-grid--compact,
    .flow-strip {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-header__inner,
    .app-main {
        width: min(100vw - 24px, 1280px);
    }

    .app-searchbar,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .workspace-head h1,
    .page-hero__title {
        font-size: 1.55rem;
    }

    .module-card {
        min-height: 240px;
    }
}

/* Apple-inspired finishing layer: restrained glass, clear affordances, and full dark-mode parity. */
.app-header__inner:first-child {
    align-items: center;
}

.app-nav + .theme-toggle {
    margin-left: 0;
}

.app-header__inner:first-child {
    padding-right: 54px;
}

.app-searchbar__input {
    min-height: 44px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel-solid) 78%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.app-searchbar__button {
    min-height: 44px;
    border-radius: 12px;
}

.module-card,
.work-panel,
.surface-card,
.surface-table,
.surface-soft,
.page-hero,
.list-card,
.detail-card,
.overview-card,
.quick-link,
.stat-tile {
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.module-card:hover,
.quick-link:hover,
.list-card:hover,
.feedback-item:hover {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
}

.quick-link:hover,
.list-card:hover,
.table-shell tbody tr:hover {
    background: color-mix(in srgb, var(--primary-soft) 52%, var(--panel));
}

.filter-bar,
.feedback-item,
.review-card {
    background: var(--panel);
    backdrop-filter: var(--blur);
}

.filter-bar {
    box-shadow: var(--shadow);
}

.table-shell thead {
    background: color-mix(in srgb, var(--soft) 80%, var(--panel-solid));
}

.table-shell tbody tr {
    border-top: 1px solid var(--line);
}

.status-dot {
    background: #30d158;
    box-shadow: 0 0 0 4px rgba(48, 209, 88, 0.14);
}

:root[data-theme="dark"] body.app-shell {
    background:
        radial-gradient(circle at 24% 0%, rgba(10, 132, 255, 0.14), transparent 32rem),
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        var(--bg);
    background-size: auto, 32px 32px, 32px 32px, auto;
}

:root[data-theme="dark"] .app-header {
    background: rgba(20, 20, 24, 0.78);
}

:root[data-theme="dark"] .nav-pill.is-active,
:root[data-theme="dark"] .app-searchbar__button,
:root[data-theme="dark"] .btn-primary {
    color: #fff;
}

:root[data-theme="dark"] .btn-secondary {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--line);
}

:root[data-theme="dark"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

:root[data-theme="dark"] .module-card,
:root[data-theme="dark"] .work-panel,
:root[data-theme="dark"] .surface-card,
:root[data-theme="dark"] .surface-table,
:root[data-theme="dark"] .surface-soft,
:root[data-theme="dark"] .page-hero,
:root[data-theme="dark"] .list-card,
:root[data-theme="dark"] .detail-card,
:root[data-theme="dark"] .overview-card,
:root[data-theme="dark"] .quick-link,
:root[data-theme="dark"] .stat-tile {
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .feedback-form input,
:root[data-theme="dark"] .feedback-form select,
:root[data-theme="dark"] .feedback-form textarea,
:root[data-theme="dark"] .field-input,
:root[data-theme="dark"] .field-select,
:root[data-theme="dark"] .app-searchbar__input {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

:root[data-theme="dark"] .feedback-form input::placeholder,
:root[data-theme="dark"] .feedback-form textarea::placeholder,
:root[data-theme="dark"] .app-searchbar__input::placeholder {
    color: rgba(235, 235, 245, 0.38);
}

:root[data-theme="dark"] .flow-strip {
    background: var(--line);
}

:root[data-theme="dark"] .flow-strip > div,
:root[data-theme="dark"] .metric-row span,
:root[data-theme="dark"] .feedback-item__meta span,
:root[data-theme="dark"] .image-grid img {
    background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .upload-dropzone {
    background: rgba(10, 132, 255, 0.08);
}

:root[data-theme="dark"] .upload-dropzone:hover {
    background: rgba(10, 132, 255, 0.16);
}

@media (max-width: 980px) {
    .theme-toggle {
        position: absolute;
        top: 14px;
        right: 20px;
    }

    .app-header__inner:first-child {
        position: relative;
        padding-right: 52px;
    }
}

/* Product polish pass: Apple-like calm, visible controls, and tactile interactions. */
body.app-shell::before,
body.app-shell::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(8px);
}

body.app-shell::before {
    top: -180px;
    right: -140px;
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(0, 113, 227, 0.18), transparent 66%);
}

body.app-shell::after {
    left: -180px;
    bottom: 10%;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(52, 199, 89, 0.12), transparent 68%);
}

.app-header {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.app-brand__title {
    letter-spacing: -0.025em;
}

.app-nav {
    max-width: 860px;
}

.theme-toggle {
    position: fixed;
    top: 86px;
    right: max(18px, calc((100vw - 1280px) / 2));
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto;
    min-width: 76px;
    height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.theme-toggle__label {
    font-size: 0.82rem;
    font-weight: 720;
    letter-spacing: -0.01em;
}

.theme-toggle:hover {
    transform: translateY(-2px) scale(1.01);
}

.theme-toggle:active {
    transform: translateY(0) scale(0.98);
}

.workspace-shell {
    gap: 20px;
}

.workspace-head--hero {
    position: relative;
    overflow: hidden;
    min-height: 292px;
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--panel-solid) 72%, transparent), color-mix(in srgb, var(--panel) 84%, transparent)),
        radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 21rem);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    backdrop-filter: var(--blur);
}

.workspace-head--hero::before {
    content: "";
    position: absolute;
    right: 48px;
    bottom: -54px;
    width: 220px;
    height: 220px;
    border-radius: 44px;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--primary) 18%, transparent), transparent),
        color-mix(in srgb, var(--panel-solid) 64%, transparent);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
    transform: rotate(-12deg);
}

.workspace-head--hero::after {
    content: "";
    position: absolute;
    right: 118px;
    bottom: 44px;
    width: 124px;
    height: 124px;
    border-radius: 30px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-solid) 58%, transparent);
    box-shadow: var(--shadow);
    transform: rotate(10deg);
}

.workspace-head__copy {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.workspace-head--hero h1 {
    max-width: 720px;
    font-size: clamp(2.05rem, 4vw, 4.25rem);
    line-height: 1.02;
    letter-spacing: -0.06em;
    font-weight: 820;
}

.workspace-head--hero p:not(.eyebrow) {
    max-width: 650px;
    margin-top: 16px;
    font-size: 1.04rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.workspace-head--hero .hero-actions .btn-primary,
.workspace-head--hero .hero-actions .btn-ghost {
    color: var(--text);
    border-color: var(--line);
    background: var(--panel-solid);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.workspace-head--hero .hero-actions .btn-primary:hover,
.workspace-head--hero .hero-actions .btn-primary:focus-visible,
.workspace-head--hero .hero-actions .btn-ghost:hover,
.workspace-head--hero .hero-actions .btn-ghost:focus-visible {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 30%, transparent);
    transform: translateY(-1px);
    outline: none;
}

.workspace-head--hero .workspace-status {
    position: relative;
    z-index: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.module-grid {
    gap: 18px;
}

.module-card {
    min-height: 318px;
    border-radius: 26px;
    padding: 26px;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.module-card::before {
    content: "";
    position: absolute;
    right: 24px;
    top: 24px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 16%, transparent), transparent 68%);
    opacity: 0;
    transition: opacity 220ms ease, transform 220ms ease;
}

.module-card:hover {
    transform: translateY(-5px);
}

.module-card:hover::before {
    opacity: 1;
    transform: scale(1.12);
}

.module-card:hover .module-action svg {
    transform: translateX(4px);
}

.module-card h2 {
    letter-spacing: -0.035em;
}

.module-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.metric-row span {
    border-radius: 999px;
}

.module-action svg {
    transition: transform 180ms ease;
}

.flow-strip {
    border-radius: 24px;
}

.flow-strip > div {
    padding: 20px;
}

:root[data-theme="dark"] body.app-shell::before {
    background: radial-gradient(circle, rgba(10, 132, 255, 0.24), transparent 66%);
}

:root[data-theme="dark"] body.app-shell::after {
    background: radial-gradient(circle, rgba(48, 209, 88, 0.1), transparent 68%);
}

:root[data-theme="dark"] .app-header {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .theme-toggle {
    background: rgba(30, 31, 36, 0.86);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .nav-menu {
    background: var(--panel-solid);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .app-context-nav a,
:root[data-theme="dark"] .context-label {
    background: rgba(255, 255, 255, 0.055);
}

:root[data-theme="dark"] .workspace-head--hero {
    background:
        linear-gradient(135deg, rgba(33, 34, 40, 0.78), rgba(20, 21, 26, 0.82)),
        radial-gradient(circle at 86% 18%, rgba(10, 132, 255, 0.22), transparent 21rem);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .workspace-head--hero::before,
:root[data-theme="dark"] .workspace-head--hero::after {
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .text-stone-500,
:root[data-theme="dark"] .text-stone-600,
:root[data-theme="dark"] .text-stone-700 {
    color: var(--muted) !important;
}

:root[data-theme="dark"] .text-stone-900,
:root[data-theme="dark"] .text-stone-950 {
    color: var(--text) !important;
}

:root[data-theme="dark"] .bg-white,
:root[data-theme="dark"] .bg-stone-50,
:root[data-theme="dark"] .bg-stone-100 {
    background-color: var(--panel) !important;
}

:root[data-theme="dark"] .border-stone-200,
:root[data-theme="dark"] .border-stone-300 {
    border-color: var(--line) !important;
}

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

@media (max-width: 980px) {
    .theme-toggle {
        top: 76px;
        right: 14px;
    }

    .nav-group {
        position: static;
    }

    .nav-menu {
        left: 0;
        right: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
        width: 100%;
    }

    .app-context-nav {
        overflow-x: auto;
        flex-direction: row;
        align-items: center;
        padding-bottom: 12px;
        scrollbar-width: none;
    }

    .app-context-nav::-webkit-scrollbar {
        display: none;
    }

    .workspace-head--hero {
        min-height: auto;
        padding: 26px;
    }

    .workspace-head--hero::before,
    .workspace-head--hero::after {
        opacity: 0.38;
    }
}

@media (max-width: 640px) {
    .theme-toggle {
        top: auto;
        right: 14px;
        bottom: 16px;
    }

    .workspace-head--hero {
        padding: 22px;
        border-radius: 22px;
    }

    .workspace-head--hero h1 {
        letter-spacing: -0.045em;
    }

    .app-nav--primary {
        justify-content: flex-start;
        border-radius: 22px;
    }

    .nav-menu {
        grid-template-columns: 1fr;
    }

    .hero-actions .btn-primary,
    .hero-actions .btn-ghost {
        width: 100%;
    }
}

/* Keep the appearance switch in the header flow so it never covers search controls. */
.theme-toggle {
    position: static;
    z-index: 1;
    flex: none;
}

@media (max-width: 980px) {
    .theme-toggle {
        position: static;
        align-self: flex-start;
    }

    .app-header__inner:first-child {
        padding-right: 0;
    }
}

/* EV issue knowledge base, ported from the deployed charging-pile issue KB flow. */
.ev-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ev-hero {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background:
        radial-gradient(circle at 86% 10%, var(--amber-soft), transparent 20rem),
        var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
}

.ev-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
}

.ev-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.ev-tab:hover,
.ev-tab.is-active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 24%, transparent);
}

.ev-search-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
}

.ev-search-card input,
.paste-composer textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--panel-solid);
    color: var(--text);
    padding: 12px;
    outline: none;
}

.ev-view {
    display: none;
}

.ev-view.is-active {
    display: block;
}

.ev-hero-grid,
.ev-workspace-grid,
.ev-doc-grid,
.ev-import-grid {
    display: grid;
    gap: 16px;
}

.ev-hero-grid {
    grid-template-columns: 1.05fr 1.35fr;
}

.ev-workspace-grid {
    grid-template-columns: 0.95fr 1.25fr 0.9fr;
    margin-top: 16px;
}

.ev-doc-grid,
.ev-import-grid {
    grid-template-columns: 0.85fr 1.35fr;
}

.ev-panel-dark {
    color: var(--text);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 34%, transparent), transparent 72%),
        var(--panel-solid);
}

.panel__kicker {
    margin: 0;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.ev-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.ev-stat-card {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-solid);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.ev-stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.7rem;
}

.ev-draft-card,
.tree-group,
.tree-child,
.document-sheet,
.paste-composer,
.report-item {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-solid);
}

.ev-draft-card {
    margin-top: 16px;
    padding: 14px;
}

.ev-draft-card span,
.report-item__meta,
.document-meta,
.document-issue__meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.ev-draft-card p {
    margin-top: 6px;
    color: var(--text);
}

.ev-category-tree,
.ev-shortcut-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.tree-group {
    padding: 14px;
}

.tree-group h3 {
    font-size: 1rem;
    font-weight: 760;
}

.tree-child {
    margin-top: 10px;
    padding: 12px;
    background: var(--panel-2);
}

.tree-child h4 {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 720;
}

.tree-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ev-empty {
    min-height: 180px;
}

.report-item {
    display: grid;
    width: 100%;
    gap: 6px;
    margin-top: 16px;
    padding: 14px;
    color: var(--text);
    text-align: left;
}

.report-item.is-active,
.report-item:hover {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
    background: var(--primary-soft);
}

.document-preview__toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.document-export {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.document-sheet {
    margin-top: 16px;
    padding: 20px;
}

.document-preview__frame {
    width: 100%;
    min-height: 620px;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-solid);
}

.document-sheet h1 {
    font-size: 1.55rem;
    font-weight: 780;
}

.document-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.document-section h2 {
    font-size: 1.12rem;
    font-weight: 760;
}

.paste-composer {
    margin-top: 16px;
    padding: 12px;
}

.paste-composer__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.composer-upload input {
    display: none;
}

.composer-upload span {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    cursor: pointer;
}

.image-selection {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.86rem;
}

.ev-suggestion-preview {
    display: grid;
    gap: 14px;
}

.ev-suggestion-preview__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ev-suggestion-preview h3 {
    margin-top: 4px;
    color: var(--text);
    font-size: 1.12rem;
    font-weight: 760;
    line-height: 1.45;
}

.ev-suggestion-preview .tree-tag-list {
    margin-top: 0;
}

.ev-suggestion-grid {
    display: grid;
    gap: 10px;
    margin: 0;
}

.ev-suggestion-grid > div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-solid);
}

.ev-suggestion-grid dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 760;
}

.ev-suggestion-grid dd {
    margin: 5px 0 0;
    color: var(--text);
    line-height: 1.58;
}

.issues-filter-state {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

:root[data-theme="dark"] .ev-draft-card,
:root[data-theme="dark"] .tree-group,
:root[data-theme="dark"] .tree-child,
:root[data-theme="dark"] .document-sheet,
:root[data-theme="dark"] .paste-composer,
:root[data-theme="dark"] .ev-suggestion-grid > div,
:root[data-theme="dark"] .report-item,
:root[data-theme="dark"] .ev-search-card input,
:root[data-theme="dark"] .paste-composer textarea {
    background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .ev-panel-dark {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 42%, transparent), transparent 72%),
        var(--panel-solid);
}

:root[data-theme="dark"] .ev-stat-card {
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 980px) {
    .ev-hero-grid,
    .ev-workspace-grid,
    .ev-doc-grid,
    .ev-import-grid {
        grid-template-columns: 1fr;
    }

    .ev-tabs {
        border-radius: 22px;
    }
}

@media (max-width: 640px) {
    .ev-search-card,
    .ev-stat-grid {
        grid-template-columns: 1fr;
    }
}
