:root {
    --bg: #fbfbfa;
    --surface: #ffffff;
    --surface-soft: #f7f7f5;
    --sidebar: #f1f1ee;
    --line: #e5e3de;
    --line-strong: #d5d2ca;
    --text: #20201d;
    --muted: #6f6d66;
    --faint: #9a978e;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --green: #067647;
    --amber: #b54708;
    --red: #b42318;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(32, 32, 29, 0.06), 0 8px 24px rgba(32, 32, 29, 0.05);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ================================================================
   ENLACE PRODUCT SYSTEM V3 — limpio, progresivo y orientado a acción
   ================================================================ */
:root {
    --brand: #2f6f4e;
    --brand-strong: #245a3e;
    --brand-soft: #eaf4ee;
    --ink: #16251d;
    --canvas: #f7f9f7;
    --accent: var(--brand);
    --accent-dark: var(--brand-strong);
    --green: var(--brand);
    --radius: 12px;
    --shadow: 0 1px 2px rgba(22,37,29,.05), 0 14px 36px rgba(22,37,29,.06);
}

body { background: var(--canvas); }
*:focus-visible { outline: 2px solid rgba(47,111,78,.65); outline-offset: 2px; }
.panel, .metric-block, .project-card { border-radius: 14px; box-shadow: 0 1px 2px rgba(22,37,29,.035); }
.btn { border-radius: 9px; }
.btn.primary, .icon-btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover, .icon-btn.dark:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.status-pill { background: var(--brand-soft); color: var(--brand-strong); border-color: rgba(47,111,78,.16); }
.nav-item.active { color: var(--brand-strong); background: rgba(255,255,255,.92); box-shadow: inset 3px 0 var(--brand), 0 1px 2px rgba(22,37,29,.04); }
.brand-mark { background: var(--brand); border-radius: 9px; }

.task-item { border-radius: 11px; background: #fff; }
.task-item.expanded { border-color: rgba(47,111,78,.32); box-shadow: 0 10px 28px rgba(22,37,29,.07); }
.task-progress-chip { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 600; }
.task-progress-chip svg { width: 12px; height: 12px; }
.task-expand-button { margin-left: auto; }
.task-expanded-summary { margin: 10px 0 0; padding: 12px; border: 1px solid #e8ece9; border-radius: 10px; background: #f9fbf9; display: grid; gap: 9px; }
.task-expanded-summary p { margin: 0; font-size: 12px; line-height: 1.55; }
.task-expanded-list { display: grid; gap: 5px; }
.task-expanded-list span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text); }
.task-expanded-list span.done { color: var(--faint); text-decoration: line-through; }
.task-expanded-list svg { width: 13px; height: 13px; color: var(--brand); }
.task-expanded-actions { display: flex; align-items: center; gap: 7px; border-top: 1px solid #e8ece9; padding-top: 8px; }
.task-expanded-actions button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--brand-strong); font-size: 11px; font-weight: 650; padding: 3px 0; }
.task-expanded-actions button + button { margin-left: 8px; }
.task-expanded-actions button svg { width: 13px; height: 13px; }
.task-expanded-actions > span { margin-left: auto; color: var(--faint); font-size: 10px; }

.task-detail-drawer { width: min(520px, 100vw); background: #fff; transition: width .25s ease, transform .25s cubic-bezier(.2,0,0,1); }
.task-detail-drawer.wide { width: min(760px, 100vw); }
.drawer-header { background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.drawer-header-context, .drawer-header-actions { display: flex; align-items: center; gap: 8px; }
.drawer-header-context > span:last-child { color: var(--muted); font-size: 12px; font-weight: 650; }
.drawer-body { gap: 12px; padding: 18px 22px 24px; }
.drawer-title-input { font-size: 22px; letter-spacing: -.02em; }
.drawer-properties-table { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; padding: 12px; border: 1px solid #e7ebe8; border-radius: 12px; background: #fafcfb; }
.drawer-property-row { grid-template-columns: 92px 1fr; min-width: 0; }
.drawer-property-label { font-size: 11px; }
.drawer-property-value-select, .drawer-property-value-input { font-size: 12px; }
.task-detail-section { border-top: 1px solid #e7ebe8; padding-top: 2px; }
.task-detail-section > summary { list-style: none; min-height: 42px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--text); font-size: 12px; font-weight: 700; }
.task-detail-section > summary::-webkit-details-marker { display: none; }
.task-detail-section > summary > span:first-child { display: flex; align-items: center; gap: 8px; }
.task-detail-section > summary svg { width: 15px; height: 15px; color: var(--muted); }
.task-detail-section > summary > svg { transition: transform .2s; }
.task-detail-section[open] > summary > svg { transform: rotate(180deg); }
.section-count { margin-left: auto; margin-right: 8px; padding: 2px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 10px; }
.drawer-description-textarea { min-height: 92px; background: #fafcfb; border-color: #e7ebe8; }
.task-subtasks, .task-links, .task-attachments { display: grid; gap: 5px; padding-bottom: 5px; }
.task-subtask-row, .task-link-row, .task-file-row { min-height: 36px; display: flex; align-items: center; gap: 8px; border-radius: 8px; padding: 6px 8px; background: #fafcfb; border: 1px solid transparent; }
.task-subtask-row:hover, .task-link-row:hover, .task-file-row:hover { border-color: #dfe6e1; background: #fff; }
.task-subtask-row input { accent-color: var(--brand); }
.task-subtask-row span { flex: 1; font-size: 12px; }
.task-subtask-row:has(input:checked) span { color: var(--faint); text-decoration: line-through; }
.task-subtask-row button, .task-link-row button { border: 0; background: transparent; color: var(--faint); padding: 2px; }
.task-subtask-row button svg, .task-link-row button svg { width: 13px; height: 13px; }
.task-link-row { justify-content: space-between; }
.task-link-row > span { min-width: 0; display: flex; align-items: center; gap: 7px; }
.task-link-row a { color: var(--brand-strong); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-file-row { width: 100%; text-align: left; cursor: pointer; }
.task-file-row > span:nth-child(2) { min-width: 0; flex: 1; }
.task-file-row strong, .task-file-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-file-row small { color: var(--muted); font-size: 10px; }
.task-file-row > svg { width: 14px; height: 14px; color: var(--faint); }
.task-inline-add { border: 0; background: transparent; color: var(--brand-strong); display: inline-flex; align-items: center; gap: 6px; padding: 7px 4px; font-size: 11px; font-weight: 650; }
.task-inline-add svg { width: 14px; height: 14px; }
.task-section-empty { margin: 3px 0; color: var(--faint); font-size: 11px; }
.drawer-footer { flex-shrink: 0; padding: 11px 20px calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: #fff; }
.comment-input-row textarea { border-radius: 9px; background: #fafcfb; }

.quick-create-modal { max-width: 520px; }
.quick-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-create-grid > button { display: flex; align-items: center; gap: 12px; min-height: 78px; padding: 14px; border: 1px solid #e2e8e4; border-radius: 12px; background: #fff; text-align: left; color: var(--text); }
.quick-create-grid > button:hover { border-color: rgba(47,111,78,.38); background: #f8fbf9; transform: translateY(-1px); }
.quick-create-grid > button > svg { width: 22px; height: 22px; color: var(--brand); }
.quick-create-grid strong, .quick-create-grid small { display: block; }
.quick-create-grid small { color: var(--muted); margin-top: 2px; font-size: 11px; }

.space-resources { margin: 12px 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.space-resources-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 10px; }
.space-resources-head h3 { margin: 1px 0 0; font-size: 14px; }
.space-resource-strip { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 8px; }
.space-resource-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e7ebe8; border-radius: 10px; background: #fafcfb; text-align: left; color: var(--text); }
.space-resource-card:hover { border-color: rgba(47,111,78,.32); background: #fff; }
.space-resource-card > span:nth-child(2) { min-width: 0; flex: 1; }
.space-resource-card strong, .space-resource-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-resource-card small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.space-resource-card > svg { width: 14px; height: 14px; color: var(--faint); }
.resource-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.resource-icon.document { background: #eef3ff; color: #3457a8; }
.resource-icon svg { width: 17px; height: 17px; }

.whiteboard-overlay { padding: 18px; }
.whiteboard-shell { width: min(1180px,100%); height: min(820px,calc(100dvh - 36px)); display: grid; grid-template-rows: auto minmax(0,1fr); background: #f4f1e8; border-radius: 16px; overflow: hidden; box-shadow: 0 28px 90px rgba(20,34,27,.22); }
.whiteboard-shell > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; background: rgba(255,255,255,.96); border-bottom: 1px solid #dedbd1; }
.whiteboard-shell > header h2 { margin: 1px 0 0; font-size: 18px; }
.whiteboard-heading { min-width: 170px; }
.whiteboard-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.whiteboard-toolbar .btn.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.whiteboard-color,.whiteboard-width { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 700; }
.whiteboard-color input { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.whiteboard-width select { max-width: 70px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.whiteboard-shell > main { position: relative; min-height: 0; overflow: hidden; background-image: radial-gradient(#cfcbbf 1px,transparent 1px); background-size: 22px 22px; }
#whiteboard-drawing-canvas { position: absolute; inset: 0; z-index: 0; display: block; pointer-events: none; touch-action: none; }
#whiteboard-canvas.drawing-active #whiteboard-drawing-canvas { z-index: 3; pointer-events: auto; cursor: crosshair; }
.whiteboard-note-layer { position: relative; z-index: 1; min-height: 100%; padding: 28px; display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); align-content: start; gap: 18px; pointer-events: none; }
.whiteboard-note { pointer-events: auto; }
#whiteboard-canvas.drawing-active .whiteboard-note { pointer-events: none; }
.whiteboard-note { min-height: 150px; padding: 14px; border-radius: 5px; box-shadow: 0 7px 16px rgba(36,38,31,.12); transform: translate(var(--x),var(--y)) rotate(-.4deg); background: #fff3a9; }
.whiteboard-note.tone-2 { background: #cdebd9; transform: translate(var(--x),var(--y)) rotate(.6deg); }
.whiteboard-note.tone-3 { background: #dbe8ff; }
.whiteboard-note.tone-4 { background: #f4d9e8; transform: translate(var(--x),var(--y)) rotate(.4deg); }
.whiteboard-note > div { display: flex; justify-content: space-between; align-items: center; color: rgba(22,37,29,.62); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.whiteboard-note button { border: 0; background: transparent; color: inherit; }
.whiteboard-note button svg { width: 13px; height: 13px; }
.whiteboard-note p { margin: 15px 0 0; font-size: 14px; line-height: 1.55; color: #28332d; }
.whiteboard-empty { grid-column: 1/-1; min-height: 360px; display: grid; place-items: center; align-content: center; gap: 7px; color: #8b897f; pointer-events: none; }
.whiteboard-empty svg { width: 40px; height: 40px; opacity: .45; }

.modal.share-center-card { width: min(720px,100%); max-height: calc(100dvh - 36px); overflow: auto; }
.share-center-layout { min-width: 0; display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 24px; align-items: center; }
.share-qr-frame { padding: 14px; border: 1px solid #e1e7e3; border-radius: 14px; background: #fff; display: grid; place-items: center; }
.share-qr-frame canvas,.share-qr-frame img { width:220px!important; height:220px!important; display:block; }
.share-center-info { display: grid; gap: 10px; }
.share-security-badge { width: fit-content; display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font-size: 10px; font-weight: 700; }
.share-security-badge svg { width: 13px; height: 13px; }
.share-center-info label { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.share-url-box { display: flex; border: 1px solid #dfe6e1; border-radius: 9px; overflow: hidden; }
.share-url-box input { min-width: 0; flex: 1; border: 0; background: #fafcfb; padding: 9px 10px; color: var(--text); font-size: 11px; }
.share-url-box button { width: 38px; border: 0; border-left: 1px solid #dfe6e1; background: #fff; color: var(--brand); }
.share-url-box svg { width: 15px; height: 15px; }
.share-center-info small { color: var(--faint); }
.share-center-actions { display: flex; gap: 8px; margin-top: 6px; }

@media (max-width: 760px) {
    .drawer-properties-table { grid-template-columns: 1fr; }
    .drawer-footer .btn.quiet { font-size: 0; }
    .drawer-footer .btn.quiet svg { margin: 0; }
    .quick-create-grid { grid-template-columns: 1fr; }
    .share-center-layout { grid-template-columns: 1fr; }
    .share-qr-frame { width: fit-content; margin: 0 auto; }
    .whiteboard-overlay { padding: 0; }
    .whiteboard-shell { height: 100dvh; border-radius: 0; }
    .whiteboard-shell > header { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px; }
    .whiteboard-toolbar { width: 100%; justify-content: flex-start; }
    .whiteboard-note-layer { grid-template-columns: 1fr; padding: 18px; }
    .share-center-actions { flex-wrap: wrap; }
    .share-center-actions .btn { flex: 1 1 150px; }
    .mobile-tabs .mobile-create { color: var(--brand); }
    .mobile-create-mark { width: 34px; height: 28px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); }
    .mobile-create-mark svg { width: 19px; height: 19px; }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
}

body.auth-locked .app-shell,
body.auth-locked .mobile-tabs {
    display: none !important;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(251, 251, 250, 0.88);
    backdrop-filter: blur(18px);
}

.auth-gate.active { display: flex; }

.auth-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(32, 32, 29, 0.16);
    padding: 24px;
}

.auth-brand { padding: 0; margin-bottom: 28px; }
.auth-card h1 { font-size: 28px; margin-bottom: 10px; }
.auth-card p { color: var(--muted); }
.auth-button { width: 100%; margin-top: 12px; }
.auth-note { font-size: 12px; margin: 14px 0 0; text-align: center; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 268px;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 14px;
    z-index: 20;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #20201d;
    color: #fff;
    font-weight: 700;
}

.brand-block strong, .brand-block span { display: block; }
.brand-block span { color: var(--muted); font-size: 12px; }

.sidebar-nav { display: grid; gap: 2px; }

.sidebar-group-label {
    margin: 14px 0 2px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    letter-spacing: 0.5px;
}
.nav-item, .mobile-tabs a {
    color: var(--muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 6px;
    font-weight: 500;
}

.nav-item svg, .mobile-tabs svg, .btn svg, .icon-btn svg { width: 17px; height: 17px; stroke-width: 2; }
.nav-item:hover { background: rgba(32, 32, 29, 0.05); color: var(--text); }
.nav-item.active { background: #fff; color: var(--text); box-shadow: 0 1px 0 rgba(32, 32, 29, 0.04); }
.nav-more { width: 100%; border: 0; background: transparent; font: inherit; color: var(--muted); cursor: pointer; text-align: left; }
.nav-more:hover { background: rgba(32, 32, 29, 0.05); color: var(--text); }

.workspace-tree {
    margin-top: 8px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: grid;
    gap: 5px;
}

.workspace-tree-head,
.tree-shortcut,
.tree-space-row,
.tree-folder-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.workspace-tree-head {
    justify-content: space-between;
    padding: 0 4px 4px 10px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.compact-modal { width: min(420px, calc(100vw - 32px)); }
.more-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px 0; }
.more-menu-grid a { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; }
.more-menu-grid a:hover { background: var(--surface-soft); border-color: var(--line-strong); }
.more-menu-grid svg { width: 16px; height: 16px; color: var(--muted); }
.trash-list { display: grid; gap: 8px; margin-top: 16px; }
.trash-row { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.trash-row-icon { display: grid; place-items: center; width: 30px; height: 30px; color: var(--muted); background: var(--surface-soft); border-radius: 5px; flex: 0 0 auto; }
.trash-row-icon svg { width: 16px; height: 16px; }
.trash-row-main { display: grid; gap: 3px; min-width: 0; flex: 1; }
.trash-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.trash-row-main span { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .trash-row { align-items: flex-start; flex-wrap: wrap; } .trash-row-main { min-width: calc(100% - 44px); } .trash-row .btn { margin-left: 42px; } }

.tree-shortcut,
.tree-space-row,
.tree-folder-row {
    width: 100%;
    min-height: 30px;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 6px;
    padding: 5px 8px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
}

.tree-space-row { padding: 0; overflow: hidden; }
.tree-space-toggle, .tree-space-open { border: 0; background: transparent; color: inherit; min-height: 30px; cursor: pointer; }
.tree-space-toggle { width: 28px; display: grid; place-items: center; flex: 0 0 auto; }
.tree-space-open { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 5px 8px 5px 0; text-align: left; font: inherit; }
.tree-space-open:hover { color: var(--text); }

.tree-shortcut:hover,
.tree-space-row:hover,
.tree-folder-row:hover { background: rgba(32, 32, 29, 0.05); color: var(--text); }
.tree-shortcut svg,
.tree-space-row svg,
.tree-folder-row svg { width: 14px; height: 14px; flex: 0 0 auto; }
.tree-shortcut span,
.tree-space-row span,
.tree-folder-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-shortcut strong,
.tree-folder-row strong {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--faint);
    font-size: 10px;
}

.tree-space-list { display: grid; gap: 3px; max-height: 30vh; overflow: auto; }
.tree-space-mark {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    display: grid !important;
    place-items: center;
    background: #dbeafe;
    color: #175cd3;
    font-size: 10px;
    flex: 0 0 auto;
}
.tree-folder-list { display: grid; gap: 2px; padding-left: 22px; }
.tree-empty { padding: 8px; color: var(--faint); font-size: 12px; line-height: 1.35; }

.sidebar-section {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.section-label, .eyebrow {
    margin: 0 0 8px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.team-row {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    text-align: left;
}

.team-row.active, .team-row:hover { background: rgba(32, 32, 29, 0.05); }
.team-row strong, .team-row small { display: block; }
.team-row small { color: var(--muted); font-size: 12px; }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 auto;
}

.avatar.muted { background: #ece9e2; color: var(--muted); }

.sync-indicator {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    padding: 8px;
}

.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.sync-indicator.online .sync-dot { background: var(--green); }

.workspace {
    margin-left: 268px;
    width: calc(100% - 268px);
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 34px;
    background: rgba(251, 251, 250, 0.86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.2; }
h2 { margin-bottom: 8px; font-size: 28px; line-height: 1.18; }
h3 { margin-bottom: 0; font-size: 16px; line-height: 1.25; }

.top-actions, .modal-actions, .ocr-actions, .canvas-btn-group, .task-actions, .report-actions { display: flex; align-items: center; gap: 8px; }

.btn, .icon-btn {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn { padding: 0 12px; }
.btn.small { min-height: 31px; padding: 0 10px; font-size: 12px; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn.danger { border-color: #fecaca; color: var(--red); background: #fff; }
.btn.primary:hover, .icon-btn.dark:hover { background: var(--accent-dark); }
.btn.secondary:hover, .icon-btn:hover { background: var(--surface-soft); border-color: var(--line-strong); }
.btn.danger:hover, .icon-btn.danger:hover { background: #fef3f2; border-color: #fca5a5; color: var(--red); }

.icon-btn { width: 36px; padding: 0; }
.icon-btn.dark { border-color: var(--accent); background: var(--accent); color: #fff; }
.icon-btn.danger { color: var(--red); border-color: #fee2e2; }
.icon-btn.compact { width: 28px; min-height: 28px; }
.icon-btn.compact svg { width: 14px; height: 14px; }

.page-frame { padding: 28px 34px 54px; max-width: 1280px; }
.view-section { display: none; }
.view-section.active { display: block; }

.intro-row, .page-title-row, .panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.intro-row {
    border-bottom: 1px solid var(--line);
    padding-bottom: 22px;
    margin-bottom: 18px;
}

.muted-text { color: var(--muted); margin-bottom: 0; max-width: 680px; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-block, .panel, .progress-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-block { padding: 16px; display: grid; gap: 4px; }
.metric-block span, .metric-block small { color: var(--muted); }
.metric-block strong { font-size: 28px; line-height: 1.1; }

.dashboard-grid, .two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
    gap: 16px;
}

.activity-panel { margin-top: 16px; }
.activity-list,
.automation-list {
    display: grid;
    gap: 8px;
}
.activity-row,
.automation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    padding: 10px 12px;
}
.activity-row { justify-content: flex-start; }
.activity-row strong,
.automation-row strong {
    display: block;
    font-size: 13px;
}
.activity-row small,
.automation-row small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}
.activity-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--accent);
    flex: 0 0 auto;
}
.activity-icon svg { width: 15px; height: 15px; }
.automation-panel {
    grid-column: span 3;
}
.empty-state.compact { padding: 10px 0; min-height: auto; }
.directory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.directory-hint {
    align-self: stretch;
    display: flex;
    align-items: center;
    color: var(--muted);
}

.panel { padding: 16px; min-width: 0; }
.main-panel, .chat-panel { min-height: 438px; }
.panel-heading { margin-bottom: 14px; }
.text-link { color: var(--accent); text-decoration: none; font-weight: 600; }

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef4ff;
    color: #175cd3;
    font-size: 12px;
    font-weight: 700;
}

.status-pill.warning { background: #fff6ed; color: var(--amber); }
.status-pill.success { background: #ecfdf3; color: var(--green); }

.task-list { display: grid; gap: 8px; }

.task-item {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    padding: 10px;
}

.task-item-left { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }

.checkbox-circle {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--line-strong);
    background: #fff;
    color: transparent;
    border-radius: 50%;
    flex: 0 0 auto;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    display: grid;
    place-items: center;
    font-size: 11px;
}
.checkbox-circle:hover { border-color: var(--accent); background: #eef4ff; }

.task-item.completed .checkbox-circle { background: var(--green); border-color: var(--green); color: #fff; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-item.completed .task-title { color: var(--muted); text-decoration: line-through; }

.task-meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; }
.priority-badge { border-radius: 999px; padding: 1px 7px; font-weight: 700; text-transform: uppercase; font-size: 11px; }
.priority-high, .priority-urgent { background: #fef3f2; color: var(--red); }
.priority-medium { background: #fff6ed; color: var(--amber); }
.priority-low { background: #ecfdf3; color: var(--green); }
.task-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.task-select-checkbox {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--accent);
    flex: 0 0 auto;
}
.task-action-btn {
    min-height: 26px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    display: inline-flex;
    align-items: center;
}
.task-action-btn:hover { border-color: var(--line-strong); color: var(--text); background: #fff; }
.task-action-btn.active { background: #eef4ff; border-color: #bfdbfe; color: #175cd3; }
.task-details { flex-grow: 1; min-width: 0; }

.chat-panel { display: flex; flex-direction: column; }
.chat-box {
    flex: 1;
    min-height: 280px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8f8f6;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    max-width: 86%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    font-size: 13px;
}

.chat-message.user { align-self: flex-end; background: #eff6ff; border-color: #bfdbfe; }
.chat-message.assistant { align-self: flex-start; }
.chat-message.system { align-self: center; max-width: 100%; color: var(--muted); background: transparent; border: 0; text-align: center; font-size: 12px; }

.chat-input-area { display: flex; gap: 8px; margin-top: 10px; }
.chat-input-area input { flex: 1; min-width: 0; }

input[type="text"], input[type="number"], input[type="date"], select {
    min-height: 36px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 0 10px;
    outline: none;
}

input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
label { color: var(--muted); font-size: 12px; font-weight: 700; }
.field-group { display: grid; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-warn { border-color: #fedf89 !important; background: #fffcf5 !important; }

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

.project-card { padding: 16px; }
.project-card header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.project-card strong { font-size: 17px; }
.project-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.project-stats span { display: block; color: var(--muted); font-size: 12px; }
.project-stats b { font-size: 18px; }

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

.kanban-column { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 360px; }
.kanban-column h3 { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.kanban-board.grouped-project { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.bulk-action-bar {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #175cd3;
}
.bulk-action-bar.active { display: flex; flex-wrap: wrap; }
.bulk-action-bar strong { margin-right: 4px; }
.bulk-select { width: auto; min-width: 170px; min-height: 31px; font-size: 12px; }

.upload-zone {
    width: 100%;
    min-height: 160px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 22px;
    text-align: center;
}

.upload-zone svg { width: 28px; height: 28px; color: var(--accent); }
.upload-zone strong { color: var(--text); }

.canvas-wrapper { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.hide { display: none !important; }
#photo-canvas { width: 100%; height: auto; max-height: 390px; display: block; cursor: crosshair; }
.canvas-actions { border-top: 1px solid var(--line); padding: 10px; display: flex; justify-content: space-between; gap: 10px; }
.color-picker-bar { display: flex; gap: 7px; align-items: center; }
.color-dot { width: 22px; height: 22px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line-strong); }
.color-dot.active { box-shadow: 0 0 0 2px var(--accent); }
.color-red { background: var(--red); }
.color-green { background: var(--green); }
.color-blue { background: var(--accent); }

.photos-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gallery-photo-card { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.gallery-photo-card img, .photo-placeholder { width: 100%; height: 118px; object-fit: cover; display: grid; place-items: center; background: var(--surface-soft); color: var(--muted); }
.gallery-photo-card span { display: block; padding: 8px; font-size: 12px; color: var(--muted); }

.file-drop-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.file-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 170px 170px auto; gap: 10px; margin-bottom: 12px; }
.drive-view-toggle { align-self: stretch; }
.transfer-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.transfer-summary div {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    padding: 9px 10px;
}
.transfer-summary strong { display: block; font-size: 18px; line-height: 1; }
.transfer-summary span { color: var(--muted); font-size: 11px; }
.folder-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 0 10px;
    margin-bottom: 12px;
}
.folder-chip {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--muted);
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    white-space: nowrap;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.folder-chip svg { width: 15px; height: 15px; }
.folder-chip strong {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
}
.folder-chip.active { border-color: #bfdbfe; background: #eff6ff; color: #175cd3; }
.folder-chip.active strong { background: #dbeafe; color: #175cd3; }
.document-drive-panel { width: 100%; }
.file-list { display: grid; gap: 8px; margin-bottom: 14px; }
.file-list.grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-items: stretch;
}
.file-row {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}
.file-list.grid .file-row {
    grid-template-columns: 1fr;
    align-content: space-between;
}
.file-list.grid .file-row-main {
    align-items: flex-start;
}
.file-list.grid .file-icon {
    width: 42px;
    height: 42px;
}
.file-list.grid .file-actions {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    justify-content: flex-end;
}
.file-row.active { border-color: #93c5fd; background: #eff6ff; }
.file-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-row-info { min-width: 0; }
.file-row-main strong, .file-row-main small { display: block; }
.file-row-main strong { overflow-wrap: anywhere; color: var(--text); }
.file-row-main small { color: var(--muted); font-size: 12px; }
.file-tag-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
}
.file-tag, .file-tag-row .status-pill {
    min-height: 22px;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.file-tag svg { width: 12px; height: 12px; }
.file-tag.success { color: #047857; background: #ecfdf3; border-color: #abefc6; }
.file-tag.warning { color: var(--amber); background: #fff6ed; border-color: #fedf89; }
.file-icon {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: #eef4ff;
    color: #175cd3;
    flex: 0 0 auto;
}
.file-icon svg { width: 17px; height: 17px; }
.file-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.document-preview-panel { margin-top: 16px; }
.document-preview {
    border: 1px solid var(--line);
    border-radius: 7px;
    min-height: 520px;
    max-height: 78vh;
    overflow: auto;
    background: #fff;
    color: var(--muted);
    padding: 12px;
}
.preview-frame { width: 100%; height: 70vh; min-height: 520px; border: 0; background: #fff; }
.preview-image { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: 6px; }
.preview-text {
    margin: 0;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.ocr-ticket-preview { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; background: #fffdf7; }
.receipt-lines { display: grid; gap: 6px; margin-bottom: 14px; }
.receipt-lines span { height: 8px; background: #ece6da; border-radius: 4px; }
.receipt-lines span:nth-child(2) { width: 70%; }
.receipt-lines span:nth-child(3) { width: 42%; }
.ocr-fields { display: grid; gap: 10px; margin-bottom: 12px; }
.expense-list { display: grid; gap: 8px; }
.expense-row { display: flex; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.expense-row small { color: var(--muted); }

.client-portal-header { margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.report-toolbar { margin-bottom: 16px; display: flex; justify-content: space-between; gap: 14px; align-items: end; }
.report-toolbar .field-row { min-width: min(420px, 100%); }
.report-preview { display: grid; gap: 16px; }
.progress-card { padding: 16px; margin-bottom: 16px; }
.progress-card > div:first-child { display: flex; justify-content: space-between; margin-bottom: 12px; }
.progress-card span { color: var(--muted); }
.progress-card strong { font-size: 24px; }
.progress-bar-container { height: 10px; background: var(--surface-soft); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--green); border-radius: inherit; }
.completed-tasks-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.completed-tasks-list li { border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.completed-tasks-list small { display: block; color: var(--muted); margin-top: 3px; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(32, 32, 29, 0.28);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 50;
    overflow: auto;
}

#share-center-modal { z-index: 320; }
#whiteboard-modal { z-index: 200; }
#app-dialog-modal { z-index: 400; }

.modal-overlay.active { display: flex; }

.chat-card-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.chat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    color: var(--text);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.chat-card-head {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.chat-card-head strong {
    display: block;
    font-size: 13px;
}

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

.chat-card p {
    margin: 8px 0 0;
    line-height: 1.45;
}

.chat-card-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--accent);
    flex-shrink: 0;
}

.chat-card-icon svg { width: 15px; height: 15px; }

.chat-card-meta,
.chat-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chat-card-meta span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 11px;
    color: var(--muted);
    background: var(--surface-soft);
}

.chat-card-link {
    display: block;
    margin-top: 8px;
    word-break: break-all;
}

.document-readonly-shell {
    background: #f7f8fb;
    padding: 18px;
    min-height: 430px;
    overflow: auto;
}

#readonly-document-viewer {
    max-width: 840px;
    min-height: 380px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

#readonly-document-viewer .ql-container {
    border: 0;
    font-size: 14px;
}

#readonly-document-viewer .ql-editor {
    padding: 34px 42px;
    line-height: 1.65;
}

.document-readonly {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    overflow: auto;
}

.document-readonly pre {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.5;
    margin: 0;
}

.assistant-dock {
    position: fixed;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(420px, calc(100vw - 36px));
    z-index: 42;
    display: none;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
    padding: 14px;
}
.assistant-dock.active { display: grid; }
.assistant-dock-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.assistant-dock-header h3 { margin: 0; }
.assistant-scope-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.assistant-scope-row span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 8px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.assistant-scope-row svg { width: 12px; height: 12px; }
.assistant-dock-chat { min-height: 0; }
.assistant-dock-input { margin-top: 0; }
.assistant-fab {
    position: fixed;
    right: 20px;
    bottom: 22px;
    z-index: 41;
    width: 48px;
    height: 48px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.28);
}
.assistant-fab svg { width: 20px; height: 20px; }
.assistant-fab.hidden { display: none; }
@media (min-width: 961px) { .assistant-fab { display: none !important; } }
.modal { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 80px rgba(32, 32, 29, 0.24); padding: 16px; display: grid; gap: 14px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-header h2 { font-size: 18px; margin: 0; }
.modal-note { color: var(--muted); margin: 0; }

.mobile-tabs { display: none; }

@media (max-width: 960px) {
    .sidebar { display: none; }
    .workspace { margin-left: 0; width: 100%; }
    .topbar {
        padding: 13px 16px;
        align-items: flex-start;
        flex-direction: column;
    }
    .top-actions {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .top-actions .plane-dropdown-btn {
        min-width: 0;
        justify-content: flex-start;
    }
    .top-actions .icon-btn { display: none; }
    .top-actions .btn.secondary {
        width: 42px;
        padding: 0;
        font-size: 0;
        gap: 0;
    }
    .page-frame { padding: 18px 16px 88px; }
    .metrics-grid, .dashboard-grid, .two-column, .projects-grid, .kanban-board, .directory-grid { grid-template-columns: 1fr; }
    .file-toolbar, .transfer-summary { grid-template-columns: 1fr; }
    .automation-panel { grid-column: span 1; }
    .intro-row, .page-title-row, .report-toolbar { align-items: stretch; flex-direction: column; }
    .mobile-tabs {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(14px);
        border-top: 1px solid var(--line);
        padding: 7px 5px calc(7px + env(safe-area-inset-bottom));
    }
    .mobile-tabs a { justify-content: center; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
    .mobile-tabs a.active { color: var(--text); }
}

@media (max-width: 560px) {
    h1 { font-size: 21px; }
    h2 { font-size: 24px; }
    .field-row, .photos-gallery { grid-template-columns: 1fr; }
    .canvas-actions, .modal-actions { flex-direction: column; align-items: stretch; }
    .canvas-actions .btn, .modal-actions .btn { width: 100%; }
    .chat-input-area .icon-btn {
        flex: 0 0 44px;
        width: 44px;
    }
    .chat-input-area { gap: 8px; }
    .icon-btn.compact, .file-actions .icon-btn { width: 34px; }
    .file-row { grid-template-columns: 1fr; align-items: stretch; }
    .file-actions { justify-content: flex-end; flex-wrap: wrap; }
}

/* --- MEJORAS DE INTERACCIÓN UX (SaaS DE OFICINA) --- */

/* Barra de filtros de uso general */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.filter-bar-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 140px;
}

.filter-group.search-group {
    min-width: 180px;
}

.filter-group label {
    font-size: 10px;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-control {
    width: 100%;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.filter-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Toggle de Vista (Kanban vs Lista) */
.view-toggle-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 2px;
    background: var(--surface-soft);
}

.view-toggle-btn {
    border: 0;
    background: transparent;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    transition: background 0.12s ease, color 0.12s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(32, 32, 29, 0.05);
}

/* Vista de Lista / Tabla para tareas */
.task-list-view {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-top: 10px;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

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

.task-table th {
    background: var(--surface-soft);
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-table tr:last-child td {
    border-bottom: 0;
}

.task-table tr:hover td {
    background: rgba(32, 32, 29, 0.015);
}

.task-table-checkbox {
    width: 32px;
    text-align: center;
}

.task-inline-select {
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    color: inherit;
    font-weight: inherit;
    outline: none;
}

.task-inline-select:hover, .task-inline-select:focus {
    border-color: var(--line-strong);
    background: #fff;
}

/* Control deslizante de progreso en espacios */
.progress-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.progress-slider {
    flex-grow: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-soft);
    outline: none;
    -webkit-appearance: none;
    border: 1px solid var(--line);
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(32, 32, 29, 0.2);
    border: 1px solid #fff;
    transition: transform 0.1s ease;
}

.progress-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Resumen visual de gastos por categoria */
.category-summary-box {
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.category-bar-row {
    margin-bottom: 10px;
}

.category-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 3px;
    font-weight: 500;
}

.category-bar-container {
    height: 8px;
    background: var(--surface-soft);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.category-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
}

/* Formulario Gasto Manual */
.manual-expense-form {
    border-top: 1px solid var(--line);
    padding-top: 16px;
    margin-top: 16px;
}

.manual-expense-form h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    inset: 0;
    background: rgba(32, 32, 29, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-container {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background: #fff;
    padding: 12px;
    border-radius: var(--radius);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-caption {
    color: var(--text);
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.lightbox-close-btn {
    position: absolute;
    top: -42px;
    right: 0;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}

/* Alertas de Oficina / Acciones Urgentes */
.alerts-banner-container {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(32,32,29,0.03);
}

.alert-banner.danger {
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fda29b;
}

.alert-banner.warning {
    background: #fffaeb;
    color: #b54708;
    border: 1px solid #fecd76;
}

.alert-banner.info {
    background: #f0f9ff;
    color: #026aa2;
    border: 1px solid #7cd4fd;
}

.alert-banner-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-banner-btn {
    background: transparent;
    border: 0;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    color: inherit;
    padding: 2px 6px;
    font-size: 12px;
}

.expense-row-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.expense-delete-btn {
    background: transparent;
    border: 0;
    color: var(--red);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 4px;
    border-radius: 4px;
}

.expense-delete-btn:hover {
    background: #fef3f2;
}

.gallery-photo-card img {
    cursor: pointer;
    transition: opacity 0.16s ease;
}

.gallery-photo-card img:hover {
    opacity: 0.85;
}

/* --- ESTILOS DE LA VISTA DETALLADA DE ESPACIOS --- */
.project-detail-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.project-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
    gap: 16px;
    flex-wrap: wrap;
}

.project-detail-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.project-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: 0;
    padding: 0;
    margin-bottom: 8px;
    cursor: pointer;
    transition: color 0.12s ease;
}

.project-detail-back-btn:hover {
    color: var(--text);
}

.project-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 960px) {
    .project-detail-grid {
        grid-template-columns: 1fr;
    }
}

.project-detail-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.project-detail-column-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 10px;
    margin-bottom: 6px;
}

.project-detail-column-heading h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text);
}

.project-card {
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.project-card input[type="range"] {
    cursor: pointer;
}

/* --- PLANE.SO STYLE ALIGNMENT --- */

/* Migas de Pan (Breadcrumbs) */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 2px;
}

.breadcrumbs span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumbs .separator {
    color: var(--faint);
    font-size: 11px;
}

.breadcrumbs .current {
    color: var(--text);
    font-weight: 600;
}

/* Sidebar refined selectors */
.workspace-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(32,32,29,0.04);
    border: 1px solid var(--line);
    margin-bottom: 8px;
    font-weight: 600;
}

/* Toolbar superior al estilo Plane.so */
.plane-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.plane-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.plane-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Menú Desplegable (Dropdown Menu) */
.plane-dropdown {
    position: relative;
    display: inline-block;
}

.plane-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.plane-dropdown-btn:hover {
    background: var(--surface-soft);
    border-color: var(--line-strong);
    color: var(--text);
}

.plane-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 40;
    width: 220px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(32,32,29,0.12);
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
}

.plane-dropdown-menu.active {
    display: flex;
}

.plane-dropdown-menu h4 {
    margin: 0 0 4px 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--faint);
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.dropdown-item input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

/* Cajón Lateral Deslizante (Task Detail Drawer) */
.task-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: 460px;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -10px 0 40px rgba(32,32,29,0.08);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-detail-drawer.active {
    transform: translateX(0);
}

.drawer-header {
    min-height: 64px;
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(32,32,29,0.15);
    z-index: 55;
    display: none;
    backdrop-filter: blur(2px);
}

.drawer-overlay.active {
    display: block;
}

/* Campos del Cajón Estilo Notion/Plane */
.drawer-title-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    padding: 4px 6px;
    border-radius: 4px;
    outline: none;
    margin-left: -6px;
}

.drawer-title-input:hover, .drawer-title-input:focus {
    background: var(--surface-soft);
    border-color: var(--line);
}

.drawer-properties-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
}

.drawer-property-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.drawer-property-label {
    color: var(--muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-property-value-select {
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    outline: none;
    width: 100%;
}

.drawer-property-value-select:hover, .drawer-property-value-select:focus {
    background: var(--surface-soft);
    border-color: var(--line);
}

.drawer-property-value-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    width: 100%;
}

.drawer-property-value-input:hover, .drawer-property-value-input:focus {
    background: var(--surface-soft);
    border-color: var(--line);
}

.drawer-section-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--faint);
    letter-spacing: 0.5px;
    margin: 4px 0;
}

.drawer-description-textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
}

.drawer-description-textarea:hover, .drawer-description-textarea:focus {
    background: var(--surface-soft);
    border-color: var(--line);
}

/* Hover en Tareas para Abrir */
.task-item {
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.task-item:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 4px 12px rgba(32,32,29,0.06);
}

.task-item-clickable {
    flex-grow: 1;
}

@media (max-width: 560px) {
    .task-detail-drawer {
        width: 100%;
    }
}

/* --- COMPONENTES COMPLEMENTARIOS ESTILO PLANE.SO --- */

/* Badge de ID de Tarea */
.task-id-badge {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Paleta de Comandos (Command Menu / Ctrl+K) */
.command-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(32, 32, 29, 0.4);
    backdrop-filter: blur(4px);
    z-index: 120;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: fadeIn 0.15s ease-out;
}

.command-menu-backdrop.active {
    display: flex;
}

.command-menu-container {
    width: 600px;
    max-width: 90%;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: 0 30px 90px rgba(32,32,29,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.command-menu-search-row {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
}

.command-menu-search-row input {
    flex-grow: 1;
    border: 0;
    outline: none;
    font-size: 15px;
    color: var(--text);
    background: transparent;
}

.command-menu-search-row kbd {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    font-family: inherit;
}

.command-menu-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.command-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.command-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--faint);
    letter-spacing: 0.5px;
    padding-left: 8px;
    margin-bottom: 4px;
}

.command-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.1s;
}

.command-item:hover, .command-item.selected {
    background: var(--surface-soft);
}

.command-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.command-item-left span {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Calendario Plane.so UI */
.task-calendar-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    margin-top: 10px;
}

.calendar-day-header {
    background: var(--surface-soft);
    padding: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.calendar-day-header:last-child {
    border-right: 0;
}

.calendar-cell {
    min-height: 110px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
}

.calendar-cell:nth-child(7n) {
    border-right: 0;
}

.calendar-cell.different-month {
    background: var(--surface-soft);
    opacity: 0.65;
}

.calendar-cell-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-align: right;
    margin-bottom: 2px;
}

.calendar-task-card {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 6px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid var(--line-strong);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(32,32,29,0.02);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    transition: transform 0.1s;
}

.calendar-task-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Comentarios en Cajón Lateral */
.drawer-comments-section {
    border-top: 1px solid var(--line);
    padding-top: 16px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.comment-item {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.comment-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.comment-input-row {
    display: flex;
    gap: 8px;
}

.comment-input-row textarea {
    flex-grow: 1;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
    resize: none;
    font-family: inherit;
}

.comment-input-row textarea:focus {
    border-color: var(--line-strong);
}

/* Agrupamiento de Kanban por Prioridad */
.kanban-board.grouped-priority .kanban-column {
    border-top: 3px solid var(--line);
}

.kanban-board.grouped-priority .column-urgent { border-top-color: var(--red); }
.kanban-board.grouped-priority .column-high { border-top-color: var(--amber); }
.kanban-board.grouped-priority .column-medium { border-top-color: var(--accent); }
.kanban-board.grouped-priority .column-low { border-top-color: var(--muted); }

/* --- PORTAL DE COMPARTICIÓN PÚBLICA (QR / ENLACES) --- */
.public-share-gate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fbfbfa;
    z-index: 10000;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 32px 16px;
}

.public-share-card {
    background: #ffffff;
    width: 100%;
    max-width: 680px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(32,32,29,0.04);
    padding: 32px;
    margin: 0 auto;
}

.public-share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.public-share-tabs .tab-btn {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    transition: all 0.16s ease;
}

.public-share-tabs .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.public-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
    transition: border-color 0.15s ease;
}

.public-list-item:hover {
    border-color: var(--line-strong);
}

.public-list-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-file-btn {
    color: var(--primary);
    background: #f0f7ff;
    border: 1px solid #c2e0ff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.public-file-btn:hover {
    background: #e0efff;
}

/* =========================================================
   UX refinement v5 — product shell, work board and library
   ========================================================= */
:root {
    --bg: #f7f8fa;
    --surface-soft: #f4f6f8;
    --sidebar: #f8f9fb;
    --line: #e3e7ec;
    --line-strong: #cbd2da;
    --text: #18202a;
    --muted: #66717f;
    --faint: #8993a1;
    --accent: #245ec7;
    --accent-dark: #194ca8;
    --accent-soft: #edf3ff;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .045);
}

html, body { max-width: 100%; overflow-x: hidden; }
body[data-accent="graphite"] { --accent: #344054; --accent-dark: #1d2939; --accent-soft: #f2f4f7; }
body[data-accent="teal"] { --accent: #0f766e; --accent-dark: #115e59; --accent-soft: #ecfdf9; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; }

.sidebar { width: 252px; padding: 12px; gap: 10px; background: var(--sidebar); }
.workspace { margin-left: 252px; width: calc(100% - 252px); }
body[data-sidebar="compact"] .sidebar { width: 220px; }
body[data-sidebar="compact"] .workspace { margin-left: 220px; width: calc(100% - 220px); }
.brand-block { padding: 6px 8px 10px; }
.sidebar-nav { gap: 3px; }
.nav-item { min-height: 38px; padding: 8px 10px; border-radius: 8px; }
.nav-item.active { background: var(--surface); color: var(--accent); border: 1px solid var(--line); box-shadow: none; }
.workspace-tree { margin-top: 5px; max-height: min(300px, 32vh); overflow-y: auto; }
.tree-space-list { display: grid; gap: 3px; }
.tree-space-open.simple { width: 100%; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 34px; padding: 4px 7px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); text-align: left; }
.tree-space-open.simple:hover { color: var(--text); background: rgba(16, 24, 40, .045); }
.tree-space-open.simple > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-space-open.simple > strong { min-width: 20px; color: var(--faint); font-size: 11px; text-align: right; }
.tree-space-mark { width: 25px; height: 25px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); }
.sidebar-section { margin-top: auto; }
.sync-indicator { margin-top: 0; }

.topbar { min-height: 70px; padding: 12px clamp(18px, 3vw, 38px); background: rgba(247, 248, 250, .9); border-bottom-color: var(--line); }
.page-frame { width: min(1480px, 100%); margin-inline: auto; padding: 28px clamp(18px, 3vw, 38px) 48px; }
.view-section > .page-title-row { margin-bottom: 18px; }
.section-description { margin: 5px 0 0; color: var(--muted); font-size: 13px; max-width: 680px; }
.panel { border-color: var(--line); border-radius: 12px; box-shadow: none; }
.panel:hover { border-color: var(--line); }
.metric-block { border-radius: 12px; padding: 18px; box-shadow: none; }
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-block strong { font-size: 28px; letter-spacing: -.6px; }
.metric-block span { color: var(--muted); font-weight: 650; }
.metric-block small { display: block; margin-top: 6px; color: var(--faint); }
.activity-panel { margin-top: 14px; }

.plane-toolbar { align-items: flex-start; padding: 12px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.plane-toolbar-left { flex: 1 1 680px; }
.plane-toolbar-right { flex: 0 1 auto; }
.task-search-control { flex: 2 1 220px; min-width: 170px; }
.task-group-control { flex: 1 1 150px; }
.plane-toolbar .filter-control { width: auto; min-width: 128px; min-height: 36px; background: #fff; }
.task-clear-filters { min-height: 36px; }
.view-toggle-group { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface-soft); overflow-x: auto; }
.view-toggle-btn { flex: 0 0 auto; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.view-toggle-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

.kanban-board { grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding: 2px 1px 14px; align-items: start; }
.kanban-board.grouped-priority, .kanban-board.grouped-project, .kanban-board.grouped-tag { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); }
.kanban-column { min-height: 440px; padding: 9px; border-radius: 12px; background: #f1f3f6; transition: background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.kanban-column.is-drag-over { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.kanban-column-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 3px 8px; }
.kanban-column-header h3 { flex: 1; margin: 0; }
.kanban-column-header h3 > span:last-child { min-width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 999px; background: #e2e6eb; color: var(--muted); font-size: 11px; }
.kanban-drop-zone { min-height: 360px; align-content: start; }
.kanban-empty { min-height: 88px; display: grid; place-items: center; align-content: center; gap: 6px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--faint); font-size: 12px; }
.kanban-empty svg { width: 16px; height: 16px; }
.task-item { padding: 10px; border-radius: 9px; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .035); transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease; }
.task-item:hover { border-color: var(--line-strong); box-shadow: 0 4px 12px rgba(16, 24, 40, .07); }
.task-item.is-dragging { opacity: .42; }
.task-item-left { gap: 7px; }
.task-drag-handle { display: grid; place-items: center; width: 14px; height: 20px; margin-left: -4px; color: var(--faint); cursor: grab; opacity: 0; transition: opacity .12s; }
.task-item:hover .task-drag-handle, .task-item:focus-within .task-drag-handle { opacity: 1; }
.task-drag-handle svg { width: 14px; height: 14px; }
.task-details { display: grid; gap: 7px; }
.task-title-row { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.task-title { margin: 0; font-size: 13px; line-height: 1.35; }
.task-id-badge { flex: 0 0 auto; font-size: 10px; }
.task-meta { margin-top: 0; }
.task-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-status-chip { min-height: 25px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 650; }
.task-status-chip > span { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.task-status-chip.status-in_review > span { background: #d97706; }
.task-status-chip.status-completed > span { background: var(--green); }
.task-status-chip:hover { border-color: var(--line-strong); color: var(--text); }

.row-actions-menu { position: relative; }
.row-actions-menu > summary { list-style: none; }
.row-actions-menu > summary::-webkit-details-marker { display: none; }
.row-actions-menu[open] > summary { background: var(--surface-soft); }
.row-actions-popover { position: absolute; z-index: 35; top: calc(100% + 5px); right: 0; width: 210px; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 14px 34px rgba(16,24,40,.14); }
.row-actions-popover button { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; font-size: 12px; }
.row-actions-popover button:hover { background: var(--surface-soft); }
.row-actions-popover button.danger { color: var(--red); }
.row-actions-popover svg { width: 15px; height: 15px; }

.document-drive-panel { padding: 18px; }
.file-toolbar { grid-template-columns: minmax(220px, 1fr) minmax(140px, 170px) minmax(160px, 190px) auto; }
.file-toolbar { grid-template-columns: minmax(200px,1fr) repeat(4,minmax(130px,auto)); }
.custom-tag { --tag-color:#64748b; display:inline-flex; align-items:center; gap:5px; min-height:22px; padding:2px 7px; border:1px solid color-mix(in srgb,var(--tag-color) 28%,#dfe5e1); border-radius:999px; background:color-mix(in srgb,var(--tag-color) 9%,#fff); color:#34423a; font-size:10px; font-weight:650; white-space:nowrap; }
.custom-tag > span { width:7px; height:7px; border-radius:50%; background:var(--tag-color); }
.custom-tag.large { min-height:28px; padding:4px 10px; font-size:12px; }
.custom-tag.editable,.workflow-state-pill.editable { cursor:pointer; font:inherit; }
.custom-tag.editable svg,.workflow-state-pill.editable svg { width:12px; height:12px; opacity:.55; }
.task-custom-tags { min-width:0; display:inline-flex; gap:4px; overflow:hidden; }
.workflow-state-pill { --status-color:#64748b; display:inline-flex; align-items:center; gap:6px; min-height:27px; padding:3px 9px; border:1px solid color-mix(in srgb,var(--status-color) 32%,var(--line)); border-radius:999px; background:color-mix(in srgb,var(--status-color) 10%,#fff); color:#26372e; font-size:11px; font-weight:700; white-space:nowrap; }
.workflow-state-pill::before { content:""; width:8px; height:8px; border-radius:50%; background:var(--status-color); }
.project-workflow-control { display:grid; gap:5px; min-width:0; }
.project-workflow-control label { color:var(--muted); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
.project-workflow-control select { min-height:34px; max-width:100%; border:1px solid var(--line); border-radius:8px; padding:0 9px; background:#fff; color:var(--text); font:inherit; }
.kanban-column-header { border-top:3px solid var(--status-color,#d8dde3); padding-top:7px; }
.task-status-chip > span { background:var(--status-color,#64748b); }
.folder-chip.nested { margin-left:8px; border-style:dashed; }
.management-overlay { z-index:300; }
#color-picker-modal { z-index:460; }
.color-picker-modal { width:min(680px,100%); }
.color-picker-layout { display:grid; grid-template-columns:minmax(280px,1.15fr) minmax(230px,.85fr); gap:18px; }
.color-picker-layout > section { display:grid; align-content:start; gap:14px; }
.color-picker-preview { min-height:68px; display:grid; grid-template-columns:42px 1fr; column-gap:11px; align-items:center; padding:11px; border:1px solid var(--line); border-radius:11px; background:#fafcfb; cursor:pointer; }
.color-picker-preview input { position:absolute; width:1px; height:1px; opacity:0; }
.color-picker-preview > span { grid-row:1/3; width:42px; height:42px; border-radius:10px; background:var(--selected-color); box-shadow:inset 0 0 0 1px rgba(0,0,0,.08); }
.color-picker-preview strong,.color-picker-preview small { display:block; }
.color-picker-preview small,.color-picker-help { color:var(--muted); font-size:11px; }
.color-preset-grid { display:grid; grid-template-columns:repeat(9,1fr); gap:8px; }
.color-preset { aspect-ratio:1; min-width:0; display:grid; place-items:center; padding:3px; border:2px solid transparent; border-radius:9px; background:transparent; cursor:pointer; }
.color-preset > span { width:100%; height:100%; min-height:24px; border-radius:6px; background:var(--preset-color); box-shadow:inset 0 0 0 1px rgba(0,0,0,.08); }
.color-preset:hover,.color-preset.active { border-color:var(--text); }
.color-values { padding:13px; border:1px solid var(--line); border-radius:11px; background:#fafcfb; }
.color-values input.invalid { border-color:var(--red); box-shadow:0 0 0 2px rgba(220,38,38,.1); }
.rgb-grid { display:grid; gap:9px; }
.rgb-channel { display:grid; grid-template-columns:18px 62px 1fr; align-items:center; gap:8px; }
.rgb-channel label { font-size:11px; font-weight:750; }
.rgb-channel input[type="number"] { min-height:34px; width:62px; border:1px solid var(--line); border-radius:7px; padding:0 7px; }
.rgb-channel input[type="range"] { width:100%; accent-color:var(--brand); }
.drawer-tags-property { grid-column:1/-1; align-items:flex-start; }
.drawer-task-tags { min-width:0; display:flex; align-items:flex-start; gap:7px; flex-wrap:wrap; }
.drawer-tag-options { display:flex; flex-wrap:wrap; gap:5px; min-width:0; }
.drawer-tag-option { display:inline-flex; align-items:center; overflow:hidden; border:1px solid color-mix(in srgb,var(--tag-color) 24%,var(--line)); border-radius:999px; background:#fff; }
.drawer-tag-option.active { background:color-mix(in srgb,var(--tag-color) 11%,#fff); border-color:color-mix(in srgb,var(--tag-color) 46%,var(--line)); }
.drawer-tag-option > button { min-height:27px; display:inline-flex; align-items:center; gap:5px; padding:3px 7px; border:0; background:transparent; color:var(--text); font-size:10px; font-weight:680; cursor:pointer; }
.drawer-tag-option > button > span { width:7px; height:7px; border-radius:50%; background:var(--tag-color); }
.drawer-tag-option svg { width:11px; height:11px; }
.drawer-tag-option .drawer-tag-edit { width:25px; justify-content:center; padding:0 6px; border-left:1px solid color-mix(in srgb,var(--tag-color) 20%,var(--line)); color:var(--muted); }
.drawer-tag-create { min-height:27px; display:inline-flex; align-items:center; gap:4px; padding:3px 7px; border:1px dashed var(--line-strong); border-radius:999px; background:#fff; color:var(--brand); font-size:10px; font-weight:700; cursor:pointer; }
.drawer-tag-create svg { width:12px; height:12px; }
.whiteboard-color-button { min-height:34px; display:inline-flex; align-items:center; gap:7px; padding:0 9px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--text); font:inherit; cursor:pointer; }
.whiteboard-color-button > span { width:16px; height:16px; border-radius:5px; background:var(--selected-color); box-shadow:inset 0 0 0 1px rgba(0,0,0,.12); }
.management-modal { width:min(760px,100%); max-height:calc(100dvh - 36px); overflow:auto; }
.management-modal.compact { width:min(620px,100%); }
.management-section { display:grid; gap:12px; padding:14px; border:1px solid var(--line); border-radius:12px; background:#fafcfb; }
.management-section-head,.workflow-set-card > header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.management-section-head > div,.workflow-set-card header > div { display:grid; gap:2px; }
.management-section-head small { color:var(--muted); }
.management-chip-list,.workflow-set-card > div { display:flex; flex-wrap:wrap; gap:7px; }
.workflow-set-list { display:grid; gap:8px; }
.workflow-set-card { display:grid; gap:10px; padding:12px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.tag-check-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:7px; }
.tag-check-grid label { display:flex; align-items:center; gap:7px; min-height:36px; padding:6px 8px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; }
.movement-type { display:inline-flex; align-items:center; min-height:22px; padding:2px 7px; border-radius:999px; background:#f1f5f3; font-weight:700; }
.movement-type.income { background:#eaf7ef; color:#18794e; }
.movement-amount.income { color:#18794e; }
.movement-amount.expense { color:#9f3030; }
.saved-report-row { grid-template-columns:auto minmax(0,1fr) auto; }
.saved-report-icon { width:38px; height:38px; display:grid; place-items:center; border-radius:10px; background:var(--brand-soft); color:var(--brand); }
.saved-report-icon svg { width:18px; height:18px; }
.transfer-summary { gap: 10px; }
.transfer-summary div { padding: 12px; border-radius: 9px; background: #f7f8fa; }
.folder-strip { scrollbar-width: thin; }
.file-context-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; margin-bottom: 8px; padding: 0 4px; color: var(--muted); font-size: 12px; }
.file-context-line .text-link { border: 0; background: transparent; }
.file-row { min-height: 74px; border-radius: 9px; cursor: pointer; transition: background .14s ease, border-color .14s ease, box-shadow .14s ease; }
.file-row:hover { background: #fbfcfd; border-color: var(--line-strong); box-shadow: 0 3px 12px rgba(16,24,40,.045); }
.file-row.active { border-color: var(--accent); background: var(--accent-soft); }
.file-row-info strong { font-size: 13px; }
.file-actions { display: flex; align-items: center; gap: 4px; }
.file-list.grid .file-quick-action { display: none; }

.settings-experience-panel { padding: 20px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.settings-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); cursor: pointer; }
.settings-switch-row span { display: grid; gap: 3px; }
.settings-switch-row small { color: var(--muted); font-weight: 400; }
.settings-switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.settings-session-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px; }

.selected-upload-file { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.selected-upload-file[hidden] { display: none; }
.selected-upload-file > span:last-child { display: grid; gap: 2px; min-width: 0; }
.selected-upload-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-upload-file small { color: var(--muted); }
.upload-progress-panel { display: grid; gap: 9px; padding: 13px; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 10px; background: var(--accent-soft); }
.upload-progress-panel[hidden] { display: none; }
.upload-progress-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.upload-progress-heading > span { display: grid; min-width: 0; }
.upload-progress-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress-heading small, .upload-progress-panel > small { color: var(--muted); }
.upload-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(102,113,127,.17); }
.upload-progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.upload-progress-toast { position: fixed; right: 24px; bottom: 24px; z-index: 10000; width: min(360px, calc(100vw - 32px)); display: grid; gap: 9px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 38px rgba(0,0,0,.16); }
.upload-progress-toast > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.upload-progress-toast strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress-toast span { color: var(--muted); white-space: nowrap; }
.spin { animation: ux-spin .8s linear infinite; }
@keyframes ux-spin { to { transform: rotate(360deg); } }

body[data-density="compact"] .page-frame { padding-top: 20px; }
body[data-density="compact"] .panel { padding: 13px; }
body[data-density="compact"] .task-item { padding: 8px; }
body[data-density="compact"] .file-row { min-height: 62px; padding: 9px; }

@media (max-width: 1180px) {
    .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kanban-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); }
}

@media (max-width: 960px) {
    .workspace, body[data-sidebar="compact"] .workspace { margin-left: 0; width: 100%; }
    .topbar { min-height: auto; padding: 10px 14px; flex-direction: row; align-items: center; }
    .topbar #page-kicker { display: none; }
    .topbar .breadcrumbs { display: none; }
    .topbar h1 { font-size: 18px !important; }
    .top-actions { width: auto !important; display: flex !important; }
    .top-actions .plane-dropdown-btn { min-width: 40px; width: 40px; justify-content: center; padding: 0; font-size: 0 !important; }
    .top-actions .plane-dropdown-btn span, .top-actions .plane-dropdown-btn kbd { display: none; }
    .top-actions .top-create-btn { width: 40px; height: 40px; padding: 0; font-size: 0; }
    .top-actions .top-create-btn svg { margin: auto; }
    .page-frame { padding: 20px 14px calc(92px + env(safe-area-inset-bottom)); }
    .plane-toolbar { display: grid; gap: 10px; }
    .plane-toolbar-left { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; flex-basis: auto; }
    .plane-toolbar .filter-control { width: 100%; min-width: 0; }
    .task-search-control { grid-column: 1 / -1; }
    .task-clear-filters { width: 100%; }
    .plane-toolbar-right { width: 100%; justify-content: space-between; min-width: 0; }
    .plane-toolbar-right .view-toggle-group { flex: 1; justify-content: stretch; }
    .plane-toolbar-right .view-toggle-btn { flex: 1 0 auto; }
    .kanban-board, .kanban-board.grouped-priority, .kanban-board.grouped-project, .kanban-board.grouped-tag { display: grid; grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: minmax(82vw, 340px); overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-inline: contain; }
    .kanban-column { scroll-snap-align: start; min-height: 430px; }
    .file-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .file-toolbar > input { grid-column: 1 / -1; }
    .transfer-summary { grid-template-columns: repeat(4, minmax(115px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
    .settings-session-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
    .page-title-row { gap: 12px; }
    .page-title-row .btn { width: 100%; justify-content: center; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-block { padding: 14px; }
    .metric-block strong { font-size: 24px; }
    .metric-block small { display: none; }
    .settings-grid { grid-template-columns: 1fr; }
    #view-settings > div:nth-child(2) > .panel:first-child > div:nth-child(2) { grid-template-columns: 1fr !important; }
    .plane-toolbar-left { grid-template-columns: 1fr; }
    .task-search-control { grid-column: auto; }
    .plane-toolbar-right { align-items: stretch; flex-direction: column; }
    .plane-toolbar-right .plane-dropdown, .plane-toolbar-right .plane-dropdown-btn { width: 100%; }
    .plane-toolbar-right .plane-dropdown-btn { justify-content: center; }
    .plane-toolbar-right .view-toggle-btn span { display: none; }
    .file-toolbar { grid-template-columns: 1fr; }
    .file-toolbar > input { grid-column: auto; }
    .transfer-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
    .folder-strip { scrollbar-width: none; }
    .folder-strip::-webkit-scrollbar { display: none; }
    .drive-view-toggle { width: 100%; }
    .drive-view-toggle .view-toggle-btn { flex: 1; }
    .file-row { grid-template-columns: minmax(0, 1fr) auto; align-items: flex-start; padding: 10px; }
    .file-tag-row .file-tag:nth-of-type(n+4) { display: none; }
    .file-quick-action { display: none; }
    .file-context-line { align-items: flex-start; }
    .settings-actions { flex-direction: column-reverse; }
    .settings-actions .btn { width: 100%; justify-content: center; }
    .modal.upload-modal { max-height: calc(100dvh - 24px); overflow-y: auto; }
    .upload-progress-toast { right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* Mature secondary tools */
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-metrics-grid { margin-bottom: 16px; }
.tool-metrics-grid .metric-block strong { font-size: 22px; }
.toolbar-result-count { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.directory-toolbar, .trash-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px; }
.directory-toolbar input { flex: 1 1 320px; }
.directory-toolbar select { flex: 0 1 190px; }
.directory-toolbar .toolbar-result-count, .trash-toolbar .toolbar-result-count { margin-left: auto; padding-inline: 6px; }
.directory-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.contact-card { position: relative; display: grid; gap: 14px; min-height: 190px; padding: 16px; }
.contact-card-header { display: flex; align-items: flex-start; gap: 11px; }
.contact-card-header > div { min-width: 0; flex: 1; }
.contact-card-header strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.contact-card-header small { color: var(--muted); }
.contact-card-avatar { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.contact-detail-list { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.contact-detail-list span { display: flex; align-items: flex-start; gap: 7px; min-width: 0; }
.contact-detail-list svg { width: 14px; height: 14px; margin-top: 1px; flex: 0 0 auto; }
.contact-detail-list a { color: inherit; overflow-wrap: anywhere; text-decoration: none; }
.contact-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.contact-modal { width: min(620px, 100%); }
.textarea-field { min-height: 90px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

.expense-row { min-height: 68px; border-radius: 9px; }
.expense-row-main { display: grid; gap: 4px; min-width: 0; }
.expense-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.expense-status { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 700; }
.expense-status.approved, .expense-status.exported { background: #ecfdf3; color: var(--green); }
.expense-status.needs_review, .expense-status.pending { background: #fff6ed; color: var(--amber); }
.expense-status.rejected { background: #fef3f2; color: var(--red); }
.expense-row-actions .row-actions-menu { display: inline-block; }
.danger-outline { border: 1px solid #fecdca; background: #fff; color: var(--red); }
.danger-outline:hover { background: #fef3f2; }

.saved-reports-panel { margin-top: 16px; }
.saved-reports-panel .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.saved-reports-panel .panel-heading input { width: min(280px, 100%); }
.saved-reports-list { display: grid; gap: 8px; }
.saved-report-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.saved-report-main { display: grid; gap: 5px; min-width: 0; }
.saved-report-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-report-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.saved-report-actions { display: flex; align-items: center; gap: 5px; }
.report-toolbar #report-project { min-width: 180px; }

.trash-toolbar { justify-content: space-between; }
.trash-row-actions { display: flex; align-items: center; gap: 6px; }
.settings-channel-panel { padding: 20px; }
.settings-switch-row.compact { margin-top: 0; min-height: 74px; }
.settings-switch-row.compact input { flex: 0 0 auto; }

@media (max-width: 760px) {
    .file-toolbar { grid-template-columns:1fr 1fr; }
    .file-toolbar > input { grid-column:1/-1; }
    .management-modal { max-height:100dvh; border-radius:0; }
    .color-picker-layout { grid-template-columns:1fr; }
    .color-preset-grid { grid-template-columns:repeat(6,1fr); }
    .report-metrics { grid-template-columns:1fr 1fr; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; justify-content: center; }
    .directory-toolbar { align-items: stretch; flex-direction: column; }
    .directory-toolbar input, .directory-toolbar select { flex: 0 0 auto; width: 100%; }
    .directory-toolbar .toolbar-result-count { margin-left: 0; }
    .saved-reports-panel .panel-heading { align-items: stretch; flex-direction: column; }
    .saved-reports-panel .panel-heading input { width: 100%; }
    .saved-report-row { grid-template-columns: 1fr; }
    .saved-report-actions { justify-content: flex-end; }
    .trash-row-actions { width: 100%; justify-content: flex-end; padding-left: 42px; }
}

/* V3 final cascade: must remain after legacy compatibility styles. */
:root { --brand:#2f6f4e; --brand-strong:#245a3e; --brand-soft:#eaf4ee; --canvas:#f7f9f7; --accent:var(--brand); --accent-dark:var(--brand-strong); --green:var(--brand); --radius:12px; }
body { background:var(--canvas); }
.brand-mark { background:var(--brand); border-radius:9px; }
.btn.primary,.icon-btn.dark { background:var(--brand); border-color:var(--brand); color:#fff; }
.btn.primary:hover,.icon-btn.dark:hover { background:var(--brand-strong); border-color:var(--brand-strong); }
.nav-item.active { color:var(--brand-strong); background:#fff; box-shadow:inset 3px 0 var(--brand),0 1px 2px rgba(22,37,29,.04); }
.task-item { border-radius:11px; background:#fff; }
.task-item.expanded { border-color:rgba(47,111,78,.32); box-shadow:0 10px 28px rgba(22,37,29,.07); }
.task-detail-drawer { width:min(520px,100vw); background:#fff; transition:width .25s ease,transform .25s cubic-bezier(.2,0,0,1); }
.task-detail-drawer.wide { width:min(760px,100vw); }
.drawer-body { gap:12px; padding:18px 22px 24px; }
.drawer-properties-table { display:grid; grid-template-columns:1fr 1fr; gap:6px 16px; padding:12px; border:1px solid #e7ebe8; border-radius:12px; background:#fafcfb; }
.drawer-property-row { grid-template-columns:92px 1fr; min-width:0; }
.drawer-footer { flex-shrink:0; padding:11px 20px calc(11px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; background:#fff; }
.modal-overlay.active { display:flex; }
@media(max-width:760px){.drawer-properties-table{grid-template-columns:1fr}.task-detail-drawer,.task-detail-drawer.wide{width:100%}.mobile-tabs .mobile-create{color:var(--brand)}}
.create-file-modal { max-width:620px; }
.create-type-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
.create-type-grid label { cursor:pointer; }
.create-type-grid input { position:absolute; opacity:0; pointer-events:none; }
.create-type-grid span { min-height:82px; display:grid; grid-template-columns:auto 1fr; column-gap:10px; align-content:center; padding:13px; border:1px solid #dfe6e1; border-radius:12px; background:#fff; }
.create-type-grid span > svg { grid-row:1/3; width:22px; height:22px; color:var(--brand); align-self:center; }
.create-type-grid strong,.create-type-grid small { display:block; }
.create-type-grid small { color:var(--muted); font-size:11px; margin-top:2px; }
.create-type-grid input:checked + span { border-color:var(--brand); background:var(--brand-soft); box-shadow:0 0 0 1px var(--brand); }
.create-with-ai { min-height:64px!important; padding:10px 12px!important; margin-top:12px; border-radius:10px; background:#fafcfb; }
@media(max-width:620px){.create-type-grid{grid-template-columns:1fr}.create-file-modal .field-row{grid-template-columns:1fr}}

/* Scalable file library */
.file-library-panel { padding:0; overflow:hidden; }
.file-library-topbar { display:grid; grid-template-columns:minmax(280px,1fr) auto auto; gap:10px; align-items:center; padding:14px; border-bottom:1px solid var(--line); }
.file-search-box,.file-nav-search { min-height:40px; display:flex; align-items:center; gap:8px; padding:0 11px; border:1px solid var(--line); border-radius:9px; background:#fff; }
.file-search-box:focus-within,.file-nav-search:focus-within { border-color:var(--brand); box-shadow:0 0 0 3px rgba(47,111,78,.09); }
.file-search-box svg,.file-nav-search svg { width:16px; height:16px; flex:0 0 auto; color:var(--muted); }
.file-search-box input,.file-nav-search input { width:100%; min-width:0; border:0; outline:0; background:transparent; font:inherit; }
.file-filter-panel { display:flex; align-items:center; gap:8px; }
.file-filter-panel select { width:auto; min-width:138px; min-height:40px; border:1px solid var(--line); border-radius:9px; background:#fff; padding:0 30px 0 10px; color:var(--text); }
.file-filter-clear { min-height:40px; }
.file-mobile-control,.file-mobile-panel-head { display:none; }
.file-library-panel > .transfer-summary { grid-template-columns:repeat(4,minmax(120px,1fr)); margin:0; padding:10px 14px; border-bottom:1px solid var(--line); background:#fafcfb; }
.file-library-panel > .transfer-summary div { padding:7px 9px; background:#fff; }
.file-library-panel > .transfer-summary strong { font-size:15px; }
.file-library-shell { display:grid; grid-template-columns:270px minmax(0,1fr); min-height:600px; }
.file-nav-pane { min-width:0; padding:12px; border-right:1px solid var(--line); background:#fafcfb; max-height:72vh; overflow:auto; }
.file-nav-search { min-height:36px; margin-bottom:10px; }
.file-location-tree { display:grid; gap:3px; }
.file-location-item { width:100%; min-height:36px; display:grid; grid-template-columns:18px minmax(0,1fr) auto; align-items:center; gap:8px; padding:6px 8px; border:0; border-radius:7px; background:transparent; color:var(--muted); text-align:left; cursor:pointer; }
.file-location-item:hover { background:#eef2ef; color:var(--text); }
.file-location-item.active { background:var(--brand-soft); color:var(--brand-strong); font-weight:700; }
.file-location-item svg { width:15px; height:15px; }
.file-location-item span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-location-item strong { min-width:24px; color:inherit; font-size:10px; text-align:right; }
.file-tree-label { display:flex; align-items:center; justify-content:space-between; margin:14px 7px 5px; color:var(--faint); font-size:10px; font-weight:750; text-transform:uppercase; letter-spacing:.06em; }
.file-project-row { display:grid; grid-template-columns:24px minmax(0,1fr); align-items:center; }
.file-tree-toggle { width:24px; height:32px; display:grid; place-items:center; padding:0; border:0; background:transparent; color:var(--faint); cursor:pointer; }
.file-tree-toggle svg { width:14px; height:14px; }
.file-folder-children { display:grid; gap:2px; padding-left:24px; }
.file-location-item.folder { min-height:33px; }
.file-location-empty { min-height:32px; display:flex; align-items:center; gap:7px; margin-left:7px; border:0; background:transparent; color:var(--brand); font-size:11px; cursor:pointer; }
.file-location-empty svg { width:14px; height:14px; }
.file-nav-empty { padding:14px 8px; color:var(--muted); font-size:12px; }
.file-results-pane { min-width:0; padding:12px 14px; overflow:hidden; }
.file-results-head { min-height:44px; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:2px 2px 12px; }
.file-results-head > div { display:grid; gap:3px; }
.file-results-head > div > strong { font-size:12px; color:var(--muted); }
.file-location-breadcrumb { min-height:20px; display:flex; align-items:center; gap:5px; color:var(--text); font-size:14px; font-weight:750; }
.file-location-breadcrumb button { border:0; padding:0; background:transparent; color:var(--brand); font:inherit; cursor:pointer; }
.file-location-breadcrumb svg { width:13px; height:13px; color:var(--faint); }
.file-table-head,.file-list:not(.grid) .file-row { display:grid; grid-template-columns:minmax(240px,2fr) minmax(150px,1.15fr) minmax(130px,1fr) 80px 90px 42px; gap:10px; align-items:center; }
.file-table-head { min-height:34px; padding:0 10px; border-bottom:1px solid var(--line); color:var(--faint); font-size:10px; font-weight:750; text-transform:uppercase; letter-spacing:.04em; }
.file-list { gap:0; margin:0; }
.file-list:not(.grid) .file-row { min-height:62px; padding:8px 10px; border:0; border-bottom:1px solid var(--line); border-radius:0; box-shadow:none; }
.file-list:not(.grid) .file-row:hover { background:#fafcfb; box-shadow:none; }
.file-row-info strong { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.file-cell { min-width:0; color:var(--muted); font-size:11px; }
.file-cell-location { display:flex; align-items:center; gap:6px; }
.file-cell-location svg { width:13px; height:13px; flex:0 0 auto; }
.file-cell-location span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-cell-tags { display:flex; align-items:center; gap:4px; overflow:hidden; }
.file-cell-tags .custom-tag { max-width:120px; overflow:hidden; text-overflow:ellipsis; }
.file-empty-value { color:var(--faint); }
.file-mobile-tags { display:none; }
.file-list.grid { grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:10px; }
.file-list.grid .file-row { min-height:190px; }
.file-list.grid .file-cell { display:none; }
.file-list.grid .file-cell-tags { display:flex; }
.file-pagination { min-height:48px; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 2px 0; color:var(--muted); font-size:11px; }
.file-pagination > div { display:flex; align-items:center; gap:8px; }
.file-pagination .icon-btn[disabled] { opacity:.35; pointer-events:none; }
.file-mobile-scrim { display:none; }
body.file-preview-open { overflow:hidden; }
body.file-panel-open { overflow:hidden; }
.file-preview-overlay { z-index:350; padding:20px; background:rgba(22,32,26,.48); }
.file-preview-dialog { width:min(1500px,calc(100vw - 40px)); height:calc(100dvh - 40px); display:flex; flex-direction:column; overflow:hidden; margin:0; border-radius:14px; background:#fff; box-shadow:0 28px 80px rgba(0,0,0,.24); }
.file-preview-header { min-height:64px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 14px; border-bottom:1px solid var(--line); background:#fff; }
.file-preview-heading,.file-preview-actions { display:flex; align-items:center; gap:9px; min-width:0; }
.file-preview-heading > div { min-width:0; }
.file-preview-heading h3 { margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; }
.file-preview-heading .eyebrow { margin:0 0 2px; }
.file-preview-actions svg { width:15px; height:15px; }
.file-preview-dialog .document-preview { flex:1; min-height:0; max-height:none; overflow:auto; border:0; border-radius:0; padding:0; }
.file-preview-dialog .preview-frame { height:100%; min-height:calc(100dvh - 105px); }
.file-preview-dialog .preview-image { max-height:calc(100dvh - 105px); padding:16px; }
.file-preview-loading { display:grid; place-items:center; min-height:60vh; color:var(--muted); }

@media (max-width:900px) {
    .file-library-topbar { grid-template-columns:minmax(0,1fr) auto auto auto; }
    .file-search-box { grid-column:1/-1; }
    .file-mobile-control { display:inline-flex; min-height:44px; justify-content:center; }
    .file-filter-panel { display:none; position:fixed; left:0; right:0; bottom:0; z-index:380; max-height:78dvh; overflow:auto; padding:14px 14px calc(18px + env(safe-area-inset-bottom)); border-radius:18px 18px 0 0; background:#fff; box-shadow:0 -18px 50px rgba(0,0,0,.2); }
    #view-capture[data-mobile-panel="filters"] .file-filter-panel { display:grid; gap:10px; }
    .file-filter-panel select,.file-filter-panel .btn { width:100%; min-height:48px; }
    .file-mobile-panel-head { display:flex; align-items:center; justify-content:space-between; min-height:44px; }
    .file-library-panel > .transfer-summary { display:flex; overflow-x:auto; scroll-snap-type:x proximity; }
    .file-library-panel > .transfer-summary div { min-width:132px; flex:0 0 auto; scroll-snap-align:start; }
    .file-library-shell { display:block; min-height:520px; }
    .file-nav-pane { display:none; position:fixed; inset:0 0 0 10%; z-index:380; max-height:none; padding:14px 14px calc(18px + env(safe-area-inset-bottom)); border:0; background:#fff; box-shadow:-18px 0 50px rgba(0,0,0,.2); }
    #view-capture[data-mobile-panel="nav"] .file-nav-pane { display:block; }
    #view-capture[data-mobile-panel="nav"] .file-mobile-scrim,#view-capture[data-mobile-panel="filters"] .file-mobile-scrim { display:block; position:fixed; inset:0; z-index:370; border:0; background:rgba(15,23,20,.42); }
    .file-nav-search { min-height:46px; }
    .file-location-item { min-height:46px; }
    .file-tree-toggle { height:44px; }
    .file-results-pane { padding:10px; }
    .file-table-head { display:none; }
    .file-list:not(.grid) .file-row { grid-template-columns:minmax(0,1fr) auto; gap:5px 8px; min-height:78px; padding:10px 8px; }
    .file-list:not(.grid) .file-row-main { grid-column:1; }
    .file-list:not(.grid) .file-cell-location { display:flex; grid-column:1; padding-left:44px; }
    .file-list:not(.grid) .file-cell-tags { display:flex; grid-column:1; padding-left:44px; }
    .file-list:not(.grid) .file-cell-size,.file-list:not(.grid) .file-cell-date { display:none; }
    .file-list:not(.grid) .file-actions { grid-column:2; grid-row:1/4; align-self:center; }
    .file-list.grid { grid-template-columns:1fr; }
    .file-list.grid .file-row { min-height:150px; }
    .file-mobile-tags { display:flex; }
    .file-quick-action { display:none; }
    .file-pagination { position:sticky; bottom:calc(72px + env(safe-area-inset-bottom)); z-index:5; padding:9px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.96); box-shadow:0 8px 24px rgba(0,0,0,.08); }
    .file-preview-overlay { padding:0; }
    .file-preview-dialog { width:100vw; height:100dvh; border-radius:0; }
    .file-preview-header { min-height:58px; padding:8px 10px; padding-top:max(8px,env(safe-area-inset-top)); }
    .file-preview-heading .file-icon { display:none; }
    .file-preview-actions { gap:5px; }
    .file-preview-actions .btn { width:44px; min-width:44px; min-height:44px; padding:0; justify-content:center; }
    .file-preview-actions .btn span { display:none; }
    .file-preview-actions .icon-btn { width:44px; height:44px; }
    .file-preview-dialog .preview-frame { min-height:calc(100dvh - 58px); }
}

@media (pointer:coarse) {
    .file-location-item,.file-tree-toggle,.file-row,.file-actions .icon-btn { min-height:44px; }
    .file-row { -webkit-tap-highlight-color:transparent; }
}

/* Mobile-first surfaces for Inicio and Mi trabajo */
.dashboard-mobile-actions,.task-mobile-toolbar,.task-mobile-scrim,.task-mobile-sheet-head { display:none; }

@media (max-width:720px) {
    body.task-mobile-sheet-open { overflow:hidden; }
    #view-dashboard .intro-row { margin-bottom:14px; padding-bottom:14px; align-items:center; }
    #view-dashboard .intro-row .eyebrow,#view-dashboard .intro-row .muted-text { display:none; }
    #view-dashboard .intro-row h2 { font-size:22px; line-height:1.15; }
    #view-dashboard .intro-row > .btn { width:44px; min-width:44px; height:44px; padding:0; font-size:0; border-radius:12px; }
    #view-dashboard .intro-row > .btn svg { width:19px; height:19px; margin:0; }
    .dashboard-mobile-actions { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(158px,1fr); gap:8px; margin:0 -14px 14px; padding:0 14px 3px; overflow-x:auto; scroll-snap-type:x proximity; scrollbar-width:none; }
    .dashboard-mobile-actions::-webkit-scrollbar { display:none; }
    .dashboard-mobile-actions button { min-height:68px; display:flex; align-items:center; gap:10px; padding:11px; scroll-snap-align:start; border:1px solid var(--line); border-radius:13px; background:#fff; color:var(--text); text-align:left; }
    .dashboard-mobile-actions button > svg { width:20px; height:20px; padding:9px; box-sizing:content-box; border-radius:10px; background:var(--accent-soft); color:var(--accent); }
    .dashboard-mobile-actions button span { display:grid; gap:2px; }
    .dashboard-mobile-actions button strong { font-size:13px; }
    .dashboard-mobile-actions button small { color:var(--muted); font-size:11px; }
    #view-dashboard .alerts-banner-container { margin-bottom:10px; }
    #view-dashboard .alert-banner { align-items:flex-start; gap:8px; padding:11px; border-radius:12px; }
    #view-dashboard .alert-banner-left { align-items:flex-start; }
    #view-dashboard .metrics-grid { display:flex; gap:8px; margin:0 -14px 14px; padding:0 14px 3px; overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none; }
    #view-dashboard .metrics-grid::-webkit-scrollbar { display:none; }
    #view-dashboard .metric-block { flex:0 0 132px; min-height:92px; padding:12px; scroll-snap-align:start; box-shadow:none; }
    #view-dashboard .metric-block span { font-size:11px; }
    #view-dashboard .metric-block strong { margin-top:auto; font-size:27px; }
    #view-dashboard .dashboard-grid { display:flex; flex-direction:column; gap:12px; }
    #view-dashboard .panel { padding:13px; border-radius:14px; box-shadow:none; }
    #view-dashboard .main-panel,#view-dashboard .chat-panel { min-height:0; }
    #view-dashboard .main-panel { order:1; }
    #view-dashboard .chat-panel { order:2; }
    #view-dashboard .chat-box { max-height:300px; min-height:170px; }
    #view-dashboard .chat-input-area { position:sticky; bottom:0; padding-top:10px; background:#fff; }
    #view-dashboard .chat-input-area .field { min-height:46px; }
    #view-dashboard .chat-input-area .icon-btn { width:44px; min-width:44px; min-height:44px; }
    #view-dashboard .activity-panel { margin-top:12px; }
    #view-dashboard .activity-row { min-height:54px; padding:9px; }
    #dashboard-tasks .task-item:nth-child(n+5) { display:none; }

    #view-tasks .page-title-row { align-items:center; margin-bottom:12px; }
    #view-tasks .page-title-row .eyebrow,#view-tasks .section-description { display:none; }
    #view-tasks .page-title-row h2 { font-size:22px; }
    #view-tasks .page-title-row > .btn { display:none; }
    .task-mobile-toolbar { position:sticky; top:0; z-index:24; display:grid; grid-template-columns:minmax(0,1fr) 46px 46px; gap:8px; margin:0 0 12px; padding:7px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.96); box-shadow:0 8px 24px rgba(22,32,26,.08); backdrop-filter:blur(12px); }
    .task-mobile-toolbar button { min-height:46px; display:flex; align-items:center; justify-content:center; gap:8px; border:0; border-radius:10px; background:var(--surface-soft); color:var(--text); }
    .task-mobile-toolbar .task-mobile-filter { justify-content:flex-start; padding:0 12px; color:var(--muted); }
    .task-mobile-toolbar button.primary { background:var(--accent); color:#fff; }
    .task-mobile-toolbar svg { width:18px; height:18px; }
    .task-mobile-filter strong { min-width:20px; height:20px; display:grid; place-items:center; margin-left:auto; border-radius:999px; background:var(--accent); color:#fff; font-size:11px; }
    .task-mobile-filter strong[hidden] { display:none; }
    #view-tasks .plane-toolbar { display:none; position:fixed; inset:auto 0 0; z-index:402; max-height:88dvh; overflow-y:auto; margin:0; padding:10px 14px calc(18px + env(safe-area-inset-bottom)); border:0; border-radius:20px 20px 0 0; background:#fff; box-shadow:0 -20px 60px rgba(12,24,18,.24); }
    #view-tasks[data-mobile-filters] .plane-toolbar { display:grid; gap:10px; }
    .task-mobile-sheet-head { display:flex; align-items:center; justify-content:space-between; min-height:48px; }
    .task-mobile-sheet-head > div { display:grid; gap:6px; }
    .task-mobile-sheet-head > div > span { width:44px; height:4px; border-radius:999px; background:var(--line-strong); }
    .task-mobile-sheet-head strong { font-size:16px; }
    #view-tasks .plane-toolbar-left { display:grid; grid-template-columns:1fr; gap:9px; }
    #view-tasks .plane-toolbar .filter-control,#view-tasks .plane-toolbar .btn { width:100%; min-height:48px; font-size:15px; }
    #view-tasks .plane-toolbar-right { display:grid; gap:9px; }
    #view-tasks .plane-toolbar-right .plane-dropdown-btn { min-height:48px; }
    #view-tasks .view-toggle-group { min-height:48px; }
    #view-tasks .view-toggle-btn { min-height:46px; }
    #view-tasks .view-toggle-btn span { display:inline; }
    .task-mobile-scrim { display:none; }
    #view-tasks[data-mobile-filters] .task-mobile-scrim { display:block; position:fixed; inset:0; z-index:401; border:0; background:rgba(15,23,20,.46); }
    #view-tasks .kanban-board,#view-tasks .kanban-board.grouped-priority,#view-tasks .kanban-board.grouped-project,#view-tasks .kanban-board.grouped-tag { grid-auto-columns:calc(100vw - 28px); gap:10px; margin:0 -14px; padding:0 14px 6px; scroll-snap-type:x mandatory; }
    #view-tasks .kanban-column { min-height:calc(100dvh - 245px); max-height:none; padding:9px; border-radius:14px; scroll-snap-align:center; }
    #view-tasks .kanban-column-header { position:sticky; top:0; z-index:2; background:#f1f3f6; }
    #view-tasks .task-item { min-height:94px; padding:12px 10px; border-radius:12px; box-shadow:none; -webkit-tap-highlight-color:transparent; }
    #view-tasks .task-item:hover { transform:none; box-shadow:none; }
    #view-tasks .task-drag-handle { display:none; }
    #view-tasks .task-select-checkbox { width:22px; height:22px; }
    #view-tasks .checkbox-circle { width:26px; height:26px; }
    #view-tasks .task-title { font-size:15px; line-height:1.35; }
    #view-tasks .task-meta { gap:6px; overflow-x:auto; scrollbar-width:none; }
    #view-tasks .task-card-footer { margin-top:9px; gap:6px; }
    #view-tasks .task-card-footer .icon-btn { width:40px; min-width:40px; min-height:40px; }
    #view-tasks .row-actions-popover { position:fixed; left:12px; right:12px; bottom:calc(82px + env(safe-area-inset-bottom)); width:auto; }
    .task-mobile-list { display:grid; gap:9px; }
    #view-tasks .bulk-action-bar:not(:empty) { position:sticky; top:70px; z-index:20; overflow-x:auto; flex-wrap:nowrap; }
}

@media (pointer:coarse) {
    .dashboard-mobile-actions button,.task-mobile-toolbar button,#view-tasks .task-status-chip { min-height:44px; }
    #view-tasks .task-item { user-select:none; }
}
