:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232733;
  --surface3: #2a3040;
  --border: #2e3345;
  --text: #e4e6ed;
  --text2: #9ca0b0;
  --accent: #6c8cff;
  --accent2: #4a6adf;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --orange: #fb923c;
  --item-bg: rgba(35,39,51,.65);
  --comment-bg: #2c3344;
  --comment-input-bg: #343c4f;
  --shadow: rgba(0,0,0,.35);
  --radius: 10px;
}

:root[data-theme="light"] {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface2: #f1f4f9;
  --surface3: #e8edf6;
  --border: #dce3ee;
  --text: #111827;
  --text2: #5f6b7a;
  --accent: #315efb;
  --accent2: #2548c9;
  --green: #047857;
  --yellow: #a16207;
  --red: #dc2626;
  --orange: #c2410c;
  --item-bg: #f8fafc;
  --comment-bg: #ffffff;
  --comment-input-bg: #ffffff;
  --shadow: rgba(15,23,42,.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 58%, var(--surface3)) var(--surface2); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--surface2); border-radius: 999px; }
*::-webkit-scrollbar-thumb { min-height: 42px; border: 2px solid var(--surface2); border-radius: 999px; background: linear-gradient(180deg, var(--accent), var(--accent2)); }
*::-webkit-scrollbar-thumb:hover { background: var(--accent); }
*::-webkit-scrollbar-corner { background: transparent; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
body.auth-pending .app { display: none; }
.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 0; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar-logo { padding: 0 20px 20px; font-size: 18px; font-weight: 800; color: var(--accent); border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.sidebar-nav { flex: 1; }
.sidebar-nav a { display: block; padding: 11px 20px; color: var(--text2); font-size: 14px; cursor: pointer; transition: all .15s; }
.sidebar-nav a.is-hidden, .settings-button.is-hidden { display: none; }
.sidebar-nav a:hover, .sidebar-nav a.active { color: var(--text); background: var(--surface2); }
.sidebar-nav a.active { border-right: 3px solid var(--accent); color: var(--accent); }
.mobile-menu-toggle { display: none; }
.settings-button { margin: 12px 14px 0; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); cursor: pointer; text-align: left; font-size: 13px; }
.settings-button:hover { border-color: var(--accent); color: var(--accent); }
.main { flex: 1; overflow-y: auto; padding: 28px; }

.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.notifications-widget { position: relative; display: inline-flex; z-index: 20; }
.notification-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 35px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface2); color: var(--text); cursor: pointer; font-size: 15px; line-height: 1; transition: all .15s; }
.notification-bell:hover { border-color: var(--accent); color: var(--accent); }
.notification-bell svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.notification-bell span { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; line-height: 18px; font-weight: 800; }
.notifications-panel { display: none; position: absolute; top: 50px; right: 0; width: min(380px, calc(100vw - 32px)); max-height: 520px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 18px 48px var(--shadow); overflow: hidden; }
.notifications-panel.open { display: block; }
.notifications-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.notifications-head > div { display: flex; gap: 6px; }
.notifications-list { max-height: 450px; overflow-y: auto; padding: 8px; }
.notification-item { width: 100%; display: grid; gap: 4px; margin-bottom: 8px; padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--item-bg); color: var(--text); text-align: left; cursor: pointer; }
.notification-item:hover { border-color: var(--accent); }
.notification-item.unread { border-color: rgba(108,140,255,.55); background: rgba(108,140,255,.12); }
.notification-item span { color: var(--text2); font-size: 12px; }
.notification-item small { color: var(--text2); font-size: 11px; }

.user-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; color: var(--text2); font-size: 11px; font-weight: 500; line-height: 1.4; }
.user-chip button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; }
.auth-screen { position: fixed; inset: 0; z-index: 1000; display: none; overflow-y: auto; padding: 28px; background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 43%, #f7fbf8 100%); color: #111827; }
.auth-screen.open { display: block; }
.landing-page { width: min(1180px, 100%); min-height: calc(100vh - 56px); margin: 0 auto; display: flex; flex-direction: column; gap: 34px; }
.landing-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 6px 2px; }
.landing-header span { color: #64748b; font-size: 13px; font-weight: 700; }
.landing-logo { font-size: 20px; font-weight: 900; letter-spacing: -.03em; color: #2457e6; }
.landing-hero { flex: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 420px); gap: 42px; align-items: center; }
.landing-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.landing-badge { display: inline-flex; padding: 8px 12px; border: 1px solid #c7d7fe; border-radius: 999px; background: #eef4ff; color: #2457e6; font-size: 12px; font-weight: 800; }
.landing-copy h1 { max-width: 790px; color: #111827; font-size: clamp(36px, 5vw, 62px); line-height: 1.05; letter-spacing: -.05em; }
.landing-lead { max-width: 690px; color: #475569; font-size: 18px; line-height: 1.7; }
.landing-points { display: grid; gap: 10px; max-width: 720px; list-style: none; }
.landing-points li { position: relative; padding-left: 28px; color: #334155; font-size: 15px; line-height: 1.55; }
.landing-points li::before { content: '✓'; position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #dcfce7; color: #047857; font-size: 12px; font-weight: 900; }
.landing-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 4px 0 18px; }
.landing-features article { min-height: 178px; display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 18px; align-items: flex-start; padding: 24px; border: 1px solid #dbe5f2; border-radius: 24px; background: rgba(255,255,255,.9); box-shadow: 0 18px 46px rgba(15,23,42,.08); }
.landing-feature-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: linear-gradient(135deg, #2457e6, #6c8cff); color: #fff; font-size: 23px; font-weight: 900; box-shadow: 0 14px 30px rgba(36,87,230,.24); }
.landing-features strong { display: block; margin-bottom: 10px; color: #111827; font-size: 20px; line-height: 1.18; letter-spacing: -.02em; }
.landing-features span { display: block; max-width: 440px; color: #526174; font-size: 14px; line-height: 1.65; }
.auth-card { width: min(420px, 100%); justify-self: end; background: #ffffff; border: 1px solid #dbe5f2; border-radius: 22px; padding: 30px; box-shadow: 0 24px 70px rgba(15,23,42,.14); }
.auth-card .sidebar-logo { padding: 0 0 14px; border: 0; margin: 0; }
.auth-card h1 { color: #111827; font-size: 26px; margin-bottom: 6px; }
.auth-card .muted { color: #64748b; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.auth-card .form-group label { color: #475569; }
.auth-card input, .auth-card textarea, .auth-card select { background: #f8fafc; border-color: #cbd5e1; color: #111827; }
.auth-card input:focus { outline: 2px solid rgba(36,87,230,.16); border-color: #2457e6; }

.page-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.page-header > div { min-width: 0; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-subtitle, .muted { color: var(--text2); font-size: 12px; margin-top: 4px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: border-color .15s, transform .15s; box-shadow: 0 10px 26px var(--shadow); }
.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-card .label { font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.stat-card .value { font-size: 30px; font-weight: 800; }
.stat-card.danger .value { color: var(--red); }
.stat-card.warning .value { color: var(--yellow); }
.stat-card.info .value { color: var(--accent); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr); gap: 20px; }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; box-shadow: 0 10px 26px var(--shadow); }
.section-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.section-header h2 { font-size: 16px; }
.section-body { padding: 16px 20px; }
.eyebrow { display: inline-flex; margin-bottom: 7px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.btn { padding: 8px 14px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: 13px; cursor: pointer; transition: all .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:hover, .btn.active { border-color: var(--accent); color: var(--accent); }
.btn:disabled:hover { border-color: var(--border); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn-danger:hover { background: var(--red); color: #fff; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1.3fr) repeat(5, minmax(130px, 1fr)) auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.toolbar.compact { grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); justify-content: start; }
.task-toolbar { grid-template-columns: minmax(220px, 1.3fr) repeat(6, minmax(112px, 1fr)) auto; }
.task-toolbar .view-toggle { justify-self: end; white-space: nowrap; }
.toolbar input, .toolbar select, .form-group input, .form-group select, .form-group textarea, .auth-2fa-setup input, .auth-2fa-setup textarea { width: 100%; padding: 9px 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); font-size: 13px; }
.toolbar-search { min-width: 220px; }
.view-toggle { display: flex; gap: 6px; justify-content: flex-end; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.filter-chip { border: 1px solid rgba(108,140,255,.45); background: rgba(108,140,255,.12); color: var(--text); border-radius: 999px; padding: 6px 10px; cursor: pointer; font-size: 12px; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(338px, 416px); grid-template-rows: minmax(0, 1fr); gap: 12px; min-height: 420px; max-height: calc(100vh - 260px); overflow-x: auto; overflow-y: hidden; padding-bottom: 10px; align-items: stretch; }
.kanban-col { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; transition: border-color .15s, background .15s; }
.kanban-col.drag-over { border-color: var(--accent); background: rgba(108,140,255,.10); }
.kanban-col-header { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; color: var(--text2); font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.kanban-col-cards { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 3px; }
.count { background: var(--border); border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 12px; margin-bottom: 9px; cursor: grab; transition: border-color .15s, transform .15s, opacity .15s; }
.kanban-col-cards > :last-child { margin-bottom: 0; }
.kanban-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.kanban-card.dragging { opacity: .55; cursor: grabbing; }
.kanban-card .title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.kanban-card .meta { color: var(--text2); font-size: 11px; display: flex; gap: 8px; }
.kanban-card .meta.stacked { flex-direction: column; gap: 3px; }
.card-footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.empty-col { color: var(--text2); font-size: 12px; padding: 18px 8px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.priority-low { background: var(--green); }
.priority-normal { background: var(--accent); }
.priority-high { background: var(--orange); }
.priority-critical { background: var(--red); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 11px 12px; color: var(--text2); font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr { cursor: pointer; }
tr:hover td { background: var(--surface2); }
tr.row-danger td { background: rgba(248,113,113,.06); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--text2); background: rgba(156,160,176,.13); white-space: nowrap; }
.badge-active, .badge-low { background: rgba(52,211,153,.15); color: var(--green); }
.badge-completed, .badge-normal { background: rgba(108,140,255,.15); color: var(--accent); }
.badge-on_hold, .badge-medium { background: rgba(251,191,36,.15); color: var(--yellow); }
.badge-high, .badge-critical { background: rgba(248,113,113,.15); color: var(--red); }

.attention-item, .load-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--item-bg); margin-bottom: 10px; cursor: pointer; }
.attention-item:hover, .load-item:hover { border-color: var(--accent); }
.attention-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.docs-header { align-items: center; }
.docs-header-with-upload { display: grid; grid-template-columns: minmax(300px, 1fr) auto; gap: 24px; align-items: center; }
.docs-title-block { min-width: 0; }
.docs-upload-actions { display: flex; align-items: end; align-self: center; flex-wrap: nowrap; gap: 12px; }
.docs-stats { display: grid; grid-template-columns: repeat(2, minmax(92px, 1fr)); gap: 10px; }
.docs-stats > div { padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 26px var(--shadow); }
.docs-stats strong { display: block; font-size: 24px; line-height: 1; }
.docs-stats span { display: block; margin-top: 5px; color: var(--text2); font-size: 11px; }
.docs-layout { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(620px, 1.35fr); gap: 18px; align-items: start; }
.docs-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--text2); font-size: 12px; }
.docs-summary span { padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.docs-summary strong { color: var(--text); }
.docs-summary .risk strong { color: var(--red); }
.docs-tabs { display: flex; width: max-content; max-width: 100%; margin: 0 0 18px; overflow-x: auto; }
.docs-workbench { display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) minmax(300px, 360px); gap: 16px; align-items: start; min-height: calc(100vh - 280px); }
.docs-library, .docs-actions-panel { position: sticky; top: 16px; display: grid; gap: 14px; max-height: calc(100vh - 130px); overflow: auto; }
.docs-document { min-width: 0; }
.docs-document > .doc-analysis-result { display: grid; gap: 14px; }
.package-select-all { display: inline-flex; align-items: center; justify-self: start; gap: 8px; color: var(--text2); font-size: 13px; cursor: pointer; }
.docs-search .package-select-all input { width: auto; margin: 0; padding: 0; }
.package-document-list { display: grid; gap: 8px; }
.package-document { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--item-bg); cursor: pointer; }
.package-document:hover { border-color: var(--accent); }
.package-document input { margin-top: 3px; }
.package-document span { display: grid; gap: 3px; min-width: 0; }
.package-document strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.package-document small { color: var(--text2); font-size: 11px; }
.docs-upload-inline { display: flex; flex-wrap: nowrap; align-items: end; justify-content: flex-end; gap: 8px; }
.docs-upload-title { display: none; }
.docs-upload-grid { display: flex; flex-wrap: nowrap; align-items: end; justify-content: flex-end; gap: 12px; padding: 0; }
.docs-upload-grid .form-group { display: grid; grid-template-rows: 13px 35px; gap: 4px; align-items: end; width: 170px; margin-bottom: 0; }
.docs-upload-grid .form-group:nth-child(2) { width: 180px; }
.docs-upload-grid .form-group:nth-child(3) { width: 185px; }
.docs-upload-grid .form-group > label:first-child { display: flex; align-items: flex-end; height: 13px; margin: 0; color: var(--text2); font-size: 10px; line-height: 1; }
.docs-upload-grid select { display: block; height: 35px; min-height: 35px; margin: 0; padding: 7px 10px; line-height: 19px; }
.docs-upload-grid .btn { align-self: end; height: 35px; margin: 0; padding: 8px 12px; line-height: 19px; }
.docs-upload-grid .file-picker { display: flex; align-items: center; width: 100%; min-height: 35px; height: 35px; margin: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface2); color: var(--text); font-size: 13px; font-weight: 700; line-height: 19px; cursor: pointer; }
.file-picker input { display: none; }
.file-picker:hover { border-color: var(--accent); background: rgba(108,140,255,.20); }
.docs-compact-panel { border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.docs-compact-panel summary { padding: 11px 12px; color: var(--text); font-weight: 700; cursor: pointer; list-style: none; }
.docs-compact-panel summary::-webkit-details-marker { display: none; }
.docs-compact-panel[open] { padding-bottom: 12px; }
.docs-compact-panel .docs-index-body { padding: 0 12px; }
.docs-index-card .section-header { align-items: flex-start; gap: 14px; }
.docs-index-card .section-header p { max-width: 760px; }
.docs-index-body { display: grid; gap: 16px; }
.doc-local-agent-note { display: grid; gap: 5px; padding: 14px 16px; border: 1px solid rgba(108,140,255,.32); border-radius: 14px; background: linear-gradient(135deg, rgba(108,140,255,.14), rgba(52,211,153,.08)); }
.doc-local-agent-note strong { color: var(--text); font-size: 14px; }
.doc-local-agent-note span { color: var(--text2); font-size: 12px; line-height: 1.55; }
.docs-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.docs-form-grid .form-group { margin-bottom: 0; }
.docs-form-grid select[multiple] { min-height: 132px; }
.docs-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.docs-side { position: sticky; top: 18px; }
.docs-search { display: grid; gap: 10px; }
.docs-search input, .docs-search select { width: 100%; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-size: 13px; }
.docs-list { display: grid; gap: 12px; }
.doc-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--item-bg); transition: border-color .15s, transform .15s, background .15s; }
.doc-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.doc-card.compact { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 11px; }
.doc-card.compact .doc-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 11px; }
.doc-card.compact .doc-icon-stack { width: 40px; }
.doc-card.compact p { display: none; }
.doc-card.compact .doc-card-head { margin-bottom: 4px; }
.doc-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.doc-settings-btn { min-width: 34px; padding: 7px 9px; }
.doc-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: rgba(108,140,255,.14); color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .03em; }
.doc-icon-stack { display: grid; justify-items: center; gap: 6px; }
.doc-delete-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(248,113,113,.35); border-radius: 9px; background: rgba(248,113,113,.10); color: var(--red); cursor: pointer; font-size: 14px; line-height: 1; }
.doc-delete-icon:hover { border-color: var(--red); background: rgba(248,113,113,.18); }
.doc-main { min-width: 0; }
.doc-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.doc-card-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.doc-meta { overflow: hidden; color: var(--text2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.doc-card p { margin-top: 9px; color: var(--text2); font-size: 13px; line-height: 1.5; }
.doc-card-actions { display: flex; justify-content: flex-end; }
.doc-ai-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-ai-tools.vertical { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: stretch; margin-top: 12px; }
.doc-ai-tools.vertical .btn { justify-content: flex-start; width: 100%; }
.doc-custom-action { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 6px; }
.doc-custom-action .danger-mini { justify-content: center; padding: 7px 0; color: var(--red); }
.doc-question-box { display: grid; gap: 8px; margin-top: 12px; }
.doc-question-box label { color: var(--text2); font-size: 12px; }
.doc-question-box textarea { width: 100%; min-height: 92px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); color: var(--text); resize: vertical; }
.doc-chat-hint { display: grid; gap: 4px; margin-top: 12px; padding: 12px; border: 1px solid rgba(108,140,255,.30); border-radius: 12px; background: linear-gradient(135deg, rgba(108,140,255,.12), rgba(52,211,153,.07)); }
.doc-chat-hint strong { font-size: 13px; }
.doc-chat-hint span { color: var(--text2); font-size: 11px; line-height: 1.35; }
.doc-workspace { position: relative; display: grid; gap: 12px; }
.doc-object-head { display: flex; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(135deg, var(--surface2), rgba(108,140,255,.08)); }
.doc-object-head h3 { max-width: 100%; margin: 2px 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; line-height: 1.25; }
.doc-object-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.kanban-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text2); font-size: 11px; cursor: pointer; }
.kanban-tag:hover { border-color: var(--accent); color: var(--accent); }
.kanban-tag strong { color: var(--text); }
.doc-head-actions { display: flex; align-items: flex-start; gap: 8px; }
.doc-icon-action { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(108,140,255,.45); border-radius: 12px; background: rgba(108,140,255,.14); color: var(--accent); cursor: pointer; }
.doc-icon-action:hover { border-color: var(--accent); background: rgba(108,140,255,.22); }
.doc-icon-action svg, .doc-editor-topbar svg, .doc-selection-menu svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.doc-editor-shell { min-height: 0; border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: #eef2f7; box-shadow: 0 18px 46px rgba(0,0,0,.24); }
.doc-editor-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid #d7dce6; background: #f8fafc; color: #111827; }
.doc-editor-topbar div { display: grid; gap: 2px; }
.doc-editor-topbar span { color: #667085; font-size: 12px; }
.doc-editor-topbar .btn { display: inline-flex; align-items: center; gap: 7px; }
.doc-editor-shell .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid #d7dce6; background: #fff; }
.doc-editor-shell .ql-container.ql-snow { border: 0; color: #111827; font-family: Georgia, 'Times New Roman', serif; font-size: 15px; }
.doc-editor-shell .ql-editor { min-height: 68vh; max-height: calc(100vh - 360px); overflow: auto; margin: 22px auto; max-width: 900px; padding: 42px 54px; border: 1px solid #e5e7eb; border-radius: 4px; background: #fff; box-shadow: 0 10px 30px rgba(15,23,42,.10); line-height: 1.7; }
.doc-editor-shell .ql-editor h1, .doc-editor-shell .ql-editor h2, .doc-editor-shell .ql-editor h3 { font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.doc-editor-shell .ql-picker, .doc-editor-shell .ql-stroke { color: #111827; stroke: #111827; }
.doc-editor-shell .ql-fill { fill: #111827; }
.doc-selection-menu { position: fixed; z-index: 10000; display: none; min-width: 238px; padding: 7px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 44px rgba(0,0,0,.38); }
.doc-selection-menu.open { display: grid; gap: 4px; }
.doc-selection-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.doc-selection-menu button:hover { background: var(--surface2); color: var(--accent); }
.doc-analysis-button-editor { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.doc-analysis-button-editor textarea { min-height: 92px; resize: vertical; }
.doc-full-text { max-height: 46vh; overflow: auto; white-space: pre-wrap; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface2); color: var(--text); font-family: inherit; line-height: 1.6; }
.doc-full-text.compact { max-height: 46vh; }
.docs-empty { display: grid; gap: 6px; padding: 34px 20px; }
.docs-empty strong { color: var(--text); font-size: 15px; }
.docs-empty span { color: var(--text2); font-size: 13px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(108,140,255,.18); color: var(--accent); font-weight: 800; }
.load-item { justify-content: flex-start; }
.load-main { display: flex; flex-direction: column; flex: 1; }
.load-main span { color: var(--text2); font-size: 12px; }
.empty { text-align: center; padding: 40px; color: var(--text2); font-size: 14px; }
.empty .btn { margin-top: 14px; }
.empty.compact { padding: 18px; }
.settings-section.compact { margin-top: 16px; padding: 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); }
.auth-2fa-setup { display: grid; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.auth-2fa-setup label { display: grid; gap: 6px; color: var(--text2); font-size: 12px; }
.auth-2fa-setup textarea { min-height: 70px; resize: vertical; }
.totp-qr { width: 180px; height: 180px; padding: 10px; background: #fff; border-radius: 12px; justify-self: start; }

.modal-overlay { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 220px; background: rgba(0,0,0,.50); z-index: 1000; justify-content: flex-start; align-items: stretch; opacity: 0; animation: overlayFadeIn .22s ease forwards; }
.modal-overlay.open { display: flex; }
.drawer { width: min(calc(100vw - 220px), 1100px); height: 100vh; max-height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; box-shadow: 18px 0 44px var(--shadow); transform-origin: left center; animation: drawerSlideIn .32s cubic-bezier(.16,1,.3,1) forwards; will-change: transform, opacity; }
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawerSlideIn { from { transform: translateX(-28px) scale(.985); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }
.drawer-header { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; min-height: 62px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.drawer-header h3 { font-size: 19px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-body.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 22px; }
.task-drawer { width: min(calc(100vw - 220px), 1280px); }
.drawer-body.task-card-layout { grid-template-columns: minmax(0, 1fr) 540px; grid-template-rows: minmax(0, 1fr) auto; gap: 18px; background: var(--surface2); overflow-y: auto; overflow-x: hidden; }
.task-main-column { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.task-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.task-meta-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: start; }
.task-section { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 26px rgba(0,0,0,.08); }
.task-section h4 { margin-bottom: 13px; font-size: 14px; color: var(--text); }
.task-section .form-group:last-child { margin-bottom: 0; }
.task-section-primary textarea { min-height: 135px; }
.compact-grid { gap: 12px; }
.task-links-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.task-team-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.task-team-grid .form-group:has(#task-coexecutors) { grid-column: span 1; }
.task-team-grid select[multiple] { min-height: 38px; max-height: 92px; }
.finance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.finance-grid .task-check { grid-column: 1 / -1; }
.task-check { width: fit-content; min-height: 0; margin-top: 2px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.task-check.disabled { opacity: .58; cursor: not-allowed; }
.task-side { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 14px; min-height: 0; height: 100%; overflow: hidden; }
.task-side-card { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 26px rgba(0,0,0,.08); }
.task-reminder-card { display: grid; gap: 10px; }
.task-local-actions { grid-column: 1; grid-row: 2; position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; margin: 0; padding: 14px 16px; border-top: 1px solid var(--border); border-radius: 0 0 14px 14px; background: var(--surface); box-shadow: 0 -12px 28px rgba(0,0,0,.10); }
.task-progress-actions, .task-save-actions { display: flex; justify-content: flex-end; gap: 8px; min-width: 0; }
.task-progress-actions:empty { display: none; }
#task-modal.view-mode .task-section input:disabled, #task-modal.view-mode .task-section select:disabled, #task-modal.view-mode .task-section textarea:disabled { opacity: 1; color: var(--text); cursor: default; }
.drawer-footer { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; color: var(--text2); font-size: 12px; margin-bottom: 5px; }
.form-group textarea { min-height: 170px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group.wide { grid-column: 1 / -1; }
.drawer-side { border: 1px solid var(--border); background: var(--surface2); border-radius: var(--radius); padding: 16px; align-self: start; }
.drawer-side h4 { margin-bottom: 12px; }
.context-box { display: flex; flex-direction: column; gap: 8px; color: var(--text2); font-size: 13px; }
.task-context-badges, .task-context-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-context-pills span { padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface2); color: var(--text2); line-height: 1.25; }
.task-context-hours span { background: rgba(37, 99, 235, .08); color: var(--text); }
.effort-tabs { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 12px; }
.effort-tab { box-sizing: border-box; display: grid !important; gap: 3px; min-width: 0; min-height: 64px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface2); color: var(--text); text-align: left; cursor: pointer; user-select: none; transition: transform .15s, border-color .15s, box-shadow .15s; }
.effort-tab:hover { transform: translateY(-1px); }
.effort-tab strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 1.2; }
.effort-tab span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); font-size: 11px; line-height: 1.25; }
.effort-tab.stat.active { border-color: rgba(217,119,6,.6); box-shadow: 0 8px 22px rgba(217,119,6,.16); background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.06)); }
.effort-tab.ai.active { border-color: rgba(37,99,235,.6); box-shadow: 0 8px 22px rgba(37,99,235,.16); background: linear-gradient(135deg, rgba(37,99,235,.18), rgba(37,99,235,.06)); }
.effort-assessment-card { box-sizing: border-box; width: 100%; margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface2); font-size: 12px; overflow: hidden; }
.effort-assessment-card-stat { border-color: rgba(245, 158, 11, .46); background: linear-gradient(180deg, rgba(245, 158, 11, .12), rgba(245, 158, 11, .04)); }
.effort-assessment-card-ai { border-color: rgba(37, 99, 235, .42); background: linear-gradient(180deg, rgba(37, 99, 235, .13), rgba(37, 99, 235, .04)); }
.effort-assessment-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.effort-kicker { display: block; margin-bottom: 4px; color: var(--text2); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.effort-assessment-head h5 { margin: 0; color: var(--text); font-size: 22px; line-height: 1.1; word-break: break-word; }
.effort-date { color: var(--text2); font-size: 11px; white-space: nowrap; }
.effort-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.effort-metrics span { display: grid; gap: 2px; min-width: 0; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.55); }
.effort-metrics b { color: var(--text); font-size: 15px; }
.effort-metrics small { color: var(--text2); font-size: 11px; }
.effort-source-note, .effort-data-warning { margin: 8px 0; padding: 9px 10px; border-radius: 10px; color: var(--text); line-height: 1.35; }
.effort-source-note { background: rgba(255,255,255,.55); }
.effort-data-warning { border: 1px solid rgba(217,119,6,.35); background: rgba(245,158,11,.14); font-weight: 700; }
.effort-summary { margin: 10px 0 0; color: var(--text2); line-height: 1.45; }
.subhead { margin: 6px 0 12px; font-size: 14px; color: var(--text); }
.subhead-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; }
.subhead-row .subhead { margin: 0; }
.responsibles-list { display: grid; gap: 12px; }
.responsible-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.responsible-row .form-group { margin-bottom: 0; }
.check-row { display: flex; gap: 8px; align-items: center; color: var(--text2); font-size: 12px; }
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.client-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, transform .15s; }
.client-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.client-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.client-contact, .client-responsibles { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; color: var(--text2); font-size: 12px; }
.client-responsibles span { padding: 6px 8px; border-radius: 8px; background: var(--surface2); color: var(--text); }
.client-projects { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 12px; }
.client-projects button, .metric-link { display: inline-flex; width: fit-content; padding: 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; font-weight: 700; }
.client-projects button:hover, .metric-link:hover { text-decoration: underline; }
.metric-link.danger { color: var(--red); }
.progress { height: 5px; width: 90px; margin-top: 6px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.project-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.metric-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); color: var(--text); cursor: pointer; }
.metric-card:hover { border-color: var(--accent); }
.metric-card.danger { border-color: rgba(248,113,113,.45); }
.metric-card span { color: var(--text2); font-size: 12px; }
.cost-rates { display: grid; gap: 12px; margin-top: 16px; }
.cost-rate-row { display: grid; grid-template-columns: minmax(180px, 1fr) 160px 160px auto; gap: 12px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.cost-rate-row label { display: flex; flex-direction: column; gap: 5px; color: var(--text2); font-size: 12px; }
.cost-rate-row input { padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.work-allocations { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.work-allocation-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.work-allocation-card summary { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 10px; align-items: center; padding: 10px 12px; color: var(--text2); font-size: 12px; cursor: pointer; list-style: none; }
.work-allocation-card summary::-webkit-details-marker { display: none; }
.work-allocation-card summary span { font-weight: 700; color: var(--text); }
.work-allocation-card summary span::before { content: '▸'; display: inline-block; margin-right: 7px; color: var(--text2); transition: transform .15s; }
.work-allocation-card[open] summary span::before { transform: rotate(90deg); }
.work-allocation-card input { padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.work-time-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px 12px 30px; }
.work-time-range label { display: grid; gap: 5px; color: var(--text2); font-size: 12px; }

.settings-drawer { width: min(85vw, 980px); }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
.settings-nav { border-right: 1px solid var(--border); padding-right: 14px; }
.settings-nav button { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text2); cursor: pointer; }
.settings-nav button:hover, .settings-nav button.active { background: var(--surface2); border-color: var(--border); color: var(--accent); }
.settings-section h4 { font-size: 18px; margin-bottom: 6px; }
.setting-row, .provider-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.provider-card { align-items: flex-start; flex-direction: column; }
.prompt-preview { margin-top: 8px; max-height: 72px; overflow: hidden; white-space: pre-wrap; }
.segmented { display: flex; gap: 8px; flex-shrink: 0; }

.chat-panel { position: fixed; right: 20px; bottom: 20px; width: min(620px, calc(100vw - 40px)); height: min(680px, calc(100vh - 80px)); min-height: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; display: none; flex-direction: column; z-index: 1200; box-shadow: 0 24px 80px var(--shadow); overflow: hidden; }
.chat-panel.open { display: flex; }
.chat-header, .chat-input { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-body { position: relative; flex: 1; min-height: 0; display: block; }
.chat-history { position: absolute; inset: 0 auto 0 0; z-index: 3; width: 220px; transform: translateX(-100%); transition: transform .18s ease; border-right: 1px solid var(--border); background: var(--surface2); overflow-y: auto; padding: 10px; }
.chat-panel.history-open .chat-history { transform: translateX(0); }
.chat-history-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 2px 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.chat-history-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px; gap: 4px; align-items: stretch; margin-bottom: 8px; border: 1px solid transparent; border-radius: 9px; }
.chat-history-row:hover, .chat-history-row.active { border-color: var(--accent); background: rgba(108,140,255,.12); }
.chat-history-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; min-width: 0; }
.chat-history-delete { display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text2); cursor: pointer; }
.chat-history-delete:hover { color: var(--red); background: rgba(248,113,113,.10); }
.chat-history-delete svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-history-item strong { display: block; font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history-item span, .chat-history-empty { display: block; margin-top: 4px; color: var(--text2); font-size: 11px; }
.chat-main { min-width: 0; height: 100%; min-height: 0; display: flex; flex-direction: column; }
.chat-context { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.chat-context.compact { display: grid; gap: 6px; padding: 10px 14px; background: var(--surface2); }
.chat-context-row { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 8px; align-items: center; }
.chat-context select, .chat-context input { width: 100%; min-width: 0; padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.chat-context-results { margin-top: 8px; display: grid; gap: 6px; max-height: 116px; overflow-y: auto; }
.context-result { width: 100%; min-width: 0; display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface2); color: var(--text); cursor: pointer; }
.context-result:hover { border-color: var(--accent); background: rgba(79,124,255,.10); }
.context-result strong, .context-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-result span { color: var(--text2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-context-selected { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.context-chip { max-width: 100%; min-width: 0; display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface2); font-size: 12px; }
.context-chip strong { flex: 0 0 auto; font-size: 11px; }
.context-chip button { flex: 0 0 auto; width: 16px; height: 16px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text2); cursor: pointer; }
.context-chip button:hover { background: rgba(248,113,113,.12); color: var(--red); }
.chat-context-hint { margin-top: 6px; color: var(--text2); font-size: 11px; line-height: 1.35; }
.chat-memory-panel { display: none; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-memory-panel.open { display: block; }
.memory-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.memory-card-head, .memory-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.memory-card-head span, .memory-field > span { display: block; color: var(--text2); font-size: 11px; margin-top: 2px; }
.memory-field { display: flex; flex-direction: column; gap: 6px; }
.memory-card select, .memory-card textarea { width: 100%; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.memory-card textarea { min-height: 72px; resize: vertical; }
.memory-scope-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; }
.memory-scope { display: grid; grid-template-columns: auto 1fr; gap: 2px 7px; align-items: start; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; }
.memory-scope:hover { border-color: var(--accent); }
.memory-scope input { margin-top: 3px; }
.memory-scope strong { font-size: 12px; font-weight: 700; }
.memory-scope small { grid-column: 2; color: var(--text2); font-size: 10px; line-height: 1.25; }
.chat-msg-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 4px; opacity: .62; transition: opacity .15s; }
.chat-msg:hover .chat-msg-actions { opacity: 1; }
.chat-icon-btn { width: 24px; height: 24px; display: inline-grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--text2); cursor: pointer; }
.chat-icon-btn:hover { background: var(--surface2); color: var(--accent); }
.chat-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-toggle.documents-context::after { content: '📄'; margin-left: 4px; }
.chat-icon-btn.memory svg path:first-child { fill: currentColor; opacity: .18; }
.chat-input { border-top: 1px solid var(--border); border-bottom: none; }
.chat-input input { flex: 1; padding: 9px 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.chat-msg { margin-bottom: 10px; font-size: 13px; line-height: 1.5; }
.chat-msg.user { text-align: right; }
.chat-msg-content { display: inline-block; max-width: 85%; text-align: left; vertical-align: top; }
.chat-msg.user .chat-msg-content { text-align: left; }
.bubble { display: block; padding: 8px 12px; border-radius: 10px; background: var(--surface2); }
.bubble.fallback { border: 1px solid rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.fallback-label { margin-bottom: 6px; color: var(--yellow); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.chat-msg.user .bubble { background: var(--accent); color: #fff; }
.chat-toggle { position: fixed; bottom: 20px; right: 20px; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; border: none; cursor: pointer; z-index: 1199; font-weight: 800; }

.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.calendar-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-header { text-align: center; color: var(--text2); font-size: 11px; padding: 6px; }
.cal-day { min-height: 82px; background: var(--surface2); border-radius: 7px; padding: 7px; font-size: 12px; }
.cal-day.other-month { opacity: .35; }
.day-num { font-weight: 700; margin-bottom: 6px; }
.cal-task { font-size: 10px; padding: 3px 5px; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-task.t-low { background: rgba(52,211,153,.2); color: var(--green); }
.cal-task.t-normal { background: rgba(108,140,255,.2); color: var(--accent); }
.cal-task.t-high { background: rgba(251,146,60,.2); color: var(--orange); }
.cal-task.t-critical { background: rgba(248,113,113,.2); color: var(--red); }

.planning-page { display: grid; gap: 16px; }
.planning-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.planning-hero h1 { font-size: 28px; margin-bottom: 4px; }
.planning-hero p { color: var(--text2); }
.planning-tabs { align-items: center; }
.planning-tabs .active { background: var(--accent); color: #fff; border-color: var(--accent); }
.planning-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 28px var(--shadow); }
.planning-search { min-width: 260px; flex: 1 1 280px; }
.planning-period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.planning-period label, .planning-scale { display: flex; align-items: center; gap: 6px; color: var(--text2); font-size: 12px; }
.planning-filter input, .planning-filter select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); }
.planning-filter-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.planning-summary { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.planning-summary > div { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.planning-summary span { display: block; color: var(--text2); font-size: 12px; margin-bottom: 6px; }
.planning-summary strong { font-size: 22px; }
.success-text { color: var(--green); }
.planning-load-grid { display: grid; gap: 14px; }
.planning-user-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.planning-user-head { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.planning-user-head p { color: var(--text2); font-size: 12px; margin-top: 3px; }
.planning-load-meter { display: grid; gap: 6px; color: var(--text2); font-size: 12px; }
.planning-load-meter div, .planning-mini-meter { height: 7px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.planning-load-meter i, .planning-mini-meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.planning-load-meter i.over, .planning-mini-meter i.over { background: var(--red); }
.planning-buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; padding: 14px; }
.planning-cell-card { display: grid; gap: 10px; align-content: start; min-height: 150px; padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface2); }
.planning-cell-card.overload { border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.08); }
.planning-cell-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.planning-cell-top span { display: block; margin-top: 2px; color: var(--text2); font-size: 11px; }
.planning-cell-top label { color: var(--text2); font-size: 12px; white-space: nowrap; }
.planning-cell-top input { width: 64px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); }
.planning-row input, .planning-row select { width: 100%; padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); }
.planning-projects { display: grid; gap: 7px; margin-bottom: 8px; }
.planning-row { display: grid; grid-template-columns: minmax(120px, 1fr) 78px 32px; gap: 6px; align-items: center; }
.planning-row.auto { padding: 7px 8px; border: 1px dashed var(--border); border-radius: 8px; background: rgba(108,140,255,.08); }
.planning-row.auto span { min-width: 0; font-weight: 700; }
.planning-row.auto small { display: block; margin-top: 2px; color: var(--text2); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.danger-text { color: var(--red); }
.planning-calendar-panel { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.planning-calendar-nav { display: flex; gap: 8px; padding: 12px 16px 0; }
.planning-calendar { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; padding: 16px; }
.planning-month { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); padding: 12px; }
.planning-month h3 { margin-bottom: 10px; font-size: 15px; text-transform: capitalize; }
.planning-weekdays, .planning-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.planning-weekdays span { text-align: center; color: var(--text2); font-size: 10px; }
.planning-day { min-height: 64px; padding: 5px; border-radius: 7px; background: var(--surface); font-size: 11px; display: flex; flex-direction: column; gap: 2px; }
.planning-day.other { background: var(--surface2); }
.planning-day.in-range { border: 1px solid rgba(108,140,255,.18); }
.planning-day.today { border: 2px solid var(--accent); background: rgba(108,140,255,.08); }
.planning-day.weekend { background: rgba(156,160,176,.08); color: var(--text2); }
.planning-day-task { display: block; width: 100%; padding: 2px 4px; border: 0; border-radius: 4px; background: rgba(108,140,255,.14); color: var(--accent); font-size: 10px; line-height: 1.3; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.planning-day-task:hover { background: rgba(108,140,255,.28); }
.planning-day-task.overdue { background: rgba(248,113,113,.14); color: var(--red); }
.planning-day-task.overdue:hover { background: rgba(248,113,113,.28); }
.planning-day-task.review { background: rgba(251,191,36,.14); color: var(--yellow); }
.planning-day-task.review:hover { background: rgba(251,191,36,.28); }
.planning-day-project { display: block; margin-top: 2px; padding: 2px 4px; border-radius: 5px; background: rgba(108,140,255,.14); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.planning-day-more { display: block; padding: 1px 4px; color: var(--text2); font-size: 9px; }

.mail-shell { display: grid; grid-template-columns: 210px 330px minmax(0, 1fr); min-height: calc(100vh - 150px); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.mail-folders { border-right: 1px solid var(--border); background: var(--surface); padding: 10px; }
.mail-account { display: grid; gap: 8px; padding: 10px 8px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.mail-account strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mail-folder { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text2); cursor: pointer; text-align: left; }
.mail-folder:hover, .mail-folder.active { background: var(--surface2); border-color: var(--border); color: var(--accent); }
.mail-list-pane { min-width: 0; border-right: 1px solid var(--border); background: var(--surface2); display: flex; flex-direction: column; }
.mail-search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
.mail-search input { min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.mail-bulkbar { display: grid; gap: 7px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.mail-bulk-top, .mail-bulk-actions { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-width: 0; }
.mail-bulk-actions { justify-content: flex-start; }
.mail-bulkbar .check-row { margin: 0; color: var(--text2); font-size: 12px; }
.mail-list { min-height: 0; overflow-y: auto; overflow-x: hidden; display: grid; align-content: start; }
.mail-list-item { min-width: 0; box-sizing: border-box; display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 8px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.mail-list-item:hover, .mail-list-item.active { background: rgba(108,140,255,.12); }
.mail-list-item.unread strong, .mail-list-item.unread .mail-list-subject { font-weight: 800; }
.mail-list-content { min-width: 0; display: grid; gap: 4px; }
.mail-list-item strong, .mail-list-item span, .mail-list-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list-subject { color: var(--text); font-size: 13px; }
.mail-list-item small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); font-size: 11px; }
.mail-check { width: 14px; height: 14px; margin-top: 2px; accent-color: var(--accent); }
.mail-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.mail-list-item .email-project-tags { min-width: 0; }
.mail-reader { min-width: 0; display: flex; flex-direction: column; overflow: auto; background: var(--bg); }
.mail-reader-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.mail-message { padding: 18px; border-bottom: 1px solid var(--border); }
.mail-message h2 { margin-bottom: 8px; font-size: 20px; }
.mail-message-body { margin-top: 14px; padding: 14px; min-height: 220px; overflow: auto; border-radius: 10px; background: #fff; color: #111827; white-space: pre-wrap; font-family: inherit; line-height: 1.5; }
.mail-inline-reply { display: grid; gap: 10px; padding: 16px 18px 22px; }
.mail-inline-reply h3 { font-size: 16px; }
.mail-inline-reply label { display: grid; gap: 6px; color: var(--text2); font-size: 12px; }
.mail-inline-reply input, .mail-inline-reply select, .mail-inline-reply textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); }
.mail-inline-reply textarea { min-height: 220px; resize: vertical; line-height: 1.45; }
.email-reply-drawer { width: min(86vw, 860px); }
.email-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.email-form label:not(.check-row) { display: grid; gap: 6px; color: var(--text2); font-size: 12px; }
.email-form .check-row { display: inline-flex; width: fit-content; max-width: 100%; gap: 8px; align-items: center; align-self: end; padding: 9px 0; color: var(--text2); font-size: 12px; white-space: nowrap; }
.email-form .check-row input { width: auto; flex: 0 0 auto; padding: 0; }
.email-form .wide { grid-column: 1 / -1; }
.email-form input:not([type="checkbox"]), .email-form select, .email-form textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); }
.email-form textarea { min-height: 120px; resize: vertical; }
.email-form textarea.email-reply-body { min-height: 360px; line-height: 1.45; }
.email-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.email-list { display: grid; gap: 10px; max-height: 620px; overflow-y: auto; }
.email-card { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.email-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.email-project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.email-project-tag { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 8px; border: 1px solid rgba(108,140,255,.35); border-radius: 999px; background: rgba(108,140,255,.12); color: var(--accent); cursor: pointer; font-size: 12px; }
.email-project-tag:hover { border-color: var(--accent); background: rgba(108,140,255,.18); }
.email-project-tag span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.email-project-tag small { color: var(--text2); font-size: 11px; }
.email-body { max-height: 170px; overflow: auto; white-space: pre-wrap; color: var(--text); font-size: 12px; line-height: 1.45; }
.email-suggestion { margin-top: 14px; }
.email-suggestion-head { margin-bottom: 10px; }
.email-suggestion-head h3 { font-size: 15px; margin-bottom: 3px; }
.email-suggestion-list { display: grid; gap: 12px; }
.email-suggestion-card { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.email-suggestion-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.email-suggestion-card pre { max-height: 260px; overflow: auto; padding: 11px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.5; }
.email-suggestion-card .email-actions { margin-top: 10px; }

.task-comments { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.comment-list { flex: 1; min-height: 260px; overflow-y: auto; display: grid; align-content: start; gap: 10px; margin: 10px -4px 12px 0; padding-right: 4px; }
.comment-item { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.comment-item.source-email { border-color: rgba(108,140,255,.35); background: linear-gradient(0deg, rgba(108,140,255,.10), rgba(108,140,255,.10)), var(--comment-bg); }
.comment-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 7px; }
.comment-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text2); font-size: 11px; }
.comment-meta strong { color: var(--text); font-size: 12px; }
.comment-content { white-space: pre-wrap; line-height: 1.5; font-size: 13px; }
.comment-form { display: grid; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.comment-edit { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.comment-form textarea, .comment-edit textarea { width: 100%; min-height: 88px; max-height: 180px; resize: vertical; padding: 10px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); line-height: 1.45; }
.comment-form textarea:focus, .comment-edit textarea:focus { outline: none; border-color: var(--accent); }
.comment-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }

.doc-analysis-result-content { display: grid; gap: 14px; }
.doc-analysis-result-content .section { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.doc-analysis-result-content .section-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.doc-analysis-result-content .section > p { padding: 14px 16px; line-height: 1.55; color: var(--text); }
.doc-analysis-result-content .analysis-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: start; padding: 11px 16px; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); background: var(--surface); }
.doc-analysis-result-content .analysis-item:last-child { border-bottom: 0; }
.doc-analysis-result-content .analysis-item strong { min-width: 0; font-size: 13px; line-height: 1.42; font-weight: 700; overflow-wrap: anywhere; }
.doc-analysis-result-content .analysis-item .muted { font-size: 11px; line-height: 1.35; text-align: right; white-space: nowrap; }
.doc-analysis-result-content .analysis-item.risk, .doc-analysis-result-content .analysis-item.contradiction { border-left: 3px solid rgba(248,113,113,.7); }
.doc-analysis-result-content .check-row { grid-template-columns: auto minmax(0, 1fr); cursor: pointer; }
.doc-analysis-result-content .check-row > span { display: grid; gap: 4px; }
.doc-task-candidate-check { margin-top: 2px; accent-color: var(--accent); }
.doc-analysis-result-content .task-candidate { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; }
.candidate-select { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; cursor: pointer; }
.candidate-select > span { display: grid; gap: 4px; }
.candidate-select .muted { text-align: left; white-space: normal; }
.task-candidate-controls { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px); gap: 10px; padding-top: 2px; }
.task-candidate-controls label { display: grid; gap: 5px; color: var(--text2); font-size: 11px; font-weight: 700; }
.task-candidate-controls select, .task-candidate-controls input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface2); color: var(--text); font: inherit; }
.doc-task-candidate-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface2); }
.doc-task-candidate-actions .muted { margin: 0; }
.workflow-stage-settings { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .7fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface2); }
.workflow-stage-order { display: grid; gap: 6px; color: var(--text2); font-size: 11px; font-weight: 700; }
.analysis-history-item { width: 100%; display: grid; gap: 7px; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.analysis-history-item:hover { background: var(--surface2); }
.analysis-history-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.analysis-history-top strong { font-size: 12px; }
.analysis-history-preview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text2); font-size: 12px; line-height: 1.35; }

@media (max-width: 900px) {
  .auth-screen { padding: 18px; }
  .landing-page { min-height: calc(100vh - 36px); gap: 24px; }
  .landing-hero { grid-template-columns: 1fr; gap: 28px; align-items: start; }
  .auth-card { justify-self: stretch; width: 100%; }
  .landing-copy h1 { font-size: clamp(32px, 10vw, 48px); }
  .landing-copy p { font-size: 15px; }
  .landing-features { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .landing-header { position: static; }
  .landing-features article { grid-template-columns: 1fr; min-height: 0; padding: 20px; }
  .landing-features { grid-template-columns: 1fr; }
  .task-candidate-controls { grid-template-columns: 1fr; }
  .doc-task-candidate-actions { align-items: stretch; }
  .workflow-stage-settings { grid-template-columns: 1fr; }
}

@media (max-width: 900px) { .kanban { grid-template-columns: none; grid-auto-columns: minmax(300px, 86vw); } }

@media (max-width: 1180px) { .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); } .toolbar-search { grid-column: 1 / -1; } .task-toolbar { grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(120px, 1fr)) auto; } .task-toolbar .toolbar-search { grid-column: auto; } .task-toolbar .view-toggle { grid-column: 5; grid-row: 1; } .dashboard-grid, .docs-layout, .docs-workbench, .docs-upload-grid, .docs-header-with-upload { grid-template-columns: 1fr; } .docs-side, .docs-library, .docs-actions-panel { position: static; max-height: none; overflow: visible; } .kanban { grid-template-columns: repeat(2, minmax(220px, 1fr)); } .mail-shell { grid-template-columns: 170px 280px minmax(0,1fr); } .drawer-body.task-card-layout { grid-template-columns: minmax(0, 1fr) 420px; } .task-section-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .app { flex-direction: column; } .sidebar { width: 100%; padding-bottom: 8px; } .sidebar-nav { display: flex; overflow-x: auto; } .sidebar-nav a { white-space: nowrap; } .settings-button { margin: 8px 14px 0; } .main { padding: 16px; } .stats-row, .kanban, .form-grid, .docs-form-grid, .drawer-body.two-col, .settings-layout, .cost-rate-row, .responsible-row, .planning-calendar, .email-form { grid-template-columns: 1fr; } .drawer-body.task-card-layout { overflow-y: auto; } .task-side { position: static; max-height: none; min-height: 0; overflow: visible; } .doc-card { grid-template-columns: 40px minmax(0, 1fr); } .doc-icon { width: 40px; height: 40px; } .doc-card-actions { grid-column: 2; justify-content: flex-start; } .doc-object-head, .doc-editor-topbar { flex-direction: column; align-items: stretch; } .doc-editor-shell .ql-editor { min-height: 62vh; max-height: none; margin: 0; padding: 28px 24px; } .mail-shell { grid-template-columns: 1fr; min-height: auto; } .mail-folders, .mail-list-pane { border-right: 0; border-bottom: 1px solid var(--border); } .mail-list { max-height: 280px; } .page-header { flex-direction: column; align-items: stretch; } .settings-nav { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 12px; } .toolbar { grid-template-columns: 1fr; } .modal-overlay { left: 0; } .drawer { width: 100vw; } .setting-row { align-items: flex-start; flex-direction: column; } .chat-panel { right: 12px; bottom: 12px; width: calc(100vw - 24px); height: min(720px, calc(100vh - 24px)); min-height: 0; } .chat-history { width: min(280px, 84vw); } .chat-history-item { margin-bottom: 8px; } }

@media (max-width: 900px) {
  body { overflow: hidden; }
  .app { height: 100dvh; min-height: 0; }
  .sidebar { position: sticky; top: 0; z-index: 900; width: 100%; max-height: none; padding: 0; border-right: 0; border-bottom: 1px solid var(--border); box-shadow: 0 12px 26px rgba(0,0,0,.14); }
  .sidebar-logo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 60px; margin: 0; padding: 10px 14px; border-bottom: 0; }
  .sidebar-logo > span:first-child { font-size: 17px; }
  .sidebar-logo .user-chip { grid-column: 2; min-width: 0; margin: 0; justify-self: start; }
  .sidebar-logo .user-chip span { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-menu-toggle { display: inline-grid; grid-column: 3; place-items: center; width: 40px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); color: var(--text); font-size: 20px; cursor: pointer; }
  .sidebar-nav, .settings-button { display: none; }
  body.mobile-menu-open .sidebar-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: calc(100dvh - 72px); overflow-y: auto; padding: 0 12px 12px; }
  body.mobile-menu-open .settings-button:not(.is-hidden) { display: block; margin: 0 12px 12px; }
  .sidebar-nav a { padding: 11px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface2); }
  .sidebar-nav a.active { border-right: 1px solid var(--accent); border-color: var(--accent); background: rgba(108,140,255,.14); }
  .main { min-height: 0; overflow-y: auto; padding: 14px; }
  .page-header { gap: 10px; margin-bottom: 14px; }
  .page-header h1 { font-size: 21px; }
  .toolbar, .task-toolbar { gap: 10px; padding: 10px; }
  .task-toolbar .toolbar-search, .task-toolbar .view-toggle { grid-column: auto; grid-row: auto; }
  .task-toolbar .view-toggle { justify-self: stretch; }
  .view-toggle, .segmented { width: 100%; overflow-x: auto; }
  .section { margin-bottom: 14px; border-radius: 12px; }
  .section-header { flex-direction: column; align-items: stretch; gap: 8px; padding: 13px 14px; }
  .section-body { padding: 13px 14px; }
  .stats-row { gap: 10px; }
  .stat-card { min-height: 0; padding: 14px; }
  .attention-item, .load-item { align-items: flex-start; flex-direction: column; }
  .attention-tags { justify-content: flex-start; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 720px; }

  .kanban { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(282px, 88vw); min-height: calc(100dvh - 280px); max-height: none; overflow-x: auto; overflow-y: visible; padding: 2px 2px 14px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .kanban-col { min-height: calc(100dvh - 300px); max-height: calc(100dvh - 230px); scroll-snap-align: start; }
  .kanban-col-cards { overflow-y: auto; max-height: none; padding-right: 2px; }
  .kanban-card { padding: 11px; }
  .kanban-card .title { line-height: 1.35; }

  .planning-page { gap: 12px; }
  .planning-hero { flex-direction: column; align-items: stretch; gap: 12px; }
  .planning-hero h1 { font-size: 23px; }
  .planning-tabs { justify-content: flex-start; padding-bottom: 2px; }
  .planning-tabs .btn { flex: 0 0 auto; }
  .planning-filter { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 11px; box-shadow: none; }
  .planning-search { min-width: 0; width: 100%; }
  .planning-period, .planning-filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-left: 0; }
  .planning-period label, .planning-scale { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .planning-period .btn, .planning-filter-actions .btn { width: 100%; }
  .planning-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .planning-summary > div { padding: 12px; }
  .planning-summary strong { font-size: 19px; }
  .planning-user-head { grid-template-columns: 1fr; gap: 10px; padding: 12px; }
  .planning-buckets { grid-template-columns: 1fr; gap: 10px; padding: 12px; }
  .planning-cell-card { min-height: 0; }
  .planning-cell-top { flex-direction: column; }
  .planning-cell-top label { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 86px; align-items: center; }
  .planning-cell-top input { width: 100%; }
  .planning-row { grid-template-columns: minmax(0, 1fr) 72px 34px; }
  .planning-calendar-nav { flex-wrap: wrap; padding: 12px; }
  .planning-calendar-nav .btn { flex: 1 1 120px; }
  .planning-calendar { display: flex; gap: 12px; overflow-x: auto; padding: 12px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .planning-month { flex: 0 0 min(520px, 92vw); scroll-snap-align: start; }
  .planning-weekdays, .planning-days { min-width: 420px; }
  .planning-day { min-height: 58px; padding: 4px; }
  .planning-day-task, .planning-day-project { font-size: 9px; }

  .calendar-section .section-body { padding: 12px; }
  .calendar-header { position: sticky; left: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; margin-bottom: 10px; }
  .calendar-header h3 { align-self: center; text-align: center; font-size: 16px; }
  .calendar-scroll { margin: 0 -12px; padding: 0 12px 4px; }
  .calendar-grid { min-width: 560px; gap: 5px; }
  .cal-day-header { position: sticky; top: 0; z-index: 1; padding: 7px 4px; border-radius: 7px; background: var(--surface); }
  .cal-day { min-height: 92px; padding: 6px; }
  .day-num { margin-bottom: 5px; font-size: 12px; }
  .cal-task { padding: 4px 5px; font-size: 10px; line-height: 1.25; }

  .docs-upload-actions, .docs-upload-inline, .docs-upload-grid { align-items: stretch; justify-content: stretch; flex-direction: column; flex-wrap: nowrap; width: 100%; }
  .docs-upload-grid .form-group, .docs-upload-grid .form-group:nth-child(2), .docs-upload-grid .form-group:nth-child(3) { width: 100%; }
  .docs-tabs { width: 100%; }
  .doc-card { align-items: start; }
  .mail-reader-toolbar { flex-direction: column; align-items: stretch; }
  .mail-bulk-top, .mail-bulk-actions, .email-card-head, .email-suggestion-card-head { flex-direction: column; align-items: stretch; }
  .mail-message { padding: 14px; }
  .mail-message h2 { font-size: 17px; }
  .mail-inline-reply, .mail-message-body { padding: 12px; }

  .modal-overlay { align-items: stretch; background: var(--surface); }
  .drawer { height: 100dvh; max-height: 100dvh; border-right: 0; box-shadow: none; }
  .drawer-header { min-height: 54px; padding: 10px 12px; gap: 10px; }
  .drawer-header .btn { flex: 1 1 0; }
  .drawer-body { padding: 14px; }
  .drawer-body.task-card-layout { display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto auto; gap: 12px; padding: 12px; background: var(--surface2); }
  .task-main-column { gap: 12px; }
  .task-section, .task-side-card { padding: 13px; border-radius: 13px; box-shadow: none; }
  .task-links-grid, .task-team-grid, .finance-grid { grid-template-columns: 1fr; }
  .task-team-grid .form-group:has(#task-coexecutors), .finance-grid .task-check { grid-column: auto; }
  .task-section-primary textarea { min-height: 118px; }
  .task-team-grid select[multiple] { min-height: 92px; }
  .work-time-range, .work-allocation-card summary { grid-template-columns: 1fr; }

  .task-side { grid-column: auto; grid-row: auto; height: auto; gap: 12px; overflow: visible; }
  .task-comments { min-height: 0; }
  .comment-list { min-height: 180px; max-height: 45dvh; }
  .task-local-actions { grid-column: auto; grid-row: auto; grid-template-columns: 1fr; gap: 8px; margin: 0 -12px -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .task-local-actions > span { display: none; }
  .task-progress-actions, .task-save-actions { justify-content: stretch; flex-wrap: wrap; }
  .task-local-actions .btn, .task-progress-actions .btn, .task-save-actions .btn { flex: 1 1 140px; }

  .effort-tabs { grid-template-columns: 1fr; gap: 8px; }
  .effort-tab { min-height: 54px; }
  .effort-assessment-head, .comment-head, .subhead-row { flex-direction: column; align-items: stretch; }
  .effort-metrics { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .main { padding: 10px; }
  .sidebar-logo { min-height: 58px; padding: 9px 12px; }
  .sidebar-logo > span:first-child { font-size: 16px; }
  .sidebar-logo .user-chip span { max-width: 38vw; }
  body.mobile-menu-open .sidebar-nav { grid-template-columns: 1fr; gap: 7px; padding: 0 10px 10px; }
  body.mobile-menu-open .settings-button { margin: 0 10px 10px; }
  .sidebar-nav a { padding: 10px 12px; font-size: 13px; }
  .toolbar, .task-toolbar, .planning-filter { padding: 9px; }
  .btn { padding: 8px 11px; }
  .btn-sm { padding: 6px 9px; }
  .kanban { grid-auto-columns: minmax(260px, 90vw); min-height: calc(100dvh - 260px); }
  .kanban-col { min-height: calc(100dvh - 290px); max-height: calc(100dvh - 210px); padding: 10px; }
  .kanban-col-header { margin-bottom: 9px; }
  .planning-period, .planning-filter-actions, .planning-summary { grid-template-columns: 1fr; }
  .planning-period label, .planning-scale { grid-template-columns: 1fr; }
  .planning-row { grid-template-columns: 1fr 72px 34px; }
  .planning-month { flex-basis: 94vw; padding: 10px; }
  .planning-weekdays, .planning-days { min-width: 390px; gap: 3px; }
  .planning-day { min-height: 52px; }
  .planning-day-task:nth-of-type(n+3), .planning-day-project:nth-of-type(n+3) { display: none; }
  .calendar-grid { min-width: 500px; }
  .cal-day { min-height: 82px; }
  .cal-task:nth-of-type(n+4) { display: none; }
  table { min-width: 640px; }
  .drawer-body.task-card-layout { padding: 10px; }
  .task-section, .task-side-card { padding: 12px; }
  .drawer-header { position: sticky; top: 0; }
  .drawer-header h3 { font-size: 16px; }
  .form-group textarea { min-height: 130px; }
  .task-section-primary textarea { min-height: 112px; }
  .task-local-actions { margin: 0 -10px -10px; }
  .doc-analysis-result-content .analysis-item { grid-template-columns: 1fr; }
  .doc-analysis-result-content .analysis-item .muted { text-align: left; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .modal-overlay, .drawer { animation: none; opacity: 1; transform: none; } }
