:root {
    --ink: #0f1720;
    --ink-soft: #1a2430;
    --steel: #2c3b4a;
    --mist: #e8eef3;
    --paper: #f5f7f9;
    --line: #d5dee7;
    --teal: #0f766e;
    --teal-bright: #14b8a6;
    --amber: #b45309;
    --rose: #be123c;
    --text: #15202b;
    --muted: #5b6b7a;
    --surface: #ffffff;
    --topbar-bg: rgba(245, 247, 249, 0.9);
    --btn-solid-hover: #1b2836;
    --shadow: 0 12px 40px rgba(15, 23, 32, 0.12);
    --radius: 14px;
    --font: "Sora", "Segoe UI", sans-serif;
    --display: "Fraunces", Georgia, serif;
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--paper);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
}
body.nav-lock { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; height: auto; }

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(20, 184, 166, 0.18), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(44, 59, 74, 0.22), transparent 50%),
        linear-gradient(160deg, #0f1720 0%, #1a2a36 45%, #0f1720 100%);
    color: #fff;
}

.login-panel {
    width: min(440px, 100%);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    border-radius: 22px;
    padding: 2.25rem 2rem 2rem;
    box-shadow: var(--shadow);
    animation: rise 0.55s ease both;
}

.brand-mark {
    font-family: var(--display);
    font-size: clamp(2.6rem, 6vw, 3.4rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0;
    color: var(--ink);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0 0 0.15rem;
}
.brand-lockup--compact {
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}
.brand-lockup__mark {
    flex: 0 0 auto;
    display: block;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 32, 0.18);
}
.brand-lockup--compact .brand-lockup__mark {
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 32, 0.14);
}
.brand-lockup__text.brand-mark {
    font-size: clamp(2.1rem, 5vw, 2.8rem);
    line-height: 1;
}
.brand-lockup--compact .brand-lockup__text.brand-mark {
    font-size: 1.85rem;
}

.brand-sub {
    margin: 0.35rem 0 1.75rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #0f1720 0%, #13202c 100%);
    color: #dce6ef;
    padding: 1.5rem 1rem 1.25rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.sidebar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.nav-close {
    display: none;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    min-width: 2.5rem;
    min-height: 2.5rem;
}
.sidebar__logout {
    margin-top: auto;
    padding: 0 0.75rem;
}
.sidebar__logout-btn {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.nav-backdrop {
    display: none;
}
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    min-height: 2.6rem;
    padding: 0.45rem;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
    display: block;
    width: 1.15rem;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
    content: "";
    position: absolute;
    left: 0;
}
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }

.topbar__lead {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}
.topbar__title {
    font-size: 1.15rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar__actions {
    margin: 0;
    justify-content: flex-end;
    flex-shrink: 0;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 600;
    padding: 0 0.75rem;
    color: #fff;
    text-decoration: none;
}
.sidebar .logo img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.sidebar .logo:hover {
    color: #fff;
}

.nav-list { display: flex; flex-direction: column; gap: 0.35rem; }
.nav-link {
    display: block;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: #c5d2de;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(2px); }
.nav-link.active { background: rgba(20, 184, 166, 0.22); color: #fff; }

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.75rem;
    padding-top: max(0.85rem, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: var(--topbar-bg);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.content {
    padding: 1.5rem 1.75rem 2.5rem;
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
}
.page-sub { margin: 0 0 1.5rem; color: var(--muted); }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    animation: rise 0.45s ease both;
}
.stat strong { display: block; font-size: 1.7rem; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.progress-line {
    height: 8px;
    background: var(--mist);
    border-radius: 999px;
    overflow: hidden;
}
.progress-line span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--teal-bright));
    border-radius: inherit;
    min-width: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.panel + .panel { margin-top: 1rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.05rem; }

.table { width: 100%; border-collapse: collapse; }
.table-scroll,
.panel:has(> .table),
.panel:has(> table.table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table th, .table td {
    text-align: left;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    font-size: 0.92rem;
}
.table th { color: var(--muted); font-weight: 500; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    background: var(--ink);
    color: #fff;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--btn-solid-hover); }
.btn-teal { background: var(--teal); }
.btn-teal:hover { background: #0d9488; }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--mist); }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.field { margin-bottom: 1rem; }
.field label,
.field-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    background: var(--surface);
    color: var(--text);
}
.field input[type="file"] {
    color: var(--text);
    padding: 0.45rem 0.35rem;
}
.field input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    background: var(--mist);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}
.field input::placeholder,
.field textarea::placeholder {
    color: var(--muted);
    opacity: 1;
}
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    color: var(--muted);
    background: var(--mist);
    opacity: 1;
}
.field input[type="checkbox"],
.field input[type="radio"] {
    width: auto;
    padding: 0;
    border-radius: 3px;
}
.field .check-list label,
.field label.check-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
}
.check-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.35rem;
}
.check-list--five {
    max-height: calc(5 * 1.85rem);
    overflow-y: auto;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}
.check-list--five .check-row {
    min-height: 1.4rem;
}
.check-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}
.check-row input[type="checkbox"],
.field .check-row input[type="checkbox"],
.field .check-list input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    margin: 0;
    padding: 0;
    accent-color: var(--teal);
}

.team-add {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    align-items: start;
    margin-bottom: 0.55rem;
}
.team-add select,
.team-add .team-combobox {
    margin: 0;
    min-width: 0;
}
.team-combobox {
    position: relative;
}
.team-combobox__input {
    width: 100%;
    margin: 0;
}
.team-combobox__menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 14rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--epms-shadow, 0 10px 28px rgba(15, 23, 32, 0.16));
}
.team-combobox__option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.team-combobox__option:hover,
.team-combobox__option.is-selected {
    background: var(--mist);
}
.team-combobox__option strong {
    font-size: 0.9rem;
    font-weight: 600;
}
.team-combobox__option .muted {
    font-size: 0.78rem;
}
.team-combobox__empty {
    margin: 0;
    padding: 0.65rem 0.55rem;
    font-size: 0.85rem;
}
.team-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.team-list--scroll {
    max-height: calc(5 * 2.55rem);
    overflow-y: auto;
    padding-right: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}
.team-member {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.45rem;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.35rem 0.55rem;
    border-bottom: 1px solid var(--line);
}
.team-member:last-child { border-bottom: 0; }
.team-member__name {
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-member__flag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}
.team-member__flag input {
    width: 0.9rem;
    height: 0.9rem;
    margin: 0;
    accent-color: var(--teal);
}
.team-member__flag input:disabled {
    opacity: 0.7;
}
.team-member__remove {
    width: 1.6rem;
    height: 1.6rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--rose);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.team-member__remove:hover {
    background: #ffe4e6;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 80;
}
.modal-panel {
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.35rem 1.35rem 1.25rem;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.field textarea { min-height: 90px; resize: vertical; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.alert {
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: #fff1f2; color: var(--rose); border: 1px solid #fecdd3; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    background: var(--mist);
    color: var(--steel);
}
.notif-row--unread td {
    background: color-mix(in srgb, var(--mist) 70%, transparent);
}
.notif-row--unread strong {
    font-weight: 600;
}

.badge-medium { background: #ffedd5; color: var(--amber); }
.badge-low { background: #e0f2fe; color: #0369a1; }
.badge-overdue { background: #ffe4e6; color: var(--rose); }

.kanban {
    --kanban-gap: 1rem;
    --kanban-visible: 4;
    display: flex;
    align-items: stretch;
    gap: var(--kanban-gap);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.65rem;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0.15rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.kanban-col {
    /* Grow when fewer than 4; never shrink below 1/4 viewport so extras scroll. */
    flex: 1 0 calc((100% - (var(--kanban-visible) - 1) * var(--kanban-gap)) / var(--kanban-visible));
    width: calc((100% - (var(--kanban-visible) - 1) * var(--kanban-gap)) / var(--kanban-visible));
    box-sizing: border-box;
    background: var(--mist);
    border-radius: var(--radius);
    padding: 0.85rem;
    min-height: 420px;
    min-width: 0;
    border-top: 3px solid var(--col-accent, var(--steel));
    color: var(--text);
    scroll-snap-align: start;
}
.kanban-col header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}
.kanban-col h3 { margin: 0; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-col.wip-hot { outline: 2px solid rgba(180, 83, 9, 0.35); }
.kanban-col--done .kanban-tasks {
    min-height: 80px;
}
.kanban-tasks { display: flex; flex-direction: column; gap: 0.65rem; min-height: 80px; }
.col-swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.column-editor {
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}
.column-editor-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.7fr 0.9fr auto auto;
    gap: 0.75rem;
    align-items: end;
}
@media (max-width: 980px) {
    .column-editor-grid { grid-template-columns: 1fr 1fr; }
}

.task-card {
    --task-accent: var(--col-accent, var(--steel));
    --task-bg: var(--surface);
    --task-ink: var(--text);
    --task-muted: var(--muted);
    --task-border: var(--line);
    background: var(--task-bg);
    color: var(--task-ink);
    border: 1px solid var(--task-border);
    border-left: 3px solid var(--task-accent);
    border-radius: 10px;
    padding: 0.65rem 0.7rem;
    cursor: grab;
    box-shadow: 0 1px 0 rgba(15,23,32,0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    overflow: hidden;
    min-width: 0;
}
.task-card--colored {
    border-left-width: 0;
    box-shadow: 0 1px 0 rgba(15,23,32,0.08);
}
.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card.sortable-ghost { opacity: 0.45; }
.task-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.4rem;
}
.task-card h4 {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.35;
    word-break: break-word;
    color: inherit;
}
.task-card__title {
    color: inherit;
    text-decoration: none;
}
.task-card__title:hover { text-decoration: underline; }
.task-card__remove {
    border: 0;
    background: transparent;
    color: var(--task-ink);
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
    font-size: 1.05rem;
    opacity: 0.75;
}
.task-card--colored .task-card__remove { color: #fecdd3; }
.task-card__remove:hover { opacity: 1; }
.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    color: var(--task-muted);
    font-size: 0.74rem;
    margin-top: 0.4rem;
    align-items: center;
}
.task-card--colored .task-meta .badge {
    background: color-mix(in srgb, #fff 22%, transparent);
    color: var(--task-ink);
    border: 1px solid color-mix(in srgb, var(--task-ink) 18%, transparent);
}
.task-card--colored .task-meta .badge-overdue {
    background: #ffe4e6;
    color: var(--rose);
    border-color: transparent;
}
.task-card--colored .muted {
    color: var(--task-muted);
}
.task-card--colored .btn-teal {
    background: color-mix(in srgb, #fff 18%, transparent);
    border-color: color-mix(in srgb, #fff 35%, transparent);
    color: var(--task-ink);
}
.task-card--colored .btn-teal:hover {
    background: color-mix(in srgb, #fff 28%, transparent);
}
.task-card__claim { margin-top: 0.45rem; }

.task-card-edit {
    margin-top: 0.55rem;
    min-width: 0;
}
.task-card-edit > .check-row { margin: 0.55rem 0; }
.task-card-dates + .check-row { margin-top: 0.55rem; }
.task-card-dates__hint {
    font-size: 0.75rem;
    margin: 0 0 0.45rem;
    line-height: 1.4;
}
.task-card-dates .field {
    margin: 0 0 0.45rem;
    min-width: 0;
}
.task-card-dates .field label {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}
.task-card-dates .field input[type="date"],
.task-card-dates__grid .field input[type="date"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.4rem 0.45rem;
    font-size: 0.8rem;
    border-radius: 8px;
    box-sizing: border-box;
}
.task-card-dates__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
    min-width: 0;
}
.task-card-dates__grid .field {
    margin: 0;
    min-width: 0;
}
.task-card-dates__grid .field label {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}
.task-card-alarm {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--line);
    min-width: 0;
}
.task-card-edit__actions {
    margin-top: 0.65rem;
}
.task-card-edit__actions .btn {
    white-space: nowrap;
}

.task-card__title {
    color: inherit;
    text-decoration: none;
}
.task-card__title:hover { text-decoration: underline; }

.task-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 1rem;
    align-items: start;
}
.task-detail__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}
.task-detail__section {
    margin-top: 0.35rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}
.task-attachments,
.task-comments {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.task-attachment {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem;
    background: var(--surface);
}
.task-attachment img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--mist);
}
.task-attachment__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.45rem;
    font-size: 0.78rem;
}
.task-comment {
    border-left: 3px solid var(--line);
    padding: 0.15rem 0 0.15rem 0.75rem;
}
.task-comment__head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}
.task-comment p {
    margin: 0;
    white-space: pre-wrap;
    font-size: 0.9rem;
}
@media (max-width: 900px) {
    .task-detail { grid-template-columns: 1fr; }
}

.gantt-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    margin-bottom: 1rem;
}
.gantt-panel-head h2 { margin: 0 0 0.35rem; }
.gantt-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.gantt-zoom {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--mist);
}
.gantt-zoom__btn {
    min-width: 2rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    font-size: 1rem;
    line-height: 1;
}
.gantt-zoom__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}
.gantt-zoom__label {
    min-width: 3.25rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.gantt-chart {
    --gantt-side-w: 320px;
    --gantt-row-h: 48px;
    --gantt-head-h: 64px;
    --gantt-day-w: 36px;
    --gantt-days: 14;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}
.gantt-scroll {
    overflow: auto;
    max-height: min(70vh, 720px);
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.gantt-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.gantt-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.45);
    border-radius: 999px;
}
.gantt-scroll::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.12);
}
.gantt-canvas {
    width: calc(var(--gantt-side-w) + (var(--gantt-days) * var(--gantt-day-w)));
    min-width: 100%;
}
.gantt-head-row,
.gantt-body-row {
    display: flex;
    align-items: stretch;
    width: calc(var(--gantt-side-w) + (var(--gantt-days) * var(--gantt-day-w)));
    min-width: 100%;
    box-sizing: border-box;
}
.gantt-head-row {
    position: sticky;
    top: 0;
    z-index: 5;
    height: var(--gantt-head-h);
    min-height: var(--gantt-head-h);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.gantt-body-row {
    height: var(--gantt-row-h);
    min-height: var(--gantt-row-h);
    border-bottom: 1px solid var(--line);
}
.gantt-body-row:last-child { border-bottom: 0; }
.gantt-frozen {
    position: sticky;
    left: 0;
    z-index: 3;
    flex: 0 0 var(--gantt-side-w);
    width: var(--gantt-side-w);
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 64px 64px;
    gap: 0.35rem;
    align-items: center;
    padding: 0 0.75rem;
    border-right: 1px solid var(--line);
    background: var(--mist);
    box-sizing: border-box;
}
.gantt-frozen--head {
    z-index: 6;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--mist);
}
.gantt-frozen--row {
    z-index: 2;
}
.gantt-side__title {
    min-width: 0;
}
.gantt-side__title a {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-side__title .muted {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-side__date {
    font-size: 0.78rem;
    color: var(--muted);
}
.gantt-timeline-head {
    flex: 0 0 auto;
    width: calc(var(--gantt-days) * var(--gantt-day-w));
    min-width: calc(var(--gantt-days) * var(--gantt-day-w));
    background: var(--surface);
}
.gantt-weeks {
    display: flex;
    border-bottom: 1px solid var(--line);
    height: 28px;
    min-height: 28px;
}
.gantt-week {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--steel);
    border-right: 1px solid var(--line);
    padding: 0 0.2rem;
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.gantt-week:last-child { border-right: 0; }
.gantt-days {
    display: grid;
    grid-template-columns: repeat(var(--gantt-days), var(--gantt-day-w));
    height: 36px;
    min-height: 36px;
}
.gantt-day {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    color: var(--muted);
    border-right: 1px solid var(--line);
    box-sizing: border-box;
}
.gantt-day.is-weekend { background: rgba(148, 163, 184, 0.12); }
.gantt-day.is-today {
    color: var(--rose);
    font-weight: 700;
}
.gantt-body {
    position: relative;
}
.gantt-lane {
    position: relative;
    flex: 0 0 auto;
    width: calc(var(--gantt-days) * var(--gantt-day-w));
    min-width: calc(var(--gantt-days) * var(--gantt-day-w));
    height: var(--gantt-row-h);
    z-index: 1;
}
.gantt-grid {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--gantt-side-w);
    width: calc(var(--gantt-days) * var(--gantt-day-w));
    display: grid;
    grid-template-columns: repeat(var(--gantt-days), var(--gantt-day-w));
    pointer-events: none;
    z-index: 0;
}
.gantt-grid-col {
    border-right: 1px solid var(--line);
    box-sizing: border-box;
}
.gantt-grid-col.is-weekend { background: rgba(148, 163, 184, 0.08); }
.gantt-grid-col.is-today { background: rgba(190, 18, 60, 0.06); }
.gantt-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fb7185;
    transform: translateX(-1px);
    z-index: 4;
    pointer-events: none;
}
.gantt-bar {
    position: absolute;
    top: 12px;
    height: 24px;
    display: flex;
    align-items: center;
    padding: 0 0.55rem;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--teal), var(--teal-bright));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    z-index: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 32, 0.12);
}
.gantt-bar span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-milestone {
    position: absolute;
    top: 15px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    background: #f59e0b;
    transform: rotate(45deg);
    border-radius: 3px;
    z-index: 1;
}
.gantt-milestone span {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
    white-space: nowrap;
    font-size: 0.72rem;
    color: var(--text);
    font-weight: 600;
}
.gantt-empty {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding-left: 0.75rem;
    font-size: 0.78rem;
}
.gantt-edit-list {
    margin-top: 0.25rem;
}
.gantt-edit-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) repeat(3, minmax(120px, 1fr)) auto;
    gap: 0.65rem;
    align-items: end;
    padding: 0.75rem 0;
    border-top: 1px solid var(--line);
}
.gantt-edit-row__title {
    align-self: center;
}
.gantt-edit-row .field label {
    font-size: 0.72rem;
}

.split {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    align-items: start;
}
.split > .panel + .panel {
    margin-top: 0;
}

.brand-settings {
    width: 100%;
    max-width: 56rem;
}
.settings-hub {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
    width: 100%;
}
.settings-hub > .panel + .panel {
    margin-top: 0;
}
.settings-hub__card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 10.5rem;
    box-sizing: border-box;
}
.settings-hub__card h2 {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
}
.settings-hub__card p {
    margin: 0 0 1rem;
    flex: 1 1 auto;
}
.settings-hub__card .btn {
    margin-top: auto;
}
.brand-settings__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}
.brand-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    padding: 1.15rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--mist);
}
.brand-card__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.brand-card__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 8.5rem;
    padding: 1rem;
    border-radius: 12px;
    background: #0f1720;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.brand-card__preview img {
    display: block;
    max-width: 100%;
    max-height: 6.5rem;
    width: auto;
    height: auto;
    object-fit: contain;
}
.brand-card input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; align-items: center; }

.list-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}
.list-pagination__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}
.list-pagination__per-page {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    margin: 0;
}
.list-pagination__per-page select {
    width: auto;
    min-width: 4.5rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    background: var(--surface);
    color: var(--text);
}
.list-pagination__nav {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.list-pagination__meta { font-size: 0.85rem; }
.muted { color: var(--muted); }
.user-chip { font-size: 0.9rem; text-align: left; }
.user-chip small { display: block; color: var(--muted); }

.avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mist);
    color: var(--steel);
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 0.9rem; }
.avatar-xl { width: 5.5rem; height: 5.5rem; font-size: 1.35rem; }
.avatar-fallback { background: linear-gradient(145deg, #0f766e, #1a2a36); color: #fff; }

.profile-menu { position: relative; }
.profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    cursor: pointer;
    font: inherit;
    color: var(--text);
}
.profile-trigger:hover { background: var(--mist); }
.profile-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    width: min(280px, 85vw);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0.75rem;
    z-index: 60;
}
.profile-panel-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--line);
}
.profile-panel-link {
    display: block;
    padding: 0.55rem 0.4rem;
    border-radius: 8px;
    font-size: 0.9rem;
}
.profile-panel-link:hover { background: var(--mist); }
.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 1rem;
    align-items: start;
}
.profile-layout > .panel,
.profile-layout__side {
    margin-top: 0;
    align-self: start;
}
.profile-layout__side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.profile-layout__side > .panel {
    margin-top: 0;
}
.security-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 1rem;
    background: var(--mist);
}
.security-box {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.9rem;
    background: var(--surface);
}
.security-qr {
    display: grid;
    place-items: center;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}
.security-options .btn-block { width: 100%; }
.theme-options {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    background: var(--surface);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-option:hover { background: var(--mist); }
.theme-option.is-selected {
    border-color: var(--teal);
    background: color-mix(in srgb, var(--teal) 10%, var(--surface));
}
.theme-option input {
    margin: 0;
    accent-color: var(--teal);
}
.theme-option strong {
    display: block;
    font-size: 0.92rem;
}
.theme-option small {
    display: block;
    font-size: 0.78rem;
    margin-top: 0.15rem;
}
.theme-option__swatch {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.theme-option__swatch--light {
    background: linear-gradient(145deg, #f5f7f9 45%, #ffffff 45%);
}
.theme-option__swatch--dark {
    background: linear-gradient(145deg, #0f1419 45%, #1a2430 45%);
}
.theme-option__swatch--system {
    background:
        linear-gradient(90deg, #f5f7f9 50%, #0f1419 50%);
}
@media (max-width: 980px) {
    .profile-layout { grid-template-columns: 1fr; }
}

.profile-avatar-editor {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
}

.phone-input {
    display: grid;
    grid-template-columns: minmax(9.5rem, 12rem) 1fr;
    gap: 0.55rem;
    align-items: stretch;
}
.phone-input__country {
    margin: 0;
}
.phone-input__number {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    padding: 0 0.75rem;
    min-height: 2.55rem;
}
.phone-input__prefix {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}
.phone-input__number input {
    border: 0;
    outline: none;
    box-shadow: none;
    margin: 0;
    padding: 0.55rem 0;
    background: transparent;
    width: 100%;
    min-width: 0;
}
@media (max-width: 640px) {
    .phone-input { grid-template-columns: 1fr; }
}

.notif-menu { position: relative; }
.notif-bell { display: inline-flex; align-items: center; gap: 0.35rem; }
.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    width: min(340px, 85vw);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0.85rem;
    z-index: 60;
}
.notif-item {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0.55rem 0.35rem;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font: inherit;
    color: inherit;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--mist); }
.alarm-fields { font-size: 0.85rem; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.audit-props {
    margin: .45rem 0 0;
    padding: .65rem .75rem;
    background: var(--mist);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .75rem;
    line-height: 1.4;
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-flex; }
    .nav-close { display: inline-flex; }
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 32, 0.55);
        z-index: 90;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(280px, 86vw);
        z-index: 100;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
    }
    .topbar {
        padding-left: max(0.85rem, env(safe-area-inset-left));
        padding-right: max(0.85rem, env(safe-area-inset-right));
    }
    .content {
        padding: 1rem 0.9rem 2rem;
        padding-left: max(0.9rem, env(safe-area-inset-left));
        padding-right: max(0.9rem, env(safe-area-inset-right));
    }
    .user-chip { display: none; }
    .profile-trigger { padding-right: 0.25rem; }
    .notif-bell__label { display: none; }
    .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: 1fr; }
    .brand-settings__grid { grid-template-columns: 1fr; }
    .settings-hub { grid-template-columns: 1fr; }
    .gantt-chart { --gantt-side-w: 200px; }
    .gantt-panel-head { flex-direction: column; }
    .gantt-actions { width: 100%; }
    .gantt-edit-row { grid-template-columns: 1fr 1fr; }
    .kanban {
        --kanban-visible: 1;
        --kanban-gap: 0.75rem;
        width: 100%;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.75rem;
    }
    .kanban-col {
        /* One column per screen width; swipe to see the next. */
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
        min-height: min(70vh, 560px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
    .table { min-width: 640px; }
    .toolbar { gap: 0.5rem; }
    .modal-backdrop { padding: 0.75rem; align-items: flex-end; }
    .modal-panel {
        width: 100%;
        max-height: min(92vh, 900px);
        border-radius: 16px 16px 0 0;
    }
    .guest-shell { padding: 1rem; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
    .login-panel { padding: 1.5rem 1.15rem 1.35rem; border-radius: 18px; }
    .brand-lockup { flex-wrap: wrap; }
    .tabs { flex-wrap: wrap; }
    .column-editor-grid { grid-template-columns: 1fr 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    .task-detail { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .grid-stats { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
    .stat { padding: 0.85rem 0.9rem; }
    .stat strong { font-size: 1.35rem; }
    .page-title { font-size: 1.25rem; }
    .topbar__title { font-size: 1rem; }
    .panel { padding: 1rem; border-radius: 12px; }
    .btn { min-height: 2.5rem; }
    .btn-sm { min-height: 2.25rem; }
    .field input,
    .field select,
    .field textarea {
        font-size: 16px; /* prevent iOS zoom on focus */
        min-height: 2.6rem;
    }
    .gantt-chart { --gantt-side-w: 168px; --gantt-row-h: 52px; }
    .gantt-frozen {
        grid-template-columns: minmax(0, 1fr) 52px 52px;
        padding: 0 0.5rem;
        gap: 0.25rem;
    }
    .gantt-scroll { max-height: min(65vh, 560px); }
    .gantt-actions .btn { flex: 1 1 auto; }
    .list-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    .list-pagination__controls {
        justify-content: space-between;
    }
    .notif-panel {
        position: fixed;
        left: 0.65rem;
        right: 0.65rem;
        top: max(3.75rem, calc(env(safe-area-inset-top) + 3.25rem));
        width: auto;
        max-height: min(70vh, 480px);
        overflow: auto;
    }
    .profile-panel {
        position: fixed;
        left: 0.65rem;
        right: 0.65rem;
        top: max(3.75rem, calc(env(safe-area-inset-top) + 3.25rem));
        width: auto;
    }
    .phone-input { grid-template-columns: 1fr; }
    .gantt-edit-row { grid-template-columns: 1fr; }
    .column-editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .grid-stats { grid-template-columns: 1fr; }
}

/* —— Theme: dark / system ——
   Keep --ink dark (sidebar/brand/solid buttons). Only flip content surfaces & text. */
html[data-theme="dark"] {
    --ink: #0f1720;
    --ink-soft: #1a2430;
    --steel: #8fa3b5;
    --mist: #243140;
    --paper: #0c1117;
    --line: #3a4d5f;
    --text: #f1f5f9;
    --muted: #b6c5d4;
    --surface: #18222d;
    --topbar-bg: rgba(12, 17, 23, 0.94);
    --btn-solid-hover: #1b2836;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    --teal: #2dd4bf;
    --teal-bright: #5eead4;
    --amber: #fbbf24;
    --rose: #fb7185;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        --ink: #0f1720;
        --ink-soft: #1a2430;
        --steel: #8fa3b5;
        --mist: #243140;
        --paper: #0c1117;
        --line: #3a4d5f;
        --text: #f1f5f9;
        --muted: #b6c5d4;
        --surface: #18222d;
        --topbar-bg: rgba(12, 17, 23, 0.94);
        --btn-solid-hover: #1b2836;
        --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
        --teal: #2dd4bf;
        --teal-bright: #5eead4;
        --amber: #fbbf24;
        --rose: #fb7185;
        color-scheme: dark;
    }
}

html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .kanban-col,
html[data-theme="dark"] .comment-box,
html[data-theme="dark"] .gantt-edit-panel,
html[data-theme="dark"] .security-box,
html[data-theme="dark"] .security-qr,
html[data-theme="dark"] .theme-option {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

html[data-theme="dark"] .task-card {
    --task-bg: var(--surface);
    --task-ink: var(--text);
    --task-muted: var(--muted);
    --task-border: var(--line);
}

html[data-theme="dark"] .btn-ghost {
    color: var(--text);
    border-color: var(--line);
}
html[data-theme="dark"] .btn-ghost:hover {
    background: var(--mist);
    color: var(--text);
}

html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td {
    border-color: var(--line);
    color: var(--text);
}
html[data-theme="dark"] .table th {
    color: var(--muted);
}

html[data-theme="dark"] .badge-low { background: #0c4a6e; color: #bae6fd; }
html[data-theme="dark"] .badge-medium { background: #78350f; color: #fde68a; }
html[data-theme="dark"] .badge-high,
html[data-theme="dark"] .badge-urgent { background: #7f1d1d; color: #fecaca; }

html[data-theme="dark"] .alert-error {
    background: #3f1219;
    border-color: #7f1d1d;
    color: #fecdd3;
}
html[data-theme="dark"] .alert-success {
    background: #0f2e28;
    border-color: #115e59;
    color: #99f6e4;
}

html[data-theme="dark"] .gantt-day.is-weekend,
html[data-theme="dark"] .gantt-grid-col.is-weekend {
    background: rgba(148, 163, 184, 0.1);
}
html[data-theme="dark"] .gantt-frozen,
html[data-theme="dark"] .gantt-frozen--head {
    background: var(--mist);
}

html[data-theme="dark"] .sidebar .btn-ghost {
    color: #e8eef3;
    border-color: rgba(255, 255, 255, 0.25);
}
html[data-theme="dark"] .sidebar .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .modal-card,
    html[data-theme="system"] .task-card,
    html[data-theme="system"] .kanban-col,
    html[data-theme="system"] .comment-box,
    html[data-theme="system"] .gantt-edit-panel,
    html[data-theme="system"] .security-box,
    html[data-theme="system"] .security-qr,
    html[data-theme="system"] .theme-option {
        background: var(--surface);
        color: var(--text);
        border-color: var(--line);
    }

    html[data-theme="system"] .task-card {
        --task-bg: var(--surface);
        --task-ink: var(--text);
        --task-muted: var(--muted);
        --task-border: var(--line);
    }

    html[data-theme="system"] .btn-ghost {
        color: var(--text);
        border-color: var(--line);
    }
    html[data-theme="system"] .btn-ghost:hover {
        background: var(--mist);
        color: var(--text);
    }

    html[data-theme="system"] .table th,
    html[data-theme="system"] .table td {
        border-color: var(--line);
        color: var(--text);
    }
    html[data-theme="system"] .table th {
        color: var(--muted);
    }

    html[data-theme="system"] .badge-low { background: #0c4a6e; color: #bae6fd; }
    html[data-theme="system"] .badge-medium { background: #78350f; color: #fde68a; }
    html[data-theme="system"] .badge-high,
    html[data-theme="system"] .badge-urgent { background: #7f1d1d; color: #fecaca; }

    html[data-theme="system"] .alert-error {
        background: #3f1219;
        border-color: #7f1d1d;
        color: #fecdd3;
    }
    html[data-theme="system"] .alert-success {
        background: #0f2e28;
        border-color: #115e59;
        color: #99f6e4;
    }

    html[data-theme="system"] .gantt-day.is-weekend,
    html[data-theme="system"] .gantt-grid-col.is-weekend {
        background: rgba(148, 163, 184, 0.1);
    }
    html[data-theme="system"] .gantt-frozen,
    html[data-theme="system"] .gantt-frozen--head {
        background: var(--mist);
    }

    html[data-theme="system"] .sidebar .btn-ghost {
        color: #e8eef3;
        border-color: rgba(255, 255, 255, 0.25);
    }
    html[data-theme="system"] .sidebar .btn-ghost:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }
}

