﻿/* =============================================================
   MIS — design tokens
   Brand palette: deep sea-green (climate) + oral accent.
   If the logo hexes differ, change ONLY this block.
   ============================================================= */
:root {
    /* brand */
    --pine-950: #0B3138;      /* sidebar / hero gradient dark end */
    --pine-900: #0E3A40;      /* sidebar base */
    --pine-700: #17555C;      /* hero gradient light end, hovers */
    --pine-100: #DCE9E6;      /* muted text on dark */
    --accent:   #FD6262;      /* coral */
    --accent-dark: #E14F4F;

    /* neutrals */
    --bg: #F6F8F7;
    --surface: #ffffff;
    --ink: #22313A;
    --ink-soft: #5F6F76;
    --line: #E3E9E7;

    /* Task.Status colors */
    --c-backlog: #8A97A5;
    --c-in_progress: #2A7DE1;
    --c-waiting: #D99A06;
    --c-in_review: #7A5FD0;
    --c-done: #2E9E5B;
    --c-cancel: #B3BCC5;

    --sidebar-w: 250px;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(14, 58, 64, 0.06), 0 4px 14px rgba(14, 58, 64, 0.06);
}

/* Dark mode — data-theme is stamped on <html> before first paint */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0F1B1E;
    --surface: #16262B;
    --ink: #E4EEEC;
    --ink-soft: #93A8A6;
    --line: #24383D;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.30);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Thai", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--pine-700); text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------- App shell: sidebar + content ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--pine-900), var(--pine-950));
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    transition: width 0.18s ease;
}

/* collapsed (mini) state — toggled from the navbar hamburger */
.app.sidebar-mini .sidebar { width: 68px; }
.app.sidebar-mini .brand-text,
.app.sidebar-mini .side-link-text,
.app.sidebar-mini .side-label { display: none; }
.app.sidebar-mini .brand { justify-content: center; padding-left: 8px; padding-right: 8px; }
.app.sidebar-mini .side-link { justify-content: center; padding: 11px; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 22px;
    color: #fff;
}
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; }
.brand-mark {
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 14px;
}
.brand-text { font-size: 12px; line-height: 1.3; color: var(--pine-100); }

.side-nav { display: flex; flex-direction: column; padding: 0 12px; flex: 1; }
.side-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    padding: 6px 10px;
}
.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--pine-100);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
}
.side-icon { flex-shrink: 0; }
.side-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}
.side-link.is-active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ---------- Main column: navbar + page ---------- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 58px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.topbar-spacer { flex: 1; }

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--ink-soft);
    cursor: pointer;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* theme toggle: moon in light mode, sun in dark mode */
#themeToggle .icon-sun { display: none; }
:root[data-theme="dark"] #themeToggle .icon-moon { display: none; }
:root[data-theme="dark"] #themeToggle .icon-sun { display: block; }

/* ---------- User menu (top-right) ---------- */
.user-menu { position: relative; }
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border: none;
    border-radius: 10px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.user-menu-btn:hover { background: var(--bg); }
.user-menu-info { line-height: 1.25; }
.user-menu-info strong { display: block; font-size: 13.5px; color: var(--ink); }
.user-menu-info small { display: block; font-size: 11.5px; color: var(--ink-soft); }
.chevron { color: var(--ink-soft); transition: transform 0.15s; }
.user-menu.is-open .chevron { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 230px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(14, 58, 64, 0.16);
    display: none;
    z-index: 60;
}
.user-menu.is-open .user-dropdown { display: block; }
.user-dropdown-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}
.user-dropdown-head strong { display: block; font-size: 13.5px; }
.user-dropdown-head small { color: var(--ink-soft); font-size: 12px; }
.user-dropdown-form { margin: 0; }
.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 7px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}
.user-dropdown-item:hover { background: var(--bg); text-decoration: none; }
.user-dropdown-item.is-danger { color: var(--accent-dark); }

/* ---------- Content area ---------- */
.page {
    flex: 1;
    padding: 28px 32px 60px;
    max-width: 1120px;
}
.page-full { max-width: none; }
.app-public .page {
    max-width: none;
    padding: 0;
}

.page-title { margin: 0 0 4px; font-size: 24px; }
.page-subtitle { margin: 0 0 32px; color: var(--ink-soft); }

.section { margin-bottom: 32px; }
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
    margin: 0 0 12px;
}
.section-title svg { flex-shrink: 0; }
/* Children keep no bottom margin of their own (they stretch to equal
   height instead), so the row carries the spacing below itself. */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}
.stat-number { font-size: 26px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--ink-soft); }

.stat-backlog     { border-top-color: var(--c-backlog); }
.stat-in_progress { border-top-color: var(--c-in_progress); }
.stat-waiting     { border-top-color: var(--c-waiting); }
.stat-in_review   { border-top-color: var(--c-in_review); }
.stat-done        { border-top-color: var(--c-done); }
.stat-cancel      { border-top-color: var(--c-cancel); }

.stat-all      { border-top-color: var(--c-in_progress); }  /* blue */
.stat-active   { border-top-color: var(--c-done); }         /* green */
.stat-invited  { border-top-color: var(--c-waiting); }      /* amber */
.stat-inactive { border-top-color: var(--c-backlog); }      /* grey */

/* ---------- Lists ---------- */
.item-list {
    list-style: none;
    margin: 0; padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: none; }
.item-title { display: block; font-weight: 600; }
.item-meta { display: block; font-size: 12.5px; color: var(--ink-soft); }
.item-date { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.item-date.is-today { color: var(--accent-dark); font-weight: 600; }

.empty {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 20px;
    color: var(--ink-soft);
    text-align: center;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
}
.badge-backlog     { background: var(--c-backlog); }
.badge-in_progress { background: var(--c-in_progress); }
.badge-waiting     { background: var(--c-waiting); }
.badge-in_review   { background: var(--c-in_review); }
.badge-done        { background: var(--c-done); }
.badge-cancel      { background: var(--c-cancel); }

/* ---------- Buttons & fields ---------- */
.btn {
    /* Transparent border (not none) so every variant is the same
       height as .btn-ghost, which carries a real 1px border. */
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    /* Center inline icons with the label instead of baseline-riding. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.field { margin-bottom: 14px; }
.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
}
.field input::placeholder { color: #9AA8AE; }
.field input:focus {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}
.errorlist { color: var(--accent-dark); font-size: 12.5px; margin: 4px 0 0; padding-left: 18px; }

/* ---------- Auth (dark hero) ----------
   Same deep-sea-green brand as the app shell; coral stays the accent. */
.auth-hero {
    --auth-bg-0: #07191D;
    --auth-bg-1: var(--pine-900);
    --auth-card: #0F2E34;
    --auth-line: rgba(255, 255, 255, 0.10);
    --auth-field: #0A2227;
    --auth-text: #EAF2F1;
    --auth-muted: #8FA9A7;
    --auth-accent: var(--accent);
    --auth-accent-dark: var(--accent-dark);

    min-height: 100vh;
    background:
        radial-gradient(900px 600px at 50% 0%, rgba(23, 85, 92, 0.45), transparent 65%),
        linear-gradient(160deg, var(--auth-bg-1) 0%, var(--auth-bg-0) 75%);
    color: var(--auth-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 7vh 20px 60px;
}
.auth-brand { text-align: center; margin-bottom: 34px; }
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px; height: 84px;
    border-radius: 50%;
    background: #fff;
    color: var(--pine-900);
    font-weight: 800;
    font-size: 24px;
    letter-spacing: 0.05em;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.auth-app-name {
    color: #fff;
    font-size: 24px;
    margin: 18px 0 0;
    letter-spacing: 0.02em;
}
.auth-logo-img {
    max-height: 96px;
    max-width: 260px;
    filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.35));
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--auth-card);
    border: 1px solid var(--auth-line);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    padding: 32px 36px 36px;
}
.auth-card-title {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}
.auth-card-subtitle {
    margin: 0 0 24px;
    font-size: 14px;
    color: var(--auth-muted);
}

/* dark-theme overrides for the shared .field styles */
.auth-card .field { margin-bottom: 18px; }
.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    color: var(--auth-text);
}
.auth-card .field input[type="text"],
.auth-card .field input[type="email"],
.auth-card .field input[type="password"] {
    background: var(--auth-field);
    border: 1px solid var(--auth-line);
    color: var(--auth-text);
    caret-color: var(--auth-accent);
}
.auth-card .field input::placeholder { color: #5E7A78; }
.auth-card .field input:focus {
    outline: none;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 1px var(--auth-accent);
}

.field-password { position: relative; }
.field-password input { padding-right: 46px; }
/* Edge/IE inject their own reveal button; we ship ours */
.field-password input::-ms-reveal { display: none; }
/* icon swap driven by .is-showing (hidden attr is unreliable on <svg>) */
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-showing .icon-eye { display: none; }
.password-toggle.is-showing .icon-eye-off { display: block; }
.password-toggle {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--auth-muted);
}
.password-toggle:hover { color: var(--auth-text); }

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 22px;
}
.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--auth-text);
    cursor: pointer;
}
.auth-remember input {
    width: 16px; height: 16px;
    accent-color: var(--auth-accent);
    cursor: pointer;
}
.auth-forgot { font-size: 14px; font-weight: 600; color: var(--auth-accent); }
.auth-forgot:hover { color: var(--auth-accent-dark); }

.auth-card .btn-primary {
    background: var(--auth-accent);
    padding: 12px 18px;
    font-size: 15px;
}
.auth-card .btn-primary:hover { background: var(--auth-accent-dark); }
.btn-block { display: block; width: 100%; }

/* ---------- First-run setup ---------- */
.setup-card { max-width: 560px; }
.field-help {
    display: block;
    margin-top: 5px;
    font-size: 12.5px;
    color: var(--auth-muted);
}
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.auth-card .field input[type="color"] {
    width: 100%;
    height: 46px;
    padding: 4px;
    background: var(--auth-field);
    border: 1px solid var(--auth-line);
    border-radius: 8px;
    cursor: pointer;
}
.auth-card .field input[type="file"] {
    width: 100%;
    color: var(--auth-muted);
    font-size: 14px;
}
.setup-section {
    margin: 26px 0 16px;
    padding-top: 20px;
    border-top: 1px solid var(--auth-line);
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--auth-muted);
}
.auth-card .errorlist {
    list-style: none;
    margin: 5px 0 0;
    padding: 0;
    color: #FF8A80;
    font-size: 12.5px;
}

/* ---------- In-app form card (light theme, e.g. company settings) ---------- */
.form-card {
    max-width: 560px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.form-card.is-full { max-width: none; padding: 28px 32px; }
.form-card .field-label { color: var(--ink); }
.form-card .field-help { color: var(--ink-soft); }
.form-card input[type="color"] {
    width: 100%;
    height: 44px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}
.form-card input[type="file"] { width: 100%; font-size: 14px; color: var(--ink-soft); }

/* logo row: thumbnail + file picker + remove checkbox in one line */
.logo-field { display: flex; align-items: center; gap: 16px; }
.logo-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.logo-field input[type="file"] { flex: 1; }
.logo-clear {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    color: var(--ink-soft);
    white-space: nowrap;
    cursor: pointer;
}
.logo-clear:hover { color: var(--ink); }
.logo-clear input[type="checkbox"] {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.form-card .btn-primary { margin-top: 6px; }

/* ---------- Messages ----------
   .message = inline notice inside a form/modal (e.g. non-field errors).
   Flash messages use the same tones but render as .toast (see below). */
.message { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
.message-success, .toast-success { background: #E2F4E8; color: #1E6B3D; }
.message-error,   .toast-error   { background: #FBE9E7; color: #B03A2E; }
.message-info,    .toast-info    { background: #E8F1FB; color: #1B4F8A; }
:root[data-theme="dark"] .message-success, :root[data-theme="dark"] .toast-success { background: #123120; color: #7FD8A4; }
:root[data-theme="dark"] .message-error,   :root[data-theme="dark"] .toast-error   { background: #3A1815; color: #FF9C93; }
:root[data-theme="dark"] .message-info,    :root[data-theme="dark"] .toast-info    { background: #122A3E; color: #8FC2F2; }

/* ---------- Toast notifications (bottom-right corner) ---------- */
.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    /* Above the modal overlay (200): a flash must never hide behind it. */
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 40px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(14, 58, 64, 0.22);
    font-size: 14px;
    animation: toast-in 0.25s ease;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.toast.is-hiding { opacity: 0; transform: translateX(24px); }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: none; }
}
.toast-text { flex: 1; }
.toast-close {
    border: none;
    background: none;
    color: inherit;
    opacity: 0.6;
    padding: 2px;
    margin-top: 1px;
    cursor: pointer;
    line-height: 0;
}
.toast-close:hover { opacity: 1; }

/* ---------- Busy form (e.g. invite modal) ----------
   hx-disabled-elt="find fieldset" locks all fields and buttons while the
   POST is in flight; htmx puts .htmx-request on the form for the duration,
   which shows the spinner inside the submit button. */
.form-fieldset { border: 0; margin: 0; padding: 0; min-inline-size: auto; }
.form-fieldset:disabled { opacity: 0.65; }
.btn-busy { display: inline-flex; align-items: center; gap: 8px; }
.btn-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.htmx-request .btn-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
    /* sidebar overlays the content; the hamburger shows/hides it */
    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; }
    .app.sidebar-mini .sidebar { width: 0; }
    .user-menu-info { display: none; }
    .page { padding: 20px 16px 48px; }
}

/* ---------- Data table ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.data-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
}
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
/* ---------- Table row actions ---------- */
.row-action {
    display: inline-flex;
    padding: 6px;
    border-radius: 7px;
    color: var(--ink-soft);
}
.row-action:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
/* Same look when the action is a POST and sits on a <button>. */
button.row-action { border: 0; background: none; cursor: pointer; font: inherit; }

/* ---------- Modal (shared shell in base.html) ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 8vh 16px 40px;
    background: rgba(6, 20, 24, 0.55);
    overflow-y: auto;
}
.modal-overlay.is-open { display: flex; }

.modal-panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal-close { position: absolute; top: 12px; right: 12px; }

.modal-head {
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--line);
    padding-right: 48px; /* keep clear of the close button */
}
.modal-title { margin: 0; font-size: 18px; }
.modal-subtitle { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }

.modal-form { padding: 20px 24px 24px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}
.btn-ghost:hover { background: var(--bg); }

/* select styled to match .field inputs (e.g. the Role dropdown) */
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
}

/* labelled checkbox row (e.g. "Active account") */
.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin-top: 4px;
}
.check-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    accent-color: var(--accent);
    cursor: pointer;
}
.check-row small { display: block; color: var(--ink-soft); }

/* ---------- Danger actions (delete) ---------- */
:root { --danger: #D64545; --danger-dark: #B93A3A; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
/* Delete icons read as red at rest so they never blend with edit. */
.row-action-danger { color: var(--danger); }
.row-action-danger:hover { background: rgba(214, 69, 69, 0.12); color: var(--danger); }

/* Whole-row navigation (.row-click with data-href / data-preview-url). */
.row-click { cursor: pointer; }
.data-table tbody .row-click:hover td { background: var(--bg); }
.item-list .row-click:hover { background: var(--bg); }

/* Type icon next to a document name — same accent as folder icons. */
.link-icon { color: var(--accent); flex: none; vertical-align: -2px; }

.confirm-text { margin: 0 0 8px; }
.confirm-warn { margin: 0; color: var(--ink-soft); font-size: 13.5px; }

/* ---------- Page header row (title + primary action) ---------- */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head .page-title { margin: 0; }

/* ---------- Holidays ---------- */
.page-head-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Add + Import left, period switcher centre, view tabs right. */
.holiday-toolbar { align-items: center; }

/* The toolbar's Add button sits beside Import, so it borrows the same
   height as .view-tabs to keep the whole row level. */
.btn-toolbar {
    display: inline-flex;
    align-items: center;
    height: 42px;
}

/* Import lives beside the view tabs, so it needs its own colour to read as
   an action rather than a third tab. Green, not the coral --accent, which
   is already the primary/destructive tone. */
.btn-import {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    /* Match .view-tabs: 3px padding + 7px tab padding + border. */
    height: 42px;
    background: var(--c-done);
    color: #fff;
}
.btn-import:hover { background: color-mix(in srgb, var(--c-done) 85%, black); }

/* List / Calendar switch */
.view-tabs {
    display: inline-flex;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
}
.view-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-soft);
}
.view-tab:hover { color: var(--ink); text-decoration: none; }
.view-tab.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}
/* Tabs rendered as <button> (client-side switching) look identical to
   the <a> tabs on the Holidays page. */
button.view-tab {
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
}

.year-switch { display: flex; align-items: center; gap: 6px; }
.year-switch .btn-ghost { padding: 6px 12px; font-size: 18px; line-height: 1; }
.year-current { font-size: 18px; font-weight: 700; min-width: 62px; text-align: center; }

/* ---------- Holidays: CSV / Excel import (shared modal) ---------- */
.import-help { margin: 0 0 14px; font-size: 13px; color: var(--ink-soft); }
.import-help code {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12.5px;
}
#holiday-import input[type="file"] {
    width: 100%;
    font-size: 14px;
    color: var(--ink-soft);
}
.import-sample {
    margin-top: 4px;
    border-collapse: collapse;
    font-size: 12.5px;
    color: var(--ink-soft);
}
.import-sample th, .import-sample td {
    border: 1px solid var(--line);
    padding: 4px 10px;
    text-align: left;
}
.import-sample th { background: var(--bg); font-weight: 600; }

/* Quick-add modal: what the clicked day already holds */
.already-on-day {
    margin: 0 24px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
}
.already-on-day small { color: var(--ink-soft); font-size: 12px; }
.already-on-day ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.already-on-day em { color: var(--ink-soft); font-style: normal; }

/* Built-in Thai public holiday list, below the upload form in the modal */
.preset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 24px 24px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
}
.preset-title { display: block; font-size: 13.5px; }
.preset-help { display: block; font-size: 12px; color: var(--ink-soft); }

/* ---------- Holidays: calendar view ---------- */
.month-switch { display: flex; align-items: center; gap: 6px; }
.month-switch .btn-ghost { padding: 6px 12px; font-size: 18px; line-height: 1; }
.month-current {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    min-width: 170px;
    text-align: center;
}
.month-switch .month-today {
    font-size: 13.5px;
    padding: 8px 14px;
    margin-left: 6px;
}

/* One big month grid: 7 columns of equal width, one row per week. */
.cal-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
/* minmax(0,1fr): without the 0 floor a long holiday name would widen its
   own column and knock the seven days out of alignment. */
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head-cell {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
}
.cal-week { border-bottom: 1px solid var(--line); }
.cal-body .cal-week:last-child { border-bottom: none; }

.cal-cell {
    position: relative;
    /* min-, not fixed: a day with several holidays grows and takes the
       whole week row with it. */
    min-height: 108px;
    padding: 6px 8px 8px;
    border-right: 1px solid var(--line);
}
/* Second and later chips on the same day sit closer together. */
.cal-event + .cal-event { margin-top: 4px; }

/* A multi-day holiday repeats in each day it covers. Squaring the inner
   edges and bleeding into the cell padding makes the run read as one
   continuous bar across the week. */
.cal-event.is-span {
    border-radius: 0;
    border-left: 0;
    margin-left: -8px;
    margin-right: -8px;
}
.cal-event.is-span .cal-event-open { padding-left: 8px; padding-right: 8px; }
.cal-event.is-span-start {
    border-top-left-radius: 7px;
    border-bottom-left-radius: 7px;
    border-left: 3px solid var(--evt, var(--accent));
    margin-left: 0;
}
.cal-event.is-span-end {
    border-top-right-radius: 7px;
    border-bottom-right-radius: 7px;
    margin-right: 0;
}
/* Continuation days keep the bar's height without repeating the text. */
.cal-event-name.is-continued { visibility: hidden; }
.cal-cell:last-child { border-right: none; }
/* Days spilling in from the neighbouring month stay visible but recede. */
.cal-cell.is-outside { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.cal-cell.is-outside .cal-date { color: var(--ink-soft); opacity: 0.65; }
.cal-cell.is-weekend:not(.is-outside) {
    background: color-mix(in srgb, var(--bg) 45%, transparent);
}

.cal-cell-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;   /* date right, + button left */
    gap: 6px;
    min-height: 24px;
}
.cal-date { font-size: 13.5px; color: var(--ink); }
.cal-date.is-today {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 8px;
}

/* The + only appears on hover, like the reference design. */
.cal-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: var(--bg);
    color: var(--ink-soft);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--accent); color: #fff; }
.cal-add:focus-visible { opacity: 1; outline: 2px solid var(--pine-700); }

/* Event/holiday chip inside a day cell. --evt is the tone; the Calendar
   page's category classes override it, Holidays keeps the accent default. */
.cal-event {
    position: relative;
    margin-top: 6px;
    border-radius: 7px;
    background: color-mix(in srgb, var(--evt, var(--accent)) 16%, transparent);
    border-left: 3px solid var(--evt, var(--accent));
    cursor: grab;
}
.cal-event:active { cursor: grabbing; }
.cal-event.is-dragging { opacity: 0.4; }
/* The whole chip is the click target that opens the edit modal. */
.cal-event-open {
    display: block;
    width: 100%;
    padding: 6px 20px 6px 8px;   /* room for the ✕ */
    border: 0;
    border-radius: 7px;
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.cal-event-open:hover { background: color-mix(in srgb, var(--evt, var(--accent)) 10%, transparent); }
.cal-event-open:focus-visible { outline: 2px solid var(--pine-700); }
.cal-event-name {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event-note {
    display: block;
    font-size: 11px;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Where the card would land while dragging */
.cal-cell.is-drop-target {
    background: color-mix(in srgb, var(--pine-700) 16%, transparent);
    box-shadow: inset 0 0 0 2px var(--pine-700);
}
/* Fixed size, or a narrow card lets this stretch over the whole chip and
   swallow the click that should open the edit modal. */
.cal-event-del {
    position: absolute;
    top: 3px;
    right: 3px;
    margin: 0;
    width: 17px;
    height: 17px;
    line-height: 0;
}
.cal-event-del button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--ink-soft);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
}
.cal-event:hover .cal-event-del button { opacity: 1; }
.cal-event-del button:hover { background: rgba(214, 69, 69, 0.16); color: var(--danger); }

/* ---------- Calendar page: event categories + holiday layer ---------- */
.evt-meeting  { --evt: var(--c-in_progress); }
.evt-workshop { --evt: var(--c-done); }
.evt-social   { --evt: var(--c-in_review); }
.evt-deadline { --evt: var(--accent); }
.evt-other    { --evt: var(--c-backlog); }
.evt-holiday  { --evt: var(--c-waiting); }

/* Holidays are read-only on the Calendar page. */
.cal-event.is-static, .cal-event.is-static .cal-event-open { cursor: default; }

.cal-event-time {
    font-weight: 700;
    color: var(--evt, var(--accent));
    margin-right: 3px;
}

/* Legend chips double as filters (JS in calendar.html): none picked =
   show all; picked ones highlight and the rest of the grid hides. */
.cal-legend { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 0;
    border-radius: 7px;
    background: none;
    font: inherit;
    font-size: 12px;
    color: var(--ink-soft);
    cursor: pointer;
}
.cal-legend-item:hover { background: var(--bg); color: var(--ink); }
.cal-legend-item i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--evt, var(--accent));
}
.cal-legend.is-filtering .cal-legend-item { opacity: 0.45; }
.cal-legend.is-filtering .cal-legend-item.is-active {
    opacity: 1;
    background: color-mix(in srgb, var(--evt, var(--accent)) 14%, transparent);
    color: var(--ink);
}
.cal-event.is-filtered-out { display: none; }

/* ---------- Dashboard: org overview + upcoming events ---------- */
/* Small category dot in front of an event name (colour from .evt-*). */
.evt-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    margin-right: 2px;
    background: var(--evt, var(--accent));
}
/* Quiet link on the right edge of a section title. */
.section-title .section-link {
    margin-left: auto;
    text-transform: none;
    letter-spacing: normal;
    font-size: 12.5px;
    font-weight: 600;
}
/* Progress cell in the health table. */
.ovh-progress { display: flex; align-items: center; gap: 8px; }
.ovh-progress .pcard-bar { width: 90px; flex: none; }
/* Team workload rows: avatar, name, bar, open count. */
.wl-list { list-style: none; margin: 0; padding: 0; }
.wl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
.wl-row:last-child { border-bottom: none; }
.wl-name {
    flex: 0 0 130px;
    font-size: 13.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wl-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--bg);
    overflow: hidden;
}
.wl-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--c-in_progress);
}
.wl-count { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
/* Quiet rule between the org zone and the personal zone. */
.zone-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 4px 0 32px;
}
/* Section title sitting inside the tabs row loses its own bottom margin. */
.tasks-tabs-row .section-title { margin: 0; }
/* Cross-project board card: the project the task belongs to. */
.task-project {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-project:hover { color: var(--pine-700); }
/* Stacked status stripe in the health table (one stripe per status). */
.stack-bar {
    display: flex;
    width: 90px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg);
    flex: none;
}
.stack-seg { display: block; height: 100%; }
/* Tasks-by-status donut: circle strokes on a circumference-100 ring. */
.donut-wrap { display: flex; align-items: center; gap: 24px; padding: 4px 0; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-total {
    font-size: 9px;
    font-weight: 700;
    fill: var(--ink);
    text-anchor: middle;
    dominant-baseline: middle;
}
.donut-sub {
    font-size: 3.2px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: var(--ink-soft);
    text-anchor: middle;
}
.donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13px;
    color: var(--ink-soft);
}
.donut-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 7px;
}
.donut-legend b { color: var(--ink); font-weight: 700; }

/* Hover previews a status, click pins it (JS in my_dashboard.html):
   the chosen status keeps its colour everywhere, the rest dim out. */
.donut-seg { cursor: pointer; transition: opacity 0.15s ease, stroke-width 0.15s ease; }
.donut-seg.is-dim { opacity: 0.22; }
.donut-seg.is-focus { stroke-width: 6.5; }
.stack-seg { transition: opacity 0.15s ease; }
.stack-seg.is-dim { opacity: 0.18; }
.donut-legend li {
    cursor: pointer;
    padding: 3px 8px;
    margin: -3px -8px;
    border-radius: 6px;
    transition: opacity 0.15s ease;
}
.donut-legend li:hover { background: var(--bg); color: var(--ink); }
.donut-legend li.is-dim { opacity: 0.4; }
.donut-legend li.is-focus { background: var(--bg); color: var(--ink); }
.donut-legend li:focus-visible { outline: 2px solid var(--pine-700); }

/* Delete sits alone on the left of the modal footer, away from Save. */
.btn-delete-left { margin-right: auto; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-delete-left:hover { background: rgba(214, 69, 69, 0.10); }

/* ---------- Time dropdown (Google-Calendar style, _time_picker.html) ----------
   A plain text input; focusing it drops a scrollable list of 15-minute
   slots that narrows as you type. Free-form times are typed directly. */
.time-pick { position: relative; }
.tp-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 210px;
    overflow-y: auto;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: 0 8px 30px rgba(14, 58, 64, 0.16);
    z-index: 30;
}
.tp-item {
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.tp-item:hover { background: var(--bg); }
.tp-item.is-selected {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    font-weight: 600;
}

@media (max-width: 900px) {
    .cal-cell { min-height: 84px; padding: 4px 5px 6px; }
    .cal-head-cell { padding: 8px 6px; font-size: 11px; }
    .cal-event { padding: 4px 6px; }
    .cal-event-name { font-size: 11.5px; }
    .cal-event-note { display: none; }
    /* Touch screens have no hover, so keep the + visible. */
    .cal-add { opacity: 1; }
    .month-current { min-width: 0; font-size: 17px; }
}

/* Delete is a POST, so .row-action sits on a <button> here */
.row-form { display: inline; margin: 0; }
.row-form .row-action {
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
}

.data-table td.is-past { color: var(--ink-soft); }

/* ---------- Projects list ---------- */
.project-link { font-weight: 600; color: var(--ink); }
.project-link:hover { color: var(--pine-700); }
.project-desc { color: var(--ink-soft); font-size: 13.5px; }
.project-milestone-name { color: var(--ink-soft); font-size: 13px; }

/* textarea styled to match .field inputs (project/task descriptions) */
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    resize: vertical;
}
.field textarea::placeholder { color: #9AA8AE; }
.field textarea:focus {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}

/* ---------- Project detail: task board ---------- */
.board-breadcrumb { margin: 0 0 16px; font-size: 13px; color: var(--ink-soft); }
.board-subtitle { margin: 2px 0 0; max-width: 720px; }

/* The board never wraps; on narrow screens it scrolls sideways instead. */
.board-wrap { overflow-x: auto; padding-bottom: 8px; }
.board {
    display: grid;
    grid-template-columns: repeat(6, minmax(210px, 1fr));
    gap: 12px;
    align-items: start;
    min-width: 1340px;
}

.board-col {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.col-backlog     { border-top-color: var(--c-backlog); }
.col-in_progress { border-top-color: var(--c-in_progress); }
.col-waiting     { border-top-color: var(--c-waiting); }
.col-in_review   { border-top-color: var(--c-in_review); }
.col-done        { border-top-color: var(--c-done); }
.col-cancel      { border-top-color: var(--c-cancel); }

.board-col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}
.board-col-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
}
.board-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--bg);
    border-radius: 999px;
    padding: 1px 8px;
}
.board-add {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}
.board-add:hover { background: var(--accent); color: #fff; }

.board-col-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    min-height: 60px;
}
.board-empty {
    margin: 8px 0;
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
}

.task-card {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 12px;
    background: var(--bg);
}
.task-open {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}
.task-open:hover { color: var(--pine-700); }
.task-name { display: block; font-weight: 600; }

.task-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
}
.task-prio {
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 600;
    color: #fff;
}
.prio-low    { background: var(--c-backlog); }
.prio-medium { background: var(--c-waiting); }
.prio-high   { background: var(--danger); }

.task-due {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--ink-soft);
}
.task-due.is-overdue { color: var(--danger); font-weight: 700; }
.task-gh { display: inline-flex; color: var(--ink-soft); }
.task-gh:hover { color: var(--ink); }

.task-assignee {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.task-avatar { width: 22px; height: 22px; font-size: 10px; }
.task-assignee-name { font-size: 12.5px; color: var(--ink-soft); }

/* ---------- Dashboard ---------- */
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-overdue { border-top-color: var(--danger); }
.dash-overdue { color: var(--danger); font-weight: 700; }
.item-title:hover { color: var(--pine-700); }

/* ---------- Project gallery cards (Notion-style) ---------- */
.pcard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.pcard {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color 0.12s, transform 0.12s;
}
.pcard:hover { border-color: var(--pine-700); transform: translateY(-2px); }
.pcard-main { display: block; color: var(--ink); }
.pcard-main:hover { text-decoration: none; color: var(--ink); }
.pcard-cover { display: block; height: 84px; }
.pcard-cover.cover-backlog {
    background: linear-gradient(135deg, color-mix(in srgb, var(--c-backlog) 22%, var(--bg)), var(--bg));
}
.pcard-cover.cover-in_progress {
    background: linear-gradient(135deg, color-mix(in srgb, var(--c-in_progress) 22%, var(--bg)), var(--bg));
}
.pcard-cover.cover-done {
    background: linear-gradient(135deg, color-mix(in srgb, var(--c-done) 22%, var(--bg)), var(--bg));
}
.pcard-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
}
.pcard-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15.5px;
}
.pcard-icon { color: var(--pine-700); flex-shrink: 0; }
.pcard-status { display: flex; }
.pcard-progress { display: flex; align-items: center; gap: 10px; }
.pcard-pct { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); min-width: 38px; }
.pcard-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}
.pcard-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--c-done);
}
.pcard-count { font-size: 13px; color: var(--ink-soft); }
.pcard-dates { font-size: 12.5px; color: var(--ink-soft); }
.pcard-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.12s;
}
.pcard:hover .pcard-actions, .pcard-actions:focus-within { opacity: 1; }
.pcard-actions .row-action { background: var(--surface); box-shadow: var(--shadow); }
.project-desc-line { display: block; }

/* ---------- Project timeline view ---------- */
.tl-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.tl { min-width: 760px; }
.tl-months { display: flex; border-bottom: 1px solid var(--line); }
.tl-month {
    padding: 8px 0;
    text-align: center;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    border-right: 1px solid var(--line);
    overflow: hidden;
    white-space: nowrap;
}
.tl-month:last-child { border-right: none; }
.tl-body { position: relative; padding: 10px 0 14px; }
.tl-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--line);
}
.tl-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    z-index: 2;
}
.tl-group {
    position: relative;
    z-index: 1;
    padding: 10px 14px 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
}
.tl-group-due { font-weight: 400; text-transform: none; letter-spacing: 0; }
.tl-row { position: relative; height: 30px; }
.tl-bar {
    position: absolute;
    top: 3px;
    height: 24px;
    display: flex;
    align-items: center;
    border: none;
    border-radius: 6px;
    padding: 0 8px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    z-index: 1;
}
div.tl-bar { cursor: default; }
.tl-bar:hover { filter: brightness(1.08); }
.bar-backlog     { background: var(--c-backlog); }
.bar-in_progress { background: var(--c-in_progress); }
.bar-waiting     { background: var(--c-waiting); }
.bar-in_review   { background: var(--c-in_review); }
.bar-done        { background: var(--c-done); }
.bar-cancel      { background: var(--c-cancel); }
.tl-bar.is-overdue { outline: 2px solid var(--danger); outline-offset: -1px; }
.tl-bar-label { overflow: visible; }
.tl-undated-title {
    margin: 20px 0 10px;
    font-size: 14px;
    color: var(--ink-soft);
}

/* ---------- Section head with an action button (Milestones/Sprints) ---------- */
.sub-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.sub-head .section-title { margin: 0; }

/* ---------- Project meta chips + assignee avatar stacks ---------- */
.proj-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.proj-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
}
a.proj-chip:hover { color: var(--pine-700); border-color: var(--pine-700); text-decoration: none; }

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-sm {
    width: 26px;
    height: 26px;
    font-size: 10.5px;
    border: 2px solid var(--surface);
}
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.avatar-more { background: var(--ink-soft); }
/* Dashed "+" beside the team stack: admins jump to the project form,
   where the team is actually managed. Text shows only when no team yet. */
.avatar-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    margin-left: 4px;
    border: 1.5px dashed var(--ink-soft);
    border-radius: 999px;
    background: none;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.avatar-add:hover {
    border-style: solid;
    border-color: var(--accent);
    color: var(--accent);
}

/* multi-checkbox list in modal forms (e.g. Assigned to) */
.check-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--surface);
}
.check-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 14px;
    cursor: pointer;
}
.check-list input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---------- Project icon images ---------- */
.pcard-icon-img {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}
.project-link-row { display: inline-flex; align-items: center; gap: 8px; }
.proj-title-row { display: flex; align-items: center; gap: 12px; }
.proj-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--line);
}

/* ---------- Notion-style assignee picker (chips + search) ---------- */
.assignee-picker { position: relative; }
.ap-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: text;
}
.ap-box:focus-within {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}
.ap-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px 2px 2px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
}
.ap-chip .avatar { width: 20px; height: 20px; font-size: 9px; border: none; }
.ap-x {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1;
    padding: 0 3px;
}
.ap-x:hover { color: var(--danger); }
.ap-input {
    flex: 1;
    min-width: 130px;
    border: none;
    outline: none;
    background: none;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    padding: 3px 2px;
}
.ap-input::placeholder { color: #9AA8AE; }
.ap-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(14, 58, 64, 0.16);
    padding: 6px;
}
.ap-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 7px;
    background: none;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.ap-item:hover { background: var(--bg); }
.ap-item .avatar { width: 22px; height: 22px; font-size: 9.5px; border: none; }
.ap-empty { padding: 6px 8px; font-size: 13px; color: var(--ink-soft); }

/* ---------- Board card edit affordance ---------- */
.task-card { position: relative; }
.task-edit-corner {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    padding: 5px;
    border: none;
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
    box-shadow: var(--shadow);
}
.task-card:hover .task-edit-corner,
.task-edit-corner:focus-visible { opacity: 1; }
.task-edit-corner:hover { color: var(--pine-700); }
.task-card .task-open { padding-right: 24px; }

/* Icon upload in the modal reuses the Settings logo-field look; let it
   wrap on the narrower panel instead of squeezing the file box. */
.modal-form .logo-field { flex-wrap: wrap; }
.modal-form .logo-field input[type="file"] { flex: 1; min-width: 200px; }

/* Long modals scroll inside the panel, not the page overlay */
.modal-panel { max-height: 86vh; overflow-y: auto; }

/* ---------- Add-button + view-tabs row under each section title ---------- */
.tasks-tabs-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
/* Tabs hug the right edge whether or not the Add button is rendered. */
.tasks-tabs-row .view-tabs { margin-left: auto; }

/* ---------- Board drag & drop ---------- */
.task-card[draggable] { cursor: grab; }
.task-card[draggable]:active { cursor: grabbing; }
.task-card.is-dragging { opacity: 0.4; }
.board-col-body.is-drop-target {
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 7%, transparent);
}

/* ---------- Timeline drag (shift dates) ---------- */
.tl-bar[data-task] { cursor: grab; touch-action: none; }
.tl-bar.is-shifting { opacity: 0.75; cursor: grabbing; z-index: 3; }

/* ---------- vis-timeline theme (unified project timeline) ---------- */
.vis-wrap {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.vis-wrap .vis-timeline {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: inherit;
}
.vis-wrap .vis-panel.vis-center,
.vis-wrap .vis-panel.vis-left,
.vis-wrap .vis-panel.vis-right,
.vis-wrap .vis-panel.vis-top,
.vis-wrap .vis-panel.vis-bottom { border-color: var(--line); }
.vis-wrap .vis-time-axis .vis-text {
    color: var(--ink-soft);
    font-size: 11.5px;
}
.vis-wrap .vis-time-axis .vis-grid.vis-minor { border-color: var(--line); }
.vis-wrap .vis-time-axis .vis-grid.vis-major { border-color: var(--line); }
.vis-wrap .vis-time-axis .vis-grid.vis-saturday,
.vis-wrap .vis-time-axis .vis-grid.vis-sunday {
    background: color-mix(in srgb, var(--bg) 60%, transparent);
}
.vis-wrap .vis-labelset .vis-label {
    color: var(--ink);
    border-color: var(--line);
    font-size: 13px;
    font-weight: 600;
}
.vis-wrap .vis-labelset .vis-label .vis-inner { padding: 8px 14px; }
.vis-wrap .vis-foreground .vis-group { border-color: var(--line); }
.vis-wrap .vis-current-time { background-color: var(--accent); width: 2px; }

.vis-wrap .vis-item.vis-bar {
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
}
.vis-wrap .vis-item.vis-bar .vis-item-content { padding: 3px 10px; }
.vis-wrap .vis-item.bar-backlog     { background: var(--c-backlog); }
.vis-wrap .vis-item.bar-in_progress { background: var(--c-in_progress); }
.vis-wrap .vis-item.bar-waiting     { background: var(--c-waiting); }
.vis-wrap .vis-item.bar-in_review   { background: var(--c-in_review); }
.vis-wrap .vis-item.bar-done        { background: var(--c-done); }
.vis-wrap .vis-item.bar-cancel      { background: var(--c-cancel); }
.vis-wrap .vis-item.is-overdue { outline: 2px solid var(--danger); outline-offset: -1px; }
.vis-wrap .vis-item.vis-selected {
    box-shadow: 0 0 0 2px var(--accent);
    color: #fff;
}
.vis-wrap .vis-item .vis-drag-left,
.vis-wrap .vis-item .vis-drag-right { cursor: ew-resize; }

/* ---------- vis-timeline: milestone groups + sprint bands ---------- */
.vis-wrap .vis-labelset .vis-label .vis-inner {
    min-width: 150px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vis-wrap .vis-labelset .vis-label.vis-nesting-group {
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    font-weight: 700;
}
/* The collapse caret is a :before with no padding of its own; give it
   room so it never clips at the panel edge. */
.vis-wrap .vis-labelset .vis-label.vis-nesting-group:before {
    flex-shrink: 0;
    padding: 0 4px 0 10px;
    font-size: 10px;
    color: var(--ink-soft);
}
/* vis paints nested-group labels white/grey by default, which glows in
   dark mode — keep them on the app's own surface colors. */
.vis-wrap .vis-labelset .vis-label.vis-nested-group {
    background: transparent;
    font-weight: 500;
    font-size: 12.5px;
    color: var(--ink);
}
.vis-wrap .vis-labelset .vis-label.vis-nested-group .vis-inner { padding-left: 30px; }
.vis-wrap .vis-item.vis-background.vis-sprint-band {
    background: color-mix(in srgb, var(--c-done) 10%, transparent);
    border-left: 1px solid color-mix(in srgb, var(--c-done) 45%, transparent);
    border-right: 1px solid color-mix(in srgb, var(--c-done) 45%, transparent);
}
.vis-wrap .vis-item.vis-background.vis-sprint-band .vis-item-overflow {
    overflow: visible;
}
.vis-wrap .vis-sprint-band .vis-item-content {
    padding: 2px 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--c-done);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------- Project header: progress chip + team row ---------- */
.proj-progress .pcard-bar { width: 90px; flex: none; }
.proj-team {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}
.proj-team-label { font-size: 14px; font-weight: 700; }

/* ---------- Project detail: section rhythm & content sizing ----------
   .tasks-section opts any other page (e.g. the dashboard's My Tasks)
   into the same pane sizing as the project page. */
.page-project .section { margin-bottom: 52px; }
.page-project .section [data-pane],
.tasks-section [data-pane] {
    min-height: 240px;
    max-height: 520px;
    overflow-y: auto;
}

/* ---------- Panes as full-height cards ---------- */
.page-project .section [data-pane],
.tasks-section [data-pane] {
    display: flex;
    flex-direction: column;
}
/* display:flex above would defeat the hidden attribute — restore it. */
.page-project .section [data-pane][hidden],
.tasks-section [data-pane][hidden] { display: none; }
.page-project [data-pane] > .pane-card,
.page-project [data-pane] > .vis-wrap,
.page-project [data-pane] > .board,
.tasks-section [data-pane] > .pane-card,
.tasks-section [data-pane] > .board { flex: 1 1 auto; }
.pane-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.pane-card > .data-table { border: none; border-radius: 0; box-shadow: none; }

/* ---------- Documents page ---------- */
.filter-bar { display: flex; align-items: center; gap: 8px; }
.filter-bar .filter-select,
.filter-bar .filter-search {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
}
.filter-bar .filter-search { min-width: 220px; }
.filter-bar .filter-search::placeholder { color: #9AA8AE; }
.filter-bar .filter-select:focus,
.filter-bar .filter-search:focus {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}
.doc-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.doc-link:hover { color: var(--accent); }
.doc-type {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
}

/* ---------- Documents folder browser ---------- */
.crumb-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 14px;
}
.crumb-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
}
.crumb-link:hover { color: var(--accent); }
.crumb-sep { color: var(--ink-soft); }
.crumb-here { color: var(--ink); font-weight: 700; }
.folder-link { display: inline-flex; align-items: center; gap: 7px; }
.folder-icon { color: var(--accent); flex: none; }
.doc-location { display: block; font-size: 12px; color: var(--ink-soft); }
.doc-row-actions { display: inline-flex; gap: 2px; flex: none; }
.doc-target { margin: -6px 0 14px; }

/* The note editor needs more room than the default 560px modal. */
.modal-panel:has(.modal-wide) { max-width: 860px; }

/* Drag-and-drop upload zone in the document modal. */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 16px;
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    color: var(--ink-soft);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--accent); color: var(--ink); }
.dropzone.is-over {
    border-color: var(--accent);
    background: rgba(216, 90, 48, 0.06);
    color: var(--ink);
}
.dropzone.has-files { border-style: solid; border-color: var(--accent); }
.dropzone-text { font-size: 14px; font-weight: 600; }
.dropzone-files { font-size: 12.5px; color: var(--ink); word-break: break-word; }
.dropzone-input { display: none; }

/* Inline document preview (image/PDF) in the widened modal. */
.doc-preview-body { padding: 16px 24px 24px; }
.doc-preview-img {
    display: block;
    max-width: 100%;
    max-height: 64vh;
    margin: 0 auto;
    border-radius: 8px;
}
.doc-preview-frame {
    width: 100%;
    height: 64vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
}
.modal-form .note-editor .ql-editor { min-height: 260px; }

/* ---------- Account settings ---------- */
/* White canvas behind uploaded photos, so transparent PNGs stay clean. */
.avatar-img { object-fit: cover; padding: 0; background: #fff; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; flex: none; }
/* Live password checklist in the change-password modal. */
.pw-checks {
    list-style: none;
    margin: -4px 0 10px;
    padding: 0;
    font-size: 13px;
    color: var(--ink-soft);
}
.pw-checks li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.pw-checks li::before { content: "○"; }
.pw-checks li.is-ok { color: var(--c-done); }
.pw-checks li.is-ok::before { content: "✓"; font-weight: 700; }

.zone-hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0 18px;
}
.account-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.account-zone .section-title { margin: 0 0 4px; }
.account-zone .field-help { margin: 0; }
.account-avatar-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
}
.account-avatar-row .field { flex: 1; margin-bottom: 0; }
.account-static { margin: 0; padding: 6px 0 2px; font-size: 15px; }

/* ---------- Meeting notes ---------- */
.note-meta { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.note-editor-form { max-width: 900px; }
.page-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.btn-danger-ghost { color: var(--danger); border-color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger); color: #fff; }

/* Labeled meta rows on the note detail head. */
.note-meta-table { margin-top: 6px; font-size: 13.5px; border-spacing: 0; }
.note-meta-table td { padding: 1.5px 0; }
.note-meta-label { color: var(--ink-soft); padding-right: 14px !important; white-space: nowrap; }

/* Quill (vendored, Snow theme) recoloured with the design tokens so it
   follows dark mode like every other control. */
.note-editor .ql-toolbar.ql-snow {
    border: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    background: var(--surface);
    font-family: inherit;
}
.note-editor .ql-container.ql-snow {
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
    font-family: inherit;
}
.note-editor .ql-editor { min-height: 340px; }
.note-editor .ql-editor.ql-blank::before { color: #9AA8AE; font-style: normal; }
.note-editor .ql-snow .ql-stroke { stroke: var(--ink-soft); }
.note-editor .ql-snow .ql-fill { fill: var(--ink-soft); }
.note-editor .ql-snow .ql-picker { color: var(--ink-soft); }
.note-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.note-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.note-editor .ql-snow.ql-toolbar button:hover .ql-fill,
.note-editor .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }
.note-editor .ql-snow .ql-picker-options {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}
.note-editor .ql-snow .ql-picker-label:hover,
.note-editor .ql-snow .ql-picker-item:hover,
.note-editor .ql-snow .ql-picker-item.ql-selected { color: var(--accent); }
.note-editor .ql-snow .ql-tooltip {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
    box-shadow: var(--shadow);
}
.note-editor .ql-snow .ql-tooltip input[type="text"] {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

/* Notes listed inside the event modal. */
.modal-note-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.modal-note-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.modal-note-list li:last-child { border-bottom: none; }
.modal-note-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.modal-note-list a:hover { color: var(--accent); }
.modal-note-meta { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.modal-note-empty { color: var(--ink-soft); }
.modal-note-add { font-size: 13.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.modal-note-add:hover { color: var(--accent-dark); }
button.modal-note-add { border: 0; background: none; cursor: pointer; padding: 0; font-family: inherit; }

/* Rendered note content (sanitized HTML from the editor). */
.note-content { line-height: 1.65; }
.note-content h1 { font-size: 22px; margin: 18px 0 8px; }
.note-content h2 { font-size: 18px; margin: 16px 0 6px; }
.note-content h3 { font-size: 15.5px; margin: 14px 0 6px; }
.note-content p { margin: 0 0 10px; }
.note-content ul, .note-content ol { margin: 0 0 10px; padding-left: 24px; }
.note-content blockquote {
    margin: 0 0 10px;
    padding: 6px 14px;
    border-left: 3px solid var(--accent);
    color: var(--ink-soft);
}
.note-content pre, .note-content code {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13.5px;
}
.note-content code { padding: 1px 5px; }
.note-content pre { padding: 10px 14px; overflow-x: auto; }
.note-content pre code { border: none; padding: 0; background: none; }
.note-content a { color: var(--accent); }

/* ---------- Comfortable panes on every page ----------
   Same recipe as the project page's panes: content sits in a raised card
   with a guaranteed height, so a short table keeps air below it instead
   of the page looking cramped. */
.pane-card.is-tall {
    min-height: 240px;
    display: flex;
    flex-direction: column;
}
.pane-card.is-padded { padding: 16px 18px; }
.pane-card > .item-list { border: none; border-radius: 0; box-shadow: none; }
/* An empty state fills the card and centres itself. */
.pane-card > .empty {
    border: none;
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Two-column rows: both cards stretch to the taller one, so the row
   always lines up at the bottom. */
.two-col > .section { display: flex; flex-direction: column; margin-bottom: 0; }
.two-col > .section > .pane-card { flex: 1 1 auto; }

/* Board gets extra height; its columns fill the pane top to bottom. */
.page-project .section [data-pane="board"],
.tasks-section [data-pane="board"] { min-height: 420px; }
.page-project [data-pane="board"] .board,
.tasks-section [data-pane="board"] .board { align-items: stretch; }
.board-col { display: flex; flex-direction: column; }
.board-col-body { flex: 1; }

/* ---------- Timeline loading placeholder ---------- */
/* An overlay covering the whole chart box, so the half-built chart
   underneath is never visible while vis is still settling. */
.vis-wrap { position: relative; }
.vis-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 220px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 14px;
}
.vis-loading .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Integrations (Settings cards) ---------- */
.integration-card { margin-top: 22px; }
.integration-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.integration-head .section-title { margin: 0 0 4px; }
.integration-head .field-help { margin: 0; }
.integration-chip {
    flex: none;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--line);
    color: var(--ink-soft);
}
.integration-chip.is-ok { background: rgba(46, 158, 91, 0.14); color: var(--c-done); }
.integration-chip.is-error { background: rgba(225, 79, 79, 0.14); color: var(--accent-dark); }
.integration-meta { margin: 12px 0 4px; }
.integration-repo {
    display: inline-block;
    margin: 1px 6px 1px 0;
    padding: 1.5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12.5px;
    font-family: Consolas, monospace;
}
.integration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.integration-actions form { margin: 0; }

/* Spinner on non-primary buttons (Test connection is btn-ghost): the
   stock .btn-spinner is white-on-white there, so follow the text color. */
.btn-ghost .btn-spinner {
    border-color: color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
}
.integration-actions button:disabled { opacity: 0.65; cursor: progress; }

/* Integration card actions: everyday actions (Sync/Test) sit left;
   account-level actions (Replace token/Disconnect) are pushed right so
   the row reads as two groups, not four equal buttons. */
.integration-aside { margin-left: auto; }
@media (max-width: 760px) {
    .integration-aside { margin-left: 0; }
}

/* ---------- Tasks: scroll fix + real-time search ---------- */
/* .pane-card has overflow:hidden (rounded corners), which flips its
   flex min-height from "content" to 0 - so inside the max-height pane
   it silently clipped long tables instead of letting the pane scroll.
   min-content restores the intended behavior: card grows, pane scrolls. */
.page-project [data-pane="table"] > .pane-card,
.tasks-section [data-pane="table"] > .pane-card { min-height: min-content; }

.tasks-search {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    min-width: 230px;
    margin-left: auto;
}
.tasks-search::placeholder { color: #9AA8AE; }
.tasks-search:focus {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}
/* The search takes over the right-push; tabs sit right next to it. */
.tasks-search + .view-tabs { margin-left: 0; }
@media (max-width: 760px) {
    .tasks-search { min-width: 0; flex: 1 1 140px; margin-left: 0; }
}

/* Rows/cards hidden by the search. Class, not [hidden]: .task-card and
   table rows must win over any display rule. */
.task-filtered { display: none !important; }

/* Status dropdown beside the task search; the pair hugs the right,
   next to the view tabs. */
.tasks-filter {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    margin-left: auto;
}
.tasks-filter:focus {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}
/* When the dropdown is present it takes over the right-push. */
.tasks-filter ~ .tasks-search { margin-left: 0; }
@media (max-width: 760px) {
    .tasks-filter { margin-left: 0; }
}

/* The Tasks timeline chart shares its pane with the "Without dates"
   list. Both are flex items; once the list grew long (GitHub import)
   flex shrink squashed the chart to 0px. Never shrink the chart. */
.page-project [data-pane="timeline"] > .vis-wrap,
.tasks-section [data-pane="timeline"] > .vis-wrap { flex-shrink: 0; }

/* Org overview: project filter in the zone title + focused health row. */
.org-filter { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: normal; }
.org-filter select {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
}
.org-filter select:focus {
    outline: 2px solid var(--pine-700);
    outline-offset: 1px;
    border-color: var(--pine-700);
}
.data-table tbody tr.is-focus-row td {
    background: color-mix(in srgb, var(--accent) 9%, transparent);
}

/* Two-column cards (project docs/notes, dashboard rows): size to
   content between 240px (from .is-tall) and 520px. A card with one
   note stays compact instead of stretching to match a full sibling;
   long lists scroll inside the card. */
.two-col > .section > .pane-card.is-tall {
    flex: 0 1 auto;
    max-height: 520px;
    overflow-y: auto;
}

/* "Without dates" rows open the task modal - make the whole row read
   as clickable. */
.item-click { cursor: pointer; }
.item-click:hover { background: var(--bg); }

/* Synced-sources rows on the GitHub card: air between project lines,
   label pinned to the first line. */
.integration-src { padding: 3px 0; }
.integration-meta td { vertical-align: top; padding: 3px 0; }

/* Integration action row: no stretch, no stray Save-button margin --
   every button same height on one line. */
.integration-actions { align-items: center; }
.integration-actions .btn { margin-top: 0; }
