:root {
    color-scheme: light;
    --bg: #f7f8fb;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --surface-soft: #f1f4f8;
    --ink: #101318;
    --muted: #657081;
    --subtle: #9099a8;
    --line: rgba(30, 38, 51, 0.11);
    --line-strong: rgba(30, 38, 51, 0.18);
    --red: #d9232e;
    --red-dark: #9d111b;
    --blue: #3d7cf5;
    --cyan: #45b9d7;
    --green: #35ad83;
    --gold: #dfa520;
    --orange: #f47b31;
    --slate: #6e7886;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.10);
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
    --radius: 8px;
    --sidebar: 232px;
    --topbar: 70px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(217, 35, 46, 0.08), rgba(255, 255, 255, 0) 24%),
        linear-gradient(180deg, #fbfcfe 0%, #eef2f7 100%);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: 0;
}

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

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 auto;
}

button,
input,
select {
    font: inherit;
    letter-spacing: 0;
}

button {
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 18px 18px;
    color: #eef3f8;
    background:
        linear-gradient(180deg, rgba(7, 13, 19, 0.98), rgba(13, 29, 43, 0.98)),
        #0b1219;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    position: relative;
    display: grid;
    place-items: center;
}

.brand-mark::before {
    content: "";
    width: 30px;
    height: 30px;
    display: block;
    background: linear-gradient(135deg, #ff4b4f, #c91521 55%, #721016);
    clip-path: polygon(52% 0, 98% 17%, 73% 34%, 94% 64%, 60% 54%, 56% 100%, 34% 57%, 0 75%, 20% 41%, 1% 21%);
    box-shadow: 0 12px 24px rgba(217, 35, 46, 0.34);
}

.brand-copy strong {
    display: block;
    font-size: 28px;
    line-height: 1;
    font-weight: 760;
}

.brand-copy small {
    display: block;
    margin-top: 2px;
    color: rgba(239, 244, 248, 0.58);
    font-size: 11px;
    text-transform: uppercase;
}

.nav-list {
    display: grid;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: var(--radius);
    color: rgba(242, 247, 250, 0.84);
    font-weight: 650;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item .icon {
    width: 19px;
    height: 19px;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.nav-item.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(217, 35, 46, 0.94), rgba(132, 16, 23, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 26px rgba(217, 35, 46, 0.2);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 16px;
    color: rgba(234, 241, 246, 0.68);
}

.fenice-wordmark {
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.fenice-wordmark strong {
    display: block;
    font-size: 24px;
    font-weight: 520;
    line-height: 1;
}

.fenice-wordmark span {
    display: block;
    margin-top: 4px;
    font-size: 10px;
}

.sidebar-footer p {
    margin: 0;
    font-size: 12px;
    line-height: 1.65;
}

.user-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.05);
}

.avatar,
.mini-avatar,
.team-avatar {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #253247, #da2530);
    font-weight: 800;
}

.avatar {
    width: 38px;
    height: 38px;
}

.mini-avatar {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.user-tile strong,
.user-tile small {
    display: block;
}

.user-tile strong {
    color: #fff;
    font-size: 12px;
}

.user-tile small {
    color: rgba(255, 255, 255, 0.58);
    font-size: 11px;
}

.content-shell {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 28px;
    backdrop-filter: blur(22px) saturate(1.25);
    background: rgba(247, 248, 251, 0.78);
    border-bottom: 1px solid rgba(30, 38, 51, 0.08);
}

.search-wrap {
    width: min(560px, 100%);
    height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 20px rgba(15, 23, 42, 0.04);
}

.search-wrap .icon {
    width: 18px;
    color: var(--muted);
}

.search-wrap input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.search-wrap kbd {
    min-width: 32px;
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--muted);
    background: #f1f3f6;
    font-size: 11px;
    text-align: center;
}

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

.icon-button,
.ghost-button,
.primary-action,
.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    font-weight: 700;
    white-space: nowrap;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.icon-button {
    position: relative;
    width: 38px;
    padding: 0;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.86);
}

.icon-button .icon,
.ghost-button .icon,
.primary-action .icon,
.secondary-action .icon {
    width: 17px;
    height: 17px;
}

.icon-button:hover,
.ghost-button:hover,
.secondary-action:hover,
.primary-action:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.has-dot::after {
    content: "3";
    position: absolute;
    top: -5px;
    right: -4px;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--red);
    font-size: 10px;
    font-weight: 800;
}

.db-badge,
.soft-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: #8c5310;
    background: #fff6df;
    border: 1px solid #f5dca2;
    font-size: 12px;
    font-weight: 750;
}

.db-badge.is-live {
    color: #0b7656;
    background: #e9f8f2;
    border-color: #b8e7d4;
}

.main-surface {
    padding: 20px 28px 34px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.06;
    font-weight: 790;
}

.page-heading p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.primary-action {
    padding: 0 14px;
    border-color: rgba(217, 35, 46, 0.35);
    color: #fff;
    background: linear-gradient(135deg, #ef3943, #b91622);
    box-shadow: 0 12px 24px rgba(217, 35, 46, 0.18);
}

.secondary-action,
.ghost-button {
    padding: 0 12px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.82);
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.kpi-strip.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card,
.panel,
.inspector-panel,
.pipeline-column,
.project-card,
.team-card,
.document-card,
.deadline-row {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px) saturate(1.22);
}

.kpi-card {
    display: flex;
    gap: 12px;
    min-height: 112px;
    padding: 18px;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f2f5f8;
}

.kpi-card p,
.kpi-card small {
    margin: 0;
    color: var(--muted);
}

.kpi-card p {
    font-size: 12px;
    font-weight: 700;
}

.kpi-card strong {
    display: block;
    margin: 4px 0;
    font-size: 26px;
    line-height: 1.1;
}

.tone-red .kpi-icon { color: var(--red); background: #fff0f1; }
.tone-blue .kpi-icon { color: var(--blue); background: #eef4ff; }
.tone-green .kpi-icon { color: var(--green); background: #edf9f4; }
.tone-gold .kpi-icon { color: var(--gold); background: #fff7e2; }
.tone-slate .kpi-icon { color: var(--slate); background: #f1f4f7; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.45fr) 360px;
    grid-template-areas:
        "pipeline timeline inspector"
        "table table inspector"
        "deadlines deadlines inspector";
    gap: 16px;
    align-items: start;
}

.dashboard-grid > *,
.split-layout > * {
    min-width: 0;
}

.pipeline-panel { grid-area: pipeline; }
.timeline-panel { grid-area: timeline; }
.table-panel { grid-area: table; }
.deadlines-panel { grid-area: deadlines; }
.inspector-panel { grid-area: inspector; }

.panel,
.inspector-panel {
    padding: 16px;
}

.timeline-panel {
    overflow-x: auto;
}

.panel-header,
.inspector-head,
.project-top,
.team-meta,
.offer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-header h2,
.panel-header h3,
.inspector-head h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

.panel-header a,
.compact a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--red);
    font-size: 12px;
    font-weight: 760;
}

.pipeline-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.pipeline-stage {
    position: relative;
    min-height: 122px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 3px;
    padding: 18px 10px 12px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, #f7f9fc);
    border: 1px solid var(--line);
}

.stage-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: currentColor;
}

.pipeline-stage strong {
    font-size: 26px;
}

.pipeline-stage p,
.pipeline-stage small {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.color-blue { color: var(--blue); }
.color-cyan { color: var(--cyan); }
.color-gold { color: var(--gold); }
.color-orange { color: var(--orange); }
.color-green { color: var(--green); }
.color-gray { color: #9aa3af; }

.panel-total {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.mini-gantt {
    margin-top: 16px;
}

.gantt-scale,
.gantt-row {
    display: grid;
    grid-template-columns: 132px repeat(10, 1fr);
    min-width: 520px;
}

.gantt-scale {
    color: var(--subtle);
    font-size: 11px;
    border-bottom: 1px solid var(--line);
}

.gantt-scale span {
    padding: 6px 4px;
    text-align: center;
}

.gantt-row {
    min-height: 42px;
    align-items: center;
}

.gantt-label {
    display: grid;
    gap: 2px;
    color: var(--muted);
    font-size: 11px;
}

.gantt-label strong {
    color: var(--ink);
    font-size: 12px;
}

.gantt-track,
.planner-track {
    grid-column: 2 / -1;
    display: grid;
    grid-template-columns: repeat(10, minmax(38px, 1fr));
    align-items: center;
    min-height: 38px;
    background-image: linear-gradient(to right, rgba(30, 38, 51, 0.08) 1px, transparent 1px);
    background-size: 10% 100%;
}

.gantt-bar,
.planner-bar {
    grid-column: var(--start) / span var(--span);
    min-height: 24px;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0 10px;
    border-radius: 6px;
    color: #fff;
    background: currentColor;
    box-shadow: 0 8px 18px color-mix(in srgb, currentColor 24%, transparent);
    font-size: 11px;
    font-weight: 760;
    white-space: nowrap;
}

.color-blue .gantt-bar,
.gantt-bar.color-blue,
.planner-bar.color-blue { background: var(--blue); }
.gantt-bar.color-cyan,
.planner-bar.color-cyan { background: var(--cyan); }
.gantt-bar.color-gold,
.planner-bar.color-gold { background: var(--gold); }
.gantt-bar.color-green,
.planner-bar.color-green { background: var(--green); }
.gantt-bar.color-gray,
.planner-bar.color-gray { background: #a1a9b4; }

.table-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-search,
.smart-form input,
.smart-form select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 11px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.9);
    outline: none;
}

.table-search:focus,
.smart-form input:focus,
.smart-form select:focus,
.search-wrap:focus-within {
    border-color: rgba(217, 35, 46, 0.38);
    box-shadow: 0 0 0 4px rgba(217, 35, 46, 0.08);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 14px;
}

.compact-scroll {
    max-height: 506px;
    overflow: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.data-table td {
    color: #2a303a;
}

.data-table td strong,
.data-table td small {
    display: block;
}

.data-table td small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.data-table tbody tr {
    transition: background 160ms ease;
}

.data-table tbody tr:hover {
    background: rgba(217, 35, 46, 0.035);
}

.person {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 780;
    white-space: nowrap;
    color: #526071;
    background: #eef2f6;
    border: 1px solid rgba(30, 38, 51, 0.08);
}

.status-in-corso,
.status-attivo,
.status-operativa,
.status-vinta,
.status-completamento {
    color: #087053;
    background: #e8f8f1;
    border-color: #b8e8d3;
}

.status-pianificato,
.status-prospect,
.status-offerta {
    color: #245ebc;
    background: #eef4ff;
    border-color: #c8dafa;
}

.status-attesa-materiali,
.status-attesa-conferma,
.status-in-valutazione,
.status-qualifica {
    color: #9a5a00;
    background: #fff5df;
    border-color: #f5d693;
}

.status-completato,
.status-storico {
    color: #617084;
    background: #f1f4f7;
}

.deadline-rail {
    display: grid;
    grid-template-columns: repeat(5, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 14px;
    overflow-x: auto;
}

.deadline-card {
    display: flex;
    gap: 12px;
    min-height: 86px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.deadline-card time,
.deadline-row time {
    width: 44px;
    height: 50px;
    display: grid;
    place-items: center;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.deadline-card time strong,
.deadline-row time strong {
    font-size: 18px;
    line-height: 1;
}

.deadline-card time span,
.deadline-row time span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.deadline-card strong,
.deadline-card p,
.deadline-card small {
    display: block;
    margin: 0;
}

.deadline-card p,
.deadline-card small {
    color: var(--muted);
    font-size: 12px;
}

.inspector-panel {
    position: sticky;
    top: calc(var(--topbar) + 16px);
}

.site-photo {
    height: 142px;
    margin: 16px 0 14px;
    border-radius: var(--radius);
    background:
        linear-gradient(90deg, rgba(255,255,255,.82), rgba(255,255,255,.2)),
        linear-gradient(120deg, #d9e2ec, #f9fbfd 42%, #b9c8d8);
    border: 1px solid var(--line);
    overflow: hidden;
}

.photo-lines {
    width: 100%;
    height: 100%;
    background:
        linear-gradient(90deg, transparent 0 11%, rgba(42,52,66,.12) 11% 12%, transparent 12% 24%, rgba(42,52,66,.1) 24% 25%, transparent 25%),
        linear-gradient(180deg, transparent 0 42%, rgba(42,52,66,.10) 42% 43%, transparent 43%),
        linear-gradient(135deg, transparent 0 62%, rgba(217,35,46,.10) 62% 100%);
}

.inspector-panel h3 {
    margin: 0;
    font-size: 21px;
}

.inspector-panel > p {
    margin: 4px 0 14px;
    color: var(--muted);
}

.detail-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
}

.detail-list dd {
    margin: 0;
    color: #2a303a;
    font-weight: 650;
}

.progress-line {
    display: inline-flex;
    width: 100%;
    height: 7px;
    margin-right: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7ebf0;
    vertical-align: middle;
}

.progress-line span {
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, #35ad83, #53c7a1);
}

.inspector-section {
    margin-top: 18px;
}

.activity-item,
.doc-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.activity-item > span {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #eef2f6;
}

.activity-success > span { background: #dff6ec; }
.activity-warning > span { background: #fff0cf; }
.activity-danger > span { background: #ffe1e4; }
.activity-info > span { background: #e6f0ff; }

.activity-item strong,
.doc-item strong {
    display: block;
    font-size: 12px;
}

.activity-item small,
.doc-item small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.doc-item > span,
.doc-type {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: var(--radius);
    color: var(--red);
    background: #fff0f1;
    border: 1px solid #f5c9ce;
    font-size: 11px;
    font-weight: 850;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-panel {
    scroll-margin-top: 90px;
}

.smart-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.smart-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

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

.insight-panel,
.stat-stack {
    display: grid;
    gap: 14px;
}

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

.stat-stack div {
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
}

.stat-stack span,
.stat-stack strong {
    display: block;
}

.stat-stack span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 780;
}

.stat-stack strong {
    margin-top: 6px;
    font-size: 24px;
}

.pipeline-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.pipeline-column {
    min-height: 310px;
    padding: 14px;
    display: grid;
    align-content: start;
    gap: 10px;
}

.pipeline-column h2,
.pipeline-column p {
    margin: 0;
}

.pipeline-column h2 {
    margin-top: 9px;
    font-size: 15px;
}

.pipeline-column p {
    color: var(--muted);
    font-size: 12px;
}

.offer-card,
.note-grid > div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.offer-card strong,
.offer-card span {
    display: block;
}

.offer-card > span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.offer-meta {
    margin: 10px 0 8px;
    color: var(--muted);
}

.project-cards,
.team-grid,
.document-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.project-card,
.team-card,
.document-card {
    padding: 16px;
}

.project-card {
    display: grid;
    gap: 10px;
}

.project-card h2,
.project-card p {
    margin: 0;
}

.project-card h2 {
    font-size: 18px;
}

.project-card p {
    color: var(--muted);
}

.project-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 780;
}

.planner {
    margin-top: 16px;
    min-width: 900px;
}

.planning-board {
    overflow-x: auto;
}

.planner-scale,
.planner-row {
    display: grid;
    grid-template-columns: 210px repeat(10, 1fr);
}

.planner-scale {
    color: var(--muted);
    font-size: 12px;
    font-weight: 780;
    border-bottom: 1px solid var(--line);
}

.planner-scale span {
    padding: 9px 8px;
}

.planner-row {
    min-height: 68px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.planner-team {
    display: grid;
    gap: 2px;
}

.planner-team small,
.planner-bar small {
    color: inherit;
    opacity: 0.75;
}

.planner-bar {
    display: grid;
    justify-items: start;
    min-height: 46px;
    border: 0;
    text-align: left;
}

.segmented-control {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #f4f6f9;
}

.segmented-control button {
    min-height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font-size: 12px;
    font-weight: 760;
}

.segmented-control button.is-active {
    color: var(--ink);
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.note-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.note-grid strong,
.note-grid p {
    margin: 0;
}

.note-grid p {
    margin-top: 6px;
    color: var(--muted);
}

.team-card {
    display: grid;
    gap: 12px;
}

.team-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.team-avatar {
    width: 48px;
    height: 48px;
}

.team-head h2,
.team-head p,
.team-card p {
    margin: 0;
}

.team-head h2 {
    font-size: 18px;
}

.team-head p,
.team-card p,
.team-card small {
    color: var(--muted);
}

.document-grid {
    margin-top: 14px;
}

.document-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.document-card h2,
.document-card p,
.document-card small {
    margin: 0;
}

.document-card h2 {
    font-size: 15px;
}

.document-card p,
.document-card small {
    color: var(--muted);
}

.rating {
    color: #9a5a00;
    font-weight: 850;
}

.deadline-list {
    display: grid;
    gap: 10px;
}

.deadline-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
}

.deadline-row h2,
.deadline-row p {
    margin: 0;
}

.deadline-row h2 {
    font-size: 16px;
}

.deadline-row p {
    color: var(--muted);
}

.toast-stack {
    position: fixed;
    top: 82px;
    right: 24px;
    z-index: 50;
    display: grid;
    gap: 8px;
    width: min(430px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.toast button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
}

.toast-success { border-color: #b8e8d3; }
.toast-warning { border-color: #f5d693; }
.toast-error { border-color: #f4b3bb; }

.command-dialog {
    width: min(520px, calc(100vw - 28px));
    border: 0;
    padding: 0;
    border-radius: var(--radius);
    background: transparent;
}

.command-dialog::backdrop {
    background: rgba(16, 19, 24, 0.34);
    backdrop-filter: blur(8px);
}

.dialog-panel {
    position: relative;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.dialog-panel h2,
.dialog-panel p {
    margin: 0;
}

.dialog-panel p {
    margin-top: 6px;
    color: var(--muted);
}

.dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.quick-grid a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font-weight: 780;
}

.empty-state {
    min-height: 60vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    text-align: center;
}

.empty-mark {
    color: var(--red);
    font-size: 64px;
    font-weight: 860;
}

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

@media (max-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "pipeline timeline"
            "table table"
            "deadlines deadlines"
            "inspector inspector";
    }

    .inspector-panel {
        position: static;
    }

    .project-cards,
    .team-grid,
    .document-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
    }

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

    .sidebar-footer {
        display: none;
    }

    .topbar {
        position: static;
        flex-wrap: wrap;
        height: auto;
        padding: 14px 16px;
    }

    .main-surface {
        padding: 16px;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

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

    .dashboard-grid,
    .split-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "pipeline"
            "timeline"
            "table"
            "deadlines"
            "inspector";
    }
}

@media (max-width: 680px) {
    body {
        font-size: 13px;
    }

    .brand-copy strong {
        font-size: 23px;
    }

    .nav-list,
    .kpi-strip,
    .kpi-strip.compact,
    .project-cards,
    .team-grid,
    .document-grid,
    .note-grid,
    .stat-stack,
    .form-grid,
    .quick-grid {
        grid-template-columns: 1fr;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .pipeline-row,
    .deadline-rail {
        grid-template-columns: 1fr;
    }

    .deadline-row {
        grid-template-columns: 50px minmax(0, 1fr);
    }

    .deadline-row > strong,
    .deadline-row > .status-chip {
        justify-self: start;
        grid-column: 2;
    }

    .panel,
    .inspector-panel,
    .project-card,
    .team-card,
    .document-card {
        padding: 14px;
    }
}
