/* Theme tokens. Every token is defined once; light-dark() picks the value for the active
   colour scheme. data-theme="system" follows the OS, "light"/"dark" force a scheme, and a
   missing attribute stays dark. */
:root { color-scheme: dark; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="system"] { color-scheme: light dark; }

:root {
    --canvas: light-dark(#f6f7f8, #0b0d0f);
    --surface: light-dark(#ffffff, #14171a);
    --surface-2: light-dark(#eef0f3, #1c2024);
    --surface-3: light-dark(#e4e7eb, #23282d);
    --surface-raised: light-dark(#ffffff, #1c2024);
    --border: light-dark(#d9dde2, #262b31);
    --border-strong: light-dark(#b4bbc3, #3a424a);
    --control-border: light-dark(#6b737d, #5d6670);
    --text: light-dark(#111418, #eef1f4);
    --muted: light-dark(#59616c, #9aa3ae);
    --primary: light-dark(#0f766e, #2dd4bf);
    --primary-hover: light-dark(#0d5f59, #5eead4);
    --primary-ink: light-dark(#ffffff, #042f2b);
    --primary-soft: light-dark(#d7f2ee, #0f2e2b);
    --accent: light-dark(#2f5da8, #7da9f5);
    --info: var(--accent);
    --success: light-dark(#166534, #4ade80);
    --success-soft: light-dark(#dcf5e3, #12301f);
    --warning: light-dark(#a3480a, #fbbf24);
    --warning-soft: light-dark(#fdf0d5, #3a2a07);
    --danger: light-dark(#b3261e, #ff8a93);
    --danger-soft: light-dark(#fbe4e2, #3f1d22);
    --danger-solid: light-dark(#b3261e, #c93545);
    --on-solid: #ffffff;
    --backdrop: rgba(4, 6, 9, .62);
    --backdrop-strong: rgba(4, 6, 9, .76);
    --edge-highlight: light-dark(transparent, rgba(255, 255, 255, .03));
    --bg-scrim: linear-gradient(180deg, light-dark(rgba(246, 247, 248, .84), rgba(11, 13, 15, .72)), light-dark(rgba(246, 247, 248, .95), rgba(11, 13, 15, .9)));
    --shadow-color: light-dark(rgba(16, 20, 24, .12), rgba(0, 0, 0, .32));
    --shadow: 0 18px 50px var(--shadow-color);
    --radius: 12px;
    --radius-sm: 8px;
    --header-height: 60px;
    --transition: 150ms ease;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--text); font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: 10px; font-size: 19px; line-height: 1.25; letter-spacing: -.015em; }
h3 { margin-bottom: 8px; font-size: 15px; }
p { color: var(--muted); }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.eyebrow { display: block; margin-bottom: 7px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.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; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.app-header { position: sticky; z-index: 100; top: 0; height: var(--header-height); display: flex; align-items: center; gap: 24px; padding: 0 22px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--canvas) 88%, transparent); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.brand-mark { display: block; width: 30px; height: 30px; flex: none; }
.brand-mark.large { width: 56px; height: 56px; }
.primary-nav { display: flex; align-self: stretch; gap: 4px; }
.primary-nav a, .primary-nav .primary-nav-button { position: relative; display: flex; align-items: center; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; }
.primary-nav a:hover, .primary-nav a.active, .primary-nav .primary-nav-button:hover, .primary-nav .primary-nav-button.active { color: var(--text); }
.primary-nav a.active::after, .primary-nav .primary-nav-button.active::after { content: ""; position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; background: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.external-session-form { margin: 0; }
.header-logout-button { min-height: 38px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.header-logout-button:hover { border-color: var(--border-strong); background: var(--surface-3); }
.icon-button, .avatar-button { position: relative; display: inline-grid; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; transition: background var(--transition), border var(--transition); }
.icon-button:hover, .avatar-button:hover { border-color: var(--border); background: var(--surface-2); }
.ui-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar-button { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); font-weight: 800; }
.notification-badge { position: absolute; top: 2px; right: 1px; min-width: 20px; height: 20px; padding: 0 5px; border: 2px solid var(--canvas); border-radius: 10px; background: var(--danger-solid); color: var(--on-solid); font-size: 12px; line-height: 12px; }
.mobile-nav-toggle { display: none; }
.notification-panel, .account-menu { position: fixed; z-index: 160; top: 66px; right: 18px; width: min(390px, calc(100vw - 24px)); max-height: calc(100vh - 84px); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.notification-panel { padding: 14px; }
.notification-list { display: grid; gap: 4px; }
.notification-item { position: relative; display: grid; gap: 3px; padding: 10px 11px; border-radius: 8px; }
.notification-item:hover { background: var(--surface-2); }
.notification-item.unread { padding-left: 17px; background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.notification-item.unread::before { content: ""; position: absolute; top: 16px; left: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.notification-item span, .notification-item time { color: var(--muted); font-size: 12px; }
.notification-item time { font-size: 12px; }
.account-menu { display: flex; width: 240px; padding: 14px; flex-direction: column; gap: 5px; }
.account-menu a, .account-menu .menu-button { width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.account-menu a:hover, .account-menu .menu-button:hover { background: var(--surface-2); }
.account-menu form { margin: 3px 0 0; padding-top: 6px; border-top: 1px solid var(--border); }
[hidden] { display: none !important; }

.app-main { width: min(1500px, 100%); margin: 0 auto; padding: 30px 26px 60px; }
.public-main { min-height: 100vh; }
.app-main.external-workspace-active { width: 100%; max-width: none; min-height: calc(100dvh - var(--header-height)); padding: 0; }
.project-main.external-workspace-active > :not([data-external-workspace]), .app-main.external-workspace-active > :not([data-external-workspace]) { display: none !important; }
.external-workspace { width: 100%; min-height: calc(100dvh - var(--header-height)); }
.external-service-frame { display: block; width: 100%; height: calc(100dvh - var(--header-height)); border: 0; background: #fff; }
.external-workspace-message, .external-ai-chooser { display: grid; min-height: calc(100dvh - var(--header-height)); place-items: center; padding: 24px; }
.external-workspace-message, .external-ai-chooser-content { width: min(560px,100%); text-align: center; }
.external-workspace-message { align-content: center; margin: 0 auto; border: 1px solid var(--border); background: var(--surface); }
.external-workspace-message h1, .external-ai-chooser-content h1 { margin-bottom: 8px; }
.external-workspace-message p, .external-ai-chooser-content p { margin-bottom: 0; }
.external-ai-chooser-content { display: grid; gap: 14px; }
.external-ai-choices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.external-ai-status { min-height: 24px; color: var(--text); font-weight: 700; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading p { max-width: 670px; margin-bottom: 0; }
.panel { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 var(--edge-highlight); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2 { margin: 0; }
.panel-heading a, .text-button { border: 0; background: transparent; color: var(--primary); font-weight: 700; cursor: pointer; }

.primary-button, .secondary-button, .danger-button, .small-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 750; cursor: pointer; transition: transform var(--transition), background var(--transition), border var(--transition); }
.primary-button { background: var(--primary); color: var(--primary-ink); }
.primary-button:hover { background: var(--primary-hover); }
.secondary-button, .small-button { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.secondary-button:hover, .small-button:hover { border-color: var(--border-strong); background: var(--surface-3); }
.danger-button { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); color: var(--danger); }
.danger-button:hover { border-color: var(--danger); }
.small-button { min-height: 31px; padding: 4px 9px; font-size: 12px; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .55; }
.full { width: 100%; }
.fit { width: fit-content; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

label { display: grid; gap: 7px; color: var(--text); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; outline: 0; background: var(--canvas); color: var(--text); transition: border var(--transition), box-shadow var(--transition); }
textarea { resize: vertical; }
/* One crisp 2px ring (1px border + 1px solid shadow): no translucent halo to smear on low-DPI screens. */
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); outline: none; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--primary); }
.form-stack { display: grid; align-content: start; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.span-full { grid-column: 1 / -1; }
.field-help, .form-note { margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.switch-row, .compact-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compact-check { justify-content: flex-start; white-space: nowrap; }
.inline-form { display: flex; align-items: center; gap: 7px; }
.inline-form input, .inline-form select { min-height: 34px; }
.inline-warning { padding: 10px 12px; border: 1px solid color-mix(in srgb,var(--warning) 45%,var(--border)); border-radius: 8px; background: color-mix(in srgb,var(--warning) 12%,var(--surface)); color: var(--warning); }


.login-page { overflow-x: hidden; }
.login-shell { display: grid; min-height: 100vh; padding: clamp(24px, 7vw, 90px); grid-template-columns: minmax(0,1.15fr) minmax(340px,480px); align-items: center; gap: clamp(40px, 9vw, 140px); background: radial-gradient(circle at 15% 30%, color-mix(in srgb,var(--primary) 10%,transparent), transparent 33%), var(--canvas); }
.login-brand h1 { margin: 18px 0 10px; font-size: clamp(48px, 9vw, 92px); }
.login-brand p { max-width: 500px; font-size: 18px; }
.auth-card { display: grid; gap: 20px; padding: clamp(24px, 5vw, 42px); border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb,var(--surface) 94%,transparent); box-shadow: var(--shadow); }

/* Sign-in page: illustration half and form half. The melon keeps the logo's fixed brand
   colours in both themes; login-buddy.js drives data-state, data-mood and --look-x/y. */
.login-split { display: grid; min-height: 100vh; grid-template-columns: 1fr 1fr; }
.login-art { position: relative; display: grid; place-items: center; padding: 96px 32px; overflow: hidden; border-right: 1px solid var(--border); background: var(--surface); }
.login-art-brand { position: absolute; top: 28px; left: 32px; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.login-art-tagline { position: absolute; right: 32px; bottom: 28px; left: 32px; margin: 0; font-size: 14px; }
.login-panel { display: grid; place-items: center; padding: 48px 24px; }
.login-form { display: grid; width: min(380px, 100%); gap: 18px; }
.login-form h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; letter-spacing: -.025em; }
.login-form input { min-height: 44px; font-size: 15px; }
.login-form .primary-button { min-height: 44px; margin-top: 4px; }
.login-help { margin: 4px 0 0; font-size: 13px; line-height: 1.7; }
.login-help a { color: var(--primary); font-weight: 650; }
.login-help a:hover { text-decoration: underline; }
.login-error { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 600; }
.login-error svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.login-form input[aria-invalid="true"]:not(:focus) { border-color: var(--danger); }

.melon-buddy { width: min(400px, 78%); height: auto; overflow: visible; }
.melon-shadow { fill: var(--surface-3); transform-box: fill-box; transform-origin: center; transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.melon-body { transform-box: view-box; transform-origin: 160px 150px; transform: rotate(-6deg); transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.melon-rind { fill: #2dd4bf; }
.melon-inner-rind { fill: #ccfbf1; }
.melon-flesh { fill: #fbbf24; }
.melon-seeds, .melon-eye { fill: #0b0d0f; }
.melon-eyes { transform: translate(var(--look-x, 0px), var(--look-y, 0px)); transition: transform .14s ease-out; }
.melon-eye { transform-box: fill-box; transform-origin: center; transition: transform .16s ease; }
.melon-mouth { fill: none; stroke: #0b0d0f; stroke-width: 3.5; stroke-linecap: round; opacity: 0; transition: opacity .2s ease; }
.melon-buddy[data-mood="calm"] .mouth-calm, .melon-buddy[data-mood="sad"] .mouth-sad, .melon-buddy[data-mood="happy"] .mouth-happy { opacity: 1; }

.melon-buddy[data-state="watch"] .melon-body { transform: translateX(8px) rotate(5deg); }
.melon-buddy[data-state="away"] .melon-body { transform: translateX(-14px) rotate(-18deg); }
.melon-buddy[data-state="away"] .melon-eye { transform: scaleY(.14); }
.melon-buddy[data-state="peek"] .melon-body { transform: translateX(-6px) rotate(-10deg); }
.melon-buddy[data-state="peek"] .melon-eye:first-child { transform: scaleY(.14); }
.melon-buddy.is-blinking .melon-eye { transform: scaleY(.1); }
.melon-buddy[data-mood="sad"] { animation: melon-shake .5s ease 1; }
.melon-buddy[data-mood="sad"] .melon-eyes { transform: translate(var(--look-x, 0px), calc(var(--look-y, 0px) + 4px)); }
.melon-buddy[data-mood="happy"] { animation: melon-hop .5s cubic-bezier(.2,.8,.2,1) 1; }
/* Switching between the light and dark theme fades for half a second. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .5s; }
@keyframes melon-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes melon-hop { 0%, 100% { transform: none; } 40% { transform: translateY(-14px); } }

@media (max-width: 860px) {
    .login-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .login-art { min-height: 0; padding: 64px 20px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
    .login-art-brand { top: 18px; left: 20px; }
    .login-art-tagline { display: none; }
    .melon-buddy { width: 190px; }
    .login-panel { place-items: start center; padding: 28px 20px 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .melon-body, .melon-eyes, .melon-eye, .melon-shadow, .melon-mouth { transition: none; }
    .melon-buddy[data-mood] { animation: none; }
}

.dashboard-layout { display: grid; grid-template-columns: minmax(0,1fr) 330px; align-items: start; gap: 22px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 14px; }
.project-tile { display: grid; min-height: 210px; padding: 20px; align-content: start; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform var(--transition), border var(--transition), background var(--transition); }
.project-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb,var(--primary) 48%,var(--border)); background: color-mix(in srgb,var(--surface) 96%,var(--primary)); }
.project-tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.project-tile h2 { font-size: 22px; }
.project-tile p { min-height: 44px; }
.role-pill, .stage-badge { display: inline-flex; width: fit-content; padding: 3px 8px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tile-stats { display: flex; gap: 14px; margin-top: auto; color: var(--muted); font-size: 12px; }
.dashboard-sidebar { display: grid; gap: 16px; }
.compact-list { display: grid; gap: 3px; }
.compact-list a { display: grid; gap: 2px; padding: 9px; border-radius: 7px; }
.compact-list a:hover { background: var(--surface-2); }
.compact-list span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { display: grid; min-height: 310px; place-items: center; align-content: center; padding: 36px; text-align: center; }
.empty-state p { max-width: 460px; }
.empty-icon { width: 44px; height: 44px; margin-bottom: 14px; color: var(--primary); font-size: 44px; }

.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.theme-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.theme-option { min-height: 70px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); color: var(--text); cursor: pointer; }
.theme-option:hover, .theme-option.selected { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.table-panel { padding: 0; overflow: hidden; }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.table-subline { display: block; color: var(--muted); font-size: 12px; }
.activity-log-heading { align-items: flex-end; }
.activity-log-heading > div:first-child { min-width: 0; }
.activity-log-actions { justify-content: flex-end; }
.activity-log-settings .section-heading { align-items: center; }
.activity-log-settings .section-heading p { margin-bottom: 0; }
.activity-log-table { min-width: 760px; }
.activity-log-table th:first-child, .activity-log-table td:first-child { width: 175px; white-space: nowrap; }
.activity-log-table th:nth-child(2), .activity-log-table td:nth-child(2) { width: 240px; overflow-wrap: anywhere; }
.activity-log-table th:nth-child(3), .activity-log-table td:nth-child(3) { width: 150px; }
.activity-log-table time { font-variant-numeric: tabular-nums; }
.activity-type { display: inline-flex; width: fit-content; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 750; white-space: nowrap; }
.activity-type-external { border-color: color-mix(in srgb,var(--info) 42%,var(--border)); color: var(--info); }
.activity-type-external-link { border-color: color-mix(in srgb,var(--warning) 42%,var(--border)); color: var(--warning); }
.activity-log-empty { min-height: 310px; }
.reset-form input { width: 180px; }

.app-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.app-dialog.wide-dialog { width: min(820px, calc(100vw - 24px)); }
.app-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.app-dialog > form, .app-dialog > section.form-stack, .dialog-content { display: grid; gap: 17px; padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin: 0; font-size: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.push-left { margin-right: auto; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--border); }
.danger-zone p { margin: 2px 0 0; font-size: 12px; }
.plain-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.plain-fieldset legend { margin-bottom: 8px; color: var(--text); font-size: 13px; font-weight: 700; }

.bin-list { display: grid; }
.bin-item { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.bin-item:last-child { border-bottom: 0; }
.bin-item h2 { margin: 7px 0 3px; }
.bin-item p { margin: 0; font-size: 12px; }

.stage-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.stage-dot.preparing { background: var(--warning); }.stage-dot.working { background: var(--info); }.stage-dot.done { background: var(--primary); }

.calendar-shell { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border-bottom: 1px solid var(--border); }
.calendar-navigation, .calendar-filters { display: flex; align-items: center; gap: 8px; }
.calendar-navigation h2 { min-width: 170px; margin: 0 0 0 10px; }
.calendar-filters select { min-width: 180px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.calendar-weekdays span { padding: 9px; border-right: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 750; text-align: center; text-transform: uppercase; }
.calendar-day { min-height: 125px; padding: 8px; border-top: 1px solid var(--border); border-right: 1px solid var(--border); background: transparent; cursor: pointer; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: color-mix(in srgb,var(--canvas) 55%,var(--surface)); color: var(--muted); }
.calendar-day.today .calendar-date { background: var(--primary); color: var(--primary-ink); }
.calendar-date { display: grid; width: 26px; height: 26px; margin-bottom: 5px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; font-weight: 750; cursor: pointer; }
.calendar-events { display: grid; gap: 3px; }
.calendar-event { display: block; width: 100%; overflow: hidden; padding: 4px 6px; border: 0; border-left: 3px solid var(--primary); border-radius: 4px; background: var(--surface-2); color: var(--text); font-size: 12px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.calendar-event.done { opacity: .65; text-decoration: line-through; }
.calendar-more { display: block; padding: 2px 5px; color: var(--muted); font-size: 12px; }
.calendar-grid[aria-busy="true"] { opacity: .58; }

/* Project workspace */
.project-main { width: 100%; max-width: none; padding: 0; }
.project-workspace { min-height: calc(100vh - var(--header-height)); }
.project-header { position: sticky; z-index: 80; top: var(--header-height); display: flex; min-height: 68px; align-items: center; gap: 16px; padding: 10px 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb,var(--canvas) 93%,transparent); backdrop-filter: blur(14px); }
.project-identity { min-width: 180px; }
.project-identity h1 { margin: 0; font-size: 22px; }
.project-identity p { max-width: 390px; margin: 2px 0 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.view-tab { padding: 6px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.view-tab.active { background: var(--surface-2); color: var(--text); }
.project-header-actions { display: flex; gap: 7px; margin-left: auto; }
.card-strip { display: flex; min-height: 52px; align-items: center; gap: 7px; padding: 7px 24px; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: thin; }
.card-tab { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.card-tab:hover, .card-tab.active { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.card-tab.active { border-color: color-mix(in srgb,var(--primary) 45%,var(--border)); }
.card-tab-wrap { display: flex; flex: 0 0 auto; align-items: center; border-radius: 7px; }
.card-tab-wrap.dragging, .kanban-column.dragging { opacity: .45; }
.card-tab-wrap .card-edit-button { width: 28px; height: 28px; margin-left: -5px; color: var(--muted); font-size: 12px; }
.add-card-tab { border-style: dashed; border-color: var(--border); color: var(--primary); }
.filter-bar { display: flex; align-items: center; gap: 8px; padding: 10px 24px; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--canvas); }
.filter-bar input { min-width: 210px; }
.filter-bar select { width: auto; min-width: 145px; }
.board-viewport { min-height: calc(100vh - 233px); padding: 16px 24px 30px; overflow-x: auto; }
.card-board { display: flex; min-width: max-content; align-items: flex-start; gap: 12px; }
.board-empty { width: min(720px, calc(100vw - 48px)); min-height: 360px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.kanban-column { width: 310px; max-height: calc(100vh - 260px); display: flex; flex: 0 0 310px; flex-direction: column; border: 1px solid var(--border); border-top: 3px solid transparent; border-radius: 10px; background: var(--surface); }
.kanban-column[data-stage="preparing"] { border-top-color: var(--warning); }
.kanban-column[data-stage="working"] { border-top-color: var(--info); }
.kanban-column[data-stage="done"] { border-top-color: var(--success); }
.column-heading { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.column-heading h2 { margin: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.column-heading .column-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.column-menu { width: 28px; height: 28px; }
.stage-badge.preparing { border-color: color-mix(in srgb,var(--warning) 45%,var(--border)); color: var(--warning); }
.stage-badge.working { border-color: color-mix(in srgb,var(--info) 45%,var(--border)); color: var(--info); }
.stage-badge.done { border-color: color-mix(in srgb,var(--primary) 45%,var(--border)); color: var(--primary); }
.task-list { min-height: 50px; padding: 9px; overflow-y: auto; }
.filtered-empty { padding: 10px 4px; text-align: center; }
.task-card { display: grid; gap: 8px; margin-bottom: 8px; padding: 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--canvas); cursor: pointer; transition: border var(--transition), transform var(--transition); }
.task-card:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.task-card.dragging { opacity: .45; }
.task-card.overdue { border-left: 3px solid var(--danger); }
.task-card-title { color: var(--text); font-weight: 700; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.avatar-stack { display: flex; margin-left: auto; }
.mini-avatar { display: grid; width: 23px; height: 23px; margin-left: -5px; place-items: center; border: 2px solid var(--canvas); border-radius: 50%; background: var(--surface-3); font-size: 12px; font-weight: 800; }
.add-task-button { width: calc(100% - 18px); margin: 0 9px 9px; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.add-task-button:hover { border-color: var(--primary); color: var(--text); }
.add-column-tile { width: 260px; min-height: 80px; flex: 0 0 260px; border: 1px dashed var(--border-strong); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.add-column-tile:hover { border-color: var(--primary); color: var(--text); }

.task-backdrop { position: fixed; z-index: 190; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); }
.drawer-open { overflow: hidden; }
.task-drawer { position: fixed; z-index: 200; top: 0; right: 0; width: min(680px, 100vw); height: 100vh; overflow-y: auto; border-left: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); transform: translateX(100%); transition: transform 190ms ease; }
.task-drawer.open { transform: translateX(0); }
.drawer-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter: blur(12px); }
.drawer-body { display: grid; gap: 0; padding: 14px; }
.drawer-section { display: grid; gap: 11px; padding: 26px 15px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 { margin: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-check { align-self: end; min-height: 40px; justify-content: flex-start; }
.drawer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.member-checks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.member-check { display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.comment-list, .attachment-list, .reminder-list { display: grid; gap: 8px; }
.comment-item { padding: 10px; border-radius: 8px; background: var(--surface); }
.comment-item header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.comment-item p { margin: 0; color: var(--text); white-space: pre-wrap; }
.comment-delete { margin-left: auto; font-size: 12px; }
.comment-compose { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; }
.attachment-item { display: grid; grid-template-columns: 82px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.attachment-preview { display: grid; width: 82px; height: 58px; place-items: center; overflow: hidden; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.attachment-preview img, .attachment-preview video { width: 100%; height: 100%; object-fit: cover; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-details { display: grid; min-width: 0; gap: 3px; }
.file-extension { font-size: 12px; letter-spacing: .06em; }
.upload-drop { padding: 18px; border: 1px dashed var(--border-strong); border-radius: 8px; text-align: center; }
.upload-drop label { margin-bottom: 10px; }
.progress { height: 6px; overflow: hidden; border-radius: 4px; background: var(--surface-3); }
.progress > span { display: block; width: 0; height: 100%; background: var(--primary); }
.upload-progress { width: 100%; height: 7px; margin-top: 10px; border: 0; border-radius: 4px; accent-color: var(--primary); }
.metric-overdue { color: var(--danger); font-weight: 800; }
.member-row { display: grid; grid-template-columns: minmax(130px,1fr) 130px auto auto; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.member-identity { display: grid; }
.member-list { display: grid; }
.member-invite-form { display: grid; grid-template-columns: minmax(180px,1fr) 150px auto; align-items: end; gap: 9px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); }
.member-delete-privilege { font-size: 12px; }
.position-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-calendar { padding: 16px 24px 30px; }
.project-insights { padding: 24px; }
.project-insights > .panel-heading { align-items: flex-end; }
.project-insights > .panel-heading p { max-width: 560px; margin: 0; text-align: right; }
.text-preview { max-height: 62vh; margin: 0; padding: 15px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--canvas); color: var(--text); white-space: pre-wrap; word-break: break-word; }
.reminder-item { display: flex; min-height: 32px; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; background: var(--surface); }
.reminder-item .text-button { margin-left: auto; }

@media (max-width: 1050px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .dashboard-sidebar { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .project-header { flex-wrap: wrap; }
    .project-header-actions { margin-left: 0; }
    .view-tabs { margin-left: auto; }
}

@media (max-width: 760px) {
    :root { --header-height: 56px; }
    .app-header { gap: 10px; padding: 0 12px; }
    .mobile-nav-toggle { display: grid; margin-left: auto; }
    .primary-nav { position: fixed; z-index: 140; top: var(--header-height); right: 0; left: 0; display: none; height: auto; padding: 8px 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
    .primary-nav.open { display: grid; }
    .primary-nav a, .primary-nav .primary-nav-button { min-height: 42px; border-radius: 7px; }
    .primary-nav a.active::after, .primary-nav .primary-nav-button.active::after { display: none; }
    .header-actions { margin-left: 0; }
    .header-actions .icon-button:nth-of-type(2) { display: none; }
    .app-main { padding: 22px 14px 40px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading > button { width: 100%; }
    .settings-grid, .dashboard-sidebar { grid-template-columns: 1fr; }
    .form-grid, .drawer-grid, .member-checks { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; padding: 20px; }
    .login-brand { display: none; }
    .auth-card { width: 100%; max-width: 480px; margin: auto; }
    .bin-item { align-items: flex-start; flex-direction: column; }
    .bin-item .row-actions { width: 100%; }
    .bin-item .row-actions button { flex: 1; }
    .calendar-toolbar { align-items: stretch; flex-direction: column; }
    .calendar-navigation, .calendar-filters { justify-content: space-between; }
    .calendar-filters select { min-width: 0; flex: 1; }
    .calendar-weekdays span { padding: 6px 2px; font-size: 12px; }
    .calendar-day { min-height: 82px; padding: 4px; }
    .calendar-event { padding: 3px; border-left-width: 2px; font-size: 12px; }
    .project-header { top: var(--header-height); padding: 9px 12px; }
    .project-identity { width: calc(100% - 50px); }
    .view-tabs { order: 3; width: 100%; margin: 0; }
    .view-tab { flex: 1; }
    .project-header-actions { position: absolute; top: 10px; right: 10px; }
    .project-header-actions .secondary-button { width: 36px; overflow: hidden; padding: 0; }
    .project-header-actions .action-label { display: none; }
    .card-strip, .filter-bar { padding-right: 12px; padding-left: 12px; }
    .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
    .filter-bar input { min-width: 0; grid-column: 1 / -1; }
    .filter-bar select { width: 100%; min-width: 0; }
    .board-viewport, .project-calendar { padding: 12px; }
    .kanban-column { width: min(84vw,310px); flex-basis: min(84vw,310px); max-height: calc(100vh - 260px); }
    .task-drawer { border-left: 0; }
    .drawer-body { padding: 12px; }
    .attachment-item { grid-template-columns: 60px minmax(0,1fr); }
    .attachment-preview { width: 60px; height: 50px; }
    .attachment-item .row-actions { grid-column: 1 / -1; }
    .member-row { grid-template-columns: 1fr 110px; }
    .member-row > :nth-child(n+3) { grid-column: auto; }
    .member-invite-form { grid-template-columns: 1fr; }
    .comment-compose { grid-template-columns: 1fr; }
    .comment-compose button { width: 100%; }
    .project-insights { padding: 14px; overflow-x: auto; }
    .project-insights > .panel-heading { align-items: flex-start; flex-direction: column; }
    .project-insights > .panel-heading p { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Renewed project visuals and clearer semantic states */
.secondary-button, .small-button { box-shadow: inset 0 1px 0 var(--edge-highlight); }
.danger-button:focus-visible { outline-color: color-mix(in srgb, var(--danger) 75%, transparent); }
.stage-badge.done { border-color: color-mix(in srgb,var(--success) 48%,var(--border)); color: var(--success); }

/* Dashboard imagery */
.project-tile { position: relative; min-height: 220px; padding: 0; isolation: isolate; overflow: hidden; }
.project-tile-image, .project-tile-scrim { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; }
.project-tile-image { object-fit: cover; transition: transform 280ms ease; }
.project-tile-scrim { z-index: -1; background: linear-gradient(180deg,rgba(11,13,15,.24),rgba(11,13,15,.9)); }
.project-tile:not(.has-image)::before { content: attr(data-initial); position: absolute; z-index: 0; top: -34px; right: -14px; color: color-mix(in srgb, var(--primary) 14%, transparent); font-size: 160px; font-weight: 850; line-height: 1; pointer-events: none; user-select: none; }
.project-tile-content { position: relative; z-index: 1; display: grid; min-height: 220px; padding: 20px; align-content: start; }
.project-tile:hover .project-tile-image { transform: scale(1.025); }
.project-tile.has-image { border-color: color-mix(in srgb,white 16%,var(--border)); background: #14171a; color: #fff; }
.project-tile.has-image:hover { border-color: color-mix(in srgb,var(--primary) 58%,white 12%); background: #14171a; }
.project-tile.has-image p, .project-tile.has-image .tile-stats { color: rgba(255,255,255,.78); }
.project-tile.has-image .role-pill { border-color: rgba(255,255,255,.26); background: rgba(11,13,15,.64); color: rgba(255,255,255,.9); backdrop-filter: blur(8px); }

/* Project background remains decorative and never competes with controls. */
.project-workspace { position: relative; isolation: isolate; background: var(--canvas); }
.project-background { position: fixed; z-index: -1; top: var(--header-height); right: 0; bottom: 0; left: 0; overflow: hidden; pointer-events: none; }
.project-background img, .project-background-scrim { position: absolute; inset: 0; width: 100%; height: 100%; }
.project-background img { object-fit: cover; }
.project-background-scrim { background: var(--bg-scrim); backdrop-filter: blur(4px); }
.project-workspace.has-project-background { background: transparent; }
.project-workspace.has-project-background .project-header,
.project-workspace.has-project-background .card-strip,
.project-workspace.has-project-background .filter-bar { background: color-mix(in srgb,var(--canvas) 88%,transparent); backdrop-filter: blur(18px); }
.project-workspace.has-project-background .kanban-column,
.project-workspace.has-project-background .calendar-shell,
.project-workspace.has-project-background .project-insights { background: color-mix(in srgb,var(--surface) 93%,transparent); backdrop-filter: blur(12px); }

.project-notification-control { display: flex; min-height: 38px; align-items: center; gap: 7px; padding: 4px 5px 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.project-notification-control select { width: auto; min-height: 28px; padding: 3px 25px 3px 7px; border: 0; background-color: var(--surface); font-size: 12px; font-weight: 750; }

/* Card tabs form one deliberate segmented control. */
.card-strip { gap: 9px; }
.card-tab-wrap { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.card-tab-wrap:has(.card-tab.active) { border-color: color-mix(in srgb,var(--primary) 50%,var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb,var(--primary) 8%,transparent); }
.card-tab-wrap .card-tab { min-height: 34px; padding: 6px 11px; border: 0; border-radius: 0; }
.card-tab-wrap .card-tab:hover, .card-tab-wrap .card-tab.active { border: 0; background: var(--surface-2); }
.card-tab-wrap .card-edit-button { align-self: stretch; min-width: 42px; padding: 0 9px; border: 0; border-left: 1px solid var(--border); background: color-mix(in srgb,var(--surface-2) 80%,transparent); color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.card-tab-wrap .card-edit-button:hover { background: var(--surface-3); color: var(--text); }

.filter-bar { background: color-mix(in srgb,var(--canvas) 96%,transparent); }
.filter-bar .text-button { min-width: max-content; padding: 6px 8px; }

/* Labels and richer task cards */
.task-card-labels, .label-checks { display: flex; gap: 5px; flex-wrap: wrap; }
.task-label { display: inline-flex; min-height: 20px; align-items: center; padding: 2px 7px; border: 1px solid color-mix(in srgb,var(--label-color) 58%,var(--border)); border-radius: 999px; background: color-mix(in srgb,var(--label-color) 20%,var(--surface)); color: color-mix(in srgb,var(--label-color) 75%,var(--text)); font-size: 12px; font-weight: 800; line-height: 1.2; }
.label-check { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; }
.label-check input { width: 16px; min-height: 16px; }
.task-count { padding: 2px 5px; border-radius: 5px; background: var(--surface-2); }
.task-subtask-progress { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.task-subtask-progress progress, .subtask-progress { width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: 999px; background: var(--surface-3); accent-color: var(--info); }
progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-3); }
progress::-webkit-progress-value { border-radius: 999px; background: var(--info); }
progress::-moz-progress-bar { border-radius: 999px; background: var(--info); }

/* Project settings editors */
.project-settings-content { gap: 22px; }
.settings-subsection { display: grid; gap: 13px; padding-top: 18px; border-top: 1px solid var(--border); }
.settings-subsection .section-heading p { margin: 3px 0 0; }
.project-background-editor { display: grid; grid-template-columns: minmax(180px,260px) minmax(0,1fr); gap: 16px; align-items: start; }
.project-background-preview { display: grid; min-height: 140px; place-items: center; overflow: hidden; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--canvas); color: var(--muted); }
.project-background-preview img { width: 100%; height: 150px; object-fit: cover; }
.label-create-form { display: grid; grid-template-columns: minmax(150px,1fr) 72px auto; align-items: end; gap: 8px; }
.label-create-form input[type="color"], .label-manager-row input[type="color"] { min-width: 48px; padding: 4px; cursor: pointer; }
.label-manager-list { display: grid; gap: 7px; }
.label-manager-row { display: grid; grid-template-columns: minmax(90px,auto) minmax(120px,1fr) 58px auto auto; align-items: center; gap: 7px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--canvas); }
.label-manager-preview { justify-self: start; }
.label-manager-row input { min-height: 34px; }

/* Task dialog on desktop; the original edge drawer remains on small screens. */
@media (min-width: 761px) {
    .task-drawer.task-dialog { top: 50%; right: auto; left: 50%; width: min(980px,calc(100vw - 48px)); height: min(900px,calc(100vh - 48px)); overflow: hidden; border: 1px solid var(--border-strong); border-radius: 16px; opacity: 0; pointer-events: none; transform: translate(-50%,-46%) scale(.985); transition: transform 190ms ease,opacity 150ms ease; }
    .task-drawer.task-dialog.open { opacity: 1; pointer-events: auto; transform: translate(-50%,-50%) scale(1); }
    .task-dialog .drawer-header { position: relative; }
    .task-dialog .drawer-body { max-height: calc(100% - 68px); overflow-y: auto; }
}
.task-backdrop { background: var(--backdrop); backdrop-filter: blur(5px); }
.drawer-header strong { display: block; max-width: min(70vw,720px); overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }

/* Subtasks */
.subtask-section .section-heading > div { display: grid; gap: 2px; }
.subtask-progress { height: 8px; }
.subtask-list { display: grid; gap: 6px; }
.subtask-item { display: grid; grid-template-columns: auto minmax(170px,1fr) minmax(130px,180px) auto; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.subtask-item.completed { opacity: .72; }
.subtask-item.completed .subtask-title-input, .subtask-item.completed .subtask-title { text-decoration: line-through; }
.subtask-title-input, .subtask-assignee { min-height: 34px; padding: 6px 8px; }
.subtask-actions { display: flex; align-items: center; gap: 3px; }
.compact-icon { width: 30px; height: 30px; }
.subtask-delete { padding: 3px 5px; color: var(--danger); font-size: 12px; }
.subtask-readonly { display: grid; grid-column: span 3; gap: 2px; }
.subtask-create-form { display: grid; grid-template-columns: minmax(170px,1fr) minmax(140px,190px) auto; gap: 8px; }

/* Collapsible task sections */
.collapsible-section { padding: 0; gap: 0; overflow: hidden; }
.section-toggle { display: flex; width: 100%; min-height: 62px; align-items: center; justify-content: space-between; gap: 12px; padding: 26px 15px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.section-toggle:hover { background: color-mix(in srgb,var(--surface-2) 56%,transparent); }
.section-toggle > span:first-child { display: grid; gap: 2px; }
.section-toggle small { color: var(--muted); font-weight: 500; }
.section-chevron { color: var(--muted); font-size: 20px; transition: transform var(--transition); }
.collapsible-section.expanded .section-chevron { transform: rotate(180deg); }
.collapsible-content { display: grid; gap: 11px; padding: 0 15px 26px; border-top: 1px solid var(--border); }
.collapsible-content > :first-child { margin-top: 13px; }

/* Conversation flow and stable per-author tones */
.comment-list { gap: 11px; }
.comment-item { --author-color: var(--info); display: flex; max-width: 84%; align-items: flex-end; gap: 7px; padding: 0; background: transparent; }
.comment-item.mine { margin-left: auto; flex-direction: row-reverse; }
.comment-avatar { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border: 1px solid color-mix(in srgb,var(--author-color) 55%,var(--border)); border-radius: 50%; background: color-mix(in srgb,var(--author-color) 23%,var(--surface)); color: var(--text); font-size: 12px; font-weight: 850; }
.comment-bubble { min-width: 150px; padding: 9px 11px; border: 1px solid color-mix(in srgb,var(--author-color) 28%,var(--border)); border-radius: 12px 12px 12px 3px; background: color-mix(in srgb,var(--author-color) 10%,var(--surface)); }
.comment-item.mine .comment-bubble { border-radius: 12px 12px 3px 12px; background: color-mix(in srgb,var(--author-color) 15%,var(--surface)); }
.comment-item header { align-items: center; margin-bottom: 5px; }
.comment-body { overflow-wrap: anywhere; }
.comment-item[data-author-tone="0"] { --author-color: var(--info); }
.comment-item[data-author-tone="1"] { --author-color: color-mix(in srgb, var(--primary) 65%, var(--info) 20%); }
.comment-item[data-author-tone="2"] { --author-color: color-mix(in srgb, var(--warning) 78%, var(--primary) 22%); }
.comment-item[data-author-tone="3"] { --author-color: color-mix(in srgb, var(--success) 70%, var(--info) 30%); }
.comment-item[data-author-tone="4"] { --author-color: color-mix(in srgb, var(--danger) 72%, var(--info) 28%); }
.comment-item[data-author-tone="5"] { --author-color: color-mix(in srgb, var(--success) 70%, var(--warning) 30%); }
.comment-item[data-author-tone="6"] { --author-color: var(--warning); }
.comment-item[data-author-tone="7"] { --author-color: color-mix(in srgb, var(--danger) 62%, var(--primary) 38%); }

@media (max-width: 1050px) {
    .project-notification-control > span { display: none; }
    .project-background-editor { grid-template-columns: 220px minmax(0,1fr); }
}

@media (max-width: 760px) {
    .project-header { padding-right: 12px; }
    .project-identity { width: 100%; }
    .project-header-actions { position: static; order: 2; align-items: center; margin-left: 0; }
    .view-tabs { order: 3; }
    .project-notification-control { width: 95px; padding-left: 5px; }
    .project-notification-control select { width: 100%; }
    .project-header-actions .secondary-button { display: inline-flex; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar .text-button { justify-self: start; }
    .task-drawer.task-dialog { top: 0; right: 0; left: auto; width: 100vw; height: 100dvh; overflow-y: auto; border: 0; border-radius: 0; opacity: 1; transform: translateX(100%); }
    .task-drawer.task-dialog.open { transform: translateX(0); }
    .project-background-editor, .label-create-form { grid-template-columns: 1fr; }
    .label-manager-row { grid-template-columns: minmax(90px,1fr) 54px auto auto; }
    .label-manager-row .label-manager-preview { grid-column: 1 / -1; }
    .subtask-item { grid-template-columns: auto minmax(0,1fr); }
    .subtask-item .subtask-assignee, .subtask-item .subtask-actions { grid-column: 2; }
    .subtask-readonly { grid-column: 2; }
    .subtask-create-form { grid-template-columns: 1fr; }
    .comment-item { max-width: 94%; }
    .collapsible-content .inline-form { align-items: stretch; flex-direction: column; }
}

/* Accessibility and responsive refinement */
body { overflow-x: hidden; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; border: 2px solid var(--primary); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 800; transform: translateY(-160%); transition: transform var(--transition); }
.skip-link:focus { transform: translateY(0); }
input, select, textarea { border-color: var(--control-border); }
.avatar-button, .secondary-button, .small-button, .theme-option, .view-tabs, .project-notification-control, .label-check, .member-check { border-color: var(--control-border); }
.avatar-button { background: color-mix(in srgb,var(--surface) 76%,transparent); }
.icon-button { border-color: transparent; background: transparent; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--border); background: var(--surface-2); }
.text-button:disabled { cursor: default; opacity: .5; }
.inline-text-button { display: inline; padding: 0 2px; }
.danger-text-button { min-height: 30px; padding: 3px 6px; border: 0; background: transparent; color: var(--danger); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.danger-text-button:hover { text-decoration: underline; }

.nav-close-icon { display: none; }
.mobile-nav-toggle[aria-expanded="true"] .nav-open-icon { display: none; }
.mobile-nav-toggle[aria-expanded="true"] .nav-close-icon { display: block; }
.mobile-nav-backdrop { position: fixed; z-index: 90; inset: var(--header-height) 0 0; background: var(--backdrop); backdrop-filter: blur(2px); }
.notification-unread-label { width: fit-content; padding: 1px 6px; border-radius: 999px; background: var(--primary); color: var(--primary-ink) !important; font-size: 12px !important; font-weight: 850; text-transform: uppercase; }

/* Actionable project overview */
.project-tile, .project-tile-content { min-height: 292px; }
.project-tile-content { grid-template-rows: auto auto auto auto 1fr; }
.project-health { display: grid; align-self: end; gap: 7px; margin-top: 15px; padding-top: 12px; border-top: 1px solid color-mix(in srgb,var(--border) 82%,transparent); }
.project-progress-heading { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.project-health progress { width: 100%; height: 7px; border: 0; border-radius: 999px; accent-color: var(--primary); }
.project-health-meta { display: flex; justify-content: space-between; gap: 7px 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.project-health-empty { color: var(--muted); font-size: 12px; }
.overdue-indicator, .overdue-copy { color: var(--danger) !important; font-weight: 800; }
.overdue-indicator > span { display: inline-grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: var(--danger-soft); }
.project-tile.has-image .project-health { border-top-color: rgba(255,255,255,.25); }
.project-tile.has-image .project-progress-heading, .project-tile.has-image .project-health-meta, .project-tile.has-image .project-health-empty { color: rgba(255,255,255,.86); }
.project-tile.has-image progress::-webkit-progress-bar { background: rgba(255,255,255,.25); }
.attention-panel { border-color: color-mix(in srgb,var(--danger) 48%,var(--border)); background: color-mix(in srgb,var(--danger-soft) 32%,var(--surface)); }
.attention-panel .compact-list span { overflow: visible; white-space: normal; }

/* My Tasks: urgency remains understandable without colour. */

/* Personal and workspace settings stay distinct. */
.settings-grid { align-items: start; }
.timezone-field { display: grid; gap: 7px; }
.timezone-combobox { position: relative; }
.timezone-field select { position: absolute; z-index: 15; top: calc(100% + 5px); left: 0; max-height: min(260px, 42vh); min-height: 0; padding: 5px; background: var(--surface); box-shadow: var(--shadow); }
.timezone-field option { padding: 5px 7px; border-radius: 4px; }
.password-reset-panel { border-top-color: color-mix(in srgb,var(--warning) 35%,var(--border)) !important; }

/* Calendar views and legible multi-day events */
.calendar-toolbar-actions { display: flex; align-items: center; gap: 12px; }
.view-switch { display: inline-flex; flex: 0 0 auto; padding: 3px; border: 1px solid var(--control-border); border-radius: 9px; background: var(--canvas); }
.view-switch-button { min-height: 34px; padding: 5px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.view-switch-button.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.calendar-event { display: flex; min-height: 23px; align-items: center; gap: 4px; border: 1px solid color-mix(in srgb,var(--primary) 32%,var(--border)); border-left: 3px solid var(--primary); font-size: 12px; line-height: 1.25; }
.calendar-event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event-state, .calendar-span-marker { flex: 0 0 auto; font-weight: 900; }
.calendar-event-state { color: var(--success); }
.calendar-event.span-start, .calendar-event.span-middle, .calendar-event.span-end { background: color-mix(in srgb,var(--info) 11%,var(--surface-2)); border-color: color-mix(in srgb,var(--info) 42%,var(--border)); }
.calendar-event.span-start { border-radius: 5px 2px 2px 5px; }
.calendar-event.span-middle { border-left-style: dashed; border-radius: 2px; }
.calendar-event.span-end { border-left-style: dashed; border-radius: 2px 5px 5px 2px; }
.calendar-span-marker { color: var(--info); }
.calendar-more { display: block; width: 100%; min-height: 25px; padding: 2px 5px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; text-align: left; cursor: pointer; }
.calendar-more:hover { background: var(--surface-2); color: var(--text); }
.calendar-agenda { display: grid; gap: 0; min-height: 360px; padding: 4px 18px 20px; }
.agenda-day { padding: 16px 0; border-bottom: 1px solid var(--border); }
.agenda-day:last-child { border-bottom: 0; }
.agenda-day > h3 { margin: 0 0 9px; color: var(--muted); font-size: 12px; letter-spacing: .035em; text-transform: uppercase; }
.agenda-list { display: grid; gap: 6px; }
.agenda-event { display: grid; width: 100%; min-height: 58px; grid-template-columns: minmax(155px,190px) minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; background: var(--canvas); color: var(--text); text-align: left; cursor: pointer; }
a.agenda-event { text-decoration: none; }
.agenda-event:hover { border-color: var(--control-border); background: var(--surface-2); }
.agenda-event-date { color: var(--muted); font-size: 12px; }
.agenda-event-copy { display: grid; min-width: 0; gap: 2px; }
.agenda-event-copy strong, .agenda-event-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-event-copy > span { color: var(--muted); font-size: 12px; }
.agenda-event-stage { padding: 3px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 850; text-transform: capitalize; }
.agenda-event-stage.done { color: var(--success); }
.agenda-event-stage.working { color: var(--info); }
.agenda-event-stage.preparing { color: var(--warning); }
.agenda-event-stage.overdue { background: var(--danger-soft); color: var(--danger); }
.agenda-event.done .agenda-event-copy strong { text-decoration: line-through; }
.calendar-agenda-empty { display: grid; min-height: 340px; place-items: center; align-content: center; padding: 30px; text-align: center; }
.calendar-agenda-empty p { margin-bottom: 15px; }

/* Board filter disclosure and horizontal affordances */
.filter-bar { flex-wrap: wrap; overflow: visible; }
.filter-search-row { display: flex; min-width: 210px; flex: 1 1 240px; gap: 8px; }
.filter-search-row input { min-width: 0; }
.filter-sheet-trigger, .filter-sheet-heading, .filter-done { display: none; }
.filter-sheet { display: flex; flex: 0 1 auto; align-items: end; gap: 8px; }
.filter-sheet label { min-width: 128px; gap: 3px; color: var(--muted); font-size: 12px; }
.filter-sheet select { min-width: 128px; }
.filter-sheet-actions { display: flex; align-items: center; min-height: 40px; gap: 7px; }
.filter-sheet-backdrop { display: none; }
.active-filter-chips { display: flex; flex: 1 0 100%; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.filter-chip { min-height: 30px; flex: 0 0 auto; padding: 4px 9px; border: 1px solid var(--control-border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 750; cursor: pointer; }
.card-strip, .board-viewport { scroll-snap-type: x proximity; scroll-behavior: smooth; }
.card-tab-wrap, .kanban-column, .add-column-tile { scroll-snap-align: start; }
.card-strip.is-overflowing:not(.at-scroll-end) { mask-image: linear-gradient(to right,#000 0,#000 calc(100% - 32px),transparent 100%); }
.card-strip.is-overflowing:not(.at-scroll-start):not(.at-scroll-end) { mask-image: linear-gradient(to right,transparent 0,#000 28px,#000 calc(100% - 32px),transparent 100%); }
.card-strip.is-overflowing.at-scroll-end:not(.at-scroll-start) { mask-image: linear-gradient(to right,transparent 0,#000 28px,#000 100%); }
.board-viewport.is-overflowing { background-image: linear-gradient(to right,var(--canvas),transparent 18px),linear-gradient(to left,var(--canvas),transparent 18px); background-position: left,right; background-repeat: no-repeat; background-size: 24px 100%; }
.scroll-affordance { display: none; }

/* Arbitrary label colours always receive a contrast-selected foreground. */
.task-label { border-color: color-mix(in srgb,var(--label-color) 72%,#000); background: var(--label-color); color: var(--label-ink,#fff); text-shadow: none; }
.task-overdue-text { padding: 2px 6px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-weight: 850; }

/* The background stays decorative; sticky controls are opaque. */
.project-background img { filter: saturate(.78) contrast(.9) blur(2px); transform: scale(1.015); }
.project-workspace.has-project-background .project-header, .project-workspace.has-project-background .card-strip, .project-workspace.has-project-background .filter-bar { background: var(--canvas); backdrop-filter: none; }
.project-workspace.has-project-background .kanban-column, .project-workspace.has-project-background .calendar-shell, .project-workspace.has-project-background .project-insights { background: color-mix(in srgb,var(--surface) 97%,transparent); backdrop-filter: blur(16px); }

/* Task detail navigation, save access, and keyboard/touch ordering */
.drawer-header-actions { display: flex; align-items: center; gap: 8px; }
.drawer-save-button { min-height: 34px; padding: 5px 11px; }
.task-section-nav { position: sticky; z-index: 3; top: 0; display: flex; gap: 4px; padding: 7px 14px; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: thin; }
.task-section-nav a { min-height: 38px; display: inline-flex; flex: 0 0 auto; align-items: center; padding: 5px 9px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.task-section-nav a:hover, .task-section-nav a:focus-visible { background: var(--surface-2); color: var(--text); }
.task-section-anchor, .drawer-section[id] { scroll-margin-top: 58px; }
.task-position-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; }
.task-save-actions { position: sticky; z-index: 1; bottom: -15px; margin: 4px -15px -15px; padding: 12px 15px; border-top: 1px solid var(--border); background: color-mix(in srgb,var(--canvas) 96%,transparent); backdrop-filter: blur(12px); }
@media (min-width: 761px) {
    .task-dialog .drawer-body { max-height: calc(100% - 119px); }
}

@media (max-width: 760px) {
    .app-header { gap: 7px; }
    .mobile-nav-toggle, .header-actions .icon-button, .header-actions .avatar-button { width: 44px; height: 44px; }
    .header-logout-button { min-height: 44px; }
    .desktop-utility { display: none !important; }
    .primary-nav { padding: 10px 12px 16px; box-shadow: var(--shadow); }
    .primary-nav a, .primary-nav .primary-nav-button { min-height: 48px; padding: 0 14px; }
    .mobile-nav-open { overflow: hidden; }
    .account-menu { right: 10px; width: min(290px,calc(100vw - 20px)); }
    .account-menu a, .account-menu .menu-button { min-height: 44px; }
    .notification-panel { right: 10px; width: calc(100vw - 20px); }

    .primary-button, .secondary-button, .danger-button, .small-button { min-height: 44px; }
    .icon-button, .avatar-button { width: 44px; height: 44px; }
    .compact-icon { width: 44px; height: 44px; }
    input, select, textarea { min-height: 44px; }
    .compact-check, .switch-row, .member-check, .label-check { min-height: 44px; }
    .page-heading { gap: 16px; margin-bottom: 20px; }
    .external-ai-choices { grid-template-columns: 1fr; }

    .project-grid { grid-template-columns: 1fr; }
    .project-tile, .project-tile-content { min-height: 278px; }
    .dashboard-sidebar { display: grid; grid-template-columns: 1fr; }


    .settings-grid { gap: 14px; }

    .calendar-toolbar-actions { align-items: stretch; flex-direction: column; }
    .calendar-toolbar .view-switch { align-self: flex-start; }
    .view-switch-button { min-height: 40px; }
    .calendar-navigation { display: grid; grid-template-columns: 44px auto 44px minmax(0,1fr); }
    .calendar-navigation h2 { min-width: 0; margin: 0 0 0 3px; font-size: 17px; text-align: right; }
    .calendar-filters { align-items: stretch; flex-wrap: wrap; }
    .calendar-filters > label:has(select) { min-width: 150px; flex: 1; }
    .calendar-weekdays span { font-size: 12px; }
    .calendar-day { min-height: 92px; padding: 4px 3px; }
    .calendar-date { width: 32px; height: 32px; margin-bottom: 3px; }
    .calendar-event { min-height: 24px; padding: 3px 4px; font-size: 12px; }
    .calendar-span-marker { display: none; }
    .calendar-agenda { min-height: 300px; padding: 2px 12px 16px; }
    .agenda-event { min-height: 76px; grid-template-columns: 1fr auto; gap: 5px 9px; padding: 10px; }
    .agenda-event-date { grid-column: 1 / -1; }
    .agenda-event-copy { grid-column: 1; }
    .agenda-event-stage { grid-column: 2; grid-row: 2; align-self: start; }

    .project-header { gap: 8px 10px; }
    .project-identity .eyebrow { margin-bottom: 3px; }
    .project-identity p { display: none; }
    .project-header-actions { width: 100%; justify-content: space-between; }
    .project-notification-control { width: auto; min-width: 170px; min-height: 44px; }
    .project-notification-control .notification-control-label { display: inline; }
    .project-notification-control select { min-height: 34px; }
    .project-header-actions .secondary-button { width: 44px; height: 44px; }
    .view-tabs { min-height: 50px; }
    .view-tab { min-height: 44px; }
    .card-strip { min-height: 58px; scroll-padding-inline: 12px; }
    .card-tab-wrap .card-tab, .card-tab-wrap .card-edit-button, .add-card-tab { min-height: 44px; }

    .filter-bar { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; padding: 9px 12px; }
    .filter-search-row { display: grid; width: 100%; grid-template-columns: minmax(0,1fr) auto; }
    .filter-search-row input { grid-column: auto; }
    .filter-sheet-trigger { display: inline-flex; min-width: 92px; padding-inline: 11px; }
    .filter-count { display: inline-grid; min-width: 20px; height: 20px; place-items: center; padding: 0 5px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 12px; }
    .active-filter-chips { width: calc(100vw - 24px); padding-bottom: 2px; }
    .filter-chip { min-height: 38px; }
    .filter-sheet-backdrop { position: fixed; z-index: 238; inset: 0; display: block; background: var(--backdrop); backdrop-filter: blur(3px); }
    .filter-sheet { position: fixed; z-index: 240; right: 0; bottom: 0; left: 0; display: grid; max-height: min(82dvh,690px); padding: 18px 16px max(18px,env(safe-area-inset-bottom)); overflow-y: auto; border: 1px solid var(--control-border); border-radius: 18px 18px 0 0; background: var(--surface); box-shadow: var(--shadow); transform: translateY(105%); visibility: hidden; transition: transform 190ms ease,visibility 190ms; }
    .filter-sheet.open { transform: translateY(0); visibility: visible; }
    .filter-sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; }
    .filter-sheet-heading h2 { margin: 0; font-size: 24px; }
    .filter-sheet label { min-width: 0; gap: 6px; color: var(--text); font-size: 13px; }
    .filter-sheet select { width: 100%; min-width: 0; }
    .filter-sheet-actions { justify-content: space-between; min-height: 48px; margin-top: 4px; }
    .filter-done { display: inline-flex; }
    .filter-sheet-open { overflow: hidden; }

    .board-viewport { position: relative; scroll-padding-inline: 12px; }
    .board-viewport.is-overflowing .scroll-affordance { position: sticky; z-index: 3; left: 0; display: block; width: fit-content; margin: -4px 0 8px; padding: 3px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.14); }
    .kanban-column { max-height: calc(100dvh - 300px); }

    .project-calendar { padding: 12px; }
    .project-calendar .calendar-filters { flex-direction: column; }
    .project-calendar .view-switch { align-self: flex-start; }

    .project-insights { padding: 14px; overflow: visible; }

    .task-section-nav { top: 69px; padding-inline: 10px; }
    .task-section-nav a { min-height: 44px; }
    .drawer-save-button { min-height: 40px; }
    .drawer-header { min-height: 69px; padding: 10px 12px; }
    .drawer-header strong { max-width: 47vw; }
    .task-save-actions { bottom: -12px; margin: 4px -12px -12px; padding: 11px 12px max(11px,env(safe-area-inset-bottom)); }
    .task-position-controls { align-items: flex-start; flex-direction: column; }
    .task-position-controls .row-actions, .task-position-controls button { width: 100%; }
    .activity-log-heading { align-items: stretch; flex-direction: column; }
    .activity-log-actions { justify-content: flex-start; }
    .activity-log-settings .section-heading { align-items: stretch; flex-direction: column; }
    .activity-log-settings .secondary-button { width: 100%; }
}

@media (max-width: 430px) {
    .brand { gap: 7px; }
    .brand-mark { width: 28px; height: 28px; }
    .header-actions { gap: 2px; }
    .project-notification-control { min-width: 154px; }
    .notification-control-label { font-size: 12px; }
    .calendar-navigation { grid-template-columns: 44px auto 44px; }
    .calendar-navigation h2 { grid-column: 1 / -1; margin-top: 3px; text-align: left; }
}

/* Shared Month / Week / Day / Agenda calendar */
.calendar-experience {
    --calendar-grid-line: color-mix(in srgb,var(--border) 70%,transparent);
    --calendar-grid-line-soft: color-mix(in srgb,var(--border) 38%,transparent);
    --calendar-muted-surface: color-mix(in srgb,var(--canvas) 64%,var(--surface));
    --calendar-today: color-mix(in srgb,var(--primary) 7%,transparent);
    --calendar-event-color: var(--primary);
    --calendar-time-gutter: 64px;
    --calendar-day-count: 7;
    --calendar-month-lanes: 1;
    --calendar-all-day-lanes: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 1px 0 var(--edge-highlight);
}

.calendar-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px 22px 34px;
}

.calendar-workspace {
    min-height: calc(100dvh - var(--header-height) - 54px);
}

.calendar-experience .calendar-toolbar {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--calendar-grid-line);
    background: color-mix(in srgb,var(--surface) 96%,var(--canvas));
}

.calendar-heading-group,
.calendar-heading-row,
.calendar-experience .calendar-heading,
.calendar-experience .calendar-navigation,
.calendar-experience .calendar-toolbar-actions,
.calendar-experience .calendar-filters {
    display: flex;
    align-items: center;
}

.calendar-heading-group,
.calendar-heading-row { gap: 18px; }
.calendar-experience .calendar-heading { min-width: 0; align-items: flex-start; flex-direction: column; gap: 1px; }
.calendar-experience .calendar-heading h1,
.calendar-experience .calendar-heading h2,
.calendar-heading-row > h2 {
    margin: 0;
    font-size: clamp(23px,2.2vw,30px);
    line-height: 1.08;
    letter-spacing: -.035em;
    white-space: nowrap;
}
.calendar-experience .calendar-heading h1 { font-size: clamp(25px,2.5vw,32px); }
.calendar-heading-row + .calendar-summary,
.calendar-experience .calendar-summary { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.calendar-experience .calendar-navigation { flex: 0 0 auto; gap: 7px; }
.calendar-experience .calendar-navigation .icon-button { width: 36px; height: 36px; border-color: var(--border); background: var(--canvas); }
.calendar-experience .calendar-navigation .secondary-button { min-height: 36px; padding: 6px 12px; background: var(--canvas); }
.calendar-experience .calendar-toolbar-actions { justify-content: flex-end; gap: 12px; }
.calendar-experience .calendar-filters { gap: 9px; }
.calendar-experience .calendar-filters select { min-width: 150px; background-color: var(--canvas); }
.calendar-experience .compact-check { min-height: 38px; margin: 0; padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); white-space: nowrap; }

.calendar-experience .view-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--canvas);
}
.calendar-experience .view-switch-button { min-height: 32px; padding: 5px 12px; border-radius: 7px; }
.calendar-experience .view-switch-button.active { background: var(--surface-3); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--border-strong) 35%,transparent); }

.calendar-viewport { position: relative; min-width: 0; background: var(--calendar-muted-surface); }
.calendar-viewport[aria-busy="true"] { cursor: progress; }
.calendar-viewport[aria-busy="true"]::after {
    content: "";
    position: absolute;
    z-index: 30;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg,transparent,var(--primary),transparent);
    animation: calendar-loading 1.1s linear infinite;
}
@keyframes calendar-loading { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.calendar-panel { min-width: 0; background: var(--calendar-muted-surface); }

/* Month */
.calendar-month-grid { min-width: 700px; }
.calendar-month-weekdays {
    display: grid;
    height: 33px;
    grid-template-columns: repeat(7,minmax(0,1fr));
    align-items: center;
    border-bottom: 1px solid var(--calendar-grid-line);
    background: var(--surface);
}
.calendar-month-weekdays span {
    height: 100%;
    padding: 9px 12px 7px;
    border-right: 1px solid var(--calendar-grid-line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    line-height: 1;
    text-transform: uppercase;
}
.calendar-month-weekdays span:last-child { border-right: 0; }
.calendar-month-body {
    display: grid;
    min-height: calc(100dvh - var(--header-height) - 170px);
    grid-template-rows: repeat(6,minmax(122px,1fr));
}
.project-calendar .calendar-month-body { min-height: calc(100dvh - var(--header-height) - 260px); }
.calendar-month-week {
    position: relative;
    min-height: 122px;
    border-bottom: 1px solid var(--calendar-grid-line);
}
.calendar-month-week:last-child { border-bottom: 0; }
.calendar-month-days {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(7,minmax(0,1fr));
}
.calendar-month-day {
    position: relative;
    min-width: 0;
    padding: 7px 9px;
    border-right: 1px solid var(--calendar-grid-line);
    background: color-mix(in srgb,var(--surface) 92%,var(--canvas));
    cursor: default;
    transition: background var(--transition);
}
.calendar-month-day:last-child { border-right: 0; }
.calendar-month-day.outside { background: color-mix(in srgb,var(--canvas) 80%,var(--surface)); color: color-mix(in srgb,var(--muted) 66%,transparent); }
.calendar-month-day.today { background: var(--calendar-today); }
.calendar-month-day.is-selecting { background: color-mix(in srgb,var(--primary) 15%,var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--primary) 42%,transparent); }
.calendar-month-day.calendar-keyboard-selected { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-month-date {
    position: relative;
    z-index: 4;
    display: inline-flex;
    width: auto;
    min-width: 25px;
    height: 25px;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 0 5px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 780;
    cursor: pointer;
}
.calendar-month-date:hover:not(:disabled) { background: var(--surface-3); }
.calendar-month-day.today .calendar-month-date { background: color-mix(in srgb,var(--primary) 17%,transparent); color: var(--primary); }
.calendar-month-day.today .calendar-month-date::after { content: "Today"; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.calendar-month-event-layer {
    position: absolute;
    z-index: 5;
    top: 39px;
    right: 0;
    left: 0;
    display: grid;
    grid-auto-rows: 24px;
    grid-template-columns: repeat(7,minmax(0,1fr));
    gap: 3px 0;
    pointer-events: none;
}

/* Events use persisted project/task colours supplied by the API. */
.calendar-experience .calendar-event {
    --calendar-event-surface: color-mix(in srgb,var(--calendar-event-color) 23%,var(--surface));
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 22px;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    padding: 3px 7px;
    border: 1px solid color-mix(in srgb,var(--calendar-event-color) 32%,var(--border));
    border-left: 3px solid var(--calendar-event-color);
    border-radius: 5px;
    background: var(--calendar-event-surface);
    color: var(--text);
    font-size: 12px;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
}
.calendar-experience .calendar-event:hover { filter: brightness(1.1); border-color: color-mix(in srgb,var(--calendar-event-color) 65%,var(--border)); }
.calendar-experience .calendar-event:focus-visible { z-index: 20; }
.calendar-experience .calendar-event.done { opacity: .62; }
.calendar-experience .calendar-event.done .calendar-event-title,
.calendar-experience .calendar-event.done .calendar-timed-title { text-decoration: line-through; }
.calendar-month-event { margin-inline: 3px; }
.calendar-event-title { min-width: 0; flex: 1; overflow: hidden; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event-time { flex: 0 0 auto; color: color-mix(in srgb,var(--text) 66%,var(--muted)); font-size: 12px; font-variant-numeric: tabular-nums; }
.calendar-event.continues-before { border-radius: 1px 5px 5px 1px; }
.calendar-event.continues-after { border-radius: 5px 1px 1px 5px; }
.calendar-event.continues-before.continues-after { border-radius: 1px; }
.calendar-event.continues-before::before { content: "‹"; flex: 0 0 auto; color: var(--calendar-event-color); font-weight: 900; }
.calendar-event.continues-after::after { content: "›"; flex: 0 0 auto; margin-left: auto; color: var(--calendar-event-color); font-weight: 900; }

/* Shared Week / Day header and all-day rail */
.calendar-time-grid { --calendar-time-gutter: 64px; min-width: 760px; background: var(--calendar-muted-surface); }
.calendar-experience[data-calendar-active-view="day"] .calendar-time-grid { min-width: 0; }
.calendar-time-header {
    display: grid;
    min-height: 44px;
    grid-template-columns: var(--calendar-time-gutter) repeat(var(--calendar-day-count),minmax(0,1fr));
    border-bottom: 1px solid var(--calendar-grid-line);
    background: var(--surface);
}
.calendar-time-corner { border-right: 1px solid var(--calendar-grid-line); }
.calendar-time-date {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: flex-start;
    gap: 8px;
    padding: 9px 13px;
    border: 0;
    border-right: 1px solid var(--calendar-grid-line);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.calendar-time-date:last-child { border-right: 0; }
.calendar-time-date:hover:not(:disabled) { background: var(--surface-2); }
.calendar-time-date.today { background: var(--calendar-today); color: var(--primary); }
.calendar-time-weekday { color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.calendar-time-date.today .calendar-time-weekday { color: var(--primary); }
.calendar-time-date-number { font-size: 16px; line-height: 1; }
.calendar-all-day-row {
    display: grid;
    grid-template-columns: var(--calendar-time-gutter) minmax(0,1fr);
    border-bottom: 1px solid var(--calendar-grid-line);
    background: color-mix(in srgb,var(--surface) 92%,var(--canvas));
}
.calendar-all-day-label {
    padding: 14px 9px;
    border-right: 1px solid var(--calendar-grid-line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.calendar-all-day-track {
    position: relative;
    display: grid;
    min-height: 41px;
    grid-auto-rows: 25px;
    grid-template-columns: repeat(var(--calendar-day-count),minmax(0,1fr));
    gap: 3px 0;
    padding: 6px 0;
}
.calendar-all-day-event { margin-inline: 4px; }
.calendar-all-day-empty { align-self: center; grid-column: 1 / -1; padding-left: 11px; color: var(--muted); font-size: 12px; }

/* 24-hour time canvas; quarter-hours are visible, hours are labelled. */
.calendar-time-scroll {
    position: relative;
    height: clamp(430px,calc(100dvh - var(--header-height) - 260px),850px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--border-strong) var(--canvas);
}
.project-calendar .calendar-time-scroll { height: clamp(410px,calc(100dvh - var(--header-height) - 340px),780px); }
.calendar-time-canvas { position: relative; min-width: 100%; background: color-mix(in srgb,var(--canvas) 76%,var(--surface)); }
.calendar-time-gutter {
    position: absolute;
    z-index: 4;
    inset: 0 auto 0 0;
    width: var(--calendar-time-gutter);
    border-right: 1px solid var(--calendar-grid-line);
    background: color-mix(in srgb,var(--canvas) 84%,var(--surface));
    pointer-events: none;
}
.calendar-hour-label {
    position: absolute;
    right: 10px;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transform: translateY(-50%);
}
.calendar-hour-label:first-child { transform: none; }
.calendar-time-columns,
.calendar-timed-event-layer,
.calendar-time-selection-layer {
    position: absolute;
    inset: 0 0 0 var(--calendar-time-gutter);
}
.calendar-time-columns { z-index: 1; display: grid; grid-template-columns: repeat(var(--calendar-day-count),minmax(0,1fr)); }
.calendar-time-day {
    position: relative;
    min-width: 0;
    border-right: 1px solid var(--calendar-grid-line);
    background-image:
        repeating-linear-gradient(to bottom,transparent 0,transparent 14px,var(--calendar-grid-line-soft) 14px,var(--calendar-grid-line-soft) 15px),
        repeating-linear-gradient(to bottom,transparent 0,transparent 59px,var(--calendar-grid-line) 59px,var(--calendar-grid-line) 60px);
    cursor: crosshair;
    touch-action: pan-y;
}
.calendar-time-day:last-child { border-right: 0; }
.calendar-time-day.today { background-color: var(--calendar-today); }
.calendar-time-day:focus-visible { z-index: 5; outline-offset: -3px; }
.calendar-timed-event-layer { z-index: 7; pointer-events: none; }
.calendar-timed-event {
    position: absolute !important;
    display: block !important;
    min-height: 15px !important;
    padding: 6px 8px !important;
    overflow: hidden;
    border-radius: 7px !important;
}
.calendar-timed-title,
.calendar-timed-time { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-timed-title { font-size: 12px; }
.calendar-timed-time { margin-top: 4px; color: color-mix(in srgb,var(--text) 65%,var(--muted)); font-size: 12px; font-weight: 500; }
.calendar-time-selection-layer { z-index: 6; pointer-events: none; }
.calendar-time-selection,
.calendar-time-keyboard-preview {
    position: absolute;
    margin-inline: 2px;
    border: 1px solid color-mix(in srgb,var(--primary) 72%,transparent);
    border-radius: 5px;
    background: color-mix(in srgb,var(--primary) 19%,transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--primary) 13%,transparent);
}
.calendar-time-selection::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg,transparent 0 7px,color-mix(in srgb,var(--primary) 13%,transparent) 7px 9px); }
.calendar-time-keyboard-preview { border-style: dashed; border-width: 2px; background: color-mix(in srgb,var(--primary) 10%,transparent); }
.calendar-current-time {
    position: absolute;
    z-index: 9;
    height: 1px;
    background: var(--primary);
    pointer-events: none;
}
.calendar-current-time::before { content: ""; position: absolute; top: -3px; left: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.calendar-selecting, .calendar-selecting * { user-select: none; }

/* Agenda stays available as a compact, readable alternative. */
.calendar-experience .calendar-agenda {
    display: grid;
    min-height: min(620px,calc(100dvh - var(--header-height) - 150px));
    gap: 0;
    padding: 4px 20px 22px;
    background: var(--calendar-muted-surface);
}
.calendar-experience .agenda-day { padding: 17px 0; border-bottom-color: var(--calendar-grid-line); }
.calendar-experience .agenda-day > h3 { color: var(--muted); letter-spacing: .08em; }
.calendar-experience .agenda-event {
    display: grid;
    min-height: 58px;
    grid-template-columns: minmax(150px,190px) minmax(0,1fr) auto;
    padding: 10px 12px;
    background: color-mix(in srgb,var(--calendar-event-color) 8%,var(--canvas));
}
.calendar-experience .calendar-agenda-empty { min-height: 420px; }

/* Calendar date and colour controls */
.calendar-task-dates { align-items: end; }
.calendar-color-field .color-input-row { display: flex; align-items: center; gap: 11px; }
.calendar-color-field input[type="color"] { width: 52px; min-width: 52px; height: 38px; padding: 3px; }

@media (max-width: 1100px) {
    .calendar-experience .calendar-toolbar { align-items: stretch; flex-direction: column; gap: 11px; }
    .calendar-heading-group, .calendar-heading-row { justify-content: space-between; }
    .calendar-experience .calendar-toolbar-actions { justify-content: space-between; }
    .calendar-experience .calendar-filters { margin-left: auto; }
    .calendar-month-body { min-height: 760px; }
}

@media (max-width: 760px) {
    .calendar-main { padding: 12px 10px 24px; }
    .calendar-workspace { min-height: calc(100dvh - var(--header-height) - 36px); }
    .calendar-experience { border-radius: 11px; }
    .calendar-experience .calendar-toolbar { min-height: 0; padding: 12px; }
    .calendar-heading-group, .calendar-heading-row { align-items: flex-start; flex-wrap: wrap; gap: 9px; }
    .calendar-heading-group { display: grid; grid-template-columns: 1fr auto; }
    .calendar-heading-group .calendar-heading { min-width: 0; }
    .calendar-experience .calendar-heading h1,
    .calendar-experience .calendar-heading h2,
    .calendar-heading-row > h2 { font-size: 22px; white-space: normal; }
    .calendar-experience .calendar-navigation { grid-column: 2; grid-row: 1 / span 2; }
    .calendar-experience .calendar-navigation .icon-button { width: 40px; height: 40px; }
    .calendar-experience .calendar-navigation .secondary-button { display: none; }
    .calendar-experience .calendar-toolbar-actions { align-items: stretch; flex-direction: column; overflow: hidden; }
    .calendar-experience .view-switch { width: 100%; overflow-x: auto; }
    .calendar-experience .view-switch-button { min-height: 40px; min-width: 70px; flex: 1; }
    .calendar-experience .calendar-filters { width: 100%; margin: 0; align-items: stretch; flex-wrap: wrap; }
    .calendar-experience .calendar-project-filter { min-width: 130px; flex: 1; }
    .calendar-experience .calendar-filters select { width: 100%; min-width: 0; }
    .calendar-experience .calendar-filters .primary-button { margin-left: auto; }
    .calendar-viewport { overflow-x: auto; }
    .calendar-month-grid { min-width: 680px; }
    .calendar-month-body { min-height: 650px; grid-template-rows: repeat(6,minmax(105px,1fr)); }
    .project-calendar .calendar-month-body { min-height: 650px; }
    .calendar-month-week { min-height: 105px; }
    .calendar-month-day { padding: 5px 6px; }
    .calendar-month-event-layer { top: 35px; grid-auto-rows: 22px; gap: 2px 0; }
    .calendar-experience .calendar-event { padding: 3px 5px; font-size: 12px; }
    .calendar-event-time { display: none; }
    .calendar-time-grid { min-width: 720px; }
    .calendar-experience[data-calendar-active-view="day"] .calendar-time-grid { min-width: 100%; }
    .calendar-time-scroll, .project-calendar .calendar-time-scroll { height: calc(100dvh - var(--header-height) - 300px); min-height: 430px; }
    .calendar-experience .calendar-agenda { min-width: min(100%,680px); padding: 2px 12px 16px; }
    .calendar-experience .agenda-event { min-height: 76px; grid-template-columns: 1fr auto; gap: 5px 9px; }
    .calendar-experience .agenda-event-date { grid-column: 1 / -1; }
    .calendar-experience .agenda-event-copy { grid-column: 1; }
    .calendar-experience .agenda-event-stage { grid-column: 2; grid-row: 2; align-self: start; }
}

@media (max-width: 430px) {
    .calendar-heading-group { grid-template-columns: minmax(0,1fr) auto; }
    .calendar-experience .calendar-navigation { gap: 4px; }
    .calendar-experience .calendar-filters .compact-check { flex: 1; }
    .calendar-experience .calendar-filters .primary-button { flex: 1; }
    .calendar-color-field .color-input-row { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .calendar-viewport[aria-busy="true"]::after { animation: none; }
    .calendar-time-scroll { scroll-behavior: auto; }
}

/* Full-screen task detail experience */
.task-backdrop { background: var(--backdrop-strong); backdrop-filter: blur(5px); }
.task-drawer.task-dialog {
    --task-rail-width: clamp(350px,25vw,420px);
    position: fixed;
    z-index: 200;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    display: flex;
    width: min(1500px,calc(100vw - 48px));
    height: min(1200px,calc(100dvh - 32px));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    background: var(--canvas);
    box-shadow: 0 28px 90px rgba(0,0,0,.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%,-47%) scale(.992);
    transition: opacity 150ms ease,transform 190ms ease,visibility 190ms;
}
.task-drawer.task-dialog.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%,-50%) scale(1); }
.task-dialog :is(button,input,textarea,select):focus-visible {
    outline: 2px solid #efad16;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--text);
}

.task-detail-header { position: relative; z-index: 20; flex: 0 0 auto; padding: 25px 30px 28px; border-bottom: 1px solid var(--border); background: var(--canvas); }
.task-header-row { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 18px; }
.task-breadcrumb { display: flex; min-width: 0; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.task-breadcrumb > span:first-child, .task-breadcrumb-column > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-breadcrumb-column { display: inline-flex; min-width: 0; align-items: center; gap: 8px; color: var(--primary); }
.task-breadcrumb-column i, .task-status-dot { display: inline-block; width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--muted); }
[data-task-header-tone="preparing"] i, [data-status-tone="preparing"] .task-status-dot { background: var(--primary); }
[data-task-header-tone="working"] i, [data-status-tone="working"] .task-status-dot { background: var(--info); }
[data-task-header-tone="blocked"] i, [data-status-tone="blocked"] .task-status-dot { background: var(--danger); }
[data-task-header-tone="done"] i, [data-status-tone="done"] .task-status-dot { background: #b4bbc3; }
.task-back-button { display: none; }
.task-title-input {
    width: min(1000px,calc(100vw - var(--task-rail-width) - 90px));
    min-height: 52px;
    margin: 10px 0 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: clamp(30px,2.5vw,42px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.04em;
    text-overflow: ellipsis;
}
.task-title-input:focus { border: 0; box-shadow: none; }
.task-title-input:disabled { cursor: default; opacity: 1; }
.task-header-actions { display: flex; align-items: center; gap: 12px; }
.task-saved-state { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.task-header-save { min-width: 96px; min-height: 54px; padding-inline: 22px; border-radius: 12px; font-size: 16px; }
.task-header-save:disabled, .task-mobile-savebar [data-task-save]:disabled { opacity: 1; cursor: default; }
.task-overflow-button, .task-close-button { width: 54px; height: 54px; border-color: var(--border); border-radius: 12px; background: color-mix(in srgb,var(--surface) 45%,transparent); }
.task-overflow-wrap { position: relative; }
.task-overflow-menu { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; display: grid; width: 300px; padding: 10px 20px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.task-overflow-menu button { min-height: 52px; padding: 9px 4px; border: 0; background: transparent; color: var(--text); font-weight: 720; text-align: left; cursor: pointer; }
.task-overflow-menu button:hover { color: var(--primary); }
.task-overflow-menu button.danger { color: var(--danger); }
.task-menu-divider { height: 1px; margin: 3px 0 8px; background: var(--border); }

.task-loading { display: grid; min-height: 0; flex: 1 1 auto; place-items: center; padding: 30px; }
.task-detail-body {
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0,1fr) var(--task-rail-width);
    grid-template-areas:
        "description rail"
        "tabs rail"
        "panel rail";
    grid-template-rows: auto auto minmax(0,1fr);
    align-content: start;
    overflow: hidden;
    background: var(--canvas);
}
.task-details-form { display: contents; }
.task-description-panel { grid-area: description; display: grid; gap: 12px; padding: 32px 30px 28px; }
.task-description-panel > label, .task-property-group > h3, .task-property-group > legend, .task-calendar-colour > span {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 820;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.task-description-panel textarea { min-height: 220px; padding: 19px 20px; border-color: var(--border); border-radius: 15px; background: color-mix(in srgb,var(--surface) 45%,var(--canvas)); font-size: 16px; line-height: 1.55; }
.task-property-rail { grid-area: rail; grid-row: 1 / -1; min-width: 0; min-height: 0; height: 100%; padding: 32px 26px 80px; overflow-y: auto; border-left: 1px solid var(--border); background: color-mix(in srgb,var(--canvas) 97%,var(--surface)); }
.task-property-group { position: relative; min-width: 0; margin: 0 0 27px; padding: 0; border: 0; }
.task-property-group > h3, .task-property-group > legend { margin-bottom: 10px; }
.task-property-group > legend { float: left; width: 100%; }
.task-property-group > legend + * { clear: both; }

.task-status-picker { position: relative; }
.task-status-trigger, .task-reminder-trigger, .task-date-field > button {
    display: flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb,var(--surface) 48%,var(--canvas));
    color: var(--text);
    font-weight: 740;
    text-align: left;
    cursor: pointer;
}
.task-chevron, .task-reminder-trigger > span:last-child, .task-date-field > button > span:last-child { margin-left: auto; color: var(--muted); font-size: 12px; }
.task-status-menu, .task-choice-menu { position: absolute; z-index: 55; top: calc(100% + 7px); right: 0; left: 0; display: grid; gap: 3px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.task-status-option { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 11px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 650; text-align: left; cursor: pointer; }
.task-status-option:hover, .task-status-option[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

.task-picker { position: relative; display: flex; min-height: 40px; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-picker-summary { display: contents; }
.task-person-pill { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border: 1px solid color-mix(in srgb,var(--primary) 25%,var(--border)); border-radius: 999px; background: color-mix(in srgb,var(--primary) 8%,var(--surface)); color: color-mix(in srgb,var(--primary) 72%,var(--text)); font-weight: 750; }
.task-person-avatar, .comment-compose-avatar { display: inline-grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-style: normal; font-size: 12px; font-weight: 900; }
.task-picker-add { min-height: 38px; padding: 6px 13px; border: 1px dashed var(--border-strong); border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.task-picker-add:hover { border-color: var(--primary); color: var(--text); }
.task-choice-menu { top: calc(100% + 5px); min-width: 230px; max-height: 260px; overflow-y: auto; }
.task-choice-option { display: flex; min-height: 42px; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.task-choice-option:hover { background: var(--surface-2); }
.task-choice-option > input { width: 18px; min-height: 18px; }
.task-choice-option .task-label { pointer-events: none; }
.task-selected-label { min-height: 36px; padding-inline: 14px; font-size: 12px; }
.task-picker-empty { padding: 10px; }

.task-schedule-property { padding-top: 27px; border-top: 1px solid var(--border); }
.task-property-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.task-property-heading h3 { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 820; letter-spacing: .09em; text-transform: uppercase; }
.task-property-heading strong { font-size: 13px; line-height: 1.35; }
.task-property-heading .text-button { min-height: 28px; padding: 2px 0; }
.task-schedule-card { position: relative; padding: 17px 15px 19px; border: 1px solid var(--border); border-radius: 15px; background: color-mix(in srgb,var(--surface) 43%,var(--canvas)); }
.task-all-day { display: flex; min-height: 32px; align-items: center; gap: 11px; margin-bottom: 16px; font-size: 14px; }
.task-all-day input { width: 22px; min-height: 22px; }
.task-date-fields { display: grid; grid-template-columns: minmax(0,1fr); gap: 11px; }
.task-date-field { position: relative; gap: 6px; }
.task-date-field > span:first-child { color: var(--muted); font-size: 12px; font-weight: 730; }
.task-date-field > button { min-height: 48px; padding: 9px 12px; }
.task-date-field > button strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Two classes so the generic input:disabled opacity rules can never reveal these. */
.task-date-field .task-date-native { position: absolute; width: 1px; min-height: 1px; padding: 0; border: 0; opacity: 0; clip-path: inset(50%); pointer-events: none; }
.task-schedule-readonly { display: grid; gap: 10px; margin: 0; }
.task-schedule-readonly > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.task-schedule-readonly dt { color: var(--muted); font-size: 12px; font-weight: 730; }
.task-schedule-readonly dd { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; text-align: right; }
.task-schedule-readonly dd i { width: 19px; height: 12px; border-radius: 3px; background: var(--swatch,#c084d8); }

.task-date-picker { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--canvas); box-shadow: 0 12px 30px rgba(0,0,0,.15); }
.task-date-picker-heading, .task-date-month-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-date-picker-heading { margin-bottom: 11px; }
.task-date-picker-heading > strong { color: var(--primary); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.task-date-picker-heading .text-button { min-height: 34px; padding: 4px; color: var(--muted); }
.task-date-month-heading { margin-bottom: 8px; }
.task-date-month-heading .icon-button { width: 38px; height: 38px; border-color: var(--border); background: var(--surface); }
.task-date-month-heading > strong { font-size: 15px; }
.task-date-weekdays, .task-date-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); text-align: center; }
.task-date-weekdays { margin: 5px 0; color: var(--muted); font-size: 12px; }
.task-date-grid { gap: 2px 1px; }
.task-date-empty { min-height: 33px; }
.task-date-day { min-width: 0; min-height: 33px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--text); font-size: 12px; font-weight: 670; cursor: pointer; }
.task-date-day:hover { background: var(--surface-2); }
.task-date-day.selected { background: var(--primary); color: var(--primary-ink); }
.task-time-picker { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.task-time-stepper { display: grid; min-width: 118px; grid-template-columns: 32px 1fr 32px; align-items: center; border: 1px solid var(--border); border-radius: 11px; }
.task-time-stepper button { min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.task-time-stepper output { color: var(--text); font: 18px/1 ui-monospace,SFMono-Regular,Consolas,monospace; text-align: center; }
.task-time-shortcuts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.task-time-shortcuts button { min-height: 29px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted); font: 10px/1 ui-monospace,SFMono-Regular,Consolas,monospace; cursor: pointer; }

.task-calendar-colour { display: grid; gap: 9px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--border); }
.task-calendar-colour > span { text-transform: none; letter-spacing: 0; }
.task-colour-swatches { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.task-colour-swatches button { width: 31px; height: 31px; flex: 0 1 31px; padding: 0; border: 2px solid transparent; border-radius: 9px; background: var(--swatch); cursor: pointer; }
.task-colour-swatches button.selected { border-color: var(--canvas); outline: 2px solid var(--swatch); outline-offset: 1px; }
.task-custom-colour { position: relative; display: flex; width: fit-content; min-height: 31px; align-items: center; gap: 8px; padding: 4px 9px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--muted); font: 10px/1 ui-monospace,SFMono-Regular,Consolas,monospace; cursor: pointer; }
.task-custom-colour.selected { border-color: var(--primary); }
.task-custom-colour input, .task-custom-colour input:disabled { position: absolute; width: 1px; min-height: 1px; padding: 0; border: 0; opacity: 0; clip-path: inset(50%); }
.task-custom-colour i { width: 19px; height: 12px; background: var(--swatch,#c084d8); }
.task-calendar-colour > small, .task-reminders-property > small { color: color-mix(in srgb,var(--muted) 76%,transparent); font: 10px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace; }

.task-reminders-property { padding-top: 4px; }
.task-reminder-trigger { min-height: 48px; }
.task-reminder-menu { display: grid; gap: 3px; margin-top: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 13px; background: color-mix(in srgb,var(--surface) 55%,var(--canvas)); }
.task-reminder-option { display: flex; min-height: 42px; align-items: center; gap: 10px; padding: 6px 7px; border-radius: 8px; cursor: pointer; }
.task-reminder-option:hover { background: var(--surface-2); }
.task-reminder-option input { width: 18px; min-height: 18px; }
.task-reminder-option input:checked + span { color: var(--text); font-weight: 750; }
.task-reminders-property > small { display: block; margin-top: 9px; }

.task-tabs { grid-area: tabs; display: flex; min-width: 0; gap: 4px; margin: 0 30px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.task-tab { position: relative; display: inline-flex; min-height: 58px; flex: 0 0 auto; align-items: center; gap: 8px; padding: 9px 17px; border: 0; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.task-tab::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; }
.task-tab.active { color: var(--text); }
.task-tab.active::after { background: var(--primary); }
.task-tab-count { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.task-tab.active .task-tab-count { color: var(--primary); }
.task-details-tab, .task-tab-mobile-label { display: none; }

.task-work-panel { grid-area: panel; min-width: 0; min-height: 0; padding: 27px 30px 60px; overflow-y: auto; }
.conversation-section { display: flex; height: 100%; min-height: 0; flex-direction: column; overflow: hidden; }
.comment-list { display: grid; min-height: 0; flex: 1 1 auto; align-content: start; gap: 18px; padding-right: 8px; overflow-y: auto; scrollbar-gutter: stable; }
.comment-item { --author-color: var(--info); display: flex; width: fit-content; max-width: 88%; align-items: end; gap: 10px; padding: 0; background: transparent; }
.comment-item.mine { --author-color: var(--primary); margin-left: auto; flex-direction: row-reverse; }
.comment-content { display: grid; min-width: 0; gap: 6px; }
.comment-item.mine .comment-content { justify-items: end; }
.comment-item header { display: flex; min-height: 18px; align-items: center; justify-content: flex-start; gap: 8px; margin: 0; color: var(--muted); font-size: 12px; }
.comment-item.mine header { justify-content: flex-end; }
.comment-item header strong { color: var(--author-color); }
.comment-bubble { min-width: 170px; padding: 13px 15px; border: 1px solid color-mix(in srgb,var(--author-color) 31%,var(--border)); border-radius: 14px 14px 14px 4px; background: color-mix(in srgb,var(--author-color) 9%,var(--surface)); }
.comment-item.mine .comment-bubble { border-radius: 14px 14px 4px 14px; background: color-mix(in srgb,var(--author-color) 13%,var(--surface)); }
.comment-bubble .comment-body { color: var(--text); font-size: 14px; line-height: 1.55; }
.comment-avatar { width: 36px; height: 36px; flex-basis: 36px; }
.comment-delete { min-height: 20px; padding: 0 3px; opacity: 0; transition: opacity var(--transition); }
.comment-item:hover .comment-delete, .comment-item:focus-within .comment-delete { opacity: 1; }
.comment-time-short { display: none; }
.comment-compose { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; grid-template-rows: auto auto; flex: 0 0 auto; align-items: end; gap: 8px 10px; margin-top: 24px; padding-top: 23px; border-top: 1px solid var(--border); background: var(--canvas); }
.comment-compose-avatar { align-self: start; width: 36px; height: 36px; }
.comment-compose textarea { min-height: 88px; grid-column: 2 / 4; padding: 15px; border-radius: 14px; background: color-mix(in srgb,var(--surface) 48%,var(--canvas)); }
.comment-shortcut { grid-column: 2; color: var(--muted); font-size: 12px; }
.comment-compose .primary-button { grid-column: 3; min-width: 84px; }
.comment-send-icon { display: none; }

.subtask-progress-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16px; margin: 1px 0 18px; }
.subtask-progress-row strong { color: var(--muted); font-size: 12px; }
.subtask-progress { height: 8px; accent-color: var(--primary); }
.subtask-progress::-webkit-progress-value { background: var(--primary); }
.subtask-progress::-moz-progress-bar { background: var(--primary); }
.subtask-list { display: grid; gap: 6px; }
.subtask-item { position: relative; display: grid; min-height: 56px; grid-template-columns: auto minmax(0,1fr) minmax(90px,150px) auto; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; }
.subtask-item:hover { background: color-mix(in srgb,var(--surface) 50%,transparent); }
.subtask-item > input[type="checkbox"] { width: 23px; min-height: 23px; }
.subtask-title-input { min-height: 36px; padding: 4px 2px; border: 0; background: transparent; font-weight: 650; }
.subtask-title-input:focus { border: 0; box-shadow: none; }
.subtask-item.completed { opacity: .7; }
.subtask-assignee-picker { position: relative; display: grid; min-height: 36px; place-items: center end; color: var(--muted); font-size: 12px; }
.subtask-assignee-picker select { position: absolute; inset: 0; min-height: 0; opacity: 0; cursor: pointer; }
.subtask-assignee-initial { display: none; }
.subtask-actions { opacity: 0; transition: opacity var(--transition); }
.subtask-item:hover .subtask-actions, .subtask-item:focus-within .subtask-actions { opacity: 1; }
.subtask-create-form { display: grid; grid-template-columns: minmax(170px,1fr) minmax(150px,210px) auto; gap: 9px; margin-top: 20px; }
.subtask-create-form input, .subtask-create-form select { background: color-mix(in srgb,var(--surface) 45%,var(--canvas)); }

.attachments-panel { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-content: start; gap: 16px; }
.attachments-panel .attachment-list { display: contents; }
.attachments-panel .attachment-item { position: relative; display: flex; min-width: 0; padding: 0; flex-direction: column; align-items: stretch; gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb,var(--surface) 44%,var(--canvas)); }
.attachments-panel .attachment-preview { width: 100%; height: 155px; border-radius: 0; background: repeating-linear-gradient(135deg,color-mix(in srgb,var(--surface-2) 60%,var(--canvas)) 0 7px,color-mix(in srgb,var(--surface) 52%,var(--canvas)) 7px 13px); }
.attachments-panel .attachment-details { min-height: 48px; padding: 11px 12px; border-top: 1px solid var(--border); font: 10px/1.35 ui-monospace,SFMono-Regular,Consolas,monospace; }
.attachments-panel .attachment-details > span { display: none; }
.attachments-panel .attachment-name { font-weight: 500; }
.attachments-panel .attachment-item > .row-actions { position: absolute; z-index: 2; top: 8px; right: 8px; justify-content: flex-end; padding: 5px; border-radius: 9px; background: color-mix(in srgb,var(--canvas) 82%,transparent); opacity: 0; transition: opacity var(--transition); }
.attachments-panel .attachment-item:hover > .row-actions, .attachments-panel .attachment-item:focus-within > .row-actions { opacity: 1; }
.attachments-panel .upload-drop { position: relative; display: grid; min-height: 213px; padding: 0; place-items: center; border: 1px dashed var(--border-strong); border-radius: 14px; background: transparent; }
.upload-drop.dragging { border-color: var(--primary); background: color-mix(in srgb,var(--primary) 5%,transparent); }
.attachments-panel .upload-drop label { display: grid; width: 100%; height: 100%; min-height: inherit; margin: 0; place-items: center; align-content: center; gap: 7px; color: var(--muted); text-align: center; cursor: pointer; }
.attachments-panel .upload-drop input[type="file"] { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.upload-plus { font-size: 24px; font-weight: 300; }
.attachments-panel .upload-drop label > span:last-child { font: 10px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace; }
.attachments-panel .upload-progress { position: absolute; right: 12px; bottom: 9px; left: 12px; width: calc(100% - 24px); }
.task-mobile-savebar, .task-sheet-backdrop { display: none; }

@media (max-width: 980px) and (min-width: 761px) {
    .task-drawer.task-dialog { --task-rail-width: 340px; }
    .task-title-input { width: calc(100vw - var(--task-rail-width) - 70px); }
    .attachments-panel { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .attachments-panel .upload-drop { grid-column: 1 / -1; }
}

/* Keep every persistent desktop control inside shorter modal viewports. */
@media (min-width: 761px) and (max-height: 1100px) {
    .task-detail-header { padding: 12px 20px 13px; }
    .task-title-input { min-height: 40px; margin-top: 4px; font-size: clamp(26px,2.1vw,34px); }
    .task-header-save { min-width: 88px; min-height: 46px; }
    .task-overflow-button, .task-close-button { width: 46px; height: 46px; }
    .task-detail-body { grid-template-rows: clamp(150px,28%,200px) 48px minmax(0,1fr); }
    .task-description-panel { min-height: 0; grid-template-rows: auto minmax(0,1fr); gap: 7px; padding: 14px 20px 12px; }
    .task-description-panel textarea { height: 100%; min-height: 0; padding: 12px 14px; }
    .task-property-rail { padding: 12px; }
    .task-property-group { margin-bottom: 10px; }
    .task-property-group:last-child { margin-bottom: 0; }
    .task-property-group > h3, .task-property-group > legend { margin-bottom: 6px; }
    .task-status-trigger, .task-reminder-trigger { min-height: 40px; padding: 7px 10px; }
    .task-picker { min-height: 30px; }
    .task-person-pill { min-height: 30px; padding: 2px 10px 2px 4px; }
    .task-person-avatar { width: 24px; height: 24px; flex-basis: 24px; }
    .task-picker-add, .task-selected-label { min-height: 30px; padding-block: 4px; }
    .task-schedule-property { padding-top: 10px; }
    .task-property-heading { margin-bottom: 6px; }
    .task-schedule-card { padding: 10px; }
    .task-all-day { min-height: 24px; margin-bottom: 6px; font-size: 13px; }
    .task-all-day input { width: 18px; min-height: 18px; }
    .task-date-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
    .task-date-field { gap: 4px; }
    .task-date-field > button { min-height: 38px; padding: 6px 8px; }
    .task-calendar-colour { grid-template-columns: auto minmax(0,1fr); gap: 5px 8px; margin-top: 8px; padding-top: 8px; }
    .task-calendar-colour > span, .task-colour-swatches { grid-column: 1 / -1; }
    .task-colour-swatches { gap: 5px; }
    .task-colour-swatches button { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; }
    .task-custom-colour { min-height: 23px; padding: 2px 7px; }
    .task-calendar-colour > small { align-self: center; font-size: 12px; }
    .task-reminders-property { padding-top: 0; }
    .task-reminders-property > small { margin-top: 4px; }
    .task-tabs { margin-inline: 20px; }
    .task-tab { min-height: 48px; padding-block: 6px; }
    .task-work-panel { padding: 12px 20px 14px; }
    .comment-compose { margin-top: 9px; padding-top: 9px; }
    .comment-compose textarea { min-height: 56px; padding: 10px 12px; }
}

@media (max-width: 760px) {
    .task-drawer.task-dialog { --task-rail-width: 0px; top: 0; right: 0; bottom: 0; left: 0; width: 100vw; height: 100dvh; border: 0; border-radius: 0; opacity: 0; transform: translateX(24px); }
    .task-drawer.task-dialog.open { opacity: 1; transform: none; }
    .task-detail-header { padding: max(14px,env(safe-area-inset-top)) 20px 17px; }
    .task-header-row { position: relative; min-height: 54px; justify-content: center; }
    .task-back-button { position: absolute; left: -7px; display: inline-grid; border-color: transparent; }
    .task-breadcrumb { max-width: calc(100vw - 150px); gap: 9px; justify-content: center; font-size: 12px; }
    .task-header-actions { position: absolute; right: -6px; }
    .task-header-actions > .task-saved-state, .task-header-save, .task-close-button { display: none; }
    .task-overflow-button { width: 44px; height: 44px; border-color: transparent; background: transparent; }
    .task-overflow-menu { top: calc(100% + 3px); right: 0; width: min(320px,calc(100vw - 50px)); padding: 10px 20px; }
    .task-title-input { width: 100%; min-height: 44px; margin-top: 6px; font-size: clamp(25px,7.5vw,32px); white-space: nowrap; }
    .task-loading { min-height: 0; }
    .task-detail-body { --task-mobile-savebar-space: calc(112px + env(safe-area-inset-bottom)); display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow-y: auto; scroll-padding-bottom: var(--task-mobile-savebar-space); }
    .task-detail-body::after { content: ""; display: block; width: 100%; flex: 0 0 var(--task-mobile-savebar-space); }
    .task-dialog[data-task-tab="conversation"] .task-detail-body::after { display: none; }
    .task-details-form { display: contents; }
    .task-tabs { position: sticky; z-index: 18; top: 0; order: -1; display: flex; width: 100%; min-height: 57px; margin: 0; padding: 0 13px; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--canvas); }
    .task-tab { min-width: 0; min-height: 57px; flex: 1 1 25%; justify-content: center; gap: 5px; padding: 8px 4px; font-size: clamp(12px,3.7vw,15px); }
    .task-tab-count { min-width: 21px; height: 21px; padding: 0 5px; font-size: 12px; }
    .task-details-tab, .task-tab-mobile-label { display: inline; }
    .task-tab-desktop-label { display: none; }
    .task-description-panel { order: 0; flex: 0 0 auto; gap: 11px; padding: 25px 24px 15px; }
    .task-description-panel textarea { min-height: 198px; padding: 17px 19px; border-radius: 15px; font-size: 15px; line-height: 1.55; }
    .task-property-rail { order: 0; min-height: 0; height: auto; flex: 0 0 auto; padding: 13px 24px 24px; overflow: visible; border: 0; background: transparent; }
    .task-property-group { margin-bottom: 27px; }
    .task-status-trigger { min-height: 58px; font-size: 16px; }
    .task-status-menu { position: static; margin-top: 8px; padding: 8px; }
    .task-status-option { min-height: 51px; font-size: 15px; }
    .task-person-pill { min-height: 43px; padding-right: 14px; font-size: 15px; }
    .task-picker-add { min-height: 43px; font-size: 14px; }
    .task-selected-label { min-height: 42px; padding-inline: 15px; font-size: 14px; }
    .task-choice-menu { top: calc(100% + 7px); }
    .task-schedule-property { padding-top: 27px; }
    .task-property-heading strong { font-size: 15px; }
    .task-schedule-card { padding: 20px 18px; border-radius: 16px; }
    .task-all-day { min-height: 38px; font-size: 17px; }
    .task-all-day input { width: 24px; min-height: 24px; }
    .task-date-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    .task-date-field > button { min-height: 58px; padding: 10px 12px; font-size: 14px; }
    .task-calendar-colour { margin-top: 18px; }
    .task-colour-swatches { justify-content: space-between; gap: 6px; }
    .task-colour-swatches button { width: clamp(27px,7.5vw,38px); height: clamp(27px,7.5vw,38px); flex-basis: clamp(27px,7.5vw,38px); border-radius: 9px; }
    .task-reminder-trigger { min-height: 57px; padding-inline: 17px; font-size: 15px; }
    .task-reminder-menu { padding: 11px; }
    .task-reminder-option { min-height: 52px; font-size: 15px; }
    .task-reminder-option input { width: 22px; min-height: 22px; }
    .task-work-panel { order: 0; min-height: 0; flex: 0 0 auto; padding: 24px; overflow: visible; }
    .conversation-section { height: auto; min-height: calc(100dvh - 185px); padding-bottom: 0; }
    .comment-list { flex: 0 0 auto; gap: 18px; padding-right: 0; overflow: visible; }
    .comment-item { max-width: 94%; }
    .comment-avatar { display: none; }
    .comment-content { gap: 5px; }
    .comment-item header { font-size: 12px; }
    .comment-time-long { display: none; }
    .comment-time-short { display: inline; }
    .comment-bubble { min-width: 0; padding: 13px 16px; border-radius: 15px 15px 15px 4px; }
    .comment-item.mine .comment-bubble { border-radius: 15px 15px 4px 15px; }
    .comment-bubble .comment-body { font-size: 15px; line-height: 1.5; }
    .comment-delete { display: none; }
    .comment-compose { position: sticky; z-index: 15; bottom: 0; display: grid; grid-template-columns: minmax(0,1fr) 52px; grid-template-rows: auto; gap: 10px; margin: auto -24px 0; padding: 13px 24px max(13px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--canvas); }
    .comment-compose-avatar, .comment-shortcut, .comment-send-label { display: none; }
    .comment-compose textarea { min-height: 52px; max-height: 110px; grid-column: 1; padding: 14px 18px; border-radius: 999px; resize: none; }
    .comment-compose .primary-button { width: 52px; min-width: 52px; height: 52px; grid-column: 2; padding: 0; border-radius: 50%; font-size: 22px; }
    .comment-send-icon { display: inline; }
    .subtask-progress-row { margin-bottom: 17px; }
    .subtask-item { min-height: 58px; grid-template-columns: auto minmax(0,1fr) 34px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 13px; background: color-mix(in srgb,var(--surface) 42%,var(--canvas)); }
    .subtask-item:hover { background: color-mix(in srgb,var(--surface) 55%,var(--canvas)); }
    .subtask-assignee-picker { width: 34px; }
    .subtask-assignee-full { display: none; }
    .subtask-assignee-initial { display: inline; font-weight: 700; }
    .subtask-actions { position: absolute; top: 100%; right: 8px; z-index: 4; display: none; padding: 5px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); opacity: 1; }
    .subtask-item:focus-within .subtask-actions { display: flex; }
    .subtask-create-form { grid-template-columns: minmax(0,1fr) auto; margin-top: 18px; }
    .subtask-create-form input { grid-column: 1 / -1; }
    .subtask-create-form select { grid-column: 1; }
    .subtask-create-form button { grid-column: 2; min-width: 95px; }
    .attachments-panel { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; align-content: start; }
    .attachments-panel .attachment-preview { height: 150px; }
    .attachments-panel .attachment-details { min-height: 44px; padding: 10px; }
    .attachments-panel .attachment-item > .row-actions { display: none; }
    .attachments-panel .attachment-item:focus-within > .row-actions { display: flex; }
    .attachments-panel .upload-drop { min-height: 132px; grid-column: 1 / -1; }
    .task-mobile-savebar { position: fixed; z-index: 67; right: 0; bottom: 0; left: 0; display: flex; min-height: 90px; align-items: center; justify-content: space-between; gap: 18px; margin: 0; padding: 14px 24px max(14px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--canvas); box-shadow: 0 -10px 28px rgba(0,0,0,.2); }
    .task-mobile-savebar [data-task-save] { min-width: 112px; min-height: 58px; border-radius: 14px; font-size: 17px; }
    .task-dialog[data-task-tab="conversation"] .task-mobile-savebar { display: none; }
    .task-sheet-backdrop { position: fixed; z-index: 68; inset: 0; display: block; background: var(--backdrop-strong); }
    .task-date-picker { position: fixed; z-index: 70; right: 0; bottom: 0; left: 0; max-height: min(84dvh,760px); margin: 0; padding: 24px 24px max(22px,env(safe-area-inset-bottom)); overflow-y: auto; border-color: var(--border-strong); border-radius: 28px 28px 0 0; background: var(--surface); box-shadow: 0 -24px 70px rgba(0,0,0,.42); }
    .task-date-picker-heading { margin-bottom: 17px; }
    .task-date-picker-heading > strong { font-size: 12px; }
    .task-date-picker-heading .text-button { color: var(--text); font-size: 15px; }
    .task-date-month-heading { margin-bottom: 13px; }
    .task-date-month-heading .icon-button { width: 48px; height: 48px; }
    .task-date-month-heading > strong { font-size: 20px; }
    .task-date-weekdays { margin-bottom: 10px; font-size: 12px; }
    .task-date-grid { gap: 5px 2px; }
    .task-date-empty, .task-date-day { min-height: 43px; }
    .task-date-day { border-radius: 12px; font-size: 16px; }
    .task-time-picker { gap: 11px; margin-top: 19px; padding-top: 18px; }
    .task-time-stepper { min-width: 135px; grid-template-columns: 38px 1fr 38px; }
    .task-time-stepper button { min-height: 50px; }
    .task-time-stepper output { font-size: 24px; }
    .task-time-shortcuts { justify-content: center; margin-top: 11px; }
    .task-time-shortcuts button { min-height: 34px; padding-inline: 12px; font-size: 12px; }
}

@media (max-width: 390px) {
    .task-detail-header { padding-inline: 16px; }
    .task-tabs { padding-inline: 8px; }
    .task-description-panel, .task-property-rail, .task-work-panel { padding-right: 18px; padding-left: 18px; }
    .comment-compose { margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
    .task-mobile-savebar { padding-right: 18px; padding-left: 18px; }
    .task-colour-swatches button { width: 27px; height: 27px; flex-basis: 27px; }
    .task-time-stepper { min-width: 118px; }
}

/* Project files, mapped storage and attachment viewer */
.view-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.view-tab { flex: 0 0 auto; }
.project-files { padding: 16px 24px 30px; }
.file-breadcrumb-row { display: flex; min-width: 0; align-items: center; gap: 7px; }
.file-highlight { animation: file-highlight 2.3s ease; }
@keyframes file-highlight { 0%,35% { background: color-mix(in srgb,var(--primary) 25%,var(--surface)); box-shadow: inset 4px 0 0 var(--primary), 0 0 0 2px color-mix(in srgb,var(--primary) 35%,transparent); } }
.files-upload-progress { position: absolute; z-index: 8; right: 18px; bottom: 10px; left: 18px; width: calc(100% - 36px); }

.storage-settings { display: grid; gap: 16px; }
.storage-mode-fieldset legend { margin-bottom: 9px; }
.storage-mode-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.storage-mode-option { display: flex; min-width: 0; min-height: 88px; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); cursor: pointer; }
.storage-mode-option:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.storage-mode-option input { width: 18px; min-height: 18px; flex: 0 0 18px; }
.storage-mode-option span { display: grid; min-width: 0; gap: 4px; }
.storage-mode-option small { color: var(--muted); font-weight: 500; }
.mapped-folder-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.mapped-folder-heading p { margin: 2px 0 0; }
.mapping-list { display: grid; gap: 8px; }
.mapping-card { display: grid; grid-template-columns: minmax(180px,1fr) minmax(130px,.55fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
.mapping-identity { display: grid; min-width: 0; grid-template-columns: minmax(0,auto) auto; align-items: center; justify-content: start; gap: 3px 8px; }
.mapping-identity small { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapping-provider { padding: 2px 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--primary); font-size: 12px; font-weight: 850; }
.mapping-status { margin: 0; }

.file-picker-dialog { width: min(920px,calc(100vw - 24px)); }
.picker-browser { display: grid; min-height: min(520px,62dvh); grid-template-rows: auto minmax(260px,1fr) auto; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); }
.picker-browser > .file-breadcrumb-row { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.picker-list { min-height: 0; padding: 6px; overflow-y: auto; }
.picker-row { display: grid; min-height: 52px; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 7px 9px; border-radius: 9px; cursor: default; }
.picker-row:hover, .picker-row.selected { background: var(--surface-2); }
.picker-row.navigable { cursor: pointer; }
.picker-row-copy { display: grid; min-width: 0; }
.picker-row-copy strong, .picker-row-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row input { width: 20px; min-height: 20px; }
.picker-browser [data-picker-status] { min-height: 31px; margin: 0; padding: 7px 12px; border-top: 1px solid var(--border); }
.picker-selection-summary { align-self: center; }
.delete-file-warning { padding: 14px; border: 1px solid color-mix(in srgb,var(--danger) 38%,var(--border)); border-radius: 10px; background: var(--danger-soft); }
.delete-file-warning p { margin: 5px 0 0; color: var(--text); }

.attachment-viewer-dialog { width: min(1240px,calc(100vw - 26px)); height: min(900px,calc(100dvh - 26px)); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--canvas); color: var(--text); box-shadow: var(--shadow); }
.attachment-viewer-dialog::backdrop { background: var(--backdrop-strong); backdrop-filter: blur(5px); }
.attachment-viewer { display: grid; width: 100%; height: 100%; grid-template-rows: auto minmax(0,1fr) auto; }
.attachment-viewer-header { display: flex; min-height: 74px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.attachment-viewer-title { min-width: 0; }
.attachment-viewer-title h2, .attachment-viewer-title p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-viewer-title h2 { max-width: min(440px,38vw); }
.attachment-viewer-title p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.attachment-viewer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.attachment-viewer-stage { position: relative; display: grid; min-height: 0; place-items: center; overflow: hidden; background: #0b0d0f; }
.attachment-viewer-stage:fullscreen { width: 100vw; height: 100vh; background: #06080a; }
.attachment-viewer-content { display: grid; width: 100%; height: 100%; min-height: 0; place-items: center; overflow: auto; }
.attachment-viewer-content > img, .attachment-viewer-content > video { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.attachment-viewer-content > video { width: min(1100px,100%); height: min(760px,100%); }
.attachment-viewer-content > iframe { width: calc(100% - 108px); height: calc(100% - 28px); border: 0; border-radius: 8px; background: white; }
.viewer-text { width: calc(100% - 120px); height: calc(100% - 42px); margin: 0; padding: 20px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); white-space: pre-wrap; }
.viewer-empty { display: grid; max-width: 480px; place-items: center; padding: 30px; text-align: center; }
.viewer-empty p { margin-bottom: 0; }
.viewer-file-icon { color: var(--primary); font-size: 58px; }
.viewer-arrow { position: absolute; z-index: 3; top: 50%; display: grid; width: 46px; height: 64px; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb,var(--surface) 84%,transparent); color: var(--text); font-size: 35px; cursor: pointer; transform: translateY(-50%); }
.viewer-arrow:hover { border-color: var(--primary); background: var(--surface); }
.viewer-arrow:disabled { display: none; }
.viewer-previous { left: 12px; }
.viewer-next { right: 12px; }
.attachment-viewer-footer { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 18px; border-top: 1px solid var(--border); background: var(--surface); font-size: 12px; }

.attachment-browse-tile { display: grid; min-height: 213px; place-items: center; align-content: center; gap: 7px; padding: 18px; border: 1px dashed var(--border-strong); border-radius: 14px; background: transparent; color: var(--muted); text-align: center; cursor: pointer; }
.attachment-browse-tile:hover { border-color: var(--primary); background: color-mix(in srgb,var(--primary) 5%,transparent); color: var(--text); }
.attachment-browse-tile strong { color: var(--text); }
.attachment-browse-tile > span:last-child { font: 10px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace; }
.attachment-folder-icon { color: var(--primary); font-size: 30px; }
.attachments-panel .attachment-preview.missing { color: var(--danger); }

@media (max-width: 980px) {
    .storage-mode-options { grid-template-columns: 1fr; }
    .mapping-card { grid-template-columns: minmax(0,1fr) auto; }
    .mapping-status { grid-column: 1 / -1; grid-row: 2; }
    .attachment-viewer-header { align-items: flex-start; flex-direction: column; }
    .attachment-viewer-title h2 { max-width: 80vw; }
}

@media (max-width: 760px) {
    .mapping-card { grid-template-columns: 1fr; }
    .mapping-status { grid-column: auto; grid-row: auto; }
    .mapped-folder-heading { align-items: stretch; flex-direction: column; }
    .attachment-viewer-dialog { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
    .attachment-viewer-header { max-height: 42dvh; padding: max(10px,env(safe-area-inset-top)) 12px 10px; overflow-y: auto; }
    .attachment-viewer-actions { justify-content: flex-start; }
    .attachment-viewer-actions .secondary-button, .attachment-viewer-actions .danger-button { min-height: 34px; padding: 5px 9px; font-size: 12px; }
    .attachment-viewer-content > iframe { width: calc(100% - 12px); height: calc(100% - 12px); }
    .viewer-text { width: calc(100% - 24px); height: calc(100% - 24px); }
    .viewer-arrow { top: auto; bottom: 10px; width: 46px; height: 46px; transform: none; }
    .attachment-viewer-footer .muted { display: none; }
    .attachment-browse-tile { min-height: 132px; grid-column: 1 / -1; }
}

/* Project-only external access in the People dialog. */
.people-access-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
.people-access-tab { min-height: 40px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 750; cursor: pointer; transition: background var(--transition),color var(--transition),box-shadow var(--transition); }
.people-access-tab:hover { color: var(--text); }
.people-access-tab.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 var(--edge-highlight); }
.people-access-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.people-access-section { display: grid; gap: 13px; padding-top: 18px; border-top: 1px solid var(--border); }
.people-access-section:first-of-type { padding-top: 0; border-top: 0; }
.people-access-section[role="tabpanel"] { padding-top: 0; border-top: 0; }
.people-access-section h3, .people-access-section h4 { margin: 0; }
.people-access-section .section-heading p { margin: 3px 0 0; }
.external-access-section { gap: 16px; }
.external-access-create-grid { display: grid; gap: 9px; }
.external-access-form { overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: var(--canvas); }
.external-access-disclosure { display: flex; width: 100%; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background var(--transition); }
.external-access-disclosure:hover, .external-access-disclosure[aria-expanded="true"] { background: var(--surface-2); }
.external-access-disclosure > span:first-child { display: grid; gap: 3px; }
.external-access-disclosure small { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.4; }
.external-access-chevron { flex: 0 0 auto; color: var(--muted); font-size: 22px; line-height: 1; transition: transform var(--transition),color var(--transition); }
.external-access-disclosure[aria-expanded="true"] .external-access-chevron { color: var(--text); transform: rotate(180deg); }
.external-access-form-fields { display: grid; gap: 12px; padding: 15px; border-top: 1px solid var(--border); background: var(--surface); }
.external-access-form-fields:not([hidden]) { animation: external-access-reveal var(--transition) both; }
@keyframes external-access-reveal { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.external-areas-fieldset { display: grid; gap: 8px; }
.external-area-checks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.external-area-checks .compact-check { min-height: 34px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.external-link-warning { margin: 0; padding: 11px 12px; border: 1px solid color-mix(in srgb,var(--danger) 42%,var(--border)); border-radius: 8px; background: var(--danger-soft); color: var(--text); font-size: 12px; line-height: 1.45; }
.external-link-warning strong { display: block; margin-bottom: 4px; }
.external-link-confirm { padding: 10px; border: 1px solid color-mix(in srgb,var(--danger) 34%,var(--border)); border-radius: 8px; background: color-mix(in srgb,var(--danger-soft) 62%,var(--surface)); color: var(--text); font-size: 12px; }
.external-access-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid color-mix(in srgb,var(--success) 45%,var(--border)); border-radius: 9px; background: var(--success-soft); color: var(--text); font-size: 12px; }
.external-access-list-section { display: grid; gap: 9px; padding-top: 16px; border-top: 1px solid var(--border); }
.external-access-list-section .section-heading { align-items: flex-start; }
.external-access-list { display: grid; gap: 8px; }
.external-access-list > .muted { margin: 1px 0; }
.external-access-row { display: grid; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
.external-access-identity { display: grid; min-width: 0; gap: 3px; }
.external-access-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.external-access-controls { display: grid; grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); align-items: start; gap: 10px; }
.external-access-controls .external-areas-fieldset { min-width: 0; }
.external-access-controls .external-area-checks { grid-template-columns: repeat(2,minmax(0,1fr)); }
.external-access-controls .external-area-checks .compact-check { min-height: 31px; padding: 5px 7px; font-size: 12px; }
.external-row-expiry { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.external-inline-field { display: grid; min-width: 0; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.external-inline-field select, .external-inline-field input { min-width: 0; }
.external-access-actions { justify-content: flex-start; }
.external-access-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 760px) {
    .people-access-tab { padding-right: 8px; padding-left: 8px; font-size: 12px; }
    .external-access-disclosure { min-height: 72px; }
    .external-access-list-section .section-heading { align-items: stretch; flex-direction: column; }
    .external-access-list-section .section-heading > button { width: 100%; }
    .external-access-result { align-items: stretch; flex-direction: column; }
    .external-access-result button { width: 100%; }
}

/* ==========================================================================
   Accessibility and clarity pass
   ========================================================================== */

/* Status messages: shape + text + colour, never colour alone. */

/* Themed confirmation dialog and the strong destructive action. */
.confirm-dialog { width: min(440px, calc(100vw - 24px)); }
.confirm-dialog h2 { margin: 0; }
.confirm-dialog p { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.danger-button.solid { border-color: transparent; background: var(--danger-solid); color: var(--on-solid); }
.danger-button.solid:hover { border-color: transparent; filter: brightness(1.1); }
.danger-button.solid:focus-visible { outline-color: color-mix(in srgb, var(--danger-solid) 75%, transparent); }

/* Disabled controls say why. */
.disabled-reason { align-self: center; margin-right: auto; color: var(--muted); font-size: 12px; order: -1; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .6; }

/* Form fields: rules stay visible, invalid fields are marked and described. */
.field-hint { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.password-field { position: relative; display: block; }
.password-field > input { padding-right: 68px; }
.password-toggle { position: absolute; top: 50%; right: 5px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; transform: translateY(-50%); cursor: pointer; }
.password-toggle:hover { background: var(--surface-2); color: var(--text); }

/* Loading placeholders get a spinner; errors get actions. */
.loading-state { display: flex; align-items: center; gap: 8px; }
.loading-state::before { content: ""; flex: 0 0 auto; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: melon-spin .8s linear infinite; }
@keyframes melon-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-state::before { animation: none; border-top-color: var(--border-strong); } }

/* Header: page links on the left; embedded tools sit on the right as icon buttons with a
   tooltip. Their text labels stay in the markup for screen readers and the phone menu. */
.primary-nav { flex: 1; }
.primary-nav-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.primary-nav-tools::after { content: ""; width: 1px; height: 20px; margin-left: 10px; background: var(--border); }
.primary-nav .tool-button { width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 9px; }
.primary-nav .tool-button:hover { background: var(--surface-2); }
.primary-nav .tool-button.active { background: var(--primary-soft); color: var(--primary); }
.primary-nav .tool-button.active::after { display: none; }
.tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool-button[data-tooltip]:hover::before, .tool-button[data-tooltip]:focus-visible::before { content: attr(data-tooltip); position: absolute; z-index: 200; top: calc(100% + 8px); left: 50%; padding: 5px 8px; border-radius: 6px; background: var(--text); color: var(--canvas); font-size: 12px; font-weight: 600; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.notification-badge { border-color: var(--canvas); background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.avatar-button { width: 34px; height: 34px; margin-left: 4px; border: 1px solid transparent; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 14px; font-weight: 700; }
.avatar-button:hover, .avatar-button[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-soft); }

/* Header popovers: account menu and notifications. */
.notification-panel, .account-menu { top: calc(var(--header-height) + 6px); padding: 6px; border-radius: 12px; background: var(--surface-raised); }
.account-menu { width: 264px; gap: 0; }
.account-identity { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; }
.account-identity div { display: grid; min-width: 0; }
.account-identity strong { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.account-identity div span { color: var(--muted); font-size: 12px; }
.account-avatar { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.account-menu .account-menu-group { display: grid; gap: 1px; margin: 0; padding: 6px 0; border-top: 1px solid var(--border); }
.account-menu .account-menu-group:last-child { padding-bottom: 0; }
.account-menu a, .account-menu .menu-button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px; font-weight: 500; }
.account-menu a:hover, .account-menu .menu-button:hover, .notification-item:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.account-menu .ui-icon { width: 18px; height: 18px; color: var(--muted); }
.account-menu-label { padding: 2px 10px 6px; color: var(--muted); font-size: 12px; }
.theme-switch, .notification-filter { display: grid; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--canvas); }
.theme-switch { grid-template-columns: repeat(3, 1fr); margin: 0 10px 4px; }
.theme-switch button, .notification-filter button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.theme-switch button:hover, .notification-filter button:hover { color: var(--text); }
.theme-switch button.selected, .notification-filter button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.notification-panel { width: min(380px, calc(100vw - 24px)); }
.notification-panel .panel-heading { margin: 0; padding: 6px 10px 8px; }
.notification-panel .panel-heading h2 { font-size: 15px; }
.notification-filter { width: fit-content; grid-auto-flow: column; margin: 0 10px 6px; }
.notification-list { gap: 2px; }
.notification-item, .notification-item.unread { gap: 2px; padding: 9px 10px 9px 24px; background: transparent; }
.notification-item.unread::before { top: 16px; left: 10px; width: 7px; height: 7px; }
.notification-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.notification-item .notification-item-head strong { min-width: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.notification-item:not(.unread) .notification-item-head strong { font-weight: 500; }
.notification-item time { flex: none; }
.notification-item .notification-body { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.notification-panel[data-filter="unread"] .notification-item:not(.unread) { display: none; }
.notification-filter-empty { margin: 0; padding: 16px 10px; }

/* Embedded tool panel: toolbar above the frame with an always-available escape hatch. */
.external-workspace { --workspace-toolbar-height: 44px; }
.external-workspace-toolbar { display: flex; min-height: var(--workspace-toolbar-height); align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.external-workspace-toolbar strong { flex: 0 0 auto; }
.external-frame-status { min-width: 0; flex: 1; color: var(--muted); font-size: 12px; }
.external-workspace-toolbar .text-button { flex: 0 0 auto; white-space: nowrap; }
.external-workspace-toolbar + .external-service-frame { height: calc(100dvh - var(--header-height) - var(--workspace-toolbar-height)); }

/* Header at tablet widths: the icon shortcuts live in the account menu, so drop them here. */
@media (min-width: 761px) and (max-width: 1100px) {
    .app-header { gap: 12px; padding: 0 12px; }
    .brand > span:last-child { display: none; }
    .primary-nav { gap: 0; }
    .primary-nav a, .primary-nav .primary-nav-button { padding: 0 9px; font-size: 14px; }
    .primary-nav .tool-button { padding: 0; }
}
@media (max-width: 760px) {
    .primary-nav-tools { display: grid; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px solid var(--border); }
    .primary-nav-tools::after, .tool-button[data-tooltip]::before { display: none !important; }
    .primary-nav .tool-button { width: auto; height: auto; justify-content: flex-start; gap: 10px; padding: 0 14px; }
    .tool-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .external-workspace-toolbar { flex-wrap: wrap; padding: 6px 12px; }
}

/* Touch screens: comfortable targets everywhere, dense layout kept for mouse users. */
@media (pointer: coarse) {
    .small-button, .filter-chip, .text-button, .danger-text-button, .password-toggle { min-height: 44px; }
    .icon-button, .avatar-button { min-width: 44px; min-height: 44px; }
    .card-tab-wrap .card-edit-button { min-width: 44px; min-height: 44px; }
    .calendar-date { width: 32px; height: 32px; }
}

/* Completed items keep AA contrast: a strike-through and, where text sits on the surface, the
   muted colour replace fading the whole element with opacity. */
.calendar-event.done, .calendar-experience .calendar-event.done { opacity: 1; }
.subtask-item.completed { opacity: 1; }
.subtask-item.completed .subtask-title-input, .subtask-item.completed .subtask-title { color: var(--muted); }
.calendar-month-day.outside { color: var(--muted); }
.calendar-month-day.today .calendar-month-date { color: var(--text); font-weight: 800; }

/* Panel-heading links reach the 24px minimum target size. */
.panel-heading a { display: inline-flex; align-items: center; min-height: 28px; }

/* Very narrow screens (folded phones): keep the notification menu readable. */
@media (max-width: 360px) {
    .project-notification-control .notification-control-label { display: none; }
    .project-notification-control { min-width: 0; }
}

/* ==========================================================================
   One-time links and codes, activity-log filters, forced-colours focus
   ========================================================================== */
.permissions-review { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; border-left: 3px solid var(--info); }
.permissions-review p { margin: 4px 0 0; max-width: 70ch; }
.permissions-review form { margin: 0; }
.secret-reveal { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid color-mix(in srgb,var(--success) 45%,var(--border)); border-radius: 10px; background: var(--success-soft); color: var(--text); }
.secret-reveal p { margin: 0; }
.secret-reveal-row { display: flex; align-items: center; gap: 8px; }
.secret-reveal-row input { flex: 1 1 auto; min-width: 0; }
.secret-reveal input[readonly], .secret-reveal textarea[readonly], .external-access-result input[readonly] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface); }
.secret-reveal textarea[readonly] { resize: none; line-height: 1.6; }
button.copied { border-color: var(--success); }
.external-access-result { flex-direction: column; align-items: stretch; font-size: 13px; }
.external-access-result-copy { display: grid; gap: 3px; }
.external-access-result-link { display: flex; align-items: center; gap: 8px; }
.external-access-result-link input { flex: 1 1 auto; min-width: 0; }
.external-link-warning, .external-link-confirm { font-size: 13px; }
.activity-log-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.activity-log-filters label { display: grid; gap: 4px; min-width: 150px; color: var(--muted); font-size: 12px; font-weight: 700; }
.activity-log-filters .activity-log-count { flex: 1 1 100%; margin: 0; }
.activity-log-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; }
@media (max-width: 760px) {
    .secret-reveal-row, .external-access-result-link { flex-direction: column; align-items: stretch; }
    .activity-log-filters label { flex: 1 1 100%; }
}
/* Borders and shadows are dropped in forced-colours mode, so fields get a real outline there. */
@media (forced-colors: active) {
    input:focus, select:focus, textarea:focus { outline: 2px solid Highlight; outline-offset: 1px; }
}

/* ---- Design pass 1: lighter board toolbar, full-screen Calendar and Files ---- */

@media (min-width: 761px) {
    /* Board filter row: one light toolbar instead of boxed fields */
    .filter-bar { flex-wrap: nowrap; align-items: center; gap: 6px; min-height: 52px; padding: 8px 24px; }
    .filter-search-row { flex: 0 1 340px; min-width: 200px; }
    .filter-bar input[type="search"] {
        min-height: 34px; padding: 6px 12px 6px 34px;
        border: 1px solid transparent; border-radius: 999px;
        background: var(--surface-2) no-repeat 12px center / 15px 15px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23889488' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    }
    .filter-bar input[type="search"]:hover { background-color: var(--surface-3); }
    .filter-bar input[type="search"]:focus { border-color: var(--primary); background-color: var(--canvas); }

    .filter-sheet { align-items: center; gap: 6px; }
    .filter-sheet label { min-width: 0; gap: 0; }
    .filter-sheet label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .filter-sheet select {
        width: auto; min-width: 0; min-height: 34px; padding: 6px 8px 6px 12px;
        border: 1px solid transparent; border-radius: 999px;
        background-color: var(--surface-2); color: var(--muted);
        font-size: 13px; font-weight: 600; cursor: pointer;
    }
    .filter-sheet select:hover { background-color: var(--surface-3); color: var(--text); }
    .filter-sheet select:focus { border-color: var(--primary); color: var(--text); }
    .filter-sheet-actions { min-height: 34px; margin-left: 4px; }
    .filter-sheet-actions .text-button { color: var(--muted); font-size: 13px; font-weight: 600; }
    .filter-sheet-actions .text-button:hover { color: var(--text); }

    /* Card tabs: hide the Edit segment until it is useful */
    .card-tab-wrap { border-color: transparent; background: transparent; }
    .card-tab-wrap:has(.card-tab.active) { border-color: var(--border); background: var(--surface-2); box-shadow: none; }
    .card-tab-wrap .card-edit-button { width: auto; height: auto; min-width: 0; padding: 0 10px; border-left-color: transparent; background: transparent; font-weight: 600; opacity: 0; transition: opacity var(--transition); }
    .card-tab-wrap:hover .card-edit-button,
    .card-tab-wrap:focus-within .card-edit-button,
    .card-tab-wrap:has(.card-tab.active) .card-edit-button { opacity: 1; }
}

@media (pointer: coarse) {
    .card-tab-wrap .card-edit-button { opacity: 1; }
}

/* Calendar and Files fill the rest of the screen, edge to edge */
.project-workspace { display: flex; flex-direction: column; }
.project-workspace > [data-view-panel]:not([hidden]) { flex: 1 1 auto; }
.project-calendar:not([hidden]), .project-files:not([hidden]) { display: flex; flex-direction: column; padding: 0; background: var(--surface); }
.project-calendar .calendar-shell, .project-files .files-shell { flex: 1 1 auto; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
.project-workspace.has-project-background .project-calendar .calendar-shell { background: var(--surface); backdrop-filter: none; }

@media (min-width: 761px) {
    /* While Calendar or Files is open the workspace is exactly one screen tall; the panel takes the rest and scrolls inside */
    .project-workspace > :not([data-view-panel]) { flex-shrink: 0; }
    .project-workspace:has(> .project-calendar:not([hidden]), > .project-files:not([hidden])) { height: calc(100dvh - var(--header-height)); min-height: 0; }
    .project-calendar:not([hidden]), .project-files:not([hidden]) { flex: 1 1 0; min-height: 0; }

    .project-calendar .calendar-shell, .project-calendar .calendar-viewport, .project-calendar .calendar-panel:not(.calendar-agenda),
    .project-calendar .calendar-month-grid, .project-calendar .calendar-time-grid { display: flex; flex-direction: column; }
    .project-calendar .calendar-viewport { flex: 1 1 0; min-height: 0; overflow: auto; }
    .project-calendar .calendar-panel, .project-calendar .calendar-month-grid, .project-calendar .calendar-time-grid { flex: 1 0 auto; }
    .project-calendar .calendar-month-weekdays { position: sticky; z-index: 6; top: 0; flex-shrink: 0; }
    .project-calendar .calendar-month-body { flex: 1 0 auto; min-height: 0; }
    .project-calendar .calendar-time-scroll { flex: 1 1 0; height: auto; min-height: 300px; }

    .project-files .files-shell { display: flex; flex-direction: column; }
    .project-files .files-toolbar { flex-shrink: 0; }
    .project-files .file-panes { flex: 1 1 0; min-height: 0; overflow: auto; }
}

/* Projects dashboard: cards lead with the project's image (or a patterned placeholder) so
   projects are recognisable at a glance; all text sits below it on the card surface. */
progress { -webkit-appearance: none; appearance: none; }
.dashboard-heading { align-items: center; margin-bottom: 22px; }
.dashboard-heading h1 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.dashboard-summary { margin: 4px 0 0; font-size: 14px; }
.summary-alert { color: var(--danger); font-weight: 600; }
.dashboard-heading .primary-button .ui-icon, .project-card-new .ui-icon { width: 18px; height: 18px; }
.dashboard-layout { grid-template-columns: minmax(0,1fr) 320px; gap: 24px; }
.dashboard-projects .project-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition); }
.project-card:hover { border-color: var(--border-strong); box-shadow: 0 10px 28px -14px var(--shadow-color); transform: translateY(-2px); }
.project-cover { position: relative; display: block; height: 140px; flex: none; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.project-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 280ms ease; }
.project-card:hover .project-cover img { transform: scale(1.03); }
.project-cover.is-placeholder { background-color: var(--primary-soft); background-image: radial-gradient(color-mix(in srgb, var(--primary) 32%, transparent) 1.5px, transparent 1.7px); background-size: 18px 18px; }
.project-cover-initial { position: absolute; right: 18px; bottom: -12px; color: var(--primary); font-size: 96px; font-weight: 750; line-height: 1; letter-spacing: -.04em; }
.project-role { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(11,13,15,.72); color: #eef1f4; font-size: 12px; font-weight: 600; backdrop-filter: blur(6px); }
.project-card-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.project-card-body h2 { margin: 0; overflow: hidden; font-size: 16px; font-weight: 650; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.project-card-description { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.project-card-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 12px; }
.project-card progress { width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.project-card progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-3); }
.project-card progress::-webkit-progress-value { border-radius: 999px; background: var(--primary); }
.project-card progress::-moz-progress-bar { border-radius: 999px; background: var(--primary); }
.project-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-top: 4px; color: var(--muted); font-size: 12px; }
.overdue-chip, .ok-chip, .count-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1.5; }
.overdue-chip, .count-badge { background: var(--danger-soft); color: var(--danger); }
.ok-chip { background: var(--success-soft); color: var(--success); }
.project-card-new { min-height: 280px; align-items: center; justify-content: center; gap: 8px; border-width: 1.5px; border-style: dashed; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.project-card-new:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, transparent); color: var(--primary); }

.dashboard-sidebar { gap: 16px; }
.dashboard-panel { padding: 16px; border-radius: 14px; }
.dashboard-panel .panel-heading { margin-bottom: 8px; }
.dashboard-panel .panel-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.dashboard-panel .panel-heading a, .dashboard-panel .panel-heading .text-button { font-size: 13px; font-weight: 600; }
.dashboard-list { display: grid; gap: 2px; margin: 0 -8px; }
.dashboard-list a { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; border-radius: 8px; }
.dashboard-list a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.dashboard-list-main { display: grid; min-width: 0; gap: 1px; }
.dashboard-list-main strong { overflow: hidden; font-size: 14px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-list-main > span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-list-side { flex: none; color: var(--muted); font-size: 12px; }
.dashboard-list-side.is-overdue { color: var(--danger); font-weight: 650; }
.dashboard-list a.is-unread { padding-left: 22px; }
.dashboard-list a.is-unread::before { content: ""; position: absolute; top: 15px; left: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.panel-more { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.panel-more:hover { color: var(--text); }
.dashboard-empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 0; font-size: 13px; }
.dashboard-empty .ui-icon { width: 18px; height: 18px; }

/* Dialog with header and footer bars; becomes a bottom sheet on phones. */
.sheet-dialog { width: min(480px, calc(100vw - 24px)); border-radius: 16px; background: var(--surface-raised); }
.sheet-dialog > form { gap: 0; padding: 0; }
.sheet-dialog .dialog-heading { align-items: center; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); }
.sheet-dialog .dialog-heading h2 { font-size: 17px; }
.sheet-dialog .dialog-body { display: grid; gap: 16px; padding: 20px; }
.sheet-dialog .dialog-actions { margin: 0; padding: 14px 20px; border-top: 1px solid var(--border); }
.label-optional { color: var(--muted); font-weight: 500; }
/* Grows with its text from 4 to about 10 lines, then scrolls; no drag handle. Browsers without
   field-sizing get the same behaviour from installAutoGrow() in app.js. */
textarea[data-autogrow] { min-height: 104px; max-height: 240px; overflow-y: auto; resize: none; field-sizing: content; }
.ghost-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: 8px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; }
.ghost-button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
@keyframes sheet-up { from { transform: translateY(100%); } }

@media (max-width: 1050px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .dashboard-sidebar { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .page-heading.dashboard-heading { flex-direction: row; align-items: center; margin-bottom: 16px; }
    .page-heading.dashboard-heading > button { width: auto; flex: none; }
    .dashboard-heading h1 { font-size: 26px; }
    .dashboard-summary { font-size: 13px; }
    /* One column; the overdue panel moves above the projects. */
    .dashboard-layout { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
    .dashboard-sidebar { display: contents; }
    .dashboard-overdue { order: -1; }
    .dashboard-projects .project-grid { grid-template-columns: 1fr; gap: 12px; }
    .project-cover { height: 110px; }
    .project-card:hover { transform: none; }
    .project-card-new { min-height: 56px; flex-direction: row; }
    .sheet-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-bottom: 0; border-radius: 18px 18px 0 0; }
    .sheet-dialog[open] { animation: sheet-up .25s cubic-bezier(.2,.8,.2,1); }
    .sheet-dialog .dialog-actions { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .sheet-dialog .dialog-actions button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .project-card, .project-cover img { transition: none; }
    .project-card:hover { transform: none; }
    .sheet-dialog[open] { animation: none; }
}

/* Account settings: a side menu of groups (Profile, Notifications, Security, My calendars) and
   links to project settings. installSettingsLayout() in app.js shows one group at a time; on
   phones the menu is a list and each group opens with a back link. */
.settings-layout { display: grid; max-width: 1080px; margin: 0 auto; grid-template-columns: 236px minmax(0,1fr); align-items: start; gap: 32px; }
.settings-nav { position: sticky; top: calc(var(--header-height) + 24px); display: grid; gap: 2px; }
.settings-identity { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.settings-identity div { display: grid; min-width: 0; }
.settings-identity strong { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.settings-identity div span { color: var(--muted); font-size: 12px; }
.settings-nav a { display: flex; min-height: 38px; align-items: center; gap: 10px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.settings-nav a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.settings-nav a.active { background: var(--primary-soft); color: var(--primary); }
.settings-nav .ui-icon { width: 18px; height: 18px; flex: none; }
.settings-nav a > span:not(.settings-nav-dot):not(.settings-project-thumb) { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-chevron { opacity: 0; }
.settings-nav-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--warning); }
.settings-nav-group { margin: 18px 0 4px; padding: 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.settings-project-links { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.settings-project-thumb { display: grid; width: 22px; height: 22px; flex: none; place-items: center; overflow: hidden; border-radius: 6px; background: var(--surface-3); color: var(--primary); font-size: 11px; font-weight: 700; }
.settings-project-thumb.is-placeholder { background: var(--primary-soft); }
.settings-project-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.settings-project-links .settings-chevron { width: 15px; height: 15px; opacity: .6; }

.settings-content { display: grid; min-width: 0; gap: 32px; }
.settings-section { display: grid; gap: 16px; }
/* Before app.js runs: show the group named by the URL hash, else the default one, so the first
   paint already matches what the script will show. The big scroll margin stops the browser
   jumping down to #calendars or #two-step on load (the clamp keeps the page at the top). */
.settings-layout:not(.is-enhanced) .settings-section { display: none; }
.settings-layout:not(.is-enhanced) .settings-section:is(:target, :has(:target)),
.settings-layout:not(.is-enhanced):not(:has(.settings-section:target, .settings-section :target)) .settings-section[data-settings-default] { display: grid; }
.settings-section, #two-step { scroll-margin-top: 100vh; }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.settings-section-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.settings-section-head h1:focus { outline: none; }
.settings-back { display: none; }
.scope-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 600; }
.scope-badge .ui-icon { width: 14px; height: 14px; }
.settings-section .panel { padding: 20px; border-radius: 14px; }
.settings-section .panel h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font-size: 16px; }
.settings-section .panel h2 + .muted, .settings-row .muted { margin: 4px 0 0; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-row > div { min-width: 0; }
.settings-row > button { flex: none; }
.status-chip { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.status-chip.is-on { background: var(--success-soft); color: var(--success); }
.status-chip.is-off { background: var(--warning-soft); color: var(--warning); }
.settings-note { display: flex; gap: 10px; margin: 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: 13px; }
.settings-note .ui-icon { width: 18px; height: 18px; flex: none; }
.settings-note strong { color: var(--text); }
.settings-disclosure summary { color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.settings-disclosure summary:hover { color: var(--text); }
.settings-disclosure[open] summary { margin-bottom: 12px; }
.settings-disclosure .row-actions { margin-top: 10px; }

/* Notification switches */
/* Work calendars window in the general calendar (9e): calendars under their project's name. */
.work-calendar-group { margin: 12px 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.work-calendar-group:first-child { margin-top: 0; }
.work-calendar-row { justify-content: flex-start; padding: 9px 10px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.work-calendar-row:hover { background: var(--surface-2); }
.work-calendar-row .switch { margin-left: auto; }
.work-calendar-row.is-hidden .switch-copy > span:first-child { color: var(--muted); }
.work-calendar-note { margin: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.work-calendar-note:empty { display: none; }
.switch-list { display: grid; }
.switch-list .switch-row { padding: 12px 0; border-top: 1px solid var(--border); font-weight: 600; }
.switch-list .switch-row:first-child { border-top: 0; }
.switch-copy { display: grid; gap: 2px; }
.switch-copy .field-hint { font-weight: 400; }
input.switch { position: relative; width: 42px; height: 24px; min-height: 24px; flex: none; padding: 0; border: 1px solid var(--control-border); border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background var(--transition), border-color var(--transition); -webkit-appearance: none; appearance: none; }
input.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,.35); transition: transform var(--transition); }
input.switch:checked { border-color: var(--primary); background: var(--primary); }
input.switch:checked::before { transform: translateX(18px); }

/* Theme preview cards */
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.theme-card { display: grid; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.theme-card:hover { border-color: var(--border-strong); }
.theme-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-card-label { padding: 0 4px 2px; font-size: 13px; font-weight: 600; }
.language-card { gap: 2px; padding: 10px 12px; }
.language-card-name { font-size: 14px; font-weight: 600; }
.language-card-hint { font-size: 12px; color: var(--muted); }
.language-card-check { display: none; }
.language-dialog .language-dialog-note { margin-top: -4px; font-size: 12px; }
/* After "Reload now" the new page starts under the dialog's blur, which fades once the page is set up
   (app.js). The animation is only a fallback in case the script never runs. */
html.is-language-reload body::after { content: ""; position: fixed; inset: 0; z-index: 2147483647; background: var(--backdrop); backdrop-filter: blur(3px); pointer-events: none; animation: language-reload-out .3s ease 3s forwards; }
html.is-language-reload.is-language-ready body::after { animation: none; opacity: 0; transition: opacity .3s ease; }
@keyframes language-reload-out { to { opacity: 0; visibility: hidden; } }
.theme-preview { position: relative; display: block; height: 64px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; }
.theme-preview.is-light { background: #f6f7f8; }
.theme-preview.is-dark { background: #0b0d0f; }
.theme-preview.is-system { background: linear-gradient(90deg, #f6f7f8 50%, #0b0d0f 50%); }
.theme-preview-bar { position: absolute; top: 0; right: 0; left: 0; height: 12px; }
.theme-preview-card { position: absolute; top: 20px; right: 12px; left: 12px; height: 30px; border-radius: 6px; }
.theme-preview-line { position: absolute; top: 29px; left: 20px; width: 36%; height: 5px; border-radius: 3px; background: #2dd4bf; }
.is-light .theme-preview-bar, .is-light .theme-preview-card { background: #ffffff; }
.is-light .theme-preview-card { box-shadow: 0 0 0 1px #d9dde2; }
.is-light .theme-preview-line { background: #0f766e; }
.is-dark .theme-preview-bar, .is-dark .theme-preview-card { background: #14171a; }
.is-dark .theme-preview-card { box-shadow: 0 0 0 1px #262b31; }
.is-system .theme-preview-bar, .is-system .theme-preview-card { background: linear-gradient(90deg, #ffffff 50%, #14171a 50%); }
.is-system .theme-preview-line { background: linear-gradient(90deg, #0f766e 50%, #2dd4bf 50%); }

/* Live password rules */
.password-checklist { display: grid; gap: 4px; margin: -6px 0 0; padding: 0; color: var(--muted); font-size: 13px; list-style: none; }
.password-checklist li { display: flex; align-items: center; gap: 8px; }
.password-checklist li::before { content: ""; width: 14px; height: 14px; flex: none; border: 1.5px solid var(--control-border); border-radius: 50%; }
.password-checklist li.is-met { color: var(--success); }
.password-checklist li.is-met::before { border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 3px var(--surface); }

/* Step-by-step dialogs (two-step setup, connect a calendar) */
.wizard-progress { display: grid; grid-auto-columns: minmax(0,1fr); grid-auto-flow: column; gap: 4px; padding: 14px 20px 0; }
.wizard-progress span { height: 4px; border-radius: 9px; background: var(--surface-3); }
.wizard-progress span.done { background: var(--primary); }
.wizard-dialog > form.wizard-step { display: grid; gap: 0; padding: 0; }
.wizard-step-title { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.wizard-dialog .dialog-actions { align-items: center; }
/* Pinned near the top on wide screens, so a taller or shorter step only moves the bottom edge
   instead of re-centring the whole dialog (which looked like a blink between steps). */
@media (min-width: 761px) { .wizard-dialog, .account-manage-dialog { margin-block: min(12vh, 110px) auto; } }
.wizard-dialog .dialog-actions > :first-child:not(:last-child) { margin-right: auto; }
.wizard-cancel { margin: 0; }
.qr-code { justify-self: center; width: 200px; margin: 4px 0; }
.qr-code svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.recovery-codes { min-height: 0; font: 600 15px/1.8 ui-monospace, "Cascadia Code", Menlo, monospace; letter-spacing: .06em; text-align: center; resize: none; }
.code-input { min-height: 52px; font: 600 22px/1 ui-monospace, "Cascadia Code", Menlo, monospace; letter-spacing: .4em; text-align: center; }
.code-input.is-recovery { font-size: 17px; letter-spacing: .08em; }
.code-input::placeholder { color: color-mix(in srgb, var(--muted) 55%, transparent); }
#personal-caldav-calendar-dialog[data-caldav-step="1"] .disabled-reason,
#personal-caldav-calendar-dialog[data-caldav-step="1"] [data-caldav-step-two],
#personal-caldav-calendar-dialog[data-caldav-step="2"] [data-caldav-step-one] { display: none; }
.settings-lock { display: flex; align-items: flex-start; gap: 6px; margin: 0; }
.settings-lock .ui-icon { width: 14px; height: 14px; flex: none; margin-top: 2px; }

@media (min-width: 761px) and (max-width: 1050px) {
    .settings-layout { grid-template-columns: 200px minmax(0,1fr); gap: 24px; }
}
@media (max-width: 760px) {
    .settings-layout { grid-template-columns: 1fr; gap: 0; }
    .settings-layout.is-enhanced[data-view="list"] .settings-content,
    .settings-layout.is-enhanced[data-view="section"] .settings-nav { display: none; }
    .settings-layout:not(.is-enhanced):not([data-settings-initial]):not(:has(.settings-section:target, .settings-section :target)) .settings-content,
    .settings-layout:not(.is-enhanced):is([data-settings-initial], :has(.settings-section:target, .settings-section :target)) .settings-nav { display: none; }
    .settings-nav { position: static; gap: 0; }
    .settings-nav a { min-height: 52px; border-bottom: 1px solid var(--border); border-radius: 0; color: var(--text); }
    .settings-nav a.active { background: transparent; color: var(--text); }
    .settings-chevron { opacity: .5; }
    .settings-identity { padding: 4px 0 16px; }
    .settings-nav-group { margin-top: 24px; padding: 0; }
    .settings-layout .settings-back { display: inline-flex; width: 100%; align-items: center; gap: 4px; margin-bottom: 2px; color: var(--muted); font-size: 14px; }
    .settings-back .ui-icon { width: 18px; height: 18px; }
    .settings-section-head h1 { font-size: 24px; }
    .settings-row { flex-direction: column; align-items: stretch; }
    .settings-row > button, .settings-actions button { flex: 1; }
    .theme-cards { gap: 8px; }
    .theme-preview { height: 52px; }
    .language-cards { grid-template-columns: 1fr; }
    .language-card { grid-template-columns: 1fr auto; align-items: center; min-height: 48px; }
    .language-card-hint { display: none; }
    .language-card.selected .language-card-check { display: block; color: var(--primary); }
}
@media (prefers-reduced-motion: reduce) {
    input.switch, input.switch::before { transition: none; }
}

/* My calendars and "Connect a calendar" step 2: one line per calendar, details open on demand. */
.caldav-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.caldav-account { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.caldav-account + .caldav-account { margin-top: 12px; }
.caldav-account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--text) 3%, transparent); }
.caldav-account-title { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.caldav-account-title span { color: var(--muted); }
.caldav-source + .caldav-source { border-top: 1px solid var(--border); }
.caldav-source.is-open { background: color-mix(in srgb, var(--text) 3%, transparent); }
.caldav-source-row { display: flex; align-items: center; gap: 12px; padding: 4px 16px 4px 4px; }
.caldav-source-toggle { display: flex; min-width: 0; flex: 1; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.caldav-source-toggle:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.caldav-source-copy { display: grid; min-width: 0; gap: 1px; }
.caldav-source-copy strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.caldav-source-copy span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.caldav-source-copy .caldav-source-problem { color: var(--warning); }
.caldav-source.is-hidden-calendar .caldav-source-copy strong { color: var(--muted); }
.caldav-source-details { display: grid; gap: 14px; padding: 4px 16px 16px 40px; }
.caldav-source-url { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caldav-source-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.caldav-source-actions .danger-text-button { margin-right: auto; font-size: 13px; font-weight: 650; }

.caldav-found { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.caldav-found .text-button { font-size: 13px; }
[data-caldav-discovered-list] { display: grid; gap: 8px; }
.caldav-item { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); transition: border-color var(--transition); }
.caldav-item.is-selected { border-color: var(--primary); }
.caldav-item-row { display: flex; min-height: 44px; align-items: center; gap: 12px; padding: 8px 12px; font-weight: 500; cursor: pointer; }
.caldav-item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caldav-item-details { display: grid; gap: 12px; padding: 0 12px 14px 42px; }

/* Colour swatches: presets plus a custom picker; colours in use carry a small dot. */
.colour-swatches { margin: 0; padding: 0; border: 0; }
.colour-swatches legend { margin-bottom: 7px; padding: 0; color: var(--text); font-size: 13px; font-weight: 700; }
.colour-swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.colour-swatch { position: relative; display: grid; width: 28px; height: 28px; place-items: center; cursor: pointer; }
.colour-swatch input[type="radio"] { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; opacity: 0; }
.colour-swatch-chip { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); transition: transform var(--transition); }
.colour-swatch:hover .colour-swatch-chip { transform: scale(1.08); }
.colour-swatch input:checked + .colour-swatch-chip { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.colour-swatch input:focus-visible + .colour-swatch-chip { outline: 2px solid var(--primary); outline-offset: 4px; }
.colour-swatch.is-used::after { content: ""; position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--text); }
.colour-swatch.is-custom .colour-swatch-chip { background-image: conic-gradient(#ef755f, #df9f35, #75a843, #22a6a8, #4f8cff, #a66ac2, #ef755f) !important; }
.colour-swatch.is-custom input:checked + .colour-swatch-chip { background-image: none !important; }
.colour-custom { display: grid; max-width: 260px; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.colour-custom[hidden] { display: none; }
/* As a popover it floats beside the custom swatch (app.js sets top/left), above any dialog. */
.colour-custom[popover] { position: fixed; inset: auto; width: min(260px, calc(100vw - 16px)); max-width: none; margin: 0; color: var(--text); box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.colour-custom[popover]:not(:popover-open) { display: none; }
.colour-custom-area { position: relative; height: 150px; border-radius: 8px; background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent); cursor: crosshair; touch-action: none; }
.colour-custom-area:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.colour-custom-thumb { position: absolute; width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.colour-custom-hue { width: 100%; height: 14px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 9px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); -webkit-appearance: none; appearance: none; cursor: pointer; }
.colour-custom-hue::-webkit-slider-runnable-track { height: 14px; border-radius: 9px; background: transparent; }
.colour-custom-hue::-moz-range-track { height: 14px; border-radius: 9px; background: transparent; }
.colour-custom-hue::-moz-range-progress { background: transparent; }
.colour-custom-hue::-webkit-slider-thumb { width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.3); -webkit-appearance: none; appearance: none; margin-top: -2px; }
.colour-custom-hue::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.colour-custom-hue:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.colour-custom-hex { display: flex; align-items: center; gap: 10px; }
.colour-custom-hex input { min-width: 0; flex: 1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: lowercase; }

@media (max-width: 760px) {
    .caldav-source-details, .caldav-item-details { padding-left: 16px; }
    .caldav-item-details { padding-left: 12px; }
    .caldav-source-actions { justify-content: stretch; }
    .caldav-source-actions .primary-button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .colour-swatch-chip, .caldav-item { transition: none; }
}

/* Let settings content shrink on narrow screens; long addresses end in an ellipsis. */
.settings-section, .settings-section > *, .caldav-source-details > *, .caldav-item-details > *, .caldav-account { min-width: 0; }
.settings-section .panel > *, [data-caldav-source-list] { min-width: 0; }

/* Workspace administration: the Account settings layout with People and the workspace groups. */
.settings-layout.is-single { max-width: 860px; grid-template-columns: minmax(0,1fr); }
.settings-layout.is-single .settings-back { display: none !important; }
.workspace-avatar { border-radius: 10px; }
.workspace-avatar .ui-icon { width: 20px; height: 20px; }
.settings-nav a > .settings-nav-count { flex: none !important; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--muted); font-size: 12px; font-weight: 650; }

.people-search { position: relative; display: block; }
.people-search .ui-icon { position: absolute; top: 50%; left: 12px; width: 18px; height: 18px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.people-search input { padding-left: 38px; }
.people-list { margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); list-style: none; }
.people-row + .people-row { border-top: 1px solid var(--border); }
.people-row-main { display: grid; width: 100%; grid-template-columns: auto minmax(0,1.4fr) minmax(0,1fr) auto 24px; align-items: center; gap: 14px; padding: 12px 16px; border: 0; border-radius: 0; background: transparent; color: var(--text); font: inherit; text-align: left; }
button.people-row-main { min-height: 0; cursor: pointer; }
button.people-row-main:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
button.people-row-main:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.people-row.is-disabled .people-name strong, .people-row.is-disabled .account-avatar { opacity: .55; }
.people-name { display: grid; min-width: 0; }
.people-name strong { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.people-name span { overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.people-access { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.people-access .role-pill { padding: 2px 7px; font-size: 11px; }
.people-end { display: grid; place-items: center; color: var(--muted); }
.people-end.muted { font-size: 12px; font-weight: 400; white-space: nowrap; }
.people-end .ui-icon { width: 18px; height: 18px; }
.status-chip.is-pending { background: var(--warning-soft); color: var(--warning); }
.status-chip.is-disabled { background: var(--danger-soft); color: var(--danger); }

/* Preset cards: Project lead, Staff, Restricted (and Custom in the dialogs). */
.switch-line { cursor: pointer; }
.switch-line > span { display: grid; gap: 2px; }
.switch-line strong { font-size: 14px; font-weight: 600; }
.switch-line .muted { font-size: 12px; font-weight: 400; }

/* Dialog tabs and the sign-in danger zone (Manage account). */
.dialog-tabs { display: flex; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.dialog-tabs[hidden] { display: none; }
.dialog-tabs [role="tab"] { min-height: 42px; margin-bottom: -1px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.dialog-tabs [role="tab"]:hover { color: var(--text); }
.dialog-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--primary); color: var(--text); }
.dialog-tabs [role="tab"]:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; }
.manage-person { display: flex; min-width: 0; align-items: center; gap: 12px; }
.manage-person > div { min-width: 0; }
.manage-person p { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.danger-zone { display: grid; gap: 14px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); border-radius: 12px; }
.danger-zone h3 { margin: 0; font-size: 14px; }
.danger-zone .muted { margin: 3px 0 0; font-size: 12px; }
.danger-zone > form { margin: 0; padding-top: 14px; border-top: 1px solid var(--border); }
.setup-link-heading { display: flex; min-width: 0; align-items: center; gap: 10px; }
.setup-link-heading .ui-icon { width: 22px; height: 22px; flex: none; color: var(--success); }
#setup-link-dialog .dialog-body p { margin: 0; }
#account-setup-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.wizard-dialog > form { gap: 0; padding: 0; }

/* Upload limits with the unit inside the field; network list in monospace. */
.unit-input { position: relative; display: block; margin-top: 6px; }
.unit-input input { padding-right: 44px; }
.unit-input > span { position: absolute; top: 50%; right: 12px; color: var(--muted); font-size: 13px; font-weight: 600; transform: translateY(-50%); pointer-events: none; }
/* Workspace storage (9g): three figures, a bar with one piece per project in its colour and
   the shared data in grey, then one row per project. The bars are SVG: no inline styles (CSP). */
.storage-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.storage-stats > div { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.storage-stats span { color: var(--muted); font-size: 13px; }
.storage-stats strong { font-size: 22px; }
.storage-bar { display: block; width: 100%; height: 12px; border-radius: 999px; }
.storage-row .storage-bar { height: 6px; }
.storage-bar-track { fill: var(--surface-3); }
.storage-bar-files { fill: var(--primary); }
.storage-bar-binned { fill: var(--warning); }
.storage-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0; }
.storage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.storage-dot { width: 10px; height: 10px; flex: none; }
.storage-row strong { display: flex; align-items: center; gap: 8px; }
.storage-over { border-color: var(--warning); color: var(--warning); }
.storage-limit-input { max-width: 180px; }
.storage-row { display: grid; grid-template-columns: minmax(0,1fr) 76px 130px; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.storage-row-head { padding: 0 0 6px; border: 0; color: var(--muted); font-size: 13px; }
.storage-row > div { display: grid; gap: 5px; min-width: 0; }
.storage-row .field-hint { margin: 0; }
.storage-row .unit-input { margin: 0; }
@media (max-width: 640px) {
    .storage-stats { grid-template-columns: 1fr; }
    .storage-row { grid-template-columns: minmax(0,1fr) 64px 104px; gap: 8px; }
}
.mono-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.settings-actions > .field-hint { margin: 0 auto 0 0; align-self: center; }

@media (max-width: 760px) {
    .people-row-main { grid-template-columns: auto minmax(0,1fr) auto; gap: 4px 12px; }
    .people-row-main .account-avatar { grid-row: span 2; }
    .people-access { grid-column: 2; grid-row: 2; }
    .people-status { grid-column: 3; grid-row: 1; }
    .people-end { grid-column: 3; grid-row: 2; justify-self: end; }
    .permission-group { grid-template-columns: minmax(0,1fr); }
    .settings-actions { flex-wrap: wrap; }
    .settings-actions > .field-hint { flex-basis: 100%; }
}
#setup-link-dialog .secret-reveal-row button { flex: none; white-space: nowrap; }

/* Add account: the step-by-step form on the page, same progress bar as the dialogs. */
.wizard-panel, .settings-section .wizard-panel { display: grid; padding: 0; overflow: hidden; border-radius: 14px; }
.wizard-panel .wizard-progress { padding: 16px 20px 0; }
.wizard-panel-body { display: grid; gap: 16px; padding: 18px 20px 20px; }
.wizard-panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.wizard-panel-actions > :first-child:not(:last-child) { margin-right: auto; }
.field-hint.is-error { color: var(--danger); font-weight: 500; }
/* "Can create employee accounts": a tick box set apart from the presets and the footer. */
/* Add account's numbered stepper: done steps get a tick, the current one is filled. */
.wizard-stepper { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); list-style: none; }
.wizard-stepper li { position: relative; display: flex; min-width: 0; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.wizard-stepper-dot { display: grid; width: 26px; height: 26px; flex: none; place-items: center; border: 1.5px solid var(--border-strong); border-radius: 50%; font-size: 12px; font-weight: 700; }
.wizard-stepper-dot .ui-icon { display: none; width: 14px; height: 14px; stroke-width: 3; }
.wizard-stepper-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wizard-stepper li.done:not(.is-current) .wizard-stepper-dot { border-color: transparent; background: var(--primary-soft); color: var(--primary); }
.wizard-stepper li.done:not(.is-current) .wizard-stepper-dot > span { display: none; }
.wizard-stepper li.done:not(.is-current) .wizard-stepper-dot .ui-icon { display: block; }
.wizard-stepper li.is-current { color: var(--text); }
.wizard-stepper li.is-current .wizard-stepper-dot { border-color: transparent; background: var(--primary); color: var(--primary-ink); }
.wizard-step-head h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.wizard-step-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
    .wizard-stepper { display: flex; gap: 10px; }
    .wizard-stepper li { flex: none; }
    .wizard-stepper li.is-current { flex: 1; }
    .wizard-stepper li:not(.is-current) .wizard-stepper-name { display: none; }
}

/* Preset choices in the permission picker; the arrow lists what a preset includes. */

/* Defaults for new accounts: folded under Add account. */

@media (max-width: 760px) {
    .wizard-panel-actions .primary-button { flex: 1; }
}

/* Security log: a timeline grouped by day inside Workspace administration. */
.log-intro { margin: -8px 0 0; font-size: 13px; }
.log-filters, .settings-section .log-filters { padding: 0; border-radius: 14px; }
.log-filters summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text); font-weight: 600; list-style: none; cursor: pointer; }
.log-filters summary::-webkit-details-marker { display: none; }
.log-filters summary > .ui-icon { width: 18px; height: 18px; flex: none; color: var(--muted); }
.log-filters summary .settings-nav-count { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; }
.log-count { margin-left: auto; font-size: 13px; font-weight: 400; }
.log-filters-chevron { transition: transform var(--transition); }
.log-filters[open] .log-filters-chevron { transform: rotate(180deg); }
.log-filters[open] summary { border-bottom: 1px solid var(--border); }
.log-filter-form { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px 14px; padding: 16px; }
.log-filter-actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 8px; }

.log-timeline { display: grid; gap: 6px; }
.log-day { margin: 10px 0 2px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.log-day:first-child { margin-top: 0; }
.log-list { margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); list-style: none; }
.log-entry { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: start; gap: 12px; padding: 12px 16px; }
.log-entry + .log-entry { border-top: 1px solid var(--border); }
.log-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted); }
.log-icon .ui-icon { width: 16px; height: 16px; }
.log-entry.is-people .log-icon { background: var(--primary-soft); color: var(--primary); }
.log-entry.is-link .log-icon { background: var(--warning-soft); color: var(--warning); }
.log-entry.is-danger .log-icon { background: var(--danger-soft); color: var(--danger); }
.log-main { display: grid; min-width: 0; gap: 4px; }
.log-what { margin: 0; overflow-wrap: anywhere; font-weight: 550; line-height: 1.4; }
.log-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; color: var(--muted); font-size: 12px; }
.log-meta .activity-type { padding: 1px 7px; font-size: 11px; }
.log-project { padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text); }
.log-ip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.log-time { padding-top: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; font-size: 13px; }
.log-pager > :first-child { justify-self: start; }
.log-pager > :last-child { justify-self: end; }
.log-pager .ui-icon { width: 16px; height: 16px; }
.log-empty { display: grid; gap: 6px; padding: 28px 20px; text-align: center; }
.log-empty h2 { margin: 0; font-size: 17px; }
.log-empty p { margin: 0; }

@media (max-width: 760px) {
    .log-filter-form { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
    .log-filter-form label:first-child { grid-column: 1 / -1; }
    .log-filter-actions .primary-button { flex: 1; }
    .log-entry { gap: 10px; padding: 12px; }
    .log-ip { display: none; }
    .log-pager .secondary-button { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .log-filters-chevron { transition: none; }
}

/* Bin: the settings layout with one group per item kind; each group is a table that leaves
   soonest first. On phones every row becomes a small card with full-width buttons. */
.bin-side { position: sticky; top: calc(var(--header-height) + 24px); display: grid; gap: 16px; }
.bin-side .settings-nav { position: static; }
.bin-facts { display: grid; gap: 10px; margin: 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: 13px; }
.bin-facts p { display: grid; gap: 1px; margin: 0; }
.bin-facts strong { color: var(--text); font-weight: 650; }
.bin-panel { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.bin-toolbar { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.bin-toolbar .people-search { min-width: 0; flex: 1; }
.bin-toolbar input, .bin-toolbar select { min-height: 36px; padding-block: 6px; }
.bin-sort { position: relative; flex: none; }
.bin-sort .ui-icon { position: absolute; top: 50%; left: 10px; width: 16px; height: 16px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.bin-sort select { width: auto; padding-left: 32px; font-size: 14px; font-weight: 600; cursor: pointer; }
.bin-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.bin-table th { padding: 10px 16px 8px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.bin-table th:nth-child(1) { width: 46%; }
.bin-table th:nth-child(2) { width: 20%; }
.bin-table th:nth-child(3) { width: 13%; }
.bin-table td { padding: 10px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.bin-table tr[hidden] { display: none; }
.bin-name strong, .bin-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bin-name strong { font-weight: 600; }
.bin-name span, .bin-deleted { color: var(--muted); font-size: 13px; }
.bin-deleted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bin-days { display: inline-flex; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.bin-days.is-soon { background: var(--warning-soft); color: var(--warning); }
.bin-actions { text-align: right; white-space: nowrap; }
.bin-actions > * { vertical-align: middle; }
.bin-actions .secondary-button { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.bin-delete { width: 34px; height: 34px; margin-left: 4px; color: var(--muted); }
.bin-delete:hover, .bin-delete:focus-visible { border-color: var(--danger-soft) !important; background: var(--danger-soft) !important; color: var(--danger); }
.bin-delete .ui-icon { width: 18px; height: 18px; }
.bin-delete-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.bin-view-only { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.bin-view-only .ui-icon { width: 15px; height: 15px; }
.bin-none { margin: 0; padding: 18px 16px; border-top: 1px solid var(--border); text-align: center; }
.bin-empty { display: grid; justify-items: center; gap: 10px; max-width: 620px; margin: 0 auto; padding: 40px 28px; text-align: center; }
.bin-empty h2, .bin-empty p { margin: 0; }
.bin-empty > p { max-width: 440px; }
.bin-empty-icon { display: grid; width: 56px; height: 56px; place-items: center; margin-bottom: 4px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.bin-empty-icon .ui-icon { width: 26px; height: 26px; }
.bin-empty .bin-facts { grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 8px; text-align: left; }
@media (max-width: 760px) {
    .bin-side { position: static; }
    .settings-layout.is-enhanced[data-view="section"] .bin-side { display: none; }
    .settings-layout:not(.is-enhanced) .bin-facts { display: none; }
    .bin-table, .bin-table tbody { display: block; }
    .bin-table thead { display: none; }
    .bin-table tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
    .bin-table tbody tr:first-child { border-top: 0; }
    .bin-table td { display: block; padding: 0; border: 0; }
    .bin-name { grid-column: 1; grid-row: 1; }
    .bin-left { grid-column: 2; grid-row: 1; align-self: start; }
    .bin-deleted { grid-column: 1 / -1; }
    .bin-table .bin-actions { display: flex; grid-column: 1 / -1; gap: 8px; margin-top: 8px; text-align: left; }
    .bin-actions .secondary-button, .bin-delete { flex: 1; }
    .bin-delete { display: inline-flex; width: auto; height: auto; min-height: 34px; align-items: center; justify-content: center; gap: 6px; margin: 0; border-color: var(--danger-soft); background: var(--danger-soft); color: var(--danger); font-weight: 700; }
    .bin-delete-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .bin-delete .ui-icon { width: 16px; height: 16px; }
    .bin-toolbar { flex-wrap: wrap; }
    .bin-toolbar .people-search { flex-basis: 100%; }
    .bin-sort, .bin-sort select { width: 100%; }
    .bin-empty .bin-facts { grid-template-columns: 1fr; }
}

/* Dashboard: a project card being dragged into a new place. */
.project-grid.is-sorting { cursor: grabbing; user-select: none; }
.project-card.is-dragging { pointer-events: none; }
.project-card.is-dragging { position: relative; z-index: 5; border-color: var(--primary); box-shadow: 0 18px 40px -16px var(--shadow-color); transition: none; opacity: .92; }

/* My tasks: chips for one group at a time, a search, a one-project menu (a sheet on phones),
   and rows with a circle that marks the task done. */
.mytasks { display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; }
.mytasks-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mytasks-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mytasks-chip { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: border-color var(--transition), background var(--transition), color var(--transition); }
.mytasks-chip:hover { border-color: var(--border-strong); color: var(--text); }
.mytasks-chip [data-my-task-count] { color: var(--text); font-weight: 700; }
.mytasks-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.mytasks-chip.is-overdue[aria-pressed="true"] { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.mytasks-chip[aria-pressed="true"] [data-my-task-count] { color: inherit; }
.mytasks-search { min-width: 180px; flex: 1; }
.mytasks-search input { min-height: 36px; padding-block: 6px; }
.mytasks-project { position: relative; }
.mytasks-project-button .ui-icon { width: 16px; height: 16px; }
.mytasks-project-button > span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.mytasks-project-button.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.mytasks-caret { transition: transform var(--transition); }
.mytasks-project-button[aria-expanded="true"] .mytasks-caret { transform: rotate(180deg); }
.mytasks-menu { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; display: grid; width: 260px; max-height: 360px; gap: 2px; overflow-y: auto; padding: 6px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-raised); box-shadow: 0 16px 40px -12px var(--shadow-color); }
.mytasks-menu .people-search { margin-bottom: 4px; }
.mytasks-menu .people-search input { min-height: 34px; padding-block: 5px; }
.mytasks-menu-title { display: none; margin: 0; }
.mytasks-option { display: flex; min-height: 36px; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.mytasks-option > span:first-child { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mytasks-option:hover { background: var(--surface-2); }
.mytasks-option[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.mytasks-option:first-of-type { margin-bottom: 3px; }
.mytasks-option-count { color: var(--muted); font-size: 12px; }
.mytasks-list { margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); list-style: none; }
.mytasks-list:not(:has(.mytasks-row:not([hidden]))) { display: none; }
/* Every row draws a line below; the -1px tucks the last one under the list edge. */
.mytasks-row { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: -1px; padding: 0 16px 0 12px; border-bottom: 1px solid var(--border); }
.mytasks-check { display: grid; width: 22px; height: 22px; flex: none; place-items: center; padding: 0; border: 1.5px solid var(--control-border); border-radius: 50%; background: transparent; color: transparent; cursor: pointer; transition: border-color var(--transition), background var(--transition), color var(--transition); }
.mytasks-check .ui-icon { width: 14px; height: 14px; stroke-width: 2.6; }
button.mytasks-check:hover { border-color: var(--primary); color: var(--primary); }
button.mytasks-check:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mytasks-check.is-locked { border-style: dashed; cursor: default; opacity: .55; }
.mytasks-row.is-done .mytasks-check, .mytasks-check.is-checked { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.mytasks-main { display: grid; min-width: 0; flex: 1; padding: 11px 0; color: var(--text); }
.mytasks-main:hover strong { color: var(--primary); }
.mytasks-main strong, .mytasks-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mytasks-main strong { font-weight: 600; }
.mytasks-main span { color: var(--muted); font-size: 13px; }
.mytasks-row.is-done .mytasks-main strong { color: var(--muted); text-decoration: line-through; }
/* Just ticked: a status pill, a real Undo button, and a line that runs down over the 5 seconds. */
.mytasks-undo { display: inline-flex; flex: none; align-items: center; gap: 10px; }
.mytasks-done-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 650; white-space: nowrap; }
.mytasks-done-pill .ui-icon { width: 14px; height: 14px; stroke-width: 2.6; }
.mytasks-undo-button { min-height: 32px !important; padding: 4px 12px !important; font-size: 13px; }
.mytasks-undo-button .ui-icon { width: 16px; height: 16px; }
.mytasks-row.is-settling { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.mytasks-timer { position: absolute; bottom: 0; left: 0; display: none; width: 100%; height: 2px; background: var(--primary); transform-origin: left; }
.mytasks-row.is-settling:has([data-my-task-undo]:not([hidden])) .mytasks-timer { display: block; animation: mytasks-timer 5s linear forwards; }
@keyframes mytasks-timer { to { transform: scaleX(0); } }
.mytasks-heading { padding: 8px 16px 6px; border-bottom: 1px solid var(--border); margin-bottom: -1px; background: color-mix(in srgb, var(--text) 3%, transparent); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mytasks-heading.is-overdue { color: var(--danger); }
.mytasks-heading.is-today { color: var(--warning); }
.mytasks-heading span { font-weight: 600; }
.mytasks-heading span::before { content: "· "; }
.mytasks-due { flex: none; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.mytasks-due.is-overdue { background: var(--danger-soft); color: var(--danger); }
.mytasks-due.is-today { background: var(--warning-soft); color: var(--warning); }
.mytasks-row.is-done .mytasks-due { background: var(--surface-2); color: var(--muted); }
.mytasks-row.is-settling .mytasks-due { display: none; }
.mytasks-none { margin: 0; padding: 28px 16px; border: 1px dashed var(--border-strong); border-radius: 14px; text-align: center; }
@media (max-width: 760px) {
    .mytasks-chips { min-width: 0; flex: 1 1 100%; }
    .mytasks-chip { min-height: 32px; padding: 3px 11px; font-size: 13px; }
    .mytasks-done-pill { display: none; }
    .mytasks-search { min-width: 0; flex-basis: 0; }
    .mytasks-project-button > span { max-width: 110px; }
    .mytasks-caret { display: none; }
    .mytasks.is-menu-open::before { content: ""; position: fixed; z-index: 40; inset: 0; background: rgba(0,0,0,.5); }
    .mytasks-menu { position: fixed; z-index: 41; top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: 70vh; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
    .mytasks-menu::before { content: ""; width: 36px; height: 4px; margin: 0 auto 6px; border-radius: 4px; background: var(--border-strong); }
    .mytasks-menu-title { display: block; padding: 2px 10px 6px; font-weight: 700; }
    .mytasks-option { min-height: 46px; font-size: 15px; }
    .mytasks-row { gap: 10px; padding: 0 12px 0 10px; }
    .mytasks-main { padding: 10px 0; }
    .mytasks-due { max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
    .mytasks-chip, .mytasks-check, .mytasks-caret { transition: none; }
    .mytasks-row.is-settling:has([data-my-task-undo]:not([hidden])) .mytasks-timer { animation: none; }
}

/* Calendar page (the general calendar only; project calendars keep their own look).
   Toolbar: arrows and Today first, then the title, so the title never moves the buttons. */
.calendar-workspace .calendar-heading-group { gap: 16px; }
.calendar-workspace .calendar-heading h1 { font-size: clamp(22px,2.2vw,28px); white-space: nowrap; }
.calendar-workspace .calendar-navigation { gap: 6px; }
.calendar-workspace .calendar-navigation .icon-button { width: 36px; height: 36px; border-radius: 999px; }
.calendar-workspace .calendar-navigation .ui-icon { width: 18px; height: 18px; }
.calendar-workspace .calendar-navigation .secondary-button { border-radius: 999px; }
.calendar-workspace .calendar-filters { gap: 8px; }
.calendar-workspace .calendar-filters .primary-button { display: inline-flex; align-items: center; gap: 6px; }
.calendar-workspace .calendar-filters .primary-button .ui-icon { width: 17px; height: 17px; }
.calendar-workspace .view-switch { border-radius: 999px; }
.calendar-workspace .view-switch-button { border-radius: 999px; }
.calendar-workspace .view-switch-button.active { background: var(--primary-soft); box-shadow: none; color: var(--primary); }
.calendar-mine-chip { cursor: pointer; user-select: none; }
.calendar-mine-chip .ui-icon, .calendar-all-day-chip .ui-icon, .calendar-work-chip .ui-icon { width: 16px; height: 16px; }
/* The Work calendars chip: only its icon on phones, where the toolbar is tight. */
.calendar-work-chip { cursor: pointer; }
.calendar-work-chip[hidden] { display: none; }
@media (max-width: 640px) { .calendar-work-chip span { display: none; } }
.calendar-mine-chip:has(input:checked), .calendar-all-day-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.calendar-mine-chip:has(input:focus-visible), .calendar-all-day-chip:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Month: weekends share the weekdays' light background (days from other months stay
   darker), today is a filled circle and the bars are slimmer. */
.calendar-workspace .calendar-month-day.today { background: color-mix(in srgb,var(--primary) 5%,transparent); }
.calendar-workspace .calendar-month-day.today .calendar-month-date { min-width: 25px; padding: 0; border-radius: 999px; background: var(--primary); color: var(--primary-ink); }
.calendar-workspace .calendar-month-day.today .calendar-month-date::after { content: none; }
.calendar-workspace .calendar-event { border-width: 0 0 0 3px; border-radius: 4px; background: color-mix(in srgb,var(--calendar-event-color) 20%,var(--surface)); }
.calendar-workspace .calendar-event.continues-before { border-left-width: 0; }
/* Bars fill their grid cells minus the side margins (width: 100% plus margin overflowed). */
.calendar-workspace :is(.calendar-month-event,.calendar-all-day-event) { width: auto; }

/* Week and Day: strong hour lines, faint quarter-hour lines for the 15-minute snap. */
.calendar-workspace .calendar-time-day {
    background-image:
        repeating-linear-gradient(to bottom,transparent 0 95px,var(--calendar-grid-line) 95px 96px),
        repeating-linear-gradient(to bottom,transparent 0 23px,color-mix(in srgb,var(--border) 22%,transparent) 23px 24px);
}
.calendar-workspace .calendar-time-date.today .calendar-time-date-number { display: inline-grid; min-width: 28px; height: 28px; place-items: center; border-radius: 999px; background: var(--primary); color: var(--primary-ink); }
.calendar-workspace .calendar-current-time { height: 2px; background: var(--danger); }
.calendar-workspace .calendar-current-time::before { top: -3px; left: -4px; width: 8px; height: 8px; background: var(--danger); }
.calendar-workspace .calendar-time-selection { border: 1.5px dashed var(--primary); border-radius: 7px; background: color-mix(in srgb,var(--primary) 22%,var(--surface)); box-shadow: none; }
.calendar-workspace .calendar-time-selection::after { content: none; }
.calendar-workspace .calendar-time-selection-layer { z-index: 8; }
.calendar-time-selection-label { display: none; }
.calendar-workspace .calendar-time-selection-label { position: relative; z-index: 1; display: block; padding: 3px 7px; color: var(--primary); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calendar-workspace .calendar-timed-event { border-width: 0 0 0 3px; }
/* Reserve the hour grid's scrollbar width above it too, so day headers and all-day bars line up with the columns. */
.calendar-workspace :is(.calendar-time-header,.calendar-all-day-row) { overflow-y: hidden; scrollbar-gutter: stable; }

/* Agenda: one bordered list per day, rows like My tasks (dot, title, place, when). */
.calendar-workspace .agenda-day > h3 { margin-bottom: 8px; }
.calendar-workspace .agenda-list { gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.calendar-workspace .agenda-event { min-height: 54px; grid-template-columns: 10px minmax(0,1fr) auto auto; gap: 12px; margin-bottom: -1px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.calendar-workspace .agenda-event::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--calendar-event-color); }
.calendar-workspace .agenda-event:hover { background: var(--surface-2); filter: none; }
.calendar-workspace .agenda-event-copy { order: 1; }
.calendar-workspace .agenda-event-stage { order: 2; }
.calendar-workspace .agenda-event-date { order: 3; text-align: right; font-variant-numeric: tabular-nums; }

/* Add task: two columns, colour dots instead of a bare picker. */
.calendar-task-dialog { width: min(760px, calc(100vw - 24px)); }
.calendar-task-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 22px; }
.calendar-task-column { display: grid; align-content: start; gap: 14px; }
.calendar-all-day-chip { justify-self: start; cursor: pointer; user-select: none; }
.calendar-color-field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.calendar-color-field legend { margin-bottom: 8px; padding: 0; font-weight: 650; }
.calendar-colour-note { margin: 0 0 10px; }

/* Colour key under the toolbar, and the same dots in the project menu. */
.calendar-legend { padding: 8px 18px; border-bottom: 1px solid var(--calendar-grid-line); color: var(--muted); font-size: 13px; }
.calendar-legend-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.calendar-legend-title { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.calendar-legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.calendar-legend-divider { width: 1px; height: 16px; background: var(--border-strong); }
.calendar-legend-dot { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--muted); }
.calendar-legend-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text); }
.calendar-legend-note[hidden], .calendar-legend-keys[hidden] { display: none; }
.calendar-legend-note .ui-icon { width: 17px; height: 17px; color: var(--primary); }
.calendar-legend-note > span { min-width: 0; flex: 1; }
.calendar-legend-note .mytasks-chip { min-height: 30px; padding: 2px 11px; font-size: 13px; }
.calendar-project-menu .mytasks-option > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Synced event window: icon rows for when, which calendar and where; notes in a box. */
.calendar-event-dialog { width: min(480px, calc(100vw - 24px)); }
.calendar-event-dialog h2 { overflow-wrap: anywhere; }
.calendar-event-facts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.calendar-event-facts li { display: flex; align-items: center; gap: 10px; color: var(--text); }
.calendar-event-facts li[hidden] { display: none; }
.calendar-event-facts .ui-icon { width: 18px; height: 18px; flex: none; color: var(--muted); }
.calendar-event-facts .calendar-legend-dot { width: 12px; height: 12px; margin-inline: 3px; }
.calendar-event-readonly { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; }
.calendar-event-facts .calendar-event-readonly .ui-icon { width: 13px; height: 13px; }
.calendar-event-notes { margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); white-space: pre-wrap; overflow-wrap: anywhere; }
.calendar-event-dialog .dialog-actions a.secondary-button { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.calendar-event-dialog .dialog-actions .ui-icon { width: 16px; height: 16px; }

/* Start / End: a field-like button that opens a themed month (and, for timed tasks, times). */
.calendar-task-layout .calendar-task-dates { grid-template-columns: minmax(0,1fr); gap: 12px; }
.calendar-date-field { display: grid; min-width: 0; gap: 7px; }
.calendar-date-label { font-weight: 650; }
.calendar-date-button { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--canvas); color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.calendar-date-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-date-button .ui-icon { width: 18px; height: 18px; flex: none; color: var(--muted); }
.calendar-date-button:hover { border-color: var(--border-strong); }
.calendar-date-button[aria-expanded="true"], .calendar-date-field:has(.calendar-date-popover:popover-open) .calendar-date-button { border-color: var(--primary); }
.calendar-date-popover { position: fixed; inset: auto; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.calendar-date-popover:popover-open { display: flex; gap: 12px; }
.calendar-date-month { display: grid; width: 266px; gap: 8px; }
.calendar-date-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.calendar-date-head .icon-button { width: 32px; height: 32px; border-radius: 999px; }
.calendar-date-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.calendar-date-weekday { padding: 4px 0; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.calendar-date-day, .calendar-date-time { min-height: 34px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; }
.calendar-date-day:hover, .calendar-date-time:hover { background: var(--surface-2); }
.calendar-date-day.is-outside { color: var(--muted); }
.calendar-date-day.is-today { box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); font-weight: 700; }
.calendar-date-day[aria-pressed="true"], .calendar-date-time[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.calendar-date-day:focus-visible, .calendar-date-time:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.calendar-date-foot { display: flex; justify-content: flex-start; padding-top: 4px; border-top: 1px solid var(--border); }
.calendar-date-times { display: grid; width: 82px; max-height: 300px; align-content: start; gap: 2px; overflow-y: auto; padding-left: 12px; border-left: 1px solid var(--border); scrollbar-width: thin; }
.calendar-date-time { border-radius: 8px; }

@media (max-width: 760px) {
    .calendar-workspace .calendar-heading-group { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
    .calendar-workspace .calendar-navigation .secondary-button { display: inline-flex; }
    .calendar-workspace .calendar-heading h1 { font-size: 22px; }
    .calendar-workspace .calendar-filters { flex-wrap: wrap; }
    .calendar-workspace .calendar-filters .mytasks-chip { min-height: 40px; }
    .calendar-workspace[data-calendar-active-view="month"] .calendar-viewport { overflow-x: hidden; }
    .calendar-workspace .calendar-filters .primary-button { margin-left: auto; }
    .calendar-workspace.is-menu-open::before { content: ""; position: fixed; z-index: 40; inset: 0; background: rgba(0,0,0,.5); }
    .calendar-workspace.is-menu-open { overflow: visible; }
    /* Month fits the phone: bars become slim colour strips, tap one to open its task. */
    .calendar-workspace .calendar-month-grid { min-width: 0; }
    .calendar-workspace .calendar-month-body { min-height: 0; grid-template-rows: none; }
    .calendar-workspace .calendar-month-week { min-height: 64px !important; }
    .calendar-workspace .calendar-month-day { padding: 4px 2px; text-align: center; }
    .calendar-workspace .calendar-month-weekdays span { padding-inline: 0; text-align: center; }
    .calendar-workspace .calendar-month-event-layer { top: 32px; grid-auto-rows: 6px; gap: 3px 0; }
    .calendar-workspace .calendar-month-event { min-height: 6px; height: 6px; margin-inline: 2px; padding: 0; border: 0; border-radius: 3px; background: var(--calendar-event-color); font-size: 0; }
    .calendar-workspace .calendar-month-event::before, .calendar-workspace .calendar-month-event::after, .calendar-workspace .calendar-month-event > * { display: none; }
    .calendar-workspace .agenda-event { grid-template-columns: 10px minmax(0,1fr) auto; gap: 4px 10px; padding: 10px 12px; }
    .calendar-workspace .agenda-event-copy { grid-column: 2; grid-row: 1; }
    .calendar-workspace .agenda-event-date { grid-column: 2; grid-row: 2; text-align: left; }
    .calendar-workspace .agenda-event-stage { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
    .calendar-workspace .agenda-event::before { grid-row: 1 / span 2; align-self: center; }
    .calendar-task-layout { grid-template-columns: minmax(0,1fr); }
    .calendar-date-popover:popover-open { flex-direction: column; }
    .calendar-date-times { width: auto; max-height: 132px; grid-template-columns: repeat(4,1fr); padding: 8px 0 0; border-top: 1px solid var(--border); border-left: 0; }
}

/* Project page header (Board, Calendar, Files, Workload share it).
   Row 1: name, a pill switch for the views, Notifications / People / Settings as chips.
   Row 2: card pills with task counts; the selected card carries the edit pencil.
   Row 3: search plus one chip menu per filter (phones keep the Filters sheet). */
.project-workspace .project-identity { min-width: 0; }
.project-workspace .project-identity h1 { font-size: 20px; line-height: 1.2; }
.project-workspace .view-tabs { gap: 2px; padding: 3px; border-radius: 999px; }
.project-workspace .view-tab { padding: 6px 14px; border-radius: 999px; font-weight: 650; }
.project-workspace .view-tab:hover { color: var(--text); }
.project-workspace .view-tab.active { background: var(--primary-soft); color: var(--primary); }
.project-workspace .project-header-actions { align-items: center; gap: 8px; }
.project-workspace .project-header-actions .secondary-button { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 4px 13px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.project-workspace .project-header-actions .ui-icon { width: 16px; height: 16px; }
.project-notify-menu .mytasks-menu { width: 280px; }
.project-notify-title { display: block; padding: 4px 10px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.project-notify-menu .mytasks-option > span:first-child { white-space: normal; }
.project-notify-menu .mytasks-option small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.project-notify-menu .mytasks-option[aria-pressed="true"] small { color: color-mix(in srgb,var(--primary) 75%,var(--muted)); }

.project-workspace .card-strip { min-height: 50px; gap: 8px; padding-block: 8px; }
.project-workspace .card-tab-wrap { border-radius: 999px; background: var(--surface); box-shadow: none; }
.project-workspace .card-tab-wrap:has(.card-tab.active) { border-color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.project-workspace .card-tab-wrap .card-tab { min-height: 34px; gap: 7px; padding: 5px 13px; background: transparent; color: var(--muted); font-weight: 650; }
.project-workspace .card-tab-wrap .card-tab:hover { background: transparent; color: var(--text); }
.project-workspace .card-tab-wrap .card-tab.active { background: transparent; color: var(--primary); }
.card-tab-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.card-tab.active .card-tab-count { color: inherit; font-weight: 750; }
.project-workspace .card-tab-wrap .card-edit-button { display: grid; min-width: 0; place-items: center; margin-left: -6px; padding: 0 11px 0 4px; border: 0; background: transparent; color: var(--primary); }
.project-workspace .card-tab-wrap:not(:has(.card-tab.active)) .card-edit-button { display: none; }
.project-workspace .card-tab-wrap .card-edit-button:hover { background: transparent; color: var(--text); }
.card-edit-button .ui-icon { width: 15px; height: 15px; }
.project-workspace .add-card-tab { min-height: 34px; gap: 5px; padding: 4px 13px; border: 1px dashed var(--border-strong); border-radius: 999px; color: var(--muted); font-weight: 650; }
.project-workspace .add-card-tab:hover { border-color: var(--primary); background: transparent; color: var(--primary); }
.add-card-tab .ui-icon { width: 15px; height: 15px; }

.project-workspace .filter-bar { flex-wrap: wrap; gap: 8px; padding-block: 8px; }
.project-workspace .filter-search-row { min-width: 200px; flex: 0 1 280px; }
.filter-search { flex: 1; }
.project-workspace .filter-search input { min-width: 0; min-height: 34px; padding-block: 5px; border-radius: 999px; }
.filter-menus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-menu .mytasks-menu { right: auto; left: 0; }
.filter-menu .mytasks-chip .ui-icon { width: 15px; height: 15px; }
.filter-menu .mytasks-chip > span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.filter-menu .mytasks-chip.is-active { padding-right: 34px; }
.filter-menu-clear { position: absolute; top: 50%; right: 5px; display: grid; width: 24px; height: 24px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--primary); cursor: pointer; transform: translateY(-50%); }
.filter-menu-clear:hover { background: color-mix(in srgb,var(--primary) 18%,transparent); }
.filter-menu-clear .ui-icon { width: 14px; height: 14px; }
@media (min-width: 761px) {
    .project-workspace .filter-sheet > label, .project-workspace .active-filter-chips { display: none; }
    .project-workspace .filter-sheet-actions { min-height: 34px; }
}
@media (max-width: 760px) {
    .filter-menus { display: none; }
    .project-workspace .project-identity h1 { font-size: 18px; }
    .project-workspace .project-header-actions { gap: 6px; }
    .project-workspace .project-header-actions .secondary-button, .project-notify-menu .mytasks-chip { width: 36px; min-height: 36px; justify-content: center; padding: 0; }
    .project-notify-menu .mytasks-chip .action-label, .project-notify-menu .mytasks-caret { display: none; }
    .project-workspace .project-header { flex-wrap: wrap; }
    .project-workspace .project-identity { width: auto; min-width: 0; flex: 1 1 0; order: 1; }
    .project-workspace .project-header-actions { position: static; width: auto; order: 2; justify-content: flex-end; margin-left: auto; }
    .project-workspace .view-tabs { display: flex; order: 3; width: 100%; }
    .project-workspace .filter-search input { min-height: 40px; }
    .project-workspace .filter-sheet-trigger { min-height: 40px; border-radius: 999px; }
    .project-workspace .view-tab { min-width: 0; flex: 1 1 0; padding-inline: 4px; text-align: center; }
    .project-workspace .filter-search-row { flex: 1 1 auto; }
    .project-notify-title { padding-top: 2px; color: var(--text); font-size: 15px; font-weight: 700; }
    /* The menu becomes a bottom sheet; the header's blur would trap it, so drop it here. */
    .project-workspace .project-header { background: var(--canvas); backdrop-filter: none; }
    .project-notify-menu .mytasks-menu { width: auto; }
    .project-notify-menu:has(.mytasks-menu:not([hidden]))::before { content: ""; position: fixed; z-index: 40; inset: 0; background: rgba(0,0,0,.5); }
}

/* View switch: one highlight slides to the chosen view (placeViewIndicator() in project.js). */
.project-workspace .view-tabs { position: relative; }
.project-workspace .view-tab { position: relative; z-index: 1; transition: color .2s; }
.project-workspace .view-tabs:has(.view-tabs-indicator) .view-tab.active { background: transparent; }
.view-tabs-indicator { position: absolute; top: 3px; bottom: 3px; left: 0; border-radius: 999px; background: var(--primary-soft); pointer-events: none; }
.view-tabs.has-indicator .view-tabs-indicator { transition: transform .28s cubic-bezier(.2,.8,.2,1), width .28s cubic-bezier(.2,.8,.2,1); }

/* Card row: the dragged pill lifts and follows the mouse; the others slide (Web Animations). */
.card-strip.is-sorting { cursor: grabbing; user-select: none; }
.project-workspace .card-tab-wrap.is-dragging { position: relative; z-index: 5; box-shadow: 0 10px 24px -10px var(--shadow-color); opacity: .95; pointer-events: none; }
.card-strip.is-sorting { scroll-snap-type: none; scroll-behavior: auto; }

/* New card / Edit card. */
.card-position { display: grid; gap: 8px; }
.card-position-label { font-weight: 650; }
.card-position-buttons { display: flex; gap: 8px; }
.card-position-buttons .secondary-button { display: inline-flex; min-height: 36px; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.card-position-buttons .ui-icon { width: 16px; height: 16px; }
.card-bin-button { gap: 6px; margin-right: auto; color: var(--danger); }
.card-bin-button:hover { background: var(--danger-soft); color: var(--danger); }
.card-bin-button .ui-icon { width: 16px; height: 16px; }
@media (max-width: 760px) {
    .card-dialog .dialog-actions { flex-wrap: wrap; }
    .card-dialog .dialog-actions .card-bin-button { flex: 1 0 100%; order: 3; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .view-tabs.has-indicator .view-tabs-indicator, .project-workspace .view-tab { transition: none; }
}

/* Card row drag: positions come from offsetLeft, so the row is the offset parent. */
.project-workspace .card-strip { position: relative; }
.project-workspace .card-tab-wrap.is-dragging { transition: none; }
.card-strip.is-sorting, .card-strip.is-sorting * { cursor: grabbing; }

/* Desktop: New card / Edit card open as a small window next to their button. */
.card-dialog-hint { display: none; }
/* Menu style: no title bar or footer; name field on top, actions as rows (like the Notifications menu). */
.card-dialog.is-anchored { position: fixed; z-index: 200; inset: auto; width: 230px; max-width: calc(100vw - 16px); margin: 0; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); }
.card-dialog.is-anchored .dialog-heading, .card-dialog.is-anchored .card-position-label, .card-dialog.is-anchored .card-position .field-help,
.card-dialog.is-anchored .dialog-actions > :not(.card-bin-button) { display: none; }
.card-dialog.is-anchored .card-name-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card-dialog.is-anchored .dialog-body { gap: 0; padding: 8px; }
.card-dialog.is-anchored label { gap: 4px; }
.card-dialog.is-anchored input[name="name"] { min-height: 34px; padding-block: 5px; border-radius: 8px; font-size: 14px; }
.card-dialog.is-anchored .card-dialog-hint { display: block; padding: 0 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.card-dialog.is-anchored .card-position { gap: 0; margin: 8px -8px -8px; padding: 4px 6px 0; border-top: 1px solid var(--border); }
.card-dialog.is-anchored .card-position-buttons { display: grid; gap: 2px; }
.card-dialog.is-anchored .card-position-buttons .secondary-button, .card-dialog.is-anchored .card-bin-button { display: flex; width: 100%; min-height: 34px; justify-content: flex-start; gap: 10px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; }
.card-dialog.is-anchored .card-position-buttons .secondary-button:hover:not(:disabled) { background: var(--surface-2); }
.card-dialog.is-anchored .card-position-buttons .secondary-button:disabled { opacity: .4; }
.card-dialog.is-anchored .card-position-buttons .ui-icon { order: -1; }
.card-dialog.is-anchored .dialog-actions:has(.card-bin-button:not([hidden])) { display: block; padding: 4px 6px 6px; }
.card-dialog.is-anchored .dialog-actions:not(:has(.card-bin-button:not([hidden]))) { display: none; }
.card-dialog.is-anchored .card-bin-button { margin: 0; color: var(--danger); }
.card-dialog.is-anchored .card-bin-button:hover { background: var(--danger-soft); }

/* Phones: long-press a card pill to drag it (no text selection or callout menu). */
.project-workspace .card-tab-wrap { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (max-width: 760px) {
    /* The card menu drops below the card row, clear of the keyboard, with the pills still visible. */
    .card-dialog.is-anchored { width: calc(100vw - 16px); max-height: none; border-bottom: 1px solid var(--border-strong); border-radius: 14px; animation: none; }
    .card-dialog.is-anchored input[name="name"] { min-height: 44px; font-size: 16px; }
    .card-dialog.is-anchored .card-position-buttons .secondary-button, .card-dialog.is-anchored .card-bin-button { min-height: 44px; font-size: 15px; }
    .card-dialog.is-anchored .dialog-actions .card-bin-button { flex: none; order: 0; }
}

/* Move to bin: the card menu turns into the question (no second window on top). */
.card-dialog.is-confirming form > :not(.card-bin-confirm) { display: none !important; }
.card-bin-confirm { display: grid; gap: 6px; padding: 12px; }
.card-bin-confirm[hidden] { display: none; }
.card-bin-confirm-title { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.card-bin-confirm-title .ui-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--danger); }
.card-bin-confirm-help { margin: 0 0 6px 26px; color: var(--muted); font-size: 13px; }
.card-bin-confirm-actions { display: flex; justify-content: flex-end; gap: 6px; }
.card-bin-confirm-actions button { min-height: 34px; padding: 5px 12px; border-radius: 8px; font-size: 14px; }
@media (max-width: 760px) {
    .card-bin-confirm-actions button { min-height: 44px; flex: 1; }
}

/* Project settings page (project_settings.html): the Account settings layout. */
.project-settings .project-settings-return { min-height: 32px; margin-bottom: 6px; font-size: 13px; }
.project-settings .project-settings-return .ui-icon { width: 16px; height: 16px; }
.project-settings-thumb { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }
.project-settings .settings-nav a.project-settings-danger-link { color: var(--danger); }
.project-settings .settings-nav a.project-settings-danger-link.active { background: var(--danger-soft); }
.project-settings .settings-actions { display: flex; justify-content: flex-end; gap: 8px; }
.project-settings .panel > .muted.small:first-child { margin: 0; }
.project-colour-field { display: grid; gap: 6px; }
.project-settings .project-background-editor { padding: 20px; }
.project-settings .label-create-form .colour-swatches, .label-manager-editor .colour-swatches { margin: 0; }
.project-settings .label-create-form { display: grid; grid-template-columns: minmax(0,1fr); align-items: stretch; }
.access-panel { display: grid; gap: 12px; }
.access-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.access-panel-head h2 { margin: 0; font-size: 16px; }
.access-panel-head p { margin: 4px 0 0; }
.access-panel-head > button { flex: none; }
.access-groups { display: grid; gap: 16px; }
.access-groups > [data-external-access-status]:empty { display: none; }
.project-settings .member-row { grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; padding: 10px 0; }
.project-settings .member-row:last-child { border-bottom: 0; }
.member-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.member-controls .row-actions { gap: 2px; }
.project-settings .external-access-row { gap: 0; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.project-settings .external-access-row:last-child { border-bottom: 0; }
.external-access-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.external-access-head .row-actions { flex: none; gap: 2px; }
.external-access-editor { display: grid; gap: 12px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
.external-access-editor[hidden] { display: none; }
.external-access-editor-actions { justify-content: flex-end; }
.ghost-button.danger-text-button { color: var(--danger); font-size: 13px; }
.project-settings .label-manager-list { gap: 0; padding: 6px 20px; }
.project-settings .label-manager-row { display: block; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.project-settings .label-manager-row:last-child { border-bottom: 0; }
.label-manager-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.label-manager-head .row-actions { gap: 2px; }
.label-manager-editor { margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
.label-manager-editor[hidden] { display: none; }
.label-manager-list > p { margin: 10px 0; }
.project-bin-panel { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.project-settings .panel.settings-row h2 { margin: 0; font-size: 16px; }
@media (max-width: 760px) {
    .project-settings .project-settings-return { min-height: 44px; border-bottom: 0; color: var(--muted); }
    .project-settings .project-background-editor { grid-template-columns: 1fr; }
    .project-settings .member-row { grid-template-columns: auto minmax(0,1fr); }
    .access-panel-head, .external-access-head { flex-wrap: wrap; }
    .external-access-head .row-actions { width: 100%; }
    .project-settings .label-manager-list { padding: 4px 14px; }
    .project-settings .settings-actions button { flex: 1; min-height: 44px; }
}

/* Share window: one field for everyone, who has access, and the share link. */
.share-dialog { width: min(480px, calc(100vw - 24px)); }
.share-content { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; padding: 18px 20px 16px; }
.share-content .dialog-heading { margin: 0; }
.share-content .dialog-heading h2 { min-width: 0; margin: 0; overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.share-form { display: grid; gap: 8px; }
.share-add-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; }
.share-add-row label { display: block; margin: 0; }
.share-add-row input, .share-add-row select { width: 100%; min-height: 40px; }
.share-add-row button { min-height: 40px; white-space: nowrap; }
.share-form .field-help { margin: 0; }
.share-guest { display: grid; gap: 18px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
.share-guest[hidden] { display: none; }
.share-guest-note { display: flex; gap: 8px; margin: 0; font-size: 13px; line-height: 1.45; }
.share-guest-note .ui-icon { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--primary); }
.share-expiry { display: flex; flex-wrap: wrap; gap: 8px; }
.share-expiry label { display: grid; flex: 1 1 160px; gap: 4px; margin: 0; font-size: 13px; }
.share-section { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.share-subtitle { margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.share-access-list { display: grid; gap: 2px; max-height: 240px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.share-access-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 40px; }
.share-access-name { display: flex; min-width: 0; align-items: center; gap: 6px; }
.share-access-name strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.share-access-role { color: var(--muted); font-size: 13px; text-align: right; }
.share-avatar { display: inline-grid; width: 30px; height: 30px; flex: none; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; }
.share-avatar.is-guest { background: var(--warning-soft); color: var(--warning); }
.share-guest-chip { flex: none; padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 600; }
.share-link-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; }
.share-link-row > div { display: grid; min-width: 0; }
.share-link-row button[hidden] { display: none; }
.share-link-icon { display: inline-grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.share-link-icon .ui-icon { width: 16px; height: 16px; }
.share-link-form { display: grid; gap: 20px; }
.share-link-form[hidden] { display: none; }
.share-link-form .dialog-actions { margin: 4px 0 0; }
.share-content .external-access-result { margin: 0; }
.share-manage { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -20px -16px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.share-manage strong { color: var(--primary); font-weight: 600; }
.share-manage .ui-icon { width: 16px; height: 16px; flex: none; }
.share-manage:hover strong { text-decoration: underline; }
@media (max-width: 760px) {
    .share-content { padding: 16px; }
    .share-add-row { grid-template-columns: minmax(0,1fr) auto; }
    .share-add-row .share-who { grid-column: 1 / -1; }
    .share-add-row input, .share-add-row select, .share-add-row button { min-height: 44px; font-size: 16px; }
    .share-manage { margin: 0 -16px -16px; padding: 14px 16px; }
}
/* Share window and the Settings access editors: the areas as a row of chips, and the copy buttons on one line. */
/* The parts a guest or a link opens, and when a link ends: chips. Under the parts, a switch for
   work calendar events. */
:is(.share-content, .external-access-editor) .external-areas-fieldset { display: grid; gap: 8px; margin: 0; }
:is(.share-content, .external-access-editor) .external-areas-fieldset legend { margin-bottom: 10px; font-size: 13px; }
:is(.share-content, .external-access-editor) .external-area-checks { display: flex; flex-wrap: wrap; gap: 10px; }
:is(.share-content, .external-access-editor) .external-area-checks > div { display: contents; }
:is(.share-content, .external-access-editor) .external-area-checks .compact-check { position: relative; justify-content: center; min-height: 36px; margin: 0; padding: 6px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; }
:is(.share-content, .external-access-editor) .external-area-checks .compact-check input:not(.switch) { position: absolute; width: 1px; min-height: 1px; height: 1px; opacity: 0; }
:is(.share-content, .external-access-editor, .folder-link-dialog) .external-area-checks .compact-check:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); background: var(--primary-soft); color: var(--primary); }
:is(.share-content, .external-access-editor) .external-area-checks .compact-check:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
:is(.share-content, .external-access-editor) .external-area-checks [data-external-caldav-share-control] { flex: 1 0 100%; flex-direction: row-reverse; justify-content: space-between; order: 9; margin-top: 4px; padding: 6px 2px; border: 0; border-radius: 0; background: none; color: var(--text); font-weight: 600; }
:is(.share-content, .external-access-editor) .external-area-checks [data-external-caldav-share-control]:has(input:checked) { border: 0; background: none; color: var(--text); }
:is(.share-content, .external-access-editor) .external-area-checks .compact-check[hidden] { display: none; }
.share-content .external-access-result-link button { white-space: nowrap; }
@media (max-width: 760px) {
    :is(.share-content, .external-access-editor) .external-area-checks .compact-check { min-height: 40px; }
}

/* Project settings: the description grows downwards only, within limits. */
.project-settings textarea { min-height: 120px; max-height: 360px; resize: vertical; }

/* Project settings › Image: a drop zone in place of the browser's file field. */
.project-image-form { display: grid; align-content: start; gap: 12px; }
.image-drop { display: grid; min-height: 150px; place-content: center; justify-items: center; gap: 6px; margin: 0; padding: 20px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--canvas); color: var(--muted); font-weight: 400; text-align: center; cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.image-drop:hover, .image-drop.is-dragging, .image-drop:focus-within { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 45%, var(--canvas)); }
.image-drop:focus-within { outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.image-drop.is-uploading { cursor: progress; opacity: .75; }
.image-drop-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.image-drop-icon .ui-icon { width: 20px; height: 20px; }
.image-drop-title { color: var(--text); font-size: 14px; }
.image-drop-title strong { color: var(--primary); }
.image-drop-hint { font-size: 12px; }
.project-image-form .row-actions:not(:has(:not([hidden]))) { display: none; }

/* Project settings › People and access: what each role may do. */

/* Project settings › Work calendars: the Account settings two-step window. */
#project-caldav-dialog[data-caldav-step="1"] [data-caldav-step-two],
#project-caldav-dialog[data-caldav-step="2"] [data-caldav-step-one] { display: none; }
.caldav-discovered { display: grid; gap: 8px; }
#project-caldav-dialog [data-project-caldav-form-status] { margin: 0; }

/* Project settings › File storage: the mapped folder window in three groups. */
.mapping-dialog { width: min(620px, calc(100vw - 24px)); }
.mapping-body { display: grid; gap: 16px; }
.mapping-group { display: grid; gap: 10px; margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.mapping-group legend { padding: 0 6px; margin-left: -6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.mapping-group .field-help { margin: 0; }
.mapping-group [hidden] { display: none; }
.mapping-connection { display: grid; grid-template-columns: 110px minmax(0,1fr) 110px; gap: 10px; }
.mapping-body label { margin: 0; }
@media (max-width: 760px) {
    .mapping-connection { grid-template-columns: minmax(0,1fr) 100px; }
    .mapping-connection > label:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
    .mapping-group { padding: 12px; }
}

/* Project settings › Activity log: the security log's timeline; three filters. */
.project-settings .log-filter-form { grid-template-columns: minmax(0,2fr) repeat(2, minmax(0,1fr)); }
.project-settings .log-filter-form .log-filter-actions { grid-column: 1 / -1; }
@media (max-width: 760px) {
    .project-settings .log-filter-form { grid-template-columns: 1fr; }
}
.mapping-dialog fieldset.mapping-group { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.mapping-body .form-grid { align-items: start; }
.mapping-connection { grid-template-columns: 110px minmax(0,1fr) 140px; align-items: start; }
@media (max-width: 760px) {
    .mapping-connection { grid-template-columns: minmax(0,1fr) 130px; }
    .mapping-dialog fieldset.mapping-group { padding: 12px; }
}
.mapping-dialog fieldset.mapping-group, .mapping-connection > * { min-width: 0; }
@media (max-width: 760px) { .mapping-body .form-grid { grid-template-columns: minmax(0,1fr); } .mapping-body .compact-check { white-space: normal; } }

/* Project settings › Work calendars: the My calendars rows. */
.project-settings [data-project-caldav-list] { display: grid; gap: 12px; }
/* Settings opened from Account settings: the project is one click away from its name. */
.project-settings-open { color: var(--primary); font-size: 12px; font-weight: 600; }
.project-settings-open:hover { text-decoration: underline; }
/* Required fields. */
.required-mark { margin-left: 3px; color: var(--danger); font-weight: 700; }
.required-note { margin: 0; }
/* The mapped folder window answers in place. */
.mapping-form-status { margin: 0; font-size: 13px; }
.mapping-form-status:empty { display: none; }
.mapping-form-status[data-tone="error"] { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); border-radius: 10px; background: var(--danger-soft); color: var(--danger); }
.mapping-form-status[data-tone="success"] { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.mapping-form-status:not([data-tone="error"]):not([data-tone="success"]) { color: var(--muted); }
/* Date filters: the themed picker; "Any date" reads as empty. */
.log-filter-form .calendar-date-field { gap: 6px; }
.log-filter-form .calendar-date-label { font-size: 14px; font-weight: 600; }
.calendar-date-button.is-empty span { color: var(--muted); font-weight: 500; }
.calendar-date-foot { justify-content: space-between; }

/* Project settings › Work calendars: the My calendars panel. */
.project-settings [data-project-caldav-list] { display: grid; gap: 12px; }
.project-settings [data-project-caldav-list] > p { margin: 0; }

/* Project settings › File storage: folder rows with room to breathe. */
.project-settings .mapping-list { gap: 0; }
.project-settings .mapping-card { grid-template-columns: minmax(0,1fr) auto; gap: 4px 16px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.project-settings .mapping-card:last-child { border-bottom: 0; }
.project-settings .mapping-card .mapping-identity { grid-column: 1; grid-row: 1; }
.project-settings .mapping-card .mapping-identity small { white-space: normal; }
.project-settings .mapping-card .mapping-status { grid-column: 1; grid-row: 2; margin: 0; text-align: left; }
.project-settings .mapping-card .row-actions { grid-column: 2; grid-row: 1 / span 2; gap: 2px; }
.mapping-form-status a { color: inherit; font-weight: 700; text-decoration: underline; }
@media (max-width: 760px) {
    .project-settings .mapping-card { grid-template-columns: minmax(0,1fr); }
    .project-settings .mapping-card .row-actions { grid-column: 1; grid-row: 3; }
}

/* Share window: People and Link tabs; the link's end as chips. */
.share-tabs { display: flex; gap: 18px; margin-top: -6px; border-bottom: 1px solid var(--border); }
.share-tab { position: relative; padding: 8px 0 10px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.share-tab.active { color: var(--text); }
.share-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 2px; background: var(--primary); content: ""; }
.share-panel { display: grid; gap: 16px; }
.share-panel[hidden] { display: none; }
.share-readonly { display: flex; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--text); font-size: 13px; line-height: 1.45; }
.share-readonly .ui-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--primary); }
.share-ends .compact-check input { position: absolute; opacity: 0; pointer-events: none; }
.share-ends .compact-check { position: relative; padding-left: 12px; }
.share-ends .compact-check:has(input:focus-visible) { outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.share-link-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-link-foot [data-share-link-summary]:empty { display: none; }
@media (max-width: 760px) {
    .share-link-foot { flex-wrap: wrap; }
    .share-link-foot .primary-button { flex: 1; min-height: 44px; }
}

/* Share › Link: the new link sits above the button that now copies it. */
.share-link-created { display: grid; gap: 6px; }
.share-link-created[hidden] { display: none; }
.share-link-created input { min-height: 40px; border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); font-family: var(--mono, ui-monospace, monospace); font-size: 13px; }
.share-link-foot .primary-button.copied { background: var(--primary-soft); color: var(--primary); }

/* People and access, File storage: the head keeps its button on the title's line. */
.access-panel-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; }
.access-panel-head > .ghost-button { min-height: 32px; padding: 4px 8px; margin-right: -8px; }
.member-role-text { color: var(--muted); font-size: 13px; }
/* A member's role: a pill that opens the role bar for that person; the account's tools. */
.member-role-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.member-role-pill::after { content: ""; width: 6px; height: 6px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.member-role-pill[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(-135deg); }
.member-role-pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.member-row > .member-role-panel { display: grid; grid-column: 1 / -1; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.member-row > .member-role-panel[hidden] { display: none; }
.member-role-panel .row-actions { justify-content: flex-end; }
.account-tools { display: grid; gap: 10px; margin-top: 4px; }
/* Slide to confirm (Make owner): a wide slider that acts only at its far end. */
.slide-confirm { display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 400; }
/* The part already passed (left of the knob) is red, the rest Melon's green. --slide is 0 to 1;
   the knob is as tall as the track (44px), so it covers the line where the two colours meet;
   its centre sits at 22px + slide * (100% - 44px). */
.slide-confirm input[type="range"] { --slide: 0; --slide-at: calc(22px + var(--slide) * (100% - 44px)); --slide-knob: color-mix(in srgb, var(--danger) min(calc(var(--slide) * 2000%), 100%), var(--primary)); -webkit-appearance: none; appearance: none; box-sizing: border-box; height: 46px; min-height: 46px; padding: 0; border: 1px solid color-mix(in srgb, var(--slide-knob) 55%, var(--border)); border-radius: 999px; background: linear-gradient(to right, color-mix(in srgb, var(--danger) 45%, var(--surface)) var(--slide-at), color-mix(in srgb, var(--primary) 20%, var(--surface)) var(--slide-at)); cursor: grab; }
.slide-confirm input[type="range"]:focus { border-color: var(--slide-knob); box-shadow: 0 0 0 1px var(--slide-knob); }
.slide-confirm input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--slide-knob); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.slide-confirm input[type="range"]::-moz-range-thumb { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--slide-knob); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.slide-confirm input[type="range"]::-moz-range-track { background: transparent; }
.slide-confirm input[type="range"]:disabled { opacity: .6; cursor: progress; }
.external-access-head .row-actions .ghost-button:first-child { margin-left: -10px; }
@media (max-width: 760px) {
    .access-panel-head { flex-wrap: nowrap; }
    .project-settings .member-row { grid-template-columns: auto minmax(0,1fr) auto; }
    .project-settings .member-row .member-controls.is-fixed { grid-column: auto; justify-content: flex-end; }
    .external-access-head { gap: 4px; padding-bottom: 12px; }
    .external-access-identity .muted.small { line-height: 1.45; }
    .project-settings .access-panel-head > .secondary-button { min-height: 40px; padding: 6px 12px; }
    /* The mapped folder window is a full-width sheet like the others. */
    .mapping-dialog { width: 100%; }
}
.project-settings .panel > .access-panel-head + .mapping-list { margin-top: 12px; }

/* Date fields that can be hidden (a guest's end date) stay hidden. */
.calendar-date-field[hidden] { display: none; }
.calendar-date-day:disabled { opacity: .3; cursor: default; }
.share-expiry .calendar-date-field { flex: 1 1 160px; font-size: 13px; }

/* Guest setup, first password and guest sign-in on the sign-in layout. */
.login-form .eyebrow { margin-bottom: -12px; }
.login-form .login-lead { margin: -14px 0 2px; font-size: 14px; line-height: 1.5; }
.login-form input:disabled { opacity: .7; }

/* Notifications in the top layer (above open windows): no popover box of their own. */
/* A rule still unmet when the form is sent. */
.password-checklist li.is-missing { color: var(--danger); }
.password-checklist li.is-missing::before { border-color: var(--danger); }
.login-form .password-checklist { margin-top: -8px; }
/* Share › Link: the date under the chips when "On a date" is picked. */
.share-link-date { max-width: 260px; margin-top: 8px; font-size: 13px; }

/* Share › People: the person typed already has access; the button stays off. */
.share-known { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warning, #e5a83a) 45%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--warning, #e5a83a) 10%, transparent); font-size: 13px; line-height: 1.45; }
.share-known[hidden] { display: none; }
.share-known .ui-icon { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--warning, #e5a83a); }

/* Password Show: a tap leaves no grey box behind (hover only where a pointer hovers). */
.password-toggle:hover { background: transparent; color: var(--muted); }
@media (hover: hover) { .password-toggle:hover { background: var(--surface-2); color: var(--text); } }
.password-toggle:focus-visible { background: var(--surface-2); color: var(--text); }
@media (max-width: 760px) {
    .password-toggle { min-height: 40px; right: 4px; }
    /* Guests: no navigation button, so the bell and monogram sit on the right. */
    .is-guest-header .header-actions { margin-left: auto; }
}

/* Guest menu button: a monogram on desktop, three lines on phones (H2). */
.guest-menu-button .nav-open-icon, .guest-menu-button .nav-close-icon { display: none; }
.people-list { max-height: 60vh; }
.people-note { margin: 4px 0 0; }
@media (max-width: 760px) {
    .guest-menu-button { border-color: transparent; border-radius: 9px; background: transparent; color: var(--text); }
    .guest-menu-button .guest-monogram { display: none; }
    .guest-menu-button .nav-open-icon { display: block; }
    .guest-menu-button[aria-expanded="true"] .nav-open-icon { display: none; }
    .guest-menu-button[aria-expanded="true"] .nav-close-icon { display: block; }
    .guest-menu-button[aria-expanded="true"] { border-color: var(--border); background: var(--surface-2); }
    /* The menu drops down full width under the header, like the members' navigation panel. */
    .account-menu.is-guest-menu { top: var(--header-height); right: 0; left: 0; width: auto; max-height: calc(100vh - var(--header-height)); padding: 8px 12px 14px; border-width: 0 0 1px; border-radius: 0; box-shadow: 0 12px 24px rgb(0 0 0 / .25); }
    .account-menu.is-guest-menu a, .account-menu.is-guest-menu .menu-button { min-height: 44px; }
}
.people-list .share-access-name { flex-wrap: wrap; row-gap: 0; }
.people-ends { flex-basis: 100%; }
/* People window: the list sits in its box with room inside the border. */
.share-access-list.people-list { padding: 6px 14px; border: 1px solid var(--border); border-radius: 12px; }

/* Board cards: subtask bar under the title, counts as small icons. */
.task-card-progress { display: block; width: 100%; height: 4px; margin: 2px 0 8px; overflow: hidden; border: 0; border-radius: 999px; background: var(--border-strong); accent-color: var(--primary); }
.task-card-progress::-webkit-progress-bar { background: var(--border-strong); }
.task-card-progress::-webkit-progress-value { background: var(--primary); }
.task-card-progress::-moz-progress-bar { background: var(--primary); }
.task-meta .task-count { display: inline-flex; align-items: center; gap: 3px; padding: 0; background: transparent; color: var(--muted); font-weight: 650; }
.task-meta .task-count .ui-icon { width: 14px; height: 14px; }


/* Task window (T1): the properties are chips under the title; each opens its own picker. */
.task-chip-row .task-property-group { margin: 0; padding: 0; border: 0; }
.task-chip-row .task-status-trigger, .task-chip-row .task-reminder-trigger, .task-chip-row .task-picker-add, .task-chip {
    display: inline-flex; width: auto; min-height: 36px; align-items: center; gap: 7px; padding: 6px 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
    font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap; cursor: pointer;
}
.task-chip-row .task-status-trigger:hover, .task-chip-row .task-reminder-trigger:hover, .task-chip:hover { border-color: var(--border-strong); }
.task-chip-row .task-status-trigger:disabled { cursor: default; }
.task-chip-row .task-chevron { margin-left: 0; font-size: 10px; }
.task-chip-row .task-picker-add { border-style: dashed; background: transparent; color: var(--muted); }
.task-chip-row .task-picker-add:hover { border-color: var(--primary); color: var(--text); }
.task-chip-row .task-picker { min-height: 0; gap: 6px; }
.task-chip-row .task-person-pill { min-height: 36px; padding: 3px 12px 3px 4px; border-radius: 10px; font-size: 13px; }
.task-chip-row .task-person-avatar { width: 26px; height: 26px; flex-basis: 26px; font-size: 11px; }
.task-chip-row .task-selected-label { min-height: 36px; border-radius: 10px; }
.task-chip-row .task-reminder-trigger .ui-icon { width: 15px; height: 15px; color: var(--muted); }
.task-chip-swatch { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 3px; background: var(--swatch,#c084d8); }
.task-schedule-chip.is-empty { border-style: dashed; background: transparent; color: var(--muted); }
.task-schedule-chip.is-empty:hover { border-color: var(--primary); color: var(--text); }
.task-schedule-chip.is-empty .task-chip-swatch { display: none; }
.task-schedule-chip.overdue { border-color: color-mix(in srgb,var(--danger) 40%,transparent); background: var(--danger-soft); color: var(--danger); }
.task-chip-row .task-status-menu, .task-chip-row .task-choice-menu, .task-chip-row .task-reminder-menu, .task-chip-popover {
    position: absolute; z-index: 60; top: calc(100% + 6px); right: auto; left: 0; width: max-content; min-width: 230px; max-width: min(340px,calc(100vw - 40px));
    margin: 0; padding: 8px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow);
}
.task-chip-row .task-schedule-card { width: 330px; max-height: calc(100dvh - 200px); padding: 14px; overflow-y: auto; }
.task-chip-row .task-all-day { margin-bottom: 10px; }
.task-chip-row .task-date-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.task-chip-row .task-date-field > button { min-height: 40px; padding: 7px 10px; }
.task-chip-row .task-date-picker { margin-top: 10px; box-shadow: none; }
.task-chip-row .task-calendar-colour { grid-template-columns: auto minmax(0,1fr); gap: 8px; margin-top: 12px; padding-top: 12px; }
.task-chip-row .task-calendar-colour > span, .task-chip-row .task-colour-swatches { grid-column: 1 / -1; }
.task-chip-row .task-colour-swatches { gap: 6px; }
.task-chip-row .task-colour-swatches button { width: 28px; height: 28px; flex-basis: 28px; border-radius: 8px; }
.task-chip-row .task-calendar-colour > small { align-self: center; }

@media (min-width: 761px) {
    .task-detail-header { padding-bottom: 6px; border-bottom: 0; }
    .task-detail-body { grid-template-columns: minmax(0,1fr); grid-template-areas: "rail" "tabs" "panel"; grid-template-rows: auto auto minmax(0,1fr); }
    .task-property-rail.task-chip-row { position: relative; z-index: 10; display: flex; grid-area: rail; grid-row: auto; height: auto; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 30px 18px; overflow: visible; border-left: 0; border-bottom: 1px solid var(--border); background: var(--canvas); }
    .task-chip-row .task-reminders-property .task-reminder-menu { right: 0; left: auto; }
}
@media (min-width: 761px) and (max-height: 1100px) {
    .task-detail-header { padding-bottom: 2px; }
    .task-property-rail.task-chip-row { padding: 6px 20px 12px; }
}
@media (max-width: 760px) {
    .task-detail-header { padding-bottom: 4px; border-bottom: 0; }
    .task-property-rail.task-chip-row { order: -3; display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 20px 14px; border-bottom: 1px solid var(--border); }
    .task-chip-row .task-status-trigger, .task-chip-row .task-reminder-trigger, .task-chip-row .task-picker-add, .task-chip, .task-chip-row .task-person-pill, .task-chip-row .task-selected-label { min-height: 40px; font-size: 14px; }
    .task-chip-row .task-status-option { min-height: 48px; }
    /* Pickers open as a sheet from the bottom; the shadow dims the window behind. */
    .task-chip-row .task-status-menu, .task-chip-row .task-choice-menu, .task-chip-row .task-reminder-menu, .task-chip-popover, .task-chip-row .task-schedule-card {
        position: fixed; z-index: 69; top: auto; right: 0; bottom: 0; left: 0; width: auto; max-width: none; max-height: 72dvh; overflow-y: auto;
        padding: 18px 20px max(18px,env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5);
    }
    .task-chip-row .task-colour-swatches { justify-content: space-between; }
    /* The task's ⋯ menu: the same sheet from the bottom as the pickers; its items are unchanged. */
    .task-overflow-wrap .task-overflow-menu {
        position: fixed; z-index: 69; top: auto; right: 0; bottom: 0; left: 0; width: auto; max-width: none; max-height: 72dvh; overflow-y: auto;
        padding: 10px 12px max(14px,env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5);
        animation: sheet-up .25s cubic-bezier(.2,.8,.2,1);
    }
    .task-overflow-wrap .task-overflow-menu::before { content: ""; display: block; width: 38px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--border-strong); }
    .task-overflow-wrap .task-overflow-menu button { min-height: 52px; gap: 16px; padding: 8px 14px; border-radius: 12px; font-size: 16px; font-weight: 600; }
    .task-overflow-wrap .task-overflow-menu .ui-icon { width: 21px; height: 21px; }
    .task-dialog.is-dirty[data-task-tab="conversation"] .task-mobile-savebar { display: flex; }
}

/* Column menu: the card menu (.card-dialog) plus a segmented workload choice. */
.column-stage-field { display: grid; gap: 6px; margin: 0; }
.column-stage-field > legend { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.column-stage { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); }
.column-stage label { position: relative; display: block; margin: 0; cursor: pointer; }
.column-stage input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.column-stage span { display: grid; min-height: 30px; place-items: center; padding: 3px 2px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: center; }
.column-stage label:hover span { color: var(--text); }
.column-stage input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.column-stage input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.column-dialog.is-anchored { width: 268px; }
.column-dialog.is-anchored .column-stage-field { margin: 8px -8px 0; padding: 8px 8px 0; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
    .column-dialog.is-anchored { width: calc(100vw - 16px); }
    .column-stage span { min-height: 40px; font-size: 14px; }
}

/* Task window header: smaller buttons, a compact task menu with icons. */
.task-header-save { min-width: 76px; min-height: 40px; padding-inline: 16px; border-radius: 10px; font-size: 14px; }
.task-overflow-button, .task-close-button { width: 40px; height: 40px; border-radius: 10px; }
.task-overflow-menu { width: 210px; padding: 5px; border-radius: 12px; }
.task-overflow-menu button { display: flex; min-height: 36px; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.task-overflow-menu button:hover { background: var(--surface-2); color: var(--text); }
.task-overflow-menu button.danger:hover { background: var(--danger-soft); color: var(--danger); }
.task-overflow-menu .ui-icon { width: 16px; height: 16px; color: var(--muted); }
.task-overflow-menu button.danger .ui-icon { color: inherit; }
.task-menu-divider { margin: 4px 6px; }

/* Description: plain text under the title; a click makes it an editor, like the title. */
.task-title-input { width: 100%; }
.task-description-input { display: block; width: calc(100% + 12px); min-height: 0; margin: 4px -6px 0; padding: 4px 6px; overflow-y: auto; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); font-size: 15px; line-height: 1.5; resize: none; }
.task-description-input::placeholder { color: var(--muted); }
.task-description-input:hover:not(:disabled) { background: color-mix(in srgb,var(--surface) 55%,transparent); }
.task-description-input:focus { border-color: var(--border-strong); background: var(--surface); box-shadow: none; }
.task-description-input:disabled { cursor: default; opacity: 1; }

/* Calendar colour: the last square opens the custom picker; it shows the colour once chosen. */
.task-colour-swatches .task-colour-custom { background-color: transparent; background-image: conic-gradient(#ef755f, #df9f35, #75a843, #22a6a8, #4f8cff, #a66ac2, #ef755f); }
.task-colour-swatches .task-colour-custom.selected { background-image: none; background-color: var(--swatch); }
.task-chip-row .task-calendar-colour { grid-template-columns: minmax(0,1fr); }
.task-chip-row .task-calendar-colour > small { justify-self: start; }

/* Subtasks: one bordered list with round ticks; adding is the last row. */
.subtask-progress-row { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.subtask-progress-row strong { flex: none; color: var(--text); font-size: 13px; }
.subtask-progress-row .subtask-progress { flex: 1; height: 4px; }
.subtask-box { border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb,var(--surface) 30%,var(--canvas)); }
.subtask-box .subtask-list { gap: 0; }
.subtask-box .subtask-item { min-height: 46px; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 10px; padding: 4px 8px 4px 12px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; opacity: 1; }
.subtask-box .subtask-item:first-child { border-radius: 12px 12px 0 0; }
.subtask-box .subtask-item:hover { background: color-mix(in srgb,var(--surface) 45%,transparent); }
.subtask-check, .subtask-box .subtask-item > input.subtask-check { width: 20px; height: 20px; min-height: 20px; flex: none; margin: 0; border: 1.5px solid var(--border-strong); border-radius: 50%; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.subtask-check:hover:not(:disabled) { border-color: var(--primary); }
.subtask-check:checked, .subtask-box .subtask-item > input.subtask-check:checked { border-color: var(--primary); background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0d0f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; }
.subtask-check:disabled { cursor: default; }
.subtask-item.completed .subtask-title-input, .subtask-item.completed .subtask-title { color: var(--muted); text-decoration: line-through; }
.subtask-box .subtask-title-input { min-height: 34px; font-weight: 600; }
.subtask-box .subtask-assignee-picker { display: grid; width: 30px; min-height: 30px; place-items: center; }
.subtask-avatar { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 800; }
.subtask-avatar.is-empty { border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); }
.subtask-avatar .ui-icon { width: 14px; height: 14px; }
.subtask-assignee-picker:hover .subtask-avatar.is-empty { border-color: var(--primary); color: var(--text); }
.subtask-box .subtask-actions { display: flex; gap: 0; }
.subtask-action { width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.subtask-action:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.subtask-action.subtask-delete:hover { background: var(--danger-soft); color: var(--danger); }
.subtask-action:disabled { opacity: .35; }
.subtask-action .ui-icon { width: 15px; height: 15px; }
.subtask-readonly { min-width: 0; }
.subtask-box .subtask-create-form { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; margin: 0; padding: 4px 8px 4px 12px; }
.subtask-add-icon { display: grid; width: 20px; place-items: center; color: var(--muted); }
.subtask-add-icon .ui-icon { width: 16px; height: 16px; }
.subtask-box .subtask-create-form input { min-height: 38px; padding: 4px 2px; border: 0; background: transparent; box-shadow: none; }
.subtask-box .subtask-create-form input:focus { border: 0; box-shadow: none; }
.subtask-box .subtask-create-form .subtask-assignee-picker { position: relative; }
.subtask-box .subtask-create-form select { position: absolute; inset: 0; min-height: 0; opacity: 0; cursor: pointer; }
.subtask-empty { margin: 0; padding: 12px; }
.subtask-box .subtask-list:empty + .subtask-create-form { border-radius: 12px; }

/* Attachments: a header with Upload and From project folders; smaller tiles; a ⋯ menu per file. */
.attachments-panel { display: block; }
.attachments-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.attachments-head > strong { margin-right: auto; font-size: 14px; }
.attachments-head-button { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 9px; font-size: 13px; font-weight: 650; cursor: pointer; }
.attachments-head-button .ui-icon { width: 15px; height: 15px; }
.attachments-browse-short { display: none; }
.attachments-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(170px,1fr)); align-items: start; gap: 12px; }
.attachments-grid .attachment-list { display: contents; }
.attachments-panel .attachment-item { overflow: visible; border-radius: 12px; cursor: pointer; }
.attachments-panel .attachment-item:hover { border-color: var(--border-strong); }
.attachments-panel .attachment-preview { position: relative; display: grid; height: 112px; place-items: center; overflow: hidden; border-radius: 11px 11px 0 0; }
.attachments-panel .attachment-preview img, .attachments-panel .attachment-preview video { width: 100%; height: 100%; object-fit: cover; }
.attachment-play { position: absolute; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; }
.attachment-play .ui-icon { width: 16px; height: 16px; fill: currentColor; }
.attachments-panel .attachment-details { position: relative; display: flex; min-height: 0; align-items: center; gap: 6px; padding: 6px 4px 6px 10px; }
.attachments-panel .attachment-details > span:not(.attachment-actions) { display: none; }
.attachments-panel .attachment-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments-panel .attachment-details > .row-actions.attachment-actions { position: static; display: block; padding: 0; background: none; opacity: 1; }
.attachment-more { width: 28px; height: 28px; min-height: 28px; flex: none; padding: 0; border: 0; background: transparent; color: var(--muted); }
.attachment-more:hover, .attachment-more[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.attachment-menu { position: absolute; z-index: 30; right: 4px; top: calc(100% + 4px); display: grid; min-width: 180px; padding: 5px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font: 14px/1.3 var(--font, inherit); }
.attachment-menu-item { display: flex; min-height: 34px; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.attachment-menu-item:hover { background: var(--surface-2); }
.attachment-menu-item.danger { color: var(--danger); }
.attachment-menu-item.danger:hover { background: var(--danger-soft); }
.attachment-menu-item .ui-icon { width: 16px; height: 16px; color: var(--muted); }
.attachment-menu-item.danger .ui-icon { color: inherit; }
.attachments-panel .attachments-grid .upload-drop { min-height: 152px; border-radius: 12px; }
.attachments-panel .upload-drop label { gap: 6px; font-size: 13px; }
.attachments-panel .upload-drop label > span:last-child { font: inherit; }
.attachments-panel .upload-drop .ui-icon { width: 20px; height: 20px; }
/* Selecting attachments: a tick on each tile (on hover, always while selecting), then a bar like Files. */
.attachments-panel { position: relative; }
.attachments-panel .attachment-item { position: relative; }
/* The button is a 44px hit area with the circle drawn inside; while selecting it covers the whole tile. */
.attachment-check { position: absolute; z-index: 2; top: 0; left: 0; display: block; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: transparent; opacity: 0; cursor: pointer; transition: opacity .12s; -webkit-tap-highlight-color: transparent; }
.attachment-check::before { content: ""; position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; box-sizing: border-box; border: 2px solid #fff; border-radius: 50%; background: rgba(0,0,0,.35); }
.attachment-check .ui-icon { position: absolute; top: 13.5px; left: 13.5px; width: 15px; height: 15px; stroke-width: 3; }
.attachment-item:hover .attachment-check, .attachment-item:focus-within .attachment-check, .attachments-panel.is-selecting .attachment-check { opacity: 1; }
.attachments-panel.is-selecting .attachment-check { right: 0; bottom: 0; width: auto; height: auto; }
.attachment-check[aria-pressed="true"] { color: var(--primary-ink); }
.attachment-check[aria-pressed="true"]::before { border-color: var(--primary); background: var(--primary); }
.attachments-panel.is-selecting .attachment-more { visibility: hidden; }
.attachments-panel .attachment-item.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.attachments-select-button[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }
.attachment-selection-bar { position: sticky; bottom: 12px; left: auto; width: max-content; max-width: 100%; margin: 14px auto 0; transform: none; }
.attachment-rename-ext { flex: none; color: var(--muted); font-size: 15px; }
/* Desktop: the rename form is a dialog in the middle of the screen, without the sheet's grab bar. */
@media (min-width: 761px) {
    .attachment-sheet .attachment-sheet-grab { display: none; }
    .attachment-sheet.attachment-sheet > .attachment-sheet-rename { padding: 22px 22px 20px; }
    .attachment-sheet .attachment-sheet-buttons { justify-content: flex-end; }
    .attachment-sheet .attachment-sheet-buttons > * { flex: none; min-width: 110px; }
}

/* Phones: the ⋯ menu as a sheet from the bottom; Rename swaps in a name field. */
.attachment-sheet { padding: 0; }
.attachment-sheet[open] { display: grid; }
.attachment-sheet-grab { display: block; width: 38px; height: 4px; margin: 10px auto 4px; border-radius: 2px; background: var(--border-strong); }
.attachment-sheet-head { display: flex; align-items: center; gap: 12px; padding: 8px 20px 14px; border-bottom: 1px solid var(--border); }
.attachment-sheet-thumb { display: grid; width: 48px; height: 48px; flex: none; place-items: center; overflow: hidden; border-radius: 10px; background: var(--surface-2); font-size: 10px; }
.attachment-sheet-thumb img, .attachment-sheet-thumb video { width: 100%; height: 100%; object-fit: cover; }
.attachment-sheet-text { display: grid; min-width: 0; gap: 2px; }
.attachment-sheet-text strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-sheet-text span { color: var(--muted); font-size: 13px; }
.attachment-sheet-list { display: grid; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); }
.attachment-sheet-item { display: flex; min-height: 52px; align-items: center; gap: 16px; padding: 8px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.attachment-sheet-item:active { background: var(--surface-2); }
.attachment-sheet-item .ui-icon { width: 21px; height: 21px; color: var(--muted); }
.attachment-sheet-item.danger, .attachment-sheet-item.danger .ui-icon { color: var(--danger); }
/* .sheet-dialog > form sets padding and gap to 0; the rename form needs its own. */
.attachment-sheet > .attachment-sheet-rename { display: grid; gap: 14px; padding: 6px 20px calc(16px + env(safe-area-inset-bottom)); }
.attachment-sheet-rename h2 { margin: 0; font-size: 17px; }
.attachment-sheet-field { display: flex; align-items: center; gap: 6px; }
.attachment-sheet-field input { min-width: 0; flex: 1; min-height: 46px; font-size: 16px; }
.attachment-sheet-buttons { display: flex; gap: 10px; }
.attachment-sheet-buttons > * { flex: 1; min-height: 46px; }

/* Take photo leads on phones only; desktop keeps Upload and From project folders. */
.attachments-camera-button { display: none; }
.attachments-head .primary-button.attachments-head-button { border: 0; }

/* Photo tray (task-photos.js): photos and pasted images wait here, then upload together. */
.photo-tray { margin-bottom: 14px; padding: 12px; border: 1px solid color-mix(in srgb,var(--primary) 45%,transparent); border-radius: 14px; background: color-mix(in srgb,var(--primary) 7%,var(--surface)); }
.photo-tray[hidden] { display: none; }
.photo-tray-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.photo-tray-head strong { font-size: 14px; }
.photo-tray-head span { color: var(--muted); font-size: 12px; }
.photo-tray-items { display: grid; grid-template-columns: repeat(auto-fill,minmax(132px,1fr)); gap: 12px; }
.photo-tray-item { position: relative; display: grid; gap: 6px; margin: 0; }
.photo-tray-thumb { position: relative; display: block; height: 104px; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.photo-tray-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-tray-badge { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 700; }
.photo-tray-remove { position: absolute; top: -7px; right: -7px; display: grid; width: 26px; height: 26px; min-height: 26px; place-items: center; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; }
.photo-tray-remove .ui-icon { width: 13px; height: 13px; }
.photo-tray-remove:hover { border-color: var(--danger); color: var(--danger); }
.photo-tray-name { width: 100%; min-height: 32px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.photo-tray-scan { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.photo-tray-scan:hover { border-color: var(--primary); color: var(--primary); }
.photo-tray-scan .ui-icon { width: 14px; height: 14px; }
.photo-tray-add { display: grid; height: 104px; place-items: center; align-content: center; gap: 4px; border: 1px dashed var(--primary); border-radius: 10px; color: var(--primary); font-size: 12px; font-weight: 650; cursor: pointer; }
.photo-tray-add .ui-icon { width: 22px; height: 22px; }
.photo-tray-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.photo-tray-foot .primary-button { display: inline-flex; align-items: center; gap: 7px; }
.photo-tray-foot .ui-icon { width: 15px; height: 15px; }

/* Scan editor: full screen, dark like the file viewer; four corner handles and a magnifier. */
.scan-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #0b0d0f; color: #e8eaed; }
.scan-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.scan-dialog::backdrop { background: #0b0d0f; }
.scan-header { display: flex; align-items: center; gap: 12px; padding: max(10px,env(safe-area-inset-top)) 16px 10px 10px; }
.scan-titles h2 { margin: 0; font-size: 16px; }
.scan-titles p { margin: 2px 0 0; color: #9aa0a6; font-size: 13px; }
.scan-icon-button { display: grid; width: 42px; height: 42px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #c9cdd2; cursor: pointer; }
.scan-icon-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.scan-icon-button .ui-icon { width: 20px; height: 20px; }
.scan-stage { position: relative; overflow: hidden; touch-action: none; user-select: none; }
.scan-image { position: absolute; max-width: none; pointer-events: none; }
.scan-outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-outline polygon { fill: color-mix(in srgb,var(--primary) 16%,transparent); stroke: var(--primary); stroke-width: 2; }
.scan-handle { position: absolute; top: -22px; left: -22px; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: grab; touch-action: none; }
.scan-handle::after { content: ""; position: absolute; inset: 11px; border: 3px solid var(--primary); border-radius: 50%; background: rgba(11,13,15,.55); }
.scan-handle.is-dragging { cursor: grabbing; }
.scan-handle.is-dragging::after { inset: 15px; background: transparent; }
.scan-handle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.scan-loupe { position: absolute; top: 12px; right: 12px; width: 110px; height: 110px; border: 3px solid var(--primary); border-radius: 50%; pointer-events: none; }
.scan-loupe.on-left { right: auto; left: 12px; }
.scan-loupe[hidden] { display: none; }
.scan-footer { display: flex; align-items: center; gap: 10px; padding: 10px 16px max(12px,env(safe-area-inset-bottom)); }
.scan-spacer { flex: 1; }
.scan-toggle { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: transparent; color: #e8eaed; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.scan-toggle[aria-pressed="true"] { border-color: var(--primary); background: color-mix(in srgb,var(--primary) 22%,transparent); color: #fff; }
.scan-toggle .ui-icon { width: 17px; height: 17px; }
.scan-original[hidden] { display: none; }
.scan-footer .secondary-button { border-color: rgba(255,255,255,.2); background: transparent; color: #e8eaed; }
/* Melon's camera (task-photos.js): viewfinder, shutter, last photo with a count, Done. */
.camera-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; color: #e8eaed; }
.camera-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.camera-dialog::backdrop { background: #000; }
/* No pinch or double-tap zoom in the camera and scan screens; the gallery still swipes sideways. */
.camera-dialog, .scan-dialog { touch-action: none; overscroll-behavior: none; }
.camera-dialog .camera-slides { touch-action: pan-x; }
.camera-dialog button, .scan-dialog button { touch-action: manipulation; }
.camera-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px,env(safe-area-inset-top)) 14px 10px; }
.camera-status { color: #c9cdd2; font-size: 14px; font-weight: 650; }
.camera-round { display: grid; width: 44px; height: 44px; min-height: 44px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.camera-round .ui-icon { width: 21px; height: 21px; }
.camera-view { position: relative; overflow: hidden; background: #111; }
.camera-video { width: 100%; height: 100%; object-fit: cover; }
.camera-video[hidden] { display: none; }
.camera-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.camera-flash.is-on { animation: camera-flash .35s ease-out; }
@keyframes camera-flash { from { opacity: .85; } to { opacity: 0; } }
.camera-blocked { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
.camera-blocked[hidden] { display: none; }
.camera-blocked > .ui-icon { width: 34px; height: 34px; color: #9aa0a6; }
.camera-blocked strong { font-size: 17px; }
.camera-blocked p { max-width: 300px; margin: 0; color: #9aa0a6; font-size: 14px; }
.camera-app-button { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 18px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; background: transparent; color: #fff; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.camera-app-button .ui-icon { width: 18px; height: 18px; }
.camera-bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 22px max(22px,env(safe-area-inset-bottom)); }
.camera-slot { display: flex; align-items: center; }
.camera-slot:last-child { justify-content: flex-end; }
.camera-shutter { width: 76px; height: 76px; min-height: 76px; padding: 0; border: 5px solid #fff; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 4px #000; cursor: pointer; transition: transform .12s; }
.camera-shutter:active, .camera-shutter.is-busy { transform: scale(.9); }
.camera-shutter:disabled { opacity: .4; cursor: default; }
.camera-last { position: relative; display: block; width: 54px; height: 54px; border: 2px solid #fff; border-radius: 10px; cursor: pointer; }
.camera-last[hidden] { display: none; }
.camera-last img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.camera-count { position: absolute; top: -9px; right: -9px; display: grid; min-width: 22px; height: 22px; place-items: center; padding: 0 6px; border-radius: 11px; background: var(--primary); color: var(--primary-ink); font-size: 12px; font-weight: 800; }
.camera-done { min-height: 44px; padding: 6px 22px; border: 0; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font: inherit; font-size: 15px; font-weight: 750; cursor: pointer; }
.camera-done[hidden] { display: none; }
.camera-lenses { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 8px; }
.camera-lenses[hidden] { display: none; }
.camera-lens { min-width: 44px; min-height: 36px; padding: 4px 12px; border: 0; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.camera-lens[aria-pressed="true"] { background: #fff; color: #000; }
.camera-review { position: absolute; inset: 0; z-index: 2; display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; background: #000; }
.camera-review[hidden] { display: none; }
.camera-done-small { min-height: 40px; padding: 4px 18px; font-size: 14px; }
.camera-slides { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.camera-slides::-webkit-scrollbar { display: none; }
.camera-slide { position: relative; display: grid; flex: 0 0 100%; place-items: center; margin: 0; padding: 8px 14px; scroll-snap-align: center; }
.camera-slide img { max-width: 100%; max-height: 100%; border-radius: 6px; object-fit: contain; }
.camera-slide .photo-tray-badge { left: 24px; bottom: 18px; }
.camera-strip { display: flex; justify-content: center; gap: 8px; padding: 10px 14px 4px; overflow-x: auto; scrollbar-width: none; }
.camera-strip-item { width: 48px; height: 48px; min-height: 48px; flex: none; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 9px; background: #1a1d21; opacity: .65; cursor: pointer; }
.camera-strip-item img { width: 100%; height: 100%; object-fit: cover; }
.camera-strip-item.is-current { border-color: var(--primary); opacity: 1; }
.camera-actions { display: flex; justify-content: space-around; padding: 10px 12px max(16px,env(safe-area-inset-bottom)); }
.camera-action { display: grid; min-width: 76px; min-height: 56px; justify-items: center; align-content: center; gap: 4px; padding: 4px 8px; border: 0; border-radius: 12px; background: transparent; color: #c9cdd2; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.camera-action:hover, .camera-action:active { background: rgba(255,255,255,.08); color: #fff; }
.camera-action .ui-icon { width: 22px; height: 22px; }
.camera-dialog.is-blocked .camera-shutter, .camera-dialog.is-blocked .camera-top > :not(:first-child) { visibility: hidden; }

@media (max-width: 760px) {
    .attachments-camera-button { display: inline-flex; flex: 1; justify-content: center; min-height: 40px; }
    .attachments-head > strong { display: none; }
    .attachments-head .attachments-head-text { display: none; }
    .attachments-head .secondary-button.attachments-head-button { width: 40px; min-height: 40px; justify-content: center; padding: 0; }
    .upload-drop-paste { display: none; }
    /* Phones: no circles until selecting (Select button or ⋯ → Select); a held tile never shows one. */
    .attachments-panel:not(.is-selecting) .attachment-check { display: none; }
    .attachments-panel.is-selecting .attachment-check { opacity: 1; pointer-events: auto; }
    /* Selecting on phones: the header row is the bar. × and the count on the left, icons on the right. */
    .attachments-panel.is-selecting .attachments-head > :not(.attachment-selection-bar) { display: none; }
    .attachment-selection-bar.is-inline { position: static; z-index: auto; display: flex; width: 100%; min-height: 40px; flex-wrap: nowrap; align-items: center; gap: 4px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none; animation: none; }
    .attachment-selection-bar.is-inline .file-bar-close { order: 0; width: 40px; height: 40px; min-height: 40px; flex: none; margin-left: -8px; }
    .attachment-selection-bar.is-inline .file-bar-count { flex: 1; font-size: 16px; font-weight: 700; }
    /* Undo the Files bar's phone layout (full-width row of tall buttons) for this compact header. */
    .attachment-selection-bar.is-inline .file-bar-actions { display: flex; width: auto; flex: none; order: 0; gap: 6px; }
    .attachment-selection-bar.is-inline .file-bar-button { width: 44px; min-width: 44px; height: 40px; min-height: 40px; flex: none; flex-direction: row; justify-content: center; padding: 0; border: 1px solid var(--border); border-radius: 10px; }
    .attachment-selection-bar.is-inline .file-bar-button > span { display: none; }
    .attachment-selection-bar.is-inline .file-bar-button.is-danger { border-color: color-mix(in srgb,var(--danger) 40%,transparent); }
    .photo-tray-items { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 10px; }
    .photo-tray-foot > * { flex: 1; justify-content: center; min-height: 42px; }
    .scan-footer { flex-wrap: wrap; }
    .scan-toggle span { font-size: 13px; }
}

/* File viewer: dark, icon buttons, round arrows, thumbnails. */
.attachment-viewer-dialog { border-color: #23272c; background: #0b0d0f; color: #e8eaed; }
.attachment-viewer-dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: none; }
.attachment-viewer-header { min-height: 60px; gap: 16px; padding: 10px 12px 10px 20px; border-bottom: 0; background: #0b0d0f; }
.attachment-viewer-title h2 { font-size: 15px; font-weight: 700; }
.attachment-viewer-title p { color: #9aa0a6; }
.viewer-meta-dot { margin: 0 6px; }
.attachment-viewer-title p [data-viewer-meta]:empty, .attachment-viewer-title p [data-viewer-meta]:empty ~ *, .attachment-viewer-title p:has([data-viewer-meta]:empty) .viewer-meta-dot { display: none; }
.attachment-viewer-actions { flex-wrap: nowrap; gap: 4px; }
.viewer-icon-button { display: inline-grid; width: 38px; height: 38px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #c9cdd2; cursor: pointer; }
.viewer-icon-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.viewer-icon-button.danger:hover { background: rgba(251,123,140,.14); color: #fb7b8c; }
.viewer-icon-button .ui-icon { width: 19px; height: 19px; }
.viewer-exit-full, [data-viewer-fullscreen][aria-pressed="true"] .viewer-enter-full { display: none; }
[data-viewer-fullscreen][aria-pressed="true"] .viewer-exit-full { display: inline-grid; }
.viewer-divider { width: 1px; height: 22px; margin: 0 4px; background: rgba(255,255,255,.14); }
.attachment-viewer-stage { margin: 0 12px; border-radius: 12px; background: #050607; }
.attachment-viewer-stage:fullscreen { margin: 0; border-radius: 0; background: #000; }
.attachment-viewer-stage:fullscreen .attachment-viewer-content > video, .attachment-viewer-stage:fullscreen .attachment-viewer-content > img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.viewer-arrow { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 0; }
.viewer-arrow:hover { border: 0; background: rgba(255,255,255,.2); }
.viewer-arrow .ui-icon { width: 22px; height: 22px; }
.viewer-previous { left: 14px; }
.viewer-next { right: 14px; }
.attachment-viewer-footer { position: relative; min-height: 64px; justify-content: center; padding: 10px 16px; border-top: 0; background: #0b0d0f; color: #9aa0a6; }
.viewer-position { position: absolute; left: 20px; }
.viewer-thumbs { display: flex; max-width: calc(100% - 160px); gap: 6px; overflow-x: auto; scrollbar-width: none; }
.viewer-thumb { display: grid; width: 56px; height: 40px; flex: none; place-items: center; overflow: hidden; padding: 0; border: 1px solid rgba(255,255,255,.12); border-radius: 7px; background: #1a1d21; color: #9aa0a6; font-size: 10px; font-weight: 800; opacity: .6; cursor: pointer; }
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.viewer-thumb:hover { opacity: .9; }
.viewer-thumb.is-current { border-color: var(--primary); outline: 1px solid var(--primary); opacity: 1; }
.viewer-empty { color: #c9cdd2; }

@media (min-width: 761px) and (max-height: 1100px) {
    .task-header-save { min-height: 38px; }
    .task-overflow-button, .task-close-button { width: 38px; height: 38px; }
}
@media (max-width: 760px) {
    .task-description-input { font-size: 15px; }
    .subtask-box .subtask-item { grid-template-columns: auto minmax(0,1fr) auto auto; min-height: 50px; padding: 4px 6px 4px 12px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
    .subtask-box .subtask-item:hover { background: transparent; }
    .subtask-box .subtask-actions { position: static; display: none; padding: 0; border: 0; background: none; }
    .subtask-box .subtask-item:focus-within .subtask-actions { display: flex; }
    .subtask-box .subtask-create-form { grid-template-columns: auto minmax(0,1fr) auto; margin: 0; }
    .subtask-box .subtask-create-form input { grid-column: auto; }
    .attachments-browse-long { display: none; }
    .attachments-browse-short { display: inline; }
    .attachments-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    .attachments-panel .attachment-preview { height: 104px; }
    .attachments-panel .attachments-grid .upload-drop { min-height: 140px; grid-column: auto; }
    .attachment-viewer-dialog { border: 0; }
    .attachment-viewer-header { flex-direction: row; align-items: center; max-height: none; padding: max(8px,env(safe-area-inset-top)) 6px 8px 14px; }
    .attachment-viewer-title { flex: 1; }
    .attachment-viewer-title h2 { max-width: none; }
    .attachment-viewer-title p { display: none; }
    .viewer-icon-button { width: 36px; height: 36px; }
    .viewer-icon-button[data-viewer-open-files], .viewer-divider { display: none; }
    .attachment-viewer-stage { margin: 0; border-radius: 0; }
    .viewer-arrow { top: 50%; bottom: auto; width: 40px; height: 40px; transform: translateY(-50%); }
    .viewer-previous { left: 8px; }
    .viewer-next { right: 8px; }
    .attachment-viewer-footer { min-height: 58px; padding-bottom: max(10px,env(safe-area-inset-bottom)); }
    .viewer-position { position: static; margin-right: 10px; flex: none; white-space: nowrap; }
    /* Many files: the strip scrolls sideways instead of widening the viewer past the screen. */
    .attachment-viewer { grid-template-columns: minmax(0,1fr); }
    .viewer-thumbs { min-width: 0; max-width: none; flex: 0 1 auto; }
}

/* Title, description and the comment box edit in place: no focus box, just the caret
   (the description and comment box keep a quiet border so you can see where you type). */
.task-dialog .task-title-input:focus, .task-dialog .task-title-input:focus-visible { border: 0; outline: none; box-shadow: none; }
.task-dialog .task-description-input:focus, .task-dialog .task-description-input:focus-visible { border-color: var(--border); outline: none; box-shadow: none; }
.task-dialog .comment-compose textarea:focus, .task-dialog .comment-compose textarea:focus-visible { border-color: var(--border-strong); outline: none; box-shadow: none; }
.task-dialog .subtask-box input:focus, .task-dialog .subtask-box input:focus-visible { outline: none; box-shadow: none; }

/* Round ticks: a fixed square box, whatever the generic input rules say. */
.subtask-box .subtask-item > input.subtask-check { box-sizing: border-box; width: 20px; min-width: 20px; max-width: 20px; height: 20px; min-height: 20px; padding: 0; aspect-ratio: 1; }
.subtask-box .subtask-item > input.subtask-check:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: none; }

/* Subtask person: a round button; its menu lists everyone with avatar and name. */
.subtask-box .subtask-assignee-picker { display: grid; width: 32px; height: 32px; min-height: 0; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.subtask-box .subtask-assignee-picker:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; box-shadow: none; }
.subtask-assignee-menu { position: fixed; z-index: 240; display: grid; width: 240px; max-height: min(320px,60dvh); gap: 2px; padding: 6px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.subtask-assignee-option { display: flex; min-height: 42px; align-items: center; gap: 10px; padding: 6px 10px 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.subtask-assignee-option:hover, .subtask-assignee-option:focus-visible { background: var(--surface-2); outline: none; box-shadow: none; }
.subtask-assignee-option > span:not(.subtask-avatar) { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-assignee-option > .ui-icon { width: 16px; height: 16px; color: var(--primary); }
.subtask-assignee-option .subtask-avatar { width: 28px; height: 28px; flex: none; }

/* Custom colour square: a crisp colour wheel like the Calendar's, same size as its neighbours. */
.task-colour-swatches .task-colour-custom { border-color: transparent; background: conic-gradient(from 90deg, #ef755f, #df9f35, #75a843, #22a6a8, #4f8cff, #a66ac2, #ef755f); background-clip: border-box; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.task-colour-swatches .task-colour-custom.selected { background: var(--swatch); border-color: var(--canvas); outline: 2px solid var(--swatch); outline-offset: 1px; box-shadow: none; }

@media (max-width: 760px) {
    .subtask-assignee-menu { right: 8px; left: 8px !important; width: auto; }
    .subtask-assignee-option { min-height: 48px; font-size: 15px; }
}

/* Subtasks (S1): no outer box or dividers; each step is its own soft rounded row. */
.subtask-box { border: 0; border-radius: 0; background: transparent; }
.subtask-box .subtask-list { display: grid; gap: 4px; }
.subtask-box .subtask-item, .subtask-box .subtask-item:first-child { min-height: 46px; border: 0; border-radius: 10px; background: color-mix(in srgb,var(--surface) 70%,var(--canvas)); transition: background var(--transition); }
.subtask-box .subtask-item:hover { background: var(--surface); }
.subtask-box .subtask-create-form { margin-top: 4px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.subtask-box .subtask-create-form:focus-within { border-style: solid; border-color: var(--border-strong); background: color-mix(in srgb,var(--surface) 70%,var(--canvas)); }
.subtask-box .subtask-list:empty + .subtask-create-form { margin-top: 0; }
@media (max-width: 760px) {
    .subtask-box .subtask-item, .subtask-box .subtask-item:first-child { border: 0; border-radius: 10px; background: color-mix(in srgb,var(--surface) 70%,var(--canvas)); }
    .subtask-box .subtask-item:hover { background: color-mix(in srgb,var(--surface) 70%,var(--canvas)); }
}
@media (max-width: 760px) {
    .subtask-box .subtask-create-form .subtask-assignee-picker { grid-column: auto; min-width: 0; }
}

/* Custom colour: a plain square with a plus; once a custom colour is chosen it shows that colour. */
.task-colour-swatches .task-colour-custom { display: grid; place-items: center; border: 1px dashed var(--border-strong); background: transparent; box-shadow: none; color: var(--muted); }
.task-colour-swatches .task-colour-custom:hover { border-color: var(--primary); color: var(--text); }
.task-colour-swatches .task-colour-custom .ui-icon { width: 16px; height: 16px; }
.task-colour-swatches .task-colour-custom.selected { border: 2px solid var(--canvas); background: var(--swatch); color: rgba(255,255,255,.9); }

/* Subtasks: S1's bar and people, S2's adding. Rows have no border or fill; hover tints them. */
.subtask-box .subtask-list { gap: 0; }
.subtask-box .subtask-item, .subtask-box .subtask-item:first-child { min-height: 42px; padding: 3px 6px 3px 8px; border: 0; border-radius: 8px; background: transparent; }
.subtask-box .subtask-item:hover { background: color-mix(in srgb,var(--surface) 55%,transparent); }
.subtask-box .subtask-create-form, .subtask-box .subtask-create-form:focus-within { margin-top: 0; padding: 3px 6px 3px 8px; border: 0; border-radius: 8px; background: transparent; }
.subtask-add-circle { display: block; width: 20px; height: 20px; border: 1.5px dashed var(--border-strong); border-radius: 50%; }
.subtask-box .subtask-create-form:focus-within .subtask-add-circle { border-color: var(--primary); }
.subtask-box .subtask-create-form input::placeholder { color: var(--muted); }
@media (max-width: 760px) {
    .subtask-box .subtask-item, .subtask-box .subtask-item:first-child { border: 0; background: transparent; }
    .subtask-box .subtask-item:hover { background: transparent; }
}

/* Subtask progress: the fill slides to its new width. */
.subtask-meter { position: relative; display: block; height: 4px; flex: 1; overflow: hidden; border-radius: 999px; background: var(--border-strong); }
.subtask-meter-fill { position: absolute; inset: 0 auto 0 0; width: var(--done, 0%); border-radius: inherit; background: var(--primary); transition: width 320ms cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: reduce) { .subtask-meter-fill { transition: none; } }

/* Autosave status: amber while saving, green right after, red if it failed. */
.task-saved-state { display: inline-flex; align-items: center; gap: 6px; transition: color 200ms ease; }
.task-saved-state::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; opacity: .9; }
.task-saved-state[data-save-state="saving"] { color: #efad16; }
.task-saved-state[data-save-state="saving"]::before { animation: task-saving-pulse 900ms ease-in-out infinite; }
.task-saved-state[data-save-state="fresh"] { color: var(--success, #3ecf8e); }
.task-saved-state[data-save-state="failed"] { color: var(--danger); }
.task-saved-state[data-save-state="old"]::before { display: none; }
@keyframes task-saving-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .task-saved-state[data-save-state="saving"]::before { animation: none; } }
@media (max-width: 760px) {
    .task-header-actions > .task-saved-state { display: inline-flex; font-size: 12px; }
    .task-header-actions { gap: 6px; }
    .task-breadcrumb { max-width: calc(100vw - 220px); }
    .task-detail-body { --task-mobile-savebar-space: 0px; }
}

/* File viewer arrows: dark discs, visible on light photos too. */
.viewer-arrow { border: 1px solid rgba(255,255,255,.18); background: rgba(10,12,14,.62); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.viewer-arrow:hover { border: 1px solid rgba(255,255,255,.32); background: rgba(10,12,14,.82); }

/* Task tabs: one underline that slides to the chosen tab. */
.task-tabs { position: relative; }
.task-tabs-indicator { position: absolute; bottom: 0; left: 0; width: var(--w, 0); height: 2px; border-radius: 2px; background: var(--primary); transform: translateX(var(--x, 0)); transition: transform 260ms cubic-bezier(.2,.8,.2,1), width 260ms cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.task-tabs.has-indicator .task-tab.active::after { background: transparent; }
@media (prefers-reduced-motion: reduce) { .task-tabs-indicator { transition: none; } }

/* Comment box: no resize handle; it grows with the text up to a limit, then scrolls. */
.comment-compose textarea, .task-dialog .comment-compose textarea { min-height: 52px; max-height: 240px; overflow-y: auto; resize: none; }
@media (max-width: 760px) {
    /* Phones: the status is just its dot (amber saving, green saved); the words stay for screen readers. */
    .task-header-actions > .task-saved-state { width: 22px; justify-content: center; overflow: hidden; font-size: 0; }
    .task-header-actions > .task-saved-state::before { display: block !important; width: 8px; height: 8px; }
    .task-breadcrumb { max-width: calc(100vw - 160px); }
}

/* Column drag: positions come from offsetLeft, so the board is the offset parent. */
.card-board { position: relative; }
.kanban-column .column-heading { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card-board.is-sorting-columns, .card-board.is-sorting-columns * { cursor: grabbing; }
.kanban-column.is-dragging { position: relative; z-index: 6; box-shadow: 0 18px 40px -12px rgba(0,0,0,.55); transition: none; }
@media (hover: hover) { .kanban-column .column-heading { cursor: grab; } }

/* Comment box (K1): one pill with the avatar and a round send button inside; it grows
   with the text. The shortcut hint shows only while typing. */
.task-dialog .comment-compose { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 8px; margin-top: 14px; padding: 12px 0 0; border-top: 0; background: transparent; }
.task-dialog .comment-compose .comment-compose-avatar { order: 0; width: 30px; height: 30px; flex: 0 0 30px; margin: 0 0 6px 8px; font-size: 12px; }
.task-dialog .comment-compose textarea { order: 1; min-width: 0; flex: 1 1 0; min-height: 42px; max-height: 240px; padding: 10px 0; border: 0; border-radius: 0; background: transparent; line-height: 1.45; resize: none; }
.task-dialog .comment-compose textarea:focus, .task-dialog .comment-compose textarea:focus-visible { border: 0; box-shadow: none; outline: none; }
.task-dialog .comment-compose .primary-button { order: 2; display: inline-grid; width: 36px; min-width: 36px; height: 36px; margin: 0 6px 5px 0; padding: 0; place-items: center; border-radius: 50%; }
.task-dialog .comment-compose .comment-send-label { display: none; }
.task-dialog .comment-compose .comment-send-icon { display: inline-grid; }
.task-dialog .comment-compose .comment-send-icon .ui-icon { width: 18px; height: 18px; }
.task-dialog .comment-compose .comment-shortcut { order: 3; flex-basis: 100%; height: 0; overflow: hidden; padding-left: 46px; color: var(--muted); font-size: 12px; opacity: 0; transition: opacity 160ms ease; }
.task-dialog .comment-compose:focus-within .comment-shortcut { height: 24px; padding-top: 6px; opacity: 1; }
/* The pill outline: drawn behind the avatar, field and button. */
.task-dialog .comment-compose { position: relative; }
.task-dialog .comment-compose::before { content: ""; position: absolute; z-index: 0; top: 12px; right: 0; left: 0; bottom: var(--hint-space, 0px); border: 1px solid var(--border-strong); border-radius: 22px; background: color-mix(in srgb,var(--surface) 55%,var(--canvas)); pointer-events: none; transition: border-color 160ms ease; }
.task-dialog .comment-compose:focus-within { --hint-space: 24px; }
.task-dialog .comment-compose:focus-within::before { border-color: color-mix(in srgb,var(--primary) 55%,var(--border-strong)); }
.task-dialog .comment-compose > * { position: relative; z-index: 1; }
@media (max-width: 760px) {
    .task-dialog .comment-compose { margin: auto -24px 0; padding: 10px 16px max(10px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--canvas); }
    .task-dialog .comment-compose::before { top: 10px; right: 16px; left: 16px; bottom: calc(max(10px,env(safe-area-inset-bottom)) + var(--hint-space, 0px)); }
    .task-dialog .comment-compose .comment-compose-avatar { display: none; }
    .task-dialog .comment-compose textarea { padding-left: 16px; font-size: 16px; }
    .task-dialog .comment-compose .comment-shortcut { display: none; }
    .task-dialog .comment-compose:focus-within { --hint-space: 0px; }
}
@media (max-width: 760px) {
    /* Phones: the comment pill stays stuck to the bottom of the screen. */
    .task-dialog .comment-compose { position: sticky; z-index: 15; bottom: 0; }
}
@media (max-width: 390px) {
    .task-dialog .comment-compose { margin-inline: -18px; }
}
.task-dialog .comment-compose textarea::placeholder { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Comment box (K1), rebuilt: a real pill around the avatar, the field and the send button.
   Everything is 32px tall, so one line sits centred; longer text grows the pill upwards. */
.task-dialog .comment-compose { position: static; display: block; margin-top: 14px; padding: 12px 0 0; border-top: 0; background: transparent; }
.task-dialog .comment-compose::before { content: none; }
.comment-pill { display: flex; align-items: flex-end; gap: 10px; padding: 5px 5px 5px 6px; border: 1px solid var(--border-strong); border-radius: 22px; background: color-mix(in srgb,var(--surface) 55%,var(--canvas)); transition: border-color 160ms ease; }
.comment-pill:focus-within { border-color: color-mix(in srgb,var(--primary) 55%,var(--border-strong)); }
.task-dialog .comment-pill .comment-compose-avatar { display: inline-grid; width: 32px; height: 32px; flex: 0 0 32px; margin: 0; font-size: 12px; }
.task-dialog .comment-pill textarea { display: block; min-width: 0; flex: 1 1 auto; width: auto; min-height: 32px; max-height: 240px; margin: 0; padding: 6px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 15px; line-height: 20px; overflow-y: auto; resize: none; }
.task-dialog .comment-pill textarea:focus, .task-dialog .comment-pill textarea:focus-visible { border: 0; outline: none; box-shadow: none; }
.task-dialog .comment-pill .comment-send { display: inline-grid; width: 32px; min-width: 32px; height: 32px; min-height: 32px; flex: none; margin: 0; padding: 0; place-items: center; border-radius: 50%; }
.task-dialog .comment-pill .comment-send .ui-icon { width: 17px; height: 17px; }
.task-dialog .comment-compose .comment-shortcut { display: block; height: 0; margin: 0; padding: 0 0 0 54px; overflow: hidden; color: var(--muted); font-size: 12px; opacity: 0; transition: opacity 160ms ease; }
.task-dialog .comment-compose:focus-within .comment-shortcut { height: auto; padding-top: 6px; opacity: 1; }
@media (max-width: 760px) {
    .task-dialog .comment-compose { position: sticky; z-index: 15; bottom: 0; margin: auto -24px 0; padding: 10px 16px max(10px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--canvas); }
    .task-dialog .comment-pill { padding-left: 14px; }
    .task-dialog .comment-pill .comment-compose-avatar { display: none; }
    .task-dialog .comment-pill textarea { font-size: 16px; }
    .task-dialog .comment-pill .comment-send { width: 36px; min-width: 36px; height: 36px; }
    .task-dialog .comment-compose .comment-shortcut { display: none; }
}
@media (max-width: 390px) {
    .task-dialog .comment-compose { margin-inline: -18px; }
}

/* Dragging subtasks and files. */
.subtask-list, .attachments-grid { position: relative; }
.subtask-item.is-dragging, .attachment-item.is-dragging { position: relative; z-index: 6; background: var(--surface); box-shadow: 0 14px 30px -10px rgba(0,0,0,.55); transition: none; }
.subtask-list.is-sorting, .subtask-list.is-sorting *, .attachments-grid.is-sorting, .attachments-grid.is-sorting * { cursor: grabbing; user-select: none; }
.attachments-grid .attachment-item { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Calendar: the field being picked gets a cyan outline; days that can't be picked are shaded,
   and the other end of the range is ringed. */
.task-date-field > button[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.task-date-day.out-of-range, .task-date-day.out-of-range:hover { background: transparent; color: color-mix(in srgb,var(--muted) 45%,transparent); text-decoration: line-through; cursor: not-allowed; }
.task-date-day.is-past:not(.selected), .task-date-day.is-past:not(.selected):hover { background: transparent; color: color-mix(in srgb,var(--muted) 45%,transparent); cursor: default; }
.task-date-day.other-end:not(.selected) { box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--primary) 60%,transparent); }

/* Images and video frames in file tiles: no browser image drag. */
.attachments-grid img, .attachments-grid video { -webkit-user-drag: none; pointer-events: none; }
/* No sideways scrolling in the Subtasks and Files tabs. */
.attachments-panel, .subtask-section { overflow-x: hidden; }

/* Quick add (N1a): an empty card at the bottom of a column; a small menu from the Calendar. */
.quick-add { display: grid; gap: 8px; margin: 0 0 8px; padding: 9px 10px 8px; border: 1px solid var(--primary); border-radius: 10px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--primary); }
.quick-add.is-busy { opacity: .7; }
.quick-add-when { color: var(--muted); font-size: 12px; font-weight: 650; }
.quick-add .quick-add-title, .quick-add .quick-add-title:focus, .quick-add .quick-add-title:focus-visible { width: 100%; min-height: 26px; margin: 0; padding: 0; border: 0; outline: none; background: transparent; box-shadow: none; color: var(--text); font-size: 14px; font-weight: 650; }
.quick-add-title::placeholder { color: var(--muted); font-weight: 500; }
.quick-add-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.quick-add-chip { position: relative; display: inline-flex; min-height: 26px; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.quick-add-chip:hover, .quick-add-chip[aria-expanded="true"] { border-color: var(--primary); color: var(--text); }
.quick-add-chip.is-set { color: var(--text); }
.quick-add-chip .ui-icon { width: 14px; height: 14px; }
.quick-add-chip .subtask-avatar { width: 18px; height: 18px; font-size: 10px; }
.quick-add-chip .subtask-avatar .ui-icon { width: 11px; height: 11px; }
.quick-add-chip.is-label { padding-left: 3px; }
.quick-add-chip .quick-add-label { min-height: 20px; padding: 1px 8px; font-size: 11px; }
.quick-add-more { color: var(--muted); font-size: 11px; }
.quick-add-clear { display: none; width: 16px; height: 16px; place-items: center; margin-right: -3px; border-radius: 50%; color: var(--muted); }
.quick-add-clear .ui-icon { width: 11px; height: 11px; }
.quick-add-chip:hover .quick-add-clear, .quick-add-chip:focus-visible .quick-add-clear { display: inline-grid; }
.quick-add-clear:hover { background: var(--surface); color: var(--text); }
.quick-add-hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.quick-add-chip[data-status-tone] .task-status-dot { width: 8px; height: 8px; flex-basis: 8px; }
.quick-add-popover { position: fixed; z-index: 230; width: 300px; max-width: calc(100vw - 16px); }
.quick-add-popover .quick-add { margin: 0; box-shadow: 0 0 0 1px var(--primary), 0 16px 40px -12px rgba(0,0,0,.55); }

.chip-menu { position: fixed; z-index: 240; display: grid; width: max-content; min-width: 200px; max-width: min(300px,calc(100vw - 16px)); max-height: min(520px,calc(100dvh - 16px)); gap: 2px; padding: 6px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.chip-menu-option { display: flex; min-height: 36px; align-items: center; gap: 10px; padding: 5px 10px 5px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.chip-menu-option:hover, .chip-menu-option:focus-visible { background: var(--surface-2); outline: none; box-shadow: none; }
.chip-menu-option > span:not(.subtask-avatar):not(.chip-menu-meta) { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-menu-option > .ui-icon { width: 16px; height: 16px; color: var(--primary); }
.chip-menu-option > .ui-icon:first-child { color: var(--muted); }
.chip-menu-option .subtask-avatar { width: 24px; height: 24px; flex: none; }
.chip-menu-meta { order: 3; color: var(--muted); font-size: 12px; font-weight: 500; }
.chip-menu-swatch { width: 12px; height: 12px; flex: none; border-radius: 4px; background: var(--swatch); }
.chip-menu-empty { margin: 0; padding: 8px 10px; color: var(--muted); font-size: 13px; }
.chip-menu-calendar { width: 252px; margin-top: 4px; padding: 8px 6px 4px; border-top: 1px solid var(--border); }
.chip-menu-calendar .task-date-month-heading .icon-button { width: 32px; height: 32px; }
.chip-menu-calendar .task-date-day { min-height: 32px; }

@media (max-width: 760px) {
    .quick-add .quick-add-title { font-size: 16px; }
    .quick-add-chip { min-height: 32px; padding-inline: 10px; }
    .quick-add-clear { display: inline-grid; }
    .quick-add-popover { right: 8px; left: 8px !important; width: auto; }
    .chip-menu { right: 8px; left: 8px !important; width: auto; max-width: none; }
    .chip-menu-option { min-height: 44px; font-size: 15px; }
    .chip-menu-calendar { width: auto; }
}

/* Quick add: inside the column's list, the same width and size as the task cards. */
.task-list > .quick-add { gap: 10px; margin: 0 0 8px; padding: 12px; border-radius: 8px; background: var(--canvas); box-shadow: 0 0 0 3px color-mix(in srgb,var(--primary) 18%,transparent); }
.quick-add .quick-add-title, .quick-add .quick-add-title:focus, .quick-add .quick-add-title:focus-visible { min-height: 28px; font-size: 15px; font-weight: 700; }
.quick-add-chip { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.quick-add-chip .ui-icon { width: 16px; height: 16px; }
.quick-add-chip .subtask-avatar { width: 20px; height: 20px; font-size: 10px; }

/* Column menu workload choice: one highlight that slides to the chosen option. */
.column-stage { position: relative; }
.column-stage label { z-index: 1; }
.column-stage input:checked + span { background: transparent; box-shadow: none; }
.column-stage-thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 10px) / 4); border-radius: 7px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); transition: transform 240ms cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.column-stage:has(input[value="preparing"]:checked) .column-stage-thumb { transform: translateX(calc(100% + 2px)); }
.column-stage:has(input[value="working"]:checked) .column-stage-thumb { transform: translateX(calc(200% + 4px)); }
.column-stage:has(input[value="done"]:checked) .column-stage-thumb { transform: translateX(calc(300% + 6px)); }
@media (prefers-reduced-motion: reduce) { .column-stage-thumb { transition: none; } }

/* Phones: menus from the bottom (shared), the round + button, the subtask ⋯ sheet. */
.board-add-fab, .subtask-more, .sheet-backdrop, .chip-menu-title { display: none; }
.chip-menu-option.is-danger, .chip-menu-option.is-danger > .ui-icon:first-child { color: var(--danger); }
.chip-menu-option:disabled { opacity: .4; cursor: default; }
.chip-menu-option:disabled:hover { background: transparent; }
@keyframes sheet-fade { from { opacity: 0; } }
@media (max-width: 760px) {
    .sheet-backdrop { position: fixed; z-index: 239; inset: 0; display: block; background: var(--backdrop); animation: sheet-fade .2s ease; }
    .chip-menu.is-sheet, .subtask-assignee-menu.is-sheet { top: auto !important; right: 0; bottom: 0; left: 0 !important; width: auto; min-width: 0; max-width: none; max-height: 75dvh; padding: 8px 10px calc(12px + env(safe-area-inset-bottom)); border-bottom: 0; border-radius: 18px 18px 0 0; animation: sheet-up .25s cubic-bezier(.2,.8,.2,1); }
    .chip-menu.is-sheet::before, .subtask-assignee-menu.is-sheet::before { content: ""; width: 36px; height: 4px; margin: 2px auto 6px; border-radius: 4px; background: var(--border-strong); }
    .chip-menu-title { display: block; margin: 0; padding: 2px 10px 8px; overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
    .subtask-assignee-menu.is-sheet .subtask-assignee-option { min-height: 48px; font-size: 15px; }

    .board-add-fab:not([hidden]) { position: fixed; z-index: 30; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); display: grid; width: 56px; height: 56px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary, #04201a); box-shadow: 0 10px 24px -8px rgba(0,0,0,.6); }
    .board-add-fab .ui-icon { width: 26px; height: 26px; stroke-width: 2.4; }
    .board-add-fab:active { transform: scale(.95); }

    .quick-add-popover.is-sheet { top: 0 !important; right: 0; bottom: 0; left: 0 !important; display: flex; width: auto; max-width: none; flex-direction: column; justify-content: flex-end; background: var(--backdrop); animation: sheet-fade .2s ease; }
    .quick-add-popover.is-sheet .quick-add { gap: 12px; margin: 0 0 var(--keyboard, 0px); padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--border-strong); border-radius: 18px 18px 0 0; background: var(--surface); box-shadow: none; animation: sheet-up .25s cubic-bezier(.2,.8,.2,1); }
    .quick-add-popover.is-sheet .quick-add::before { content: ""; width: 36px; height: 4px; margin: 0 auto; border-radius: 4px; background: var(--border-strong); }
    .quick-add-popover.is-sheet .quick-add-title { min-height: 34px; font-size: 18px; font-weight: 700; }

    .subtask-box .subtask-actions, .subtask-box .subtask-item:focus-within .subtask-actions { display: none; }
    .subtask-box .subtask-create-form { padding-right: 60px; }
    .subtask-box .subtask-more { display: inline-grid; width: 34px; height: 34px; min-height: 34px; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) {
    .sheet-backdrop, .chip-menu.is-sheet, .subtask-assignee-menu.is-sheet, .quick-add-popover.is-sheet, .quick-add-popover.is-sheet .quick-add { animation: none; }
}

/* Phones: date lines in the chat; Add column as a sheet from the bottom. */
.comment-day { display: none; }
@media (max-width: 760px) {
    .comment-day { display: flex; justify-content: center; margin: 6px 0 2px; }
    .comment-day span { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; }
    .column-dialog.is-anchored.is-sheet { position: fixed; z-index: 240; top: auto !important; right: 0; bottom: var(--keyboard, 0px); left: 0 !important; width: auto; max-width: none; margin: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); border-bottom: 0; border-radius: 18px 18px 0 0; animation: sheet-up .25s cubic-bezier(.2,.8,.2,1); }
    .column-dialog.is-anchored.is-sheet::before { content: ""; display: block; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--border-strong); }
}
@media (prefers-reduced-motion: reduce) { .column-dialog.is-anchored.is-sheet { animation: none; } }

/* Phones: the task's chips fold into one summary row; the tabs stay and only the panel scrolls. */
.task-summary, .task-summary-close { display: none; }
@media (max-width: 760px) {
    .task-drawer:not(.details-open) .task-details-form .task-chip-row { display: none; }
    .task-drawer:not(.details-open) .task-summary { order: -3; display: flex; flex: none; width: auto; min-height: 36px; align-items: center; gap: 8px; margin: 2px 16px 12px 17px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
    .task-summary-items { display: flex; min-width: 0; flex: 1; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg,#000 88%,transparent); }
    .task-summary-chip { display: inline-flex; flex: none; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); font-size: 12px; font-weight: 650; }
    .task-summary-chip.overdue { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
    .task-summary-chip .task-status-dot { width: 7px; height: 7px; flex-basis: 7px; }
    .task-summary-bell { padding-inline: 5px; }
    .task-summary-bell .ui-icon { width: 13px; height: 13px; }
    .task-summary-people { display: inline-flex; flex: none; align-items: center; }
    .task-summary-people .subtask-avatar { width: 22px; height: 22px; font-size: 10px; box-shadow: 0 0 0 2px var(--canvas); }
    .task-summary-people .subtask-avatar + .subtask-avatar { margin-left: -6px; }
    .task-summary .task-summary-label { flex: none; min-height: 0; padding: 2px 8px; font-size: 11px; }
    .task-summary-more { flex: none; color: var(--muted); font-size: 12px; font-weight: 650; }
    .task-summary-chevron { width: 18px; height: 18px; flex: none; color: var(--muted); }
    .task-drawer.details-open .task-summary-close { order: -3; display: flex; width: 100%; height: 30px; flex: none; align-items: center; justify-content: center; margin: 0; padding: 0 0 4px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--muted); }
    .task-drawer.details-open .task-property-rail.task-chip-row { padding-bottom: 2px; border-bottom: 0; }
    .task-summary-close .ui-icon { width: 18px; height: 18px; }

    .task-drawer:not(.details-open) .task-detail-body { flex-direction: column; overflow: hidden; }
    .task-drawer:not(.details-open) .task-detail-body > .task-details-form, .task-drawer:not(.details-open) .task-detail-body > .task-tabs { flex: none; }
    .task-drawer:not(.details-open) .task-detail-body > .task-work-panel:not([hidden]) { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
}

/* Phones: Edit card / Edit column menus dim the page behind them. */
@media (max-width: 760px) {
    .card-dialog.is-anchored.has-backdrop { z-index: 240; }
    .task-summary-chevron { margin-right: -2px; }
}

/* Project calendar: the general calendar's look (shared .calendar-workspace rules), sized by the project tab. */
.project-calendar .calendar-workspace { min-height: 0; }
.project-calendar .calendar-heading h2 { margin: 0; font-size: clamp(22px,2.2vw,28px); white-space: nowrap; }
.project-calendar .calendar-legend[hidden] { display: none; }
.project-calendar .calendar-legend-keys-list { display: contents; }
/* Labels and synced calendars flow as one wrapping row; each group drops out when empty or filtered. */
.project-calendar .calendar-legend-group { display: contents; }
.project-calendar .calendar-legend-group[hidden], .project-calendar .calendar-legend-divider[hidden], .project-calendar .calendar-legend-title-short { display: none; }
.project-calendar .calendar-legend-note + .calendar-legend-note, .project-calendar .calendar-legend-keys:not([hidden]) + .calendar-legend-note:not([hidden]) { margin-top: 6px; }
.project-calendar .mytasks-project-button .calendar-legend-dot[hidden] { display: none; }
.project-calendar .calendar-legend-dot.is-tasks { background: var(--primary); }
@media (max-width: 760px) {
    .project-calendar .calendar-legend-title-long { display: none; }
    .project-calendar .calendar-legend-title-short { display: inline; }
    .project-calendar .calendar-legend-divider { flex-basis: 100%; height: 0; background: none; }
    .project-calendar .calendar-heading h2 { font-size: 22px; }
    .project-calendar .calendar-filters { flex-direction: row; }
}

/* The card row belongs to the Board; Calendar, Files and Workload don't use it. */
.project-workspace:has(#project-panel-board[hidden]) .card-strip { display: none; }


/* Quick add from the calendar: the date line opens the date and time menu. */
button.quick-add-when { display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; margin: -3px 0 -3px -6px; padding: 3px 6px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
button.quick-add-when:hover, button.quick-add-when[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
button.quick-add-when .ui-icon { width: 14px; height: 14px; }
.quick-when-menu { width: 300px; }
.quick-when-row { display: grid; grid-template-columns: 56px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 4px 6px; }
.quick-when-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.quick-when-day { min-height: 34px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.quick-when-day[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.quick-when-time { min-width: 72px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.quick-when-time[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.quick-when-row:not(:has(.quick-when-time)) { grid-template-columns: 56px minmax(0,1fr); }
.quick-when-times { display: grid; max-height: 188px; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin: 2px 0 4px; padding: 8px 6px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--border); scrollbar-width: thin; }
.quick-when-slot { min-height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; }
.quick-when-slot:hover { background: var(--surface-2); }
.quick-when-slot[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.quick-when-menu .chip-menu-calendar { width: auto; }
.quick-when-menu .task-date-day.in-range { background: color-mix(in srgb,var(--primary) 12%,transparent); }
@media (max-width: 760px) {
    .quick-when-menu { width: auto; }
    .quick-when-day, .quick-when-time { min-height: 42px; }
    .quick-when-slot { min-height: 40px; }
    .quick-when-times { max-height: 220px; }
}


/* Narrow phones: chips keep their height and one line; under 400px Add task is a round +. */
@media (max-width: 430px) {
    .calendar-workspace .calendar-filters { flex-wrap: nowrap; align-items: center; }
    .calendar-workspace .calendar-filters .mytasks-chip { flex: none; }
    .calendar-workspace .calendar-filters .calendar-project-menu { min-width: 0; flex: 0 1 auto; }
    .calendar-workspace .calendar-filters .calendar-project-menu .mytasks-chip { max-width: 100%; }
    .calendar-workspace .calendar-filters .mytasks-project-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .calendar-workspace .calendar-filters .primary-button { flex: 0 0 auto; min-height: 40px; margin-left: auto; white-space: nowrap; }
}
@media (max-width: 400px) {
    .calendar-workspace .calendar-filters .primary-button { width: 40px; min-width: 40px; padding: 0; justify-content: center; gap: 0; border-radius: 999px; font-size: 0; } /* font-size 0 also hides an unwrapped label */
    .calendar-workspace .calendar-filters .primary-button .ui-icon { width: 20px; height: 20px; flex: none; }
    .calendar-workspace .calendar-add-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Dragging a task card: it floats with the pointer; a gap keeps its place in the column. */
.card-board.is-sorting-tasks, .card-board.is-sorting-tasks * { cursor: grabbing; user-select: none; }
.card-board.is-sorting-tasks .task-list { position: relative; }
.task-card.is-dragging { position: fixed; top: 0; left: 0; z-index: 60; margin: 0; border-color: var(--primary); box-shadow: 0 18px 40px -12px rgba(0,0,0,.55); transition: none; pointer-events: none; }
.task-card-gap { margin-bottom: 8px; border: 1px dashed color-mix(in srgb,var(--primary) 45%,var(--border)); border-radius: 8px; background: color-mix(in srgb,var(--primary) 6%,transparent); }
/* A blurred column becomes the frame for position: fixed, which put the dragged card off by the column's position. */
.card-board.is-sorting-tasks .kanban-column { backdrop-filter: none; }

/* Workload: summary line, sort chips, a row per person with a load bar and a completion ring.
   Stage colours match the column stage dots: preparing amber, working blue, done teal. */
@property --done { syntax: "<number>"; inherits: true; initial-value: 0; }
.workload-grid { display: grid; gap: 0; }
.workload-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 22px; padding-bottom: 14px; }
.workload-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 0 4px 12px; }
.project-insights > .panel-heading .workload-columns-link { margin-left: auto; }
.workload-stat { display: inline-flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 13px; }
.workload-stat strong { color: var(--text); font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.workload-stat.is-overdue strong { color: var(--danger); }
.workload-sort { display: flex; gap: 6px; margin-left: auto; }
.workload-sort-chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--control-border, var(--border)); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.workload-sort-chip:hover { color: var(--text); }
.workload-sort-chip[aria-pressed="true"] { border-color: color-mix(in srgb,var(--primary) 55%,var(--border)); background: color-mix(in srgb,var(--primary) 14%,transparent); color: var(--primary); }
.workload-list { display: grid; }
.workload-row { display: grid; grid-template-columns: minmax(150px,220px) minmax(0,1fr) 46px; gap: 18px; align-items: center; padding: 14px 4px; border-top: 1px solid var(--border); }
.workload-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.workload-name { display: grid; min-width: 0; }
.workload-name strong, .workload-name .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workload-guest { justify-self: start; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 650; }
.workload-load { display: grid; gap: 6px; min-width: 0; }
.workload-load-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.workload-load-meta .is-overdue { color: var(--danger); font-weight: 650; }
.workload-bar { display: grid; gap: 3px; min-width: 10px; transform-origin: left center; }
.workload-segments { display: flex; height: 18px; gap: 3px; }
.workload-segment { display: grid; flex: 1 1 0; min-width: 4px; place-items: center; overflow: hidden; border-radius: 3px; container-type: inline-size; }
.workload-segment:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.workload-segment:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.workload-segment-count { color: var(--surface); font-size: 11px; font-weight: 800; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
@container (max-width: 26px) { .workload-segment-count { display: none; } }
.workload-segment.preparing, .workload-key.preparing { background: var(--warning); }
.workload-segment.working, .workload-key.working { background: var(--info); }
.workload-segment.done, .workload-key.done { background: var(--primary); }
.workload-late, .workload-key.late { height: 3px; border-radius: 2px; background: var(--danger); }
.workload-ring { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--done) * 1%), var(--surface-2) 0); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.workload-ring span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--surface); }
.workload-idle { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.workload-idle summary { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; cursor: pointer; list-style: none; }
.workload-idle summary::-webkit-details-marker { display: none; }
.workload-idle summary::before { content: ""; width: 7px; height: 7px; margin: 0 4px 3px 2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s; }
.workload-idle[open] summary::before { margin-bottom: -2px; transform: rotate(225deg); }
.workload-idle[open] .workload-idle-preview { display: none; }
.workload-idle-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workload-idle-names { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 4px 14px; }
.workload-idle-person { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); }
.workload-idle-person .share-avatar { width: 26px; height: 26px; background: var(--surface-2); color: var(--muted); }
.workload-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.workload-key.none { border: 1px dashed var(--muted); background: transparent; }
.workload-columns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 4px; margin-bottom: 14px; border-block: 1px solid var(--border); }
.workload-columns-note { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.workload-columns-note .ui-icon, .workload-columns-link .ui-icon, .workload-columns-hint .ui-icon { width: 16px; height: 16px; flex: none; }
.workload-column-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.workload-column-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; }
button.workload-column-chip { cursor: pointer; transition: border-color .15s; }
button.workload-column-chip:hover { border-color: var(--border-strong); }
.workload-column-chip.none { border-style: dashed; color: var(--muted); }
.workload-columns-link { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin-left: auto; padding: 0 4px; border: 0; background: none; color: var(--primary); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.workload-columns-link:hover { text-decoration: underline; }
.workload-columns-dialog .dialog-body { gap: 12px; }
.workload-columns-intro { margin: 0; color: var(--muted); font-size: 13px; }
.workload-columns-list { display: grid; gap: 14px; max-height: min(55vh,440px); margin: 0 -8px; padding: 0 8px; overflow-y: auto; overscroll-behavior: contain; }
.workload-columns-card { margin: 0 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.workload-columns-row { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 12px; align-items: center; padding: 8px 6px; border-top: 1px solid var(--border); }
.workload-columns-row.is-focused { border-top-color: transparent; border-radius: 8px; background: color-mix(in srgb,var(--primary) 10%,transparent); }
.workload-columns-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.workload-columns-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workload-columns-hint { display: flex; gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.workload-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.workload-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.workload-key.late { width: 14px; }
.project-workspace.has-project-background .workload-ring span { background: color-mix(in srgb,var(--surface) 93%,transparent); }

/* Opening the tab: bars grow from the left one after another and the rings fill. */
.workload-grid.is-entering .workload-bar { animation: workload-grow .7s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--row-index, 0) * 70ms + 80ms); }
.workload-grid.is-entering .workload-ring { animation: workload-fill .9s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--row-index, 0) * 70ms + 160ms); }
.workload-grid.is-entering .workload-row { animation: workload-rise .4s ease-out backwards; animation-delay: calc(var(--row-index, 0) * 70ms); }
@keyframes workload-grow { from { transform: scaleX(0); } }
@keyframes workload-fill { from { --done: 0; } }
@keyframes workload-rise { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 760px) {
    .workload-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px 8px; }
    .project-insights > .panel-heading:has(.workload-columns-link:not([hidden])) { flex-direction: row; align-items: center; }
    .workload-stat { flex-direction: column; gap: 0; }
    .workload-stat strong { font-size: 22px; }
    .workload-sort { width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
    .workload-sort-chip { flex: none; min-height: 36px; }
    .workload-row { grid-template-columns: minmax(0,1fr) 42px; gap: 10px 12px; padding: 14px 2px; }
    .workload-load { grid-column: 1 / -1; grid-row: 2; }
    .workload-column-chips { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .workload-columns-row { grid-template-columns: 1fr; gap: 8px; }
    .workload-columns-list { max-height: 58dvh; }
}
@media (prefers-reduced-motion: reduce) {
    .workload-sort-chip, .workload-idle summary::before { transition: none; }
}

/* Columns in workload window: the chosen stage is tinted in its own colour, so it stands out at a glance. */
.workload-columns-dialog .column-stage-thumb { transition: transform 240ms cubic-bezier(.2,.8,.2,1), background-color .2s, box-shadow .2s; }
.workload-columns-dialog .column-stage:has(input[value="preparing"]:checked) .column-stage-thumb { background: color-mix(in srgb,var(--warning) 22%,var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--warning) 65%,transparent); }
.workload-columns-dialog .column-stage:has(input[value="working"]:checked) .column-stage-thumb { background: color-mix(in srgb,var(--info) 22%,var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--info) 65%,transparent); }
.workload-columns-dialog .column-stage:has(input[value="done"]:checked) .column-stage-thumb { background: color-mix(in srgb,var(--primary) 22%,var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--primary) 65%,transparent); }
.workload-columns-dialog .column-stage input[value="preparing"]:checked + span { color: var(--warning); }
.workload-columns-dialog .column-stage input[value="working"]:checked + span { color: var(--info); }
.workload-columns-dialog .column-stage input[value="done"]:checked + span { color: var(--primary); }
@media (prefers-reduced-motion: reduce) { .workload-columns-dialog .column-stage-thumb { transition: none; } }

/* Share › People: everyone to add as chips in one field, and matching Melon accounts under it. */
.share-who { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; min-height: 40px; padding: 4px 6px; border: 1px solid var(--control-border, var(--border)); border-radius: 9px; background: var(--canvas); cursor: text; }
.share-who:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb,var(--primary) 18%,transparent); }
.share-add-row .share-who input { flex: 1 1 140px; width: auto; min-width: 110px; min-height: 30px; padding: 2px 4px; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; }
.share-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 2px 3px 2px 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: default; animation: share-chip-in .18s ease-out; }
.share-chip .share-avatar { width: 22px; height: 22px; font-size: 10px; }
.share-chip .share-avatar .ui-icon { width: 13px; height: 13px; }
.share-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-chip-tag { flex: none; padding: 0 6px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 11px; font-weight: 700; }
.share-chip-remove { display: grid; flex: none; width: 22px; height: 22px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.share-chip-remove:hover { background: var(--surface); color: var(--text); }
.share-chip-remove .ui-icon { width: 13px; height: 13px; }
.share-chip.is-guest { border-color: color-mix(in srgb,var(--warning) 40%,var(--border)); }
.share-chip.is-checking { opacity: .6; }
.share-chip.is-blocked { border-color: color-mix(in srgb,var(--danger) 60%,var(--border)); background: color-mix(in srgb,var(--danger) 10%,var(--surface-2)); color: var(--danger); cursor: help; }
.share-chip.is-blocked .share-chip-name { text-decoration: line-through; }
@keyframes share-chip-in { from { opacity: 0; transform: scale(.9); } }
.share-suggestions { position: absolute; top: calc(100% + 6px); right: 0; left: 0; z-index: 30; display: grid; gap: 2px; max-height: 264px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-raised, var(--surface)); box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); cursor: default; }
.share-suggestions[hidden] { display: none; }
.share-suggestion { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.share-suggestion[aria-selected="true"] { background: var(--surface-2); }
.share-suggestion.is-member { cursor: default; opacity: .55; }
.share-suggestion-text { display: grid; flex: 1; min-width: 0; }
.share-suggestion-name, .share-suggestion-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-suggestion-name { font-size: 14px; font-weight: 600; }
.share-suggestion-sub { color: var(--muted); font-size: 12px; }
.share-suggestion mark { background: transparent; color: var(--primary); font-weight: 800; }
.share-suggestion-tag { flex: none; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 600; }
.external-access-result-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.external-access-result-list[hidden] { display: none; }
.external-access-result-row { display: grid; grid-template-columns: minmax(0,150px) minmax(0,1fr) auto; gap: 8px; align-items: center; }
.external-access-result-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.external-access-result.is-list .external-access-result-link > :not([data-external-access-dismiss]) { display: none; }
.external-access-result.is-list .external-access-result-link { justify-content: flex-end; order: 3; }
@media (max-width: 760px) {
    .share-who { min-height: 44px; }
    .share-add-row .share-who input { min-height: 34px; }
    .share-suggestion { min-height: 48px; }
    .external-access-result-row { grid-template-columns: minmax(0,1fr) auto; }
    .external-access-result-row strong { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .share-chip { animation: none; } }
/* Share in two steps. Step 1: the field and a round arrow beside it, also on phones. */
.share-step { display: grid; gap: 10px; }
.share-step[hidden] { display: none; }
.share-form .share-add-row { grid-template-columns: minmax(0,1fr) auto; align-items: end; }
.share-form .share-add-row .share-who { grid-column: auto; }
.share-form .share-next { display: grid; width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; place-items: center; border-radius: 10px; }
.share-form .share-next .ui-icon { width: 20px; height: 20px; }
/* Step 2: a heading with ←, one group per kind of person, then Back and Add. */
.share-panel.is-step-access .share-section { display: none; }
.share-step-head { display: flex; align-items: center; gap: 6px; margin-left: -8px; }
.share-step-head h3 { margin: 0; font-size: 16px; }
.share-group { display: grid; gap: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.share-group[hidden] { display: none; }
.share-group-title { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.share-group-title .ui-icon { width: 15px; height: 15px; }
.share-group-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.share-group-chips .share-chip { padding-right: 9px; animation: none; }
.share-group .field-help, .share-group .share-guest-note { margin: 0; }
.share-group .share-guest { padding: 0; border: 0; background: none; }
.share-step-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
/* Chips: 26px tall, a 20px avatar, and a round × (dialog buttons are 40px tall by default). */
.share-chip { min-height: 26px; height: 26px; padding: 0 2px 0 3px; gap: 5px; }
.share-chip .share-avatar { width: 20px; height: 20px; font-size: 9px; }
.share-chip .share-avatar .ui-icon { width: 12px; height: 12px; }
.share-who .share-chip-remove { position: relative; width: 20px; min-width: 20px; height: 20px; min-height: 20px; }
.share-chip-remove::after { content: ""; position: absolute; inset: -8px -6px; }
.share-chip-remove .ui-icon { width: 12px; height: 12px; }
@media (max-width: 760px) {
    .share-form .share-next { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
    .share-step-actions button { flex: 1; min-height: 44px; }
    .share-chip { height: 30px; min-height: 30px; font-size: 14px; }
    .share-who .share-chip-remove { width: 24px; min-width: 24px; height: 24px; min-height: 24px; }
}
@media (prefers-reduced-motion: reduce) { .share-role-switch span { transition: none; } }
.share-step-head h3:focus { outline: none; }

/* Accounts › Sign-in: deleting an account, and the window that asks what happens to their work. */
.account-delete-box { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 14px 16px; border: 1px solid color-mix(in srgb,var(--danger) 45%,var(--border)); border-radius: 12px; }
.account-delete-box h3 { margin: 0; color: var(--danger); font-size: 15px; }
.account-delete-box p { margin: 2px 0 0; font-size: 12px; }
.account-delete-box .danger-button { flex: none; }
.account-delete-dialog { width: min(520px, calc(100vw - 24px)); }
.account-delete-dialog .dialog-heading p { margin: 2px 0 0; font-size: 13px; }
.account-delete-dialog .dialog-body { display: grid; gap: 16px; }
.account-delete-choice { display: grid; gap: 8px; margin: 0; }
.account-delete-choice legend { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.account-delete-option { position: relative; display: flex; gap: 12px; margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.account-delete-option input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--danger); }
.account-delete-option > span { display: grid; gap: 2px; }
.account-delete-option strong { font-size: 14px; }
.account-delete-option > span > span { color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.45; }
.account-delete-option:hover { border-color: var(--border-strong); }
.account-delete-option:has(input:checked) { border-color: color-mix(in srgb,var(--danger) 70%,var(--border)); background: var(--danger-soft); }
.account-delete-always p { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.account-delete-always ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.account-delete-confirm { display: grid; gap: 6px; margin: 0; font-size: 13px; }
.account-delete-confirm input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.account-delete-dialog .danger-button:not(:disabled) { border-color: var(--danger); background: var(--danger); color: var(--surface); }
@media (max-width: 760px) {
    .account-delete-box { align-items: stretch; flex-direction: column; gap: 10px; }
    .account-delete-box .danger-button { width: 100%; min-height: 44px; }
    .account-delete-dialog { width: 100%; }
    .account-delete-confirm input { min-height: 44px; font-size: 16px; }
    .account-delete-dialog .dialog-actions button { flex: 1; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .account-delete-option { transition: none; } }

/* @ in a comment: the Share list of matches, opening upward above the comment box. */
.comment-pill { position: relative; }
.mention-suggestions { top: auto; bottom: calc(100% + 8px); max-height: min(264px, 40vh); }

/* Files: one toolbar; panes show storage cards, a list or a grid; what's selected gets a bar of
   actions; split view puts two folders side by side to drag or copy between (tabs on a phone). */
.files-shell { position: relative; display: flex; min-height: calc(100dvh - var(--header-height) - 155px); flex-direction: column; overflow: hidden; background: var(--surface); }
.files-shell .ui-icon { width: 17px; height: 17px; }
.files-toolbar { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.files-heading h2, .files-heading p { margin: 0; }
.files-heading p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.files-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.files-view-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.files-view-switch button { display: grid; width: 34px; height: 30px; place-items: center; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; transition: background var(--transition), color var(--transition); }
.files-view-switch button:hover { color: var(--text); }
.files-view-switch button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px var(--shadow-color); }
.files-split-button { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; border-radius: 999px; }
.files-split-button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.files-refresh { width: 38px; height: 38px; border-radius: 999px; }
.files-pane-tabs { display: none; }

.file-panes { display: grid; flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(0,1fr); }
.file-panes.split { grid-template-columns: repeat(2,minmax(0,1fr)); }
.file-panes.split .file-pane + .file-pane { border-left: 1px solid var(--border); }
.file-pane { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; background: var(--surface); container-type: inline-size; transition: box-shadow var(--transition), background var(--transition); }
.file-panes.split .file-pane.is-active-pane { box-shadow: inset 0 2px 0 var(--primary); }
.file-pane-header { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.file-breadcrumb-row { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 6px; }
.file-up { width: 34px; height: 34px; flex: none; border-radius: 999px; }
.file-breadcrumbs { display: flex; min-width: 0; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.file-breadcrumbs::-webkit-scrollbar { display: none; }
.file-crumb { min-height: 30px; flex: none; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 650; cursor: pointer; }
.file-crumb:hover { background: var(--surface-2); color: var(--text); }
.file-crumb[aria-current="location"] { color: var(--text); font-weight: 750; }
.file-crumb-separator { color: var(--border-strong); }
.file-pane-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.file-search { position: relative; display: flex; width: clamp(160px,22vw,260px); align-items: center; }
.file-search[hidden] { display: none; }
.file-search .ui-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.file-search input { width: 100%; min-height: 36px; padding-left: 36px; border-radius: 999px; }
.file-upload-button { display: inline-flex; min-height: 36px; align-items: center; gap: 7px; border-radius: 999px; }
.file-upload-button[hidden] { display: none; }

.file-list-heading, .file-row { display: grid; grid-template-columns: 22px 36px minmax(0,1fr) 80px 90px 130px; align-items: center; gap: 10px; }
.file-list-heading { flex-shrink: 0; padding: 8px 24px 8px 24px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.file-pane.is-top .file-list-heading, .file-pane.is-grid .file-list-heading { display: none; }
.file-list { flex: 1 1 auto; min-height: 0; padding: 6px 8px 84px; overflow: auto; }
.file-row { min-height: 50px; padding: 6px 16px; border-radius: 10px; cursor: default; user-select: none; -webkit-touch-callout: none; transition: background var(--transition); }
.file-row:hover { background: var(--surface-2); }
.file-row.selected, .file-tile.selected { background: var(--primary-soft); }
.file-row:focus-visible, .file-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.file-check { display: grid; width: 20px; height: 20px; place-items: center; padding: 0; border: 1.5px solid var(--control-border); border-radius: 6px; background: var(--surface); color: transparent; cursor: pointer; opacity: 0; transition: opacity var(--transition), background var(--transition); }
.file-check .ui-icon { width: 14px; height: 14px; stroke-width: 3; }
.file-row:hover .file-check, .file-tile:hover .file-check, .file-check:focus-visible, .is-selecting .file-check, .file-check[aria-pressed="true"] { opacity: 1; }
.file-check[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.file-thumb { position: relative; display: grid; width: 36px; height: 36px; place-items: center; overflow: hidden; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.file-thumb.is-folder { background: var(--primary-soft); color: var(--primary); }
.file-thumb.is-image { color: var(--accent); }
.file-thumb.is-video { color: var(--warning); }
.file-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file-name-cell { display: flex; min-width: 0; align-items: center; gap: 8px; }
.file-name-button { min-width: 0; padding: 4px 0; overflow: hidden; border: 0; background: transparent; color: var(--text); font-weight: 650; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.file-name-button:hover { color: var(--primary); }
.file-meta { display: none; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-linked { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.file-size-cell, .file-modified-cell { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.file-pane.is-grid .file-list { display: grid; align-content: start; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; padding: 16px 16px 90px; }
.file-tile { position: relative; display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: default; user-select: none; -webkit-touch-callout: none; transition: border-color var(--transition), background var(--transition); }
.file-tile:hover { border-color: var(--border-strong); }
.file-tile.selected { border-color: var(--primary); }
.file-tile .file-thumb { width: 100%; height: auto; border-radius: 0; aspect-ratio: 4 / 3; }
.file-tile .file-thumb > .ui-icon { width: 34px; height: 34px; stroke-width: 1.5; }
.file-tile .file-thumb.has-image > .ui-icon { visibility: hidden; }
.file-thumb-ext { position: absolute; bottom: 8px; left: 8px; padding: 2px 7px; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; }
.file-tile .file-check { position: absolute; top: 8px; left: 8px; box-shadow: 0 1px 3px var(--shadow-color); }
.file-tile .file-name-cell { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 11px 10px; }
.file-tile .file-name-button { padding: 0; font-size: 13px; }
.file-tile .file-meta { display: block; }
.file-tile .file-linked { position: absolute; top: 8px; right: 8px; background: var(--surface); }

.file-pane.is-top .file-list { display: grid; align-content: start; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 12px; padding: 16px; }
.file-storage-card { display: flex; min-height: 80px; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: border-color var(--transition), background var(--transition), transform var(--transition); }
.file-storage-card:hover { border-color: var(--primary); background: var(--surface-2); }
.file-storage-card:active { transform: scale(.99); }
.file-storage-icon { display: grid; width: 46px; height: 46px; flex: none; place-items: center; border-radius: 13px; background: var(--surface-2); color: var(--accent); }
.file-storage-icon.is-app { background: var(--primary-soft); color: var(--primary); }
.files-shell .file-storage-icon .ui-icon { width: 22px; height: 22px; }
.file-storage-text { display: grid; min-width: 0; gap: 2px; }
.file-storage-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-storage-text span { color: var(--muted); font-size: 12px; }

.file-pane-footer { display: flex; flex-shrink: 0; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 10px 4px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.file-pane-status { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.files-view-switch[hidden] { display: none; }
.file-pane-footer .files-view-switch button { width: 32px; height: 28px; }
.file-folder-button { display: grid; width: 36px; min-height: 36px; place-items: center; padding: 0; border-radius: 999px; }
.file-folder-button[hidden] { display: none; }
.file-new-folder { background: var(--primary-soft); }
.file-new-folder input { width: 100%; min-height: 34px; padding: 4px 10px; border-radius: 8px; font-weight: 650; }
.file-tile.file-new-folder .file-name-cell { padding: 8px; }
.file-empty { display: grid; gap: 4px; grid-column: 1 / -1; place-items: center; margin: 12px 8px; padding: 56px 20px; border: 1.5px dashed var(--border); border-radius: 16px; text-align: center; }

.file-selection-bar { position: absolute; z-index: 5; bottom: 56px; left: 50%; display: flex; max-width: calc(100% - 24px); align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-raised); box-shadow: var(--shadow); transform: translateX(-50%); animation: file-bar-in 180ms ease; }
.file-selection-bar[hidden] { display: none; }
@keyframes file-bar-in { from { opacity: 0; transform: translate(-50%,10px); } }
.file-bar-count { margin-right: 4px; font-size: 13px; white-space: nowrap; }
.file-bar-actions { display: flex; min-width: 0; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.file-bar-button { display: inline-flex; min-height: 34px; flex: none; align-items: center; gap: 6px; padding: 6px 11px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 13px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.file-bar-button:hover { background: var(--surface-2); }
.file-bar-button.is-danger { color: var(--danger); }
.file-bar-button.is-danger:hover { background: var(--danger-soft); }
.file-bar-close { display: grid; width: 34px; height: 34px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.file-bar-close:hover { color: var(--text); }

.file-pane.is-drop-target { background: color-mix(in srgb,var(--primary) 5%,var(--surface)); box-shadow: inset 0 0 0 2px var(--primary); }
.file-row.is-drop-target, .file-tile.is-drop-target, .file-storage-card.is-drop-target { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.file-drop-hint { position: absolute; z-index: 6; top: 66px; left: 50%; padding: 7px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow); transform: translateX(-50%); pointer-events: none; }
.file-drop-hint[hidden] { display: none; }
.file-drag-ghost { position: fixed; top: -200px; left: -200px; padding: 6px 13px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 700; }
.files-shell.is-dragging .file-row.selected, .files-shell.is-dragging .file-tile.selected { opacity: .55; }

/* A narrow pane (split view): fewer columns, shorter labels. */
@container (max-width: 780px) {
    .file-search { width: 170px; }
    .file-upload-button { width: 36px; justify-content: center; padding: 0; }
    .file-upload-button span, .file-bar-button:not(.is-transfer) span { display: none; }
    .file-bar-button { padding-inline: 9px; }
}
@container (max-width: 620px) {
    .file-list-heading, .file-row { grid-template-columns: 22px 36px minmax(0,1fr) 56px 76px; }
    .file-modified-cell, .file-list-heading span:last-child { display: none; }
    .file-search { width: 140px; }
}

@media (max-width: 760px) {
    .project-files:not([hidden]) { padding: 0; }
    .files-shell { min-height: calc(100dvh - var(--header-height) - 140px); }
    .files-toolbar { padding: 12px 16px; }
    .files-heading .eyebrow, .files-heading p { display: none; }
    .files-split-button { width: 38px; justify-content: center; padding: 0; }
    .files-split-button span { display: none; }
    .files-pane-tabs:not([hidden]) { display: flex; gap: 4px; margin: 10px 12px 0; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
    .files-pane-tabs button { display: flex; min-width: 0; min-height: 38px; flex: 1 1 0; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; }
    .files-pane-tabs button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .files-pane-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px var(--shadow-color); }
    .file-panes.split { grid-template-columns: minmax(0,1fr); }
    .file-panes.split .file-pane:not(.is-active-pane) { display: none; }
    .file-panes.split .file-pane.is-active-pane { box-shadow: none; }
    .file-panes.split .file-pane + .file-pane { border-left: 0; }
    .file-pane-header { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .file-pane-actions { width: 100%; }
    .file-search { width: auto; flex: 1 1 auto; }
    .file-search input { min-height: 42px; font-size: 16px; }
    .file-upload-button { width: auto; min-height: 42px; padding: 0 16px; }
    .file-upload-button span { display: inline; }
    .file-bar-button:not(.is-transfer) span { display: block; }
    .file-list-heading { display: none; }
    .file-list { padding: 4px 4px 24px; }
    .file-list.is-selecting { padding-bottom: 150px; }
    .file-row { grid-template-columns: 40px minmax(0,1fr) auto; min-height: 62px; gap: 12px; padding: 8px 12px; }
    .file-sharing-cell:empty { display: none; }
    .file-row:hover { background: transparent; }
    .file-row.selected { background: var(--primary-soft); }
    .file-row .file-check { display: none; width: 24px; height: 24px; justify-self: center; }
    .is-selecting .file-row .file-check { display: grid; }
    .is-selecting .file-row .file-thumb { display: none; }
    .file-thumb { width: 40px; height: 40px; }
    .file-size-cell, .file-modified-cell { display: none; }
    .file-name-cell { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1px 8px; }
    .file-name-button { padding: 0; font-size: 15px; }
    .file-meta { display: block; grid-column: 1; }
    .file-linked { grid-row: 1 / 3; grid-column: 2; align-self: center; }
    .file-pane.is-grid .file-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 12px 12px 24px; }
    .file-tile .file-check { display: none; width: 24px; height: 24px; }
    .is-selecting .file-tile .file-check { display: grid; }
    .file-pane.is-top .file-list { grid-template-columns: minmax(0,1fr); padding: 12px; }
    .file-pane-footer { position: sticky; z-index: 4; bottom: 0; padding: 4px 8px 4px 16px; padding-bottom: max(4px,env(safe-area-inset-bottom)); }
    .file-folder-button { width: 42px; min-height: 42px; }
    .file-row.file-new-folder > span:first-child { display: none; }
    .file-selection-bar { position: fixed; z-index: 40; right: 8px; bottom: max(8px,env(safe-area-inset-bottom)); left: 8px; max-width: none; flex-wrap: wrap; gap: 4px; padding: 8px; border-radius: 20px; transform: none; animation-name: file-bar-up; }
    @keyframes file-bar-up { from { opacity: 0; transform: translateY(14px); } }
    .file-bar-count { flex: 1 1 auto; padding-left: 8px; font-size: 14px; }
    .file-bar-actions { width: 100%; order: 3; justify-content: space-around; overflow: visible; }
    .file-bar-button { min-width: 0; min-height: 54px; flex: 1 1 0; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 4px; border-radius: 14px; font-size: 11px; }
    .file-bar-button span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .files-shell .file-bar-button .ui-icon { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .file-selection-bar { animation: none; }
    .file-storage-card:active { transform: none; }
}

/* Files' folder chooser (also Attach from mapped folders): kind icons, folders open with a
   chevron; a full screen of its own on phones. Rename and Delete sit above the keyboard. */
.picker-row { grid-template-columns: auto minmax(0,1fr) auto; }
.picker-row .file-thumb { width: 36px; height: 36px; }
.picker-chevron { display: grid; color: var(--muted); }
.picker-row.navigable:hover .picker-chevron { color: var(--primary); }
.picker-browser .file-crumb[aria-current="location"], .picker-browser .file-crumb:last-child { color: var(--text); }
.picker-selection-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sheet .delete-file-warning strong { overflow-wrap: anywhere; }

@media (max-width: 760px) {
    .sheet-dialog.file-sheet { margin-bottom: var(--keyboard, 0px); transition: margin-bottom .12s ease; }
    .file-picker-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
    .file-picker-dialog[open] { animation: sheet-up .25s cubic-bezier(.2,.8,.2,1); }
    .file-picker-dialog .dialog-content { display: flex; height: 100%; flex-direction: column; gap: 0; padding: 0; }
    .file-picker-dialog .dialog-heading { align-items: center; padding: max(12px,env(safe-area-inset-top)) 12px 12px 18px; border-bottom: 1px solid var(--border); }
    .file-picker-dialog .dialog-heading .eyebrow { display: none; }
    .file-picker-dialog .dialog-heading h2 { font-size: 19px; }
    .file-picker-dialog .dialog-heading p { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .file-picker-dialog .dialog-heading > div { min-width: 0; }
    .file-picker-dialog .picker-browser { min-height: 0; flex: 1 1 auto; border: 0; border-radius: 0; background: var(--surface); }
    .picker-browser > .file-breadcrumb-row { position: sticky; top: 0; padding: 8px 12px; background: var(--surface); }
    .picker-list { padding: 4px 6px; }
    .picker-row { min-height: 62px; gap: 12px; padding: 8px 10px; border-radius: 12px; }
    .picker-row .file-thumb { width: 40px; height: 40px; }
    .picker-row-copy strong { font-size: 15px; }
    .file-picker-dialog .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 10px 16px max(12px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
    .file-picker-dialog .picker-selection-summary { grid-column: 1 / -1; margin: 0 0 2px; font-size: 13px; }
    .file-picker-dialog .dialog-actions button { min-height: 46px; }
}

/* Error page: Melon's slice as the art (the 0 of 404), the code and what it means, the message,
   two actions, and one detail per error (the address, the account, a reference). */
.error-page { display: grid; min-height: calc(100dvh - var(--header-height) - 40px); place-items: center; padding: 40px 20px; }
.error-card { display: grid; width: min(540px,100%); justify-items: center; text-align: center; }
.error-art { width: min(340px,82vw); height: auto; overflow: visible; }
.error-art.is-small { width: 168px; }
.error-digit { fill: var(--text); font-size: 86px; font-weight: 800; }
.error-lock { fill: var(--text); stroke: var(--text); }
.error-lock-hole { fill: var(--surface); stroke: none; }
.error-reload { stroke: var(--text); }
.error-box { fill: var(--surface-2); stroke: var(--text); stroke-width: 2; }
.error-box-lid { fill: none; stroke: var(--text); stroke-width: 1.5; }
.error-z { fill: var(--muted); font-size: 11px; font-weight: 800; }
.error-code { display: inline-flex; max-width: 100%; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.error-code strong { padding: 3px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.error-card h1 { margin: 12px 0 6px; font-size: clamp(24px,4vw,32px); line-height: 1.2; }
.error-hint { max-width: 46ch; margin: 0; color: var(--muted); }
.error-countdown { color: var(--text); font-weight: 700; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.error-actions > * { min-width: 150px; border-radius: 999px; }
.error-detail { display: flex; max-width: 100%; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; margin: 26px 0 0; padding: 10px 16px; border: 1px dashed var(--border-strong); border-radius: 14px; color: var(--muted); font-size: 13px; }
.error-detail code { max-width: 100%; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.error-detail .text-button { min-height: 32px; padding: 4px 6px; color: var(--primary); font-weight: 700; }

.error-slice, .error-half { transform-box: fill-box; transform-origin: center; }
.error-404 .error-slice { animation: error-bob 3.4s ease-in-out infinite; }
.error-500 .error-half.is-left { animation: error-apart-left 3s ease-in-out infinite; }
.error-500 .error-half.is-right { animation: error-apart-right 3s ease-in-out infinite; }
.error-z { animation: error-z 2.6s ease-in-out infinite; }
.error-z.is-second { animation-delay: .6s; }
@keyframes error-bob { 50% { transform: translateY(-4px) rotate(-3deg); } }
@keyframes error-apart-left { 50% { transform: translate(-2px,1px) rotate(-3deg); } }
@keyframes error-apart-right { 50% { transform: translate(2px,1px) rotate(3deg); } }
@keyframes error-z { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

@media (max-width: 760px) {
    .error-page { min-height: calc(100dvh - var(--header-height)); align-items: start; padding: 48px 20px max(28px,env(safe-area-inset-bottom)); }
    .error-art { width: min(260px,76vw); }
    .error-art.is-small { width: 140px; }
    .error-code { flex-direction: column; gap: 6px; }
    .error-actions { display: grid; width: 100%; grid-template-columns: minmax(0,1fr); }
    .error-actions > * { min-height: 48px; justify-content: center; }
    .error-detail { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .error-slice, .error-half, .error-z { animation: none; }
}

/* Messages (toasts): pills at the bottom centre, the Files selection bar's family. Newest in
   front, up to two older ones peeking above it; .is-open (pointer or focus on the pile) fans
   them out. --toast-y/--toast-scale come from layoutToasts, --toast-x from a swipe. */
.flash-stack { --toast-bottom: max(20px,env(safe-area-inset-bottom)); position: fixed; z-index: 300; bottom: var(--toast-bottom); left: 50%; width: min(520px,calc(100vw - 24px)); height: 0; transform: translateX(-50%); pointer-events: none; transition: height .2s ease; }
.flash-stack[popover] { inset: auto auto var(--toast-bottom) 50%; margin: 0; padding: 0; overflow: visible; border: 0; background: transparent; color: inherit; }
body:has(.file-selection-bar:not([hidden])) .flash-stack { --toast-bottom: 112px; }
.flash { --toast-x: 0px; --toast-y: 0px; --toast-scale: 1; position: absolute; bottom: 0; left: 50%; display: flex; width: max-content; max-width: 100%; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); font-size: 14px; pointer-events: auto; transform: translate(calc(-50% + var(--toast-x)),var(--toast-y)) scale(var(--toast-scale)); transform-origin: 50% 100%; transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .2s ease; animation: toast-in .3s cubic-bezier(.2,.8,.2,1); touch-action: pan-y; }
.flash.error { border-color: color-mix(in srgb,var(--danger) 55%,var(--border-strong)); }
.flash.is-behind .flash-message, .flash.is-behind .flash-count, .flash.is-behind .flash-dismiss { opacity: 0; }
.flash.is-behind { pointer-events: none; }
.flash-stack.is-open .flash { pointer-events: auto; }
.flash.is-hidden, .flash.is-leaving { opacity: 0; pointer-events: none; }
.flash.is-leaving { transform: translate(calc(-50% + var(--toast-x)),calc(var(--toast-y) + 16px)) scale(.96); }
.flash.is-swiping { transition: none; }
.flash.is-bumped { animation: toast-bump .32s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%,18px) scale(.96); } }
@keyframes toast-bump { 40% { transform: translate(-50%,var(--toast-y)) scale(1.04); } }
.flash-icon { display: inline-grid; width: 22px; height: 22px; flex: none; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 12px; font-weight: 800; line-height: 1; }
.flash-icon::before { content: "i"; }
.flash.success .flash-icon { background: var(--primary); color: var(--primary-ink); }
.flash.success .flash-icon::before { content: "\2713"; }
.flash.error .flash-icon { background: var(--danger); color: var(--surface); }
.flash.error .flash-icon::before, .flash.warning .flash-icon::before { content: "!"; }
.flash.warning .flash-icon { background: var(--warning); color: var(--surface); }
.flash-message { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; transition: opacity .15s ease; }
.flash-count { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800; }
.flash-dismiss { display: grid; width: 30px; height: 30px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; transition: opacity .15s ease; }
.flash-dismiss:hover { background: var(--surface-2); color: var(--text); }
.flash.success .flash-dismiss, .flash.info .flash-dismiss, .flash.warning .flash-dismiss { opacity: .7; }

@media (max-width: 760px) {
    .flash-stack { --toast-bottom: max(12px,env(safe-area-inset-bottom)); width: calc(100vw - 16px); }
    body:has(.file-selection-bar:not([hidden])) .flash-stack { --toast-bottom: 150px; }
    .flash { width: 100%; padding: 10px 8px 10px 14px; border-radius: 18px; }
    .flash-dismiss { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
    .flash, .flash-stack { transition: opacity .15s ease; animation: none; }
    .flash.is-bumped { animation: none; }
}

/* Folder links: the public page a link opens (templates/folder_link.html). */
.folder-link-page { width: min(1100px, 100%); margin: 0 auto; padding: 18px 16px 32px; }
.folder-link-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.folder-link-brand { display: inline-flex; flex: none; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.folder-link-kind { color: var(--muted); font-size: 13px; }
.folder-link-card { display: grid; gap: 12px; }
.folder-link-card h1 { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.folder-link-message, .folder-link-lock { max-width: 420px; margin: 8vh auto 0; text-align: center; justify-items: center; }
.folder-link-lock form { width: 100%; text-align: left; }
.folder-link-lock-icon { width: 34px; height: 34px; color: var(--primary); }
.folder-link-level { flex: none; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; }
/* An open folder uses the whole window: the top bar, then Files' pane filling the rest. */
.folder-link-page.is-open { display: flex; width: 100%; height: 100dvh; flex-direction: column; padding: 0; }
.folder-link-page.is-open .folder-link-top { flex: none; justify-content: flex-start; margin: 0; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.folder-link-divider { color: var(--border-strong); font-size: 20px; }
.folder-link-title { min-width: 0; flex: 1 1 auto; }
.folder-link-title h1 { margin: 0; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.folder-link-title p { margin: 1px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.folder-link-files { flex: 1 1 auto; min-height: 0; }
.folder-link-files .file-list-heading, .folder-link-files .file-row { grid-template-columns: 22px 36px minmax(0,1fr) 90px 130px; }
.folder-link-upload { cursor: pointer; }
.folder-link-upload:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.folder-link-files .file-pane-status[data-tone="error"] { color: var(--danger); }
.folder-link-files .file-pane-status[data-tone="success"] { color: var(--success); }
@container (max-width: 620px) {
    .folder-link-files .file-list-heading, .folder-link-files .file-row { grid-template-columns: 22px 36px minmax(0,1fr) 76px; }
}
@media (max-width: 760px) {
    .folder-link-page.is-open { height: auto; min-height: 100dvh; }
    .folder-link-page.is-open .folder-link-top { flex-wrap: wrap; gap: 4px 10px; padding: 10px 16px; }
    .folder-link-page.is-open .folder-link-divider { display: none; }
    .folder-link-title { flex-basis: calc(100% - 120px); }
    .folder-link-page.is-open .folder-link-level { order: 3; }
    .folder-link-files .file-row { grid-template-columns: 40px minmax(0,1fr); }
}

/* Files › Preview view: the list on the left, the selected file large on the right. The pane
   becomes a grid; header and footer span both columns. Hidden on phones and with two panes. */
.file-pane.is-preview { display: grid; grid-template-columns: minmax(260px, var(--preview-list-width, 40%)) minmax(320px,1fr); grid-template-rows: auto auto minmax(0,1fr) auto; }
/* The line between list and preview can be dragged (or moved with the arrow keys); double click resets it. */
.file-preview-panel { position: relative; }
.file-preview-resize { position: absolute; z-index: 3; top: 0; bottom: 0; left: 0; width: 10px; padding: 0; border: 0; background: transparent; cursor: col-resize; touch-action: none; }
.file-preview-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 3px; background: transparent; transition: background var(--transition); }
.file-preview-resize:hover::after, .file-preview-resize:focus-visible::after, .file-pane.is-resizing .file-preview-resize::after { background: var(--primary); }
.file-pane.is-resizing { cursor: col-resize; user-select: none; }
.file-pane.is-resizing iframe { pointer-events: none; }
.file-pane.is-preview > .file-pane-header, .file-pane.is-preview > .file-pane-footer { grid-column: 1 / -1; }
.file-pane.is-preview > .file-list-heading, .file-pane.is-preview > .file-list { grid-column: 1; }
.file-pane.is-preview > .file-list-heading { grid-row: 2; }
.file-pane.is-preview > .file-list { grid-row: 3; }
.file-pane.is-preview > .file-preview-panel { grid-column: 2; grid-row: 2 / 4; }
.file-pane.is-preview .file-list-heading, .file-pane.is-preview .file-row { grid-template-columns: 22px 36px minmax(0,1fr) 28px 76px; }
.file-pane.is-preview .file-modified-cell, .file-pane.is-preview .file-list-heading span:last-child { display: none; }
.file-pane.is-preview:not(.folder-link-files) .file-list-heading span:nth-child(4) { visibility: hidden; }
.file-pane.is-preview .file-preview-panel { padding-bottom: 72px; }
.folder-link-files.is-preview .file-list-heading, .folder-link-files.is-preview .file-row { grid-template-columns: 22px 36px minmax(0,1fr) 76px; }
.file-preview-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; gap: 14px; padding: 16px; border-left: 1px solid var(--border); background: var(--surface); overflow: auto; }
.file-preview-panel[hidden] { display: none; }
.file-preview-stage { position: relative; display: grid; flex: 1 1 auto; min-height: 240px; place-items: center; overflow: hidden; border-radius: 14px; background: var(--surface-2); }
/* Fill the stage and fit inside it, so a video's own controls (seek bar, sound, full screen) stay in view. */
.file-preview-stage img, .file-preview-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.file-preview-stage video { background: #000; }
.file-preview-stage iframe { width: 100%; height: 100%; min-height: 420px; border: 0; background: #fff; }
.file-preview-text { width: 100%; height: 100%; margin: 0; padding: 14px; overflow: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.file-preview-placeholder { display: grid; justify-items: center; gap: 10px; padding: 24px; color: var(--muted); text-align: center; font-size: 13px; }
.file-preview-placeholder .ui-icon { width: 46px; height: 46px; stroke-width: 1.4; }
.file-preview-info { display: grid; gap: 4px; flex: none; }
.file-preview-name { overflow-wrap: anywhere; font-size: 16px; }
.file-preview-meta { color: var(--muted); font-size: 13px; }
.file-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-preview-actions a { text-decoration: none; }
@media (max-width: 760px) {
    .files-view-preview { display: none !important; }
}
.file-panes.split .files-view-preview { display: none; }

/* Files › Share link: the level bar. Steps add up left to right; the chosen one and every step
   before it are filled. The list under it says what the level allows. */
.folder-link-levels legend { margin-bottom: 8px; }
.folder-link-steps { display: grid; grid-auto-columns: minmax(0,1fr); grid-auto-flow: column; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 12px; }
.folder-link-step { display: grid; justify-items: center; gap: 4px; padding: 12px 6px 10px; border-left: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; cursor: pointer; transition: background var(--transition), color var(--transition); }
.folder-link-step:first-child { border-left: 0; }
.folder-link-step .ui-icon { width: 20px; height: 20px; }
.folder-link-step:hover { background: var(--surface-2); color: var(--text); }
.folder-link-step.is-on { border-left-color: color-mix(in srgb, var(--primary) 30%, var(--border)); background: var(--primary-soft); color: var(--primary); }
.folder-link-step.is-danger.is-on { background: var(--danger-soft); color: var(--danger); }
.folder-link-step:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.folder-link-abilities { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.folder-link-abilities li { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.folder-link-abilities li::before { content: "✕"; font-size: 11px; }
.folder-link-abilities li.is-yes { color: var(--text); text-decoration: none; }
.folder-link-abilities li.is-yes::before { content: "✓"; color: var(--success); font-size: 13px; font-weight: 800; }
.folder-link-levels [data-folder-link-level-help]:empty { display: none; }
.folder-link-levels [data-folder-link-level-help] { margin: 8px 0 0; }

/* Files › Share link: the box to tick before a link can change files. */
.folder-link-warning { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border)); border-radius: 10px; background: var(--warning-soft); color: var(--text); font-size: 13px; line-height: 1.45; cursor: pointer; }
.folder-link-warning.is-danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: var(--danger-soft); }
.folder-link-warning[hidden] { display: none; }
.folder-link-warning input { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* Files: the link mark on a folder shared through a folder link. */
.file-shared-mark { display: inline-grid; flex: none; place-items: center; color: var(--primary); }
.file-shared-mark .ui-icon { width: 15px; height: 15px; }
.file-tile .file-shared-mark { position: absolute; top: 8px; right: 8px; }
.file-sharing-cell { display: flex; align-items: center; }

/* The Calendar chip of a dated task (Melon.makeCalendarChoice): which outside calendar holds
   its event. A list under the chip on desktop, a sheet from the bottom on phones. */
.calendar-choice { position: relative; display: inline-flex; }
.calendar-choice.has-error .task-chip { border-color: color-mix(in srgb,var(--danger) 40%,transparent); color: var(--danger); }
.calendar-choice-menu { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; display: grid; gap: 3px; width: max-content; min-width: 230px; max-width: min(340px,calc(100vw - 40px)); max-height: min(420px,60dvh); overflow-y: auto; padding: 8px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.calendar-choice-menu[hidden] { display: none; }
.calendar-choice-menu small { padding: 6px 8px 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.calendar-choice-menu button { display: flex; min-height: 40px; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.calendar-choice-menu button:hover, .calendar-choice-menu button[aria-selected="true"] { background: var(--surface-2); }
.calendar-choice-menu button[aria-selected="true"] { font-weight: 700; }
.calendar-choice-field { display: grid; gap: 6px; justify-items: start; }
.calendar-choice-field[hidden] { display: none; }
@media (max-width: 760px) {
    .calendar-choice-menu {
        position: fixed; z-index: 69; top: auto; right: 0; bottom: 0; left: 0; width: auto; max-width: none; max-height: 72dvh;
        padding: 10px 12px max(14px,env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5);
        animation: sheet-up .25s cubic-bezier(.2,.8,.2,1);
    }
    .calendar-choice-menu::before { content: ""; display: block; width: 38px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--border-strong); }
    .calendar-choice-menu small { padding: 8px 14px 2px; font-size: 13px; }
    .calendar-choice-menu button { min-height: 52px; gap: 16px; padding: 8px 14px; border-radius: 12px; font-size: 16px; font-weight: 600; }
}

/* The calendar symbol on entries that also live in an outside calendar (calendar-view.js):
   the calendar's colour on a task, the entry's own colour on an outside event. */
.calendar-event-mark { width: 14px; height: 14px; flex: none; stroke-width: 2.2; color: var(--calendar-event-color,var(--muted)); }
.calendar-timed-event .calendar-event-mark { position: absolute; top: 4px; right: 4px; }
.calendar-timed-event:has(.calendar-event-mark) .calendar-timed-title { padding-right: 16px; }
.agenda-event .calendar-event-mark { margin-left: 7px; vertical-align: -2px; }
/* The setting under the calendar lists: what happens to a task whose event is deleted elsewhere. */
.caldav-deleted-setting { display: grid; gap: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.caldav-deleted-setting .muted { margin: 0 0 0 28px; font-size: 13px; }

/* Projects administration: people or projects as lists that open; rows reuse the member role
   pill and window from People and access. */
.projects-admin { max-width: 860px; margin: 0 auto; }
.projects-admin-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.projects-admin-tools .people-search { flex: 1 1 220px; }
/* People / Projects: one highlight that slides between two equal halves. */
.projects-admin .view-switch { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; }
.projects-admin .view-switch::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 6px; background: var(--surface-2); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.projects-admin .view-switch[data-view="projects"]::before { transform: translateX(100%); }
.projects-admin .view-switch.is-animated::before { transition: transform .22s ease; }
.projects-admin .view-switch-button { position: relative; }
.projects-admin .view-switch-button.active { background: transparent; box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
    .projects-admin .view-switch.is-animated::before { transition: none; }
}
.projects-admin-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.admin-chip { min-height: 32px; padding: 4px 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.admin-chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); background: var(--primary-soft); color: var(--primary); }
.admin-group { border-bottom: 1px solid var(--border); }
.admin-group > summary { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 2px; cursor: pointer; list-style: none; }
.admin-group > summary::-webkit-details-marker { display: none; }
.admin-group > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.admin-group[open] > summary::after { transform: rotate(45deg); }
.admin-group > summary .member-identity { flex: 1; min-width: 0; }
.admin-group-body { display: grid; gap: 2px; padding: 0 2px 14px 44px; }
.admin-section-title { margin: 10px 0 2px; color: var(--muted); font-size: 12px; font-weight: 650; }
.admin-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px 10px; align-items: center; min-height: 44px; padding: 4px 0; }
.admin-row > .member-identity { grid-column: 2; min-width: 0; }
.admin-row > :is(.member-role-panel, .external-access-editor) { display: grid; grid-column: 1 / -1; gap: 12px; margin: 4px 0 8px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.admin-row .ui-icon { width: 18px; height: 18px; color: var(--muted); }
.admin-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.admin-add :is(input, select) { flex: 1 1 200px; min-width: 0; }
.is-inactive :is(strong, .share-avatar, .member-role-pill, .member-role-text) { color: var(--muted); }
.is-inactive .share-avatar { background: var(--canvas); }
@media (max-width: 640px) {
    .admin-group-body { padding-left: 2px; }
}
