:root {
  color-scheme: dark;
  --bg: #0a0e1e;
  --surface: rgba(20, 25, 53, 0.82);
  --surface-2: rgba(29, 36, 72, 0.78);
  --surface-3: rgba(38, 47, 90, 0.82);
  --sidebar: rgba(13, 18, 39, 0.94);
  --topbar: rgba(18, 22, 52, 0.82);
  --text: #f4f7ff;
  --muted: #aab3d0;
  --subtle: #7781a4;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #7c8cff;
  --accent-2: #52d9e9;
  --accent-3: #e96fb7;
  --success: #49d7a0;
  --warning: #ffbd55;
  --danger: #ff6f85;
  --info: #68b8ff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-width: 236px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;
  --row-height: 48px;
  --pad: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-2: rgba(247, 249, 255, 0.92);
  --surface-3: rgba(235, 240, 252, 0.96);
  --sidebar: rgba(249, 251, 255, 0.96);
  --topbar: rgba(255, 255, 255, 0.88);
  --text: #18203c;
  --muted: #5f6988;
  --subtle: #8992ad;
  --border: rgba(35, 47, 85, 0.12);
  --border-strong: rgba(35, 47, 85, 0.20);
  --shadow: 0 18px 55px rgba(51, 65, 112, 0.16);
  --shadow-soft: 0 8px 28px rgba(51, 65, 112, 0.12);
}

html[data-density="compact"] {
  --row-height: 39px;
  --pad: 12px;
  --radius: 13px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: rgba(124, 140, 255, .38); }

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  inset: 0;
  z-index: -2;
}
body::before {
  background:
    radial-gradient(circle at 77% 15%, rgba(86, 214, 229, .23), transparent 28%),
    radial-gradient(circle at 62% 70%, rgba(149, 89, 255, .25), transparent 33%),
    radial-gradient(circle at 20% 80%, rgba(240, 100, 178, .16), transparent 28%),
    linear-gradient(145deg, #0b0f20 0%, #13173c 48%, #0d1634 100%);
}
body::after {
  opacity: .45;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 75%, transparent);
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(circle at 77% 15%, rgba(86, 214, 229, .25), transparent 28%),
    radial-gradient(circle at 62% 70%, rgba(149, 89, 255, .18), transparent 33%),
    radial-gradient(circle at 20% 80%, rgba(240, 100, 178, .13), transparent 28%),
    linear-gradient(145deg, #eef2fb 0%, #e8edfb 48%, #f2f6ff 100%);
}

.app-shell { height: 100%; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); transition: grid-template-columns .22s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }

.sidebar {
  min-width: 0;
  height: 100%;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(145%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}
.brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 17px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 8px 20px rgba(97, 119, 255, .22); }
.brand-copy { min-width: 0; line-height: 1.05; transition: opacity .15s ease; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-tag { margin-top: 5px; font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--subtle); white-space: nowrap; }
.sidebar-collapsed .brand { padding-inline: 18px; }
.sidebar-collapsed .brand-copy { opacity: 0; width: 0; }

.nav-scroll { overflow-y: auto; overflow-x: hidden; padding: 14px 10px 12px; scrollbar-width: thin; flex: 1; }
.nav-section { margin-bottom: 16px; }
.nav-label { padding: 4px 10px 7px; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; white-space: nowrap; transition: opacity .15s; }
.sidebar-collapsed .nav-label { opacity: 0; height: 8px; padding: 0; }
.nav-item {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 11px;
  margin: 2px 0;
  text-align: left;
  position: relative;
  white-space: nowrap;
  transition: background .16s, color .16s, transform .16s;
}
.nav-item:hover { color: var(--text); background: rgba(124, 140, 255, .10); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(124,140,255,.28), rgba(82,217,233,.12)); box-shadow: inset 0 0 0 1px rgba(139, 155, 255, .20); }
html[data-theme="light"] .nav-item.active { color: #263260; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; width: 3px; height: 24px; border-radius: 4px; background: linear-gradient(var(--accent-2), var(--accent)); }
.nav-icon { width: 21px; height: 21px; display: inline-flex; flex: 0 0 21px; align-items: center; justify-content: center; }
.nav-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 650; transition: opacity .15s; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; font-size: 10px; font-weight: 800; color: #fff; background: var(--danger); }
.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar-collapsed .nav-text, .sidebar-collapsed .nav-badge { opacity: 0; width: 0; margin: 0; padding: 0; overflow: hidden; }

.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.collapse-btn { width: 100%; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 11px; padding: 0 12px; }
.collapse-btn:hover { background: rgba(124,140,255,.10); color: var(--text); }
.collapse-btn svg { width: 19px; height: 19px; transition: transform .22s; }
.sidebar-collapsed .collapse-btn { justify-content: center; padding: 0; }
.sidebar-collapsed .collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapsed .collapse-btn span { display: none; }

.app-main { min-width: 0; height: 100%; display: grid; grid-template-rows: var(--topbar-height) minmax(0, 1fr); }
.topbar {
  height: var(--topbar-height);
  background: var(--topbar);
  backdrop-filter: blur(22px) saturate(145%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  z-index: 15;
  min-width: 0;
}
.workspace-switcher {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 11px;
  min-width: 180px;
  max-width: 235px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  font-weight: 750;
  font-size: 13px;
}
.workspace-dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 0 0 4px rgba(91, 211, 229, .10); }
.workspace-switcher .chev { margin-left: auto; color: var(--subtle); }
.global-search { flex: 1; max-width: 660px; position: relative; min-width: 160px; }
.global-search input { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255,255,255,.055); padding: 0 78px 0 40px; outline: none; transition: border .16s, background .16s, box-shadow .16s; }
.global-search input:focus { border-color: rgba(124,140,255,.62); background: rgba(255,255,255,.08); box-shadow: 0 0 0 3px rgba(124,140,255,.12); }
.global-search .search-icon { position: absolute; left: 13px; top: 10px; width: 19px; height: 19px; color: var(--subtle); }
.global-search kbd { position: absolute; right: 9px; top: 8px; height: 24px; border: 1px solid var(--border); border-bottom-color: var(--border-strong); background: var(--surface-2); border-radius: 6px; padding: 3px 7px; color: var(--subtle); font-size: 10px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.icon-btn, .top-btn {
  height: 39px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.055);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn { width: 39px; padding: 0; position: relative; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover, .top-btn:hover { color: var(--text); background: rgba(124,140,255,.13); }
.icon-btn:active, .top-btn:active { transform: translateY(1px); }
.top-btn { padding: 0 12px; gap: 7px; font-weight: 750; font-size: 12px; }
.create-btn { border: 0; color: #fff; background: linear-gradient(135deg, #6879f8, #8865f4 55%, #c764c1); box-shadow: 0 8px 24px rgba(101, 104, 246, .27); }
.create-btn:hover { color: #fff; filter: brightness(1.06); background: linear-gradient(135deg, #6879f8, #8865f4 55%, #c764c1); }
.notification-dot { position: absolute; right: 7px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--topbar); }
.timer-live { color: #fff; border-color: rgba(73,215,160,.4); background: rgba(73,215,160,.16); }
.avatar { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 850; font-size: 12px; color: #fff; background: linear-gradient(135deg, #6378ff, #e468b4); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }

.content-shell { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.contextbar {
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 22, 52, .34);
  backdrop-filter: blur(14px);
  overflow-x: auto;
  scrollbar-width: none;
}
html[data-theme="light"] .contextbar { background: rgba(255,255,255,.38); }
.contextbar::-webkit-scrollbar { display: none; }
.context-title { margin-right: 7px; min-width: max-content; }
.context-title h1 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.context-title p { margin: 2px 0 0; font-size: 11px; color: var(--subtle); }
.context-spacer { flex: 1; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.04); }
.segmented button { border: 0; background: transparent; color: var(--muted); height: 31px; padding: 0 11px; border-radius: 7px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-soft); }
.filter-select, .toolbar-input {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  padding: 0 11px;
  outline: none;
  font-size: 12px;
  min-width: 140px;
}
.toolbar-input { width: 190px; }
.action-btn {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.action-btn.primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, #5f78f4, #8c65ef); }
.action-btn.success { color: #07251b; border-color: transparent; background: var(--success); }
.action-btn.danger { color: #fff; border-color: transparent; background: var(--danger); }
.action-btn.ghost { background: transparent; }

.content { min-height: 0; min-width: 0; overflow: auto; padding: var(--pad); scrollbar-color: rgba(130,144,191,.45) transparent; }
.view { min-height: 100%; }
.page-grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(135%);
  min-width: 0;
}
.panel-header { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.panel-header p { margin: 2px 0 0; color: var(--subtle); font-size: 10px; }
.panel-header .panel-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.panel-body { padding: 15px; }
.panel-empty { min-height: 180px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 28px; }
.panel-empty strong { display: block; color: var(--text); margin-bottom: 5px; }

.metric-card { padding: 16px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: -28px; bottom: -40px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, var(--metric-glow, rgba(124,140,255,.26)), transparent 65%); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; color: var(--metric-color, var(--accent)); background: color-mix(in srgb, var(--metric-color, var(--accent)) 16%, transparent); }
.metric-icon svg { width: 18px; height: 18px; }
.metric-value { font-size: 27px; font-weight: 850; letter-spacing: -.045em; margin: 13px 0 4px; }
.metric-foot { color: var(--subtle); font-size: 10px; }
.metric-change { color: var(--success); font-weight: 800; }

.chart-bars { height: 210px; display: flex; align-items: flex-end; gap: 12px; padding: 16px 7px 6px; }
.chart-bar-wrap { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.chart-bar { width: min(36px, 78%); min-height: 3px; border-radius: 8px 8px 4px 4px; background: linear-gradient(to top, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(91, 125, 255, .22); transition: height .35s ease; }
.chart-label { color: var(--subtle); font-size: 9px; white-space: nowrap; overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
.chart-value { font-size: 9px; font-weight: 800; color: var(--muted); }

.progress-ring { width: 158px; height: 158px; margin: 11px auto 7px; position: relative; display: grid; place-items: center; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .track { stroke: rgba(255,255,255,.08); }
.progress-ring .value { stroke: url(#ringGradient); stroke-linecap: round; transition: stroke-dashoffset .4s; }
.progress-ring-center { position: absolute; text-align: center; }
.progress-ring-center strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.progress-ring-center span { color: var(--subtle); font-size: 10px; }

.activity-list { display: grid; gap: 1px; }
.activity-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(124,140,255,.13); color: var(--accent-2); }
.activity-icon svg { width: 15px; height: 15px; }
.activity-copy { min-width: 0; font-size: 11px; color: var(--muted); line-height: 1.45; }
.activity-copy strong { color: var(--text); }
.activity-time { color: var(--subtle); font-size: 9px; white-space: nowrap; }

.kanban-wrap { min-height: 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
.kanban { min-width: max-content; display: flex; gap: 12px; height: calc(100vh - 160px); align-items: stretch; }
.kanban-column { width: 292px; min-width: 292px; border: 1px solid var(--border); background: rgba(11, 15, 37, .38); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
html[data-theme="light"] .kanban-column { background: rgba(255,255,255,.38); }
.kanban-header { height: 54px; padding: 10px 12px; background: linear-gradient(90deg, color-mix(in srgb, var(--stage) 78%, transparent), color-mix(in srgb, var(--stage) 52%, transparent)); border-bottom: 1px solid rgba(255,255,255,.13); color: #fff; }
.kanban-title-row { display: flex; align-items: center; gap: 8px; }
.kanban-title { font-size: 12px; font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-count { margin-left: auto; min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 999px; background: rgba(8,12,30,.28); font-size: 9px; font-weight: 850; }
.kanban-total { margin-top: 4px; opacity: .85; font-size: 9px; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 9px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.kanban-cards.drag-over { background: rgba(124,140,255,.10); outline: 2px dashed rgba(124,140,255,.44); outline-offset: -5px; }
.kanban-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 11px; box-shadow: 0 8px 22px rgba(0,0,0,.13); cursor: grab; transition: transform .15s, border .15s, opacity .15s; }
.kanban-card:hover { transform: translateY(-2px); border-color: rgba(124,140,255,.38); }
.kanban-card.dragging { opacity: .5; transform: rotate(1.5deg); }
.card-title { font-size: 12px; font-weight: 800; line-height: 1.35; margin-bottom: 6px; }
.card-sub { color: var(--muted); font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-meta { margin-top: 10px; display: flex; align-items: center; gap: 7px; }
.card-value { font-size: 11px; font-weight: 850; }
.card-date { margin-left: auto; color: var(--subtle); font-size: 9px; }
.card-avatar { width: 23px; height: 23px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #5d74ee, #d26ab3); color: #fff; font-size: 8px; font-weight: 850; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { min-height: 20px; padding: 3px 7px; border-radius: 999px; background: rgba(124,140,255,.12); color: #bdc6ff; font-size: 8px; font-weight: 800; letter-spacing: .02em; }
html[data-theme="light"] .tag { color: #4f5b9c; }
.add-card { margin: 0 9px 9px; height: 34px; border: 1px dashed var(--border-strong); border-radius: 9px; background: transparent; color: var(--subtle); font-size: 11px; font-weight: 700; }
.add-card:hover { color: var(--text); border-color: rgba(124,140,255,.5); background: rgba(124,140,255,.07); }

.table-panel { overflow: hidden; }
.table-scroll { overflow: auto; max-height: calc(100vh - 190px); }
.data-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.data-table th { height: 39px; position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--surface-2) 94%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 0 12px; text-align: left; color: var(--subtle); text-transform: uppercase; letter-spacing: .06em; font-size: 8px; font-weight: 850; }
.data-table td { height: var(--row-height); border-bottom: 1px solid var(--border); padding: 8px 12px; font-size: 11px; color: var(--muted); }
.data-table tr { transition: background .12s; }
.data-table tbody tr:hover { background: rgba(124,140,255,.07); }
.data-table tr.clickable { cursor: pointer; }
.data-table strong { color: var(--text); }
.table-primary { display: flex; align-items: center; gap: 10px; }
.table-avatar { width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 850; flex: 0 0 auto; background: linear-gradient(135deg, #5e73e8, #cd66b2); }
.table-primary-copy { min-width: 0; }
.table-primary-copy strong, .table-primary-copy span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.table-primary-copy span { font-size: 9px; color: var(--subtle); margin-top: 2px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 3px 8px; border-radius: 999px; font-size: 8px; font-weight: 850; background: rgba(124,140,255,.12); color: #bdc6ff; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.success { color: var(--success); background: rgba(73,215,160,.11); }
.status-pill.warning { color: var(--warning); background: rgba(255,189,85,.12); }
.status-pill.danger { color: var(--danger); background: rgba(255,111,133,.12); }
.status-pill.info { color: var(--info); background: rgba(104,184,255,.12); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.mini-btn { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--subtle); display: grid; place-items: center; }
.mini-btn:hover { color: var(--text); background: var(--surface-3); }
.mini-btn svg { width: 14px; height: 14px; }

.task-board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; min-width: 980px; min-height: calc(100vh - 175px); }
.task-column { border: 1px solid var(--border); border-radius: var(--radius); background: rgba(11,15,37,.36); padding: 10px; }
.task-column-head { display: flex; align-items: center; gap: 8px; padding: 4px 3px 11px; }
.task-column-head strong { font-size: 12px; }
.task-column-head span { margin-left: auto; font-size: 9px; color: var(--subtle); }
.task-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 11px; margin-bottom: 8px; cursor: pointer; }
.task-card:hover { border-color: rgba(124,140,255,.40); }
.task-top { display: flex; gap: 8px; align-items: flex-start; }
.priority-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; background: var(--info); flex: 0 0 auto; }
.priority-dot.high { background: var(--danger); }
.priority-dot.medium { background: var(--warning); }
.priority-dot.low { background: var(--success); }
.task-title { font-size: 11px; font-weight: 800; line-height: 1.4; }
.task-project { color: var(--subtle); font-size: 9px; margin-top: 5px; }
.task-foot { margin-top: 10px; display: flex; align-items: center; color: var(--subtle); font-size: 9px; }
.task-foot .overdue { color: var(--danger); font-weight: 800; }
.task-foot .card-avatar { margin-left: auto; }

.calendar-shell { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 14px; }
.calendar { overflow: hidden; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); }
.calendar-weekdays div { height: 34px; display: grid; place-items: center; color: var(--subtle); font-size: 9px; font-weight: 800; border-bottom: 1px solid var(--border); }
.calendar-day { min-height: 112px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(255,255,255,.012); overflow: hidden; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.muted { opacity: .42; }
.calendar-day.today { background: rgba(124,140,255,.08); box-shadow: inset 0 0 0 1px rgba(124,140,255,.30); }
.day-number { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.today .day-number { background: var(--accent); color: #fff; }
.calendar-event { margin-top: 5px; border-left: 3px solid var(--event-color, var(--accent)); border-radius: 6px; padding: 4px 6px; background: color-mix(in srgb, var(--event-color, var(--accent)) 14%, transparent); font-size: 8px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.upcoming-list { display: grid; gap: 8px; }
.upcoming-item { border: 1px solid var(--border); border-radius: 11px; padding: 10px; background: rgba(255,255,255,.02); }
.upcoming-time { color: var(--accent-2); font-size: 9px; font-weight: 850; }
.upcoming-title { font-size: 11px; font-weight: 800; margin-top: 5px; }
.upcoming-sub { color: var(--subtle); font-size: 9px; margin-top: 3px; }

.inbox-layout { height: calc(100vh - 158px); display: grid; grid-template-columns: 330px minmax(0,1fr); overflow: hidden; }
.conversation-list { border-right: 1px solid var(--border); overflow-y: auto; }
.conversation-search { padding: 10px; position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--border); }
.conversation-search input { width: 100%; height: 35px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); padding: 0 10px; outline: none; }
.conversation-item { min-height: 76px; padding: 11px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 9px; cursor: pointer; }
.conversation-item:hover, .conversation-item.active { background: rgba(124,140,255,.08); }
.conv-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 850; background: linear-gradient(135deg, #5e76ed, #5ad9d4); }
.conv-name { font-size: 11px; font-weight: 820; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { color: var(--subtle); font-size: 9px; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { color: var(--subtle); font-size: 8px; text-align: right; }
.unread { width: 18px; height: 18px; margin: 7px 0 0 auto; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 8px; font-weight: 850; }
.chat-pane { min-width: 0; display: grid; grid-template-rows: 58px minmax(0,1fr) auto; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-head-copy strong { display: block; font-size: 12px; }
.chat-head-copy span { display: block; margin-top: 2px; color: var(--subtle); font-size: 9px; }
.chat-head .panel-actions { margin-left: auto; }
.messages { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.message { max-width: min(680px, 80%); padding: 9px 11px; border-radius: 12px 12px 12px 3px; background: var(--surface-3); align-self: flex-start; font-size: 11px; line-height: 1.45; }
.message.out { align-self: flex-end; border-radius: 12px 12px 3px 12px; color: #fff; background: linear-gradient(135deg, #6279ef, #8c68ee); }
.message-time { display: block; opacity: .65; font-size: 8px; margin-top: 5px; text-align: right; }
.composer { padding: 11px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 40px; max-height: 120px; resize: vertical; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); padding: 10px; outline: none; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; }
.entity-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px; box-shadow: var(--shadow-soft); min-width: 0; }
.entity-card:hover { border-color: rgba(124,140,255,.34); }
.entity-card-top { display: flex; align-items: flex-start; gap: 10px; }
.entity-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 17px; font-weight: 850; color: #fff; background: linear-gradient(135deg, #6179f0, #cf66b1); flex: 0 0 auto; }
.entity-card-copy { min-width: 0; }
.entity-card-copy h3 { margin: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-card-copy p { margin: 4px 0 0; color: var(--subtle); font-size: 9px; line-height: 1.4; }
.entity-card .kebab { margin-left: auto; }
.entity-card-stats { margin-top: 13px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.entity-stat { border-radius: 10px; background: rgba(255,255,255,.035); padding: 8px; }
.entity-stat span { display: block; color: var(--subtle); font-size: 8px; }
.entity-stat strong { display: block; margin-top: 4px; font-size: 12px; }

.integration-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.integration-categories { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: 0 10px; color: var(--muted); font-size: 9px; font-weight: 780; }
.chip.active { color: #fff; border-color: transparent; background: var(--accent); }
.integration-card { display: flex; flex-direction: column; min-height: 188px; }
.integration-logo { width: 45px; height: 45px; border-radius: 13px; display: grid; place-items: center; font-size: 18px; font-weight: 900; color: #fff; background: var(--integration-bg, linear-gradient(135deg,#677cf1,#61d7dd)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.integration-card h3 { margin: 12px 0 4px; font-size: 12px; }
.integration-card p { margin: 0; color: var(--subtle); font-size: 9px; line-height: 1.5; flex: 1; }
.integration-foot { margin-top: 12px; display: flex; align-items: center; gap: 7px; }
.integration-foot .action-btn { margin-left: auto; height: 31px; font-size: 9px; }

.automation-flow { display: flex; align-items: stretch; gap: 12px; overflow-x: auto; padding: 8px 2px 14px; }
.flow-node { width: 230px; min-width: 230px; border: 1px solid var(--border); border-radius: 13px; padding: 12px; background: var(--surface-2); position: relative; }
.flow-node:not(:last-child)::after { content: "→"; position: absolute; right: -18px; top: 50%; transform: translateY(-50%); color: var(--subtle); font-weight: 900; }
.flow-node-type { color: var(--accent-2); font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.flow-node strong { display: block; margin-top: 7px; font-size: 11px; }
.flow-node p { margin: 5px 0 0; color: var(--subtle); font-size: 9px; line-height: 1.4; }

.knowledge-layout { height: calc(100vh - 158px); display: grid; grid-template-columns: 265px minmax(0,1fr); overflow: hidden; }
.knowledge-nav { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; }
.knowledge-item { width: 100%; border: 0; border-radius: 9px; background: transparent; color: var(--muted); padding: 9px 10px; text-align: left; font-size: 10px; margin-bottom: 3px; }
.knowledge-item:hover, .knowledge-item.active { background: rgba(124,140,255,.09); color: var(--text); }
.knowledge-article { overflow-y: auto; padding: clamp(20px, 5vw, 55px); }
.article-wrap { max-width: 820px; margin: 0 auto; }
.article-wrap h1 { margin: 0 0 10px; font-size: clamp(27px,4vw,42px); letter-spacing: -.045em; }
.article-meta { color: var(--subtle); font-size: 10px; margin-bottom: 28px; }
.article-content { color: var(--muted); font-size: 13px; line-height: 1.75; }
.article-content h2 { color: var(--text); margin-top: 28px; }
.article-content code { background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; }

.settings-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 15px; }
.settings-nav { padding: 9px; align-self: start; position: sticky; top: 0; }
.settings-nav button { width: 100%; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; padding: 0 10px; font-size: 10px; font-weight: 750; }
.settings-nav button:hover, .settings-nav button.active { color: var(--text); background: rgba(124,140,255,.09); }
.settings-section { padding: 18px; margin-bottom: 13px; }
.settings-section h2 { margin: 0 0 5px; font-size: 15px; }
.settings-section > p { margin: 0 0 17px; color: var(--subtle); font-size: 10px; }
.setting-row { min-height: 57px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16px; border-top: 1px solid var(--border); padding: 10px 0; }
.setting-row:first-of-type { border-top: 0; }
.setting-copy strong { display: block; font-size: 11px; }
.setting-copy span { display: block; margin-top: 3px; color: var(--subtle); font-size: 9px; line-height: 1.4; }
.switch { width: 42px; height: 24px; border: 0; border-radius: 999px; background: var(--surface-3); padding: 3px; transition: background .17s; }
.switch::after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.22); transition: transform .17s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.theme-options { display: flex; gap: 8px; }
.theme-option { width: 98px; height: 61px; border: 2px solid transparent; border-radius: 11px; padding: 6px; background: var(--surface-2); position: relative; }
.theme-option.active { border-color: var(--accent); }
.theme-preview { width: 100%; height: 100%; border-radius: 7px; overflow: hidden; display: grid; grid-template-columns: 23% 1fr; background: #eceff8; }
.theme-preview.dark { background: #11162f; }
.theme-preview span:first-child { background: #1b2140; }
.theme-preview.light span:first-child { background: #fff; }
.theme-preview span:last-child { margin: 6px; border-radius: 4px; background: rgba(124,140,255,.28); }

.drawer-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 6, 18, .46);
  backdrop-filter: blur(3px);
  animation: fade-in .14s ease;
}
.drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(590px, 94vw); background: color-mix(in srgb, var(--sidebar) 96%, transparent); border-left: 1px solid var(--border-strong); box-shadow: -24px 0 70px rgba(0,0,0,.35); display: grid; grid-template-rows: auto minmax(0,1fr) auto; animation: slide-in .20s ease; backdrop-filter: blur(28px) saturate(150%); }
.drawer-head { min-height: 68px; display: flex; align-items: center; gap: 11px; padding: 12px 15px; border-bottom: 1px solid var(--border); }
.drawer-head-copy { min-width: 0; }
.drawer-head-copy h2 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-head-copy p { margin: 4px 0 0; color: var(--subtle); font-size: 9px; }
.drawer-head .close-btn { margin-left: auto; }
.drawer-body { overflow-y: auto; padding: 16px; }
.drawer-foot { min-height: 61px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 15px; border-top: 1px solid var(--border); }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.detail-block { border: 1px solid var(--border); border-radius: 11px; padding: 10px; background: rgba(255,255,255,.025); }
.detail-block.full { grid-column: 1 / -1; }
.detail-label { color: var(--subtle); font-size: 8px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.detail-value { margin-top: 5px; font-size: 11px; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }
.detail-section { margin-top: 18px; }
.detail-section h3 { margin: 0 0 8px; font-size: 12px; }
.timeline { position: relative; padding-left: 17px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 1px; background: var(--border-strong); }
.timeline-item { position: relative; padding: 0 0 13px 11px; }
.timeline-item::before { content: ""; position: absolute; left: -15px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 13%, transparent); }
.timeline-item strong { display: block; font-size: 10px; }
.timeline-item p { margin: 4px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.timeline-item time { color: var(--subtle); font-size: 8px; }

.modal { position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(640px, calc(100vw - 28px)); max-height: min(800px, calc(100vh - 28px)); background: color-mix(in srgb, var(--sidebar) 97%, transparent); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: 0 30px 95px rgba(0,0,0,.48); display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; animation: modal-in .18s ease; backdrop-filter: blur(30px) saturate(150%); }
.modal.wide { width: min(900px, calc(100vw - 28px)); }
.modal-head { min-height: 62px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-head p { margin: 3px 0 0; color: var(--subtle); font-size: 9px; }
.modal-head .close-btn { margin-left: auto; }
.modal-body { overflow-y: auto; padding: 16px; }
.modal-foot { min-height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-field { min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { display: block; color: var(--muted); font-size: 9px; font-weight: 800; margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); outline: none; padding: 0 10px; transition: border .15s, box-shadow .15s; }
.form-field input, .form-field select { height: 40px; }
.form-field textarea { min-height: 92px; resize: vertical; padding-top: 9px; line-height: 1.45; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: rgba(124,140,255,.62); box-shadow: 0 0 0 3px rgba(124,140,255,.10); }
.form-help { margin-top: 5px; color: var(--subtle); font-size: 8px; line-height: 1.4; }
.form-error { color: var(--danger); font-size: 9px; margin-top: 5px; }
.quick-create-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.quick-create-card { min-height: 100px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--muted); padding: 12px; text-align: left; }
.quick-create-card:hover { border-color: rgba(124,140,255,.42); color: var(--text); background: var(--surface-3); }
.quick-create-card svg { width: 22px; height: 22px; color: var(--accent-2); }
.quick-create-card strong { display: block; color: var(--text); margin-top: 8px; font-size: 11px; }
.quick-create-card span { display: block; margin-top: 4px; font-size: 8px; line-height: 1.35; }

.dropdown { position: fixed; z-index: 110; width: 310px; max-height: 420px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 14px; background: color-mix(in srgb, var(--sidebar) 97%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(28px) saturate(150%); animation: dropdown-in .14s ease; }
.dropdown-head { padding: 12px; display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.dropdown-head strong { font-size: 11px; }
.dropdown-head button { margin-left: auto; border: 0; background: transparent; color: var(--accent-2); font-size: 9px; }
.dropdown-item { padding: 10px 12px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 9px; cursor: pointer; }
.dropdown-item:last-child { border-bottom: 0; }
.dropdown-item:hover { background: rgba(124,140,255,.08); }
.dropdown-item.unseen { background: rgba(124,140,255,.05); }
.dropdown-copy { min-width: 0; font-size: 9px; color: var(--muted); line-height: 1.45; }
.dropdown-copy strong { color: var(--text); }
.dropdown-copy time { display: block; color: var(--subtle); margin-top: 3px; font-size: 8px; }

.search-results { position: fixed; z-index: 120; top: 58px; left: min(calc(var(--sidebar-width) + 200px), 31vw); width: min(620px, calc(100vw - 320px)); max-height: 460px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 14px; background: color-mix(in srgb, var(--sidebar) 97%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(28px); }
.sidebar-collapsed .search-results { left: 150px; }
.search-result-section { padding: 9px 10px 4px; color: var(--subtle); font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.search-result { width: 100%; min-height: 48px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--muted); padding: 8px 11px; display: flex; align-items: center; gap: 10px; text-align: left; }
.search-result:hover { background: rgba(124,140,255,.08); }
.search-result-icon { width: 30px; height: 30px; border-radius: 9px; background: rgba(124,140,255,.12); display: grid; place-items: center; color: var(--accent-2); }
.search-result-copy { min-width: 0; }
.search-result-copy strong { display: block; color: var(--text); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-copy span { display: block; color: var(--subtle); margin-top: 3px; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.command-palette { position: fixed; z-index: 140; top: 14vh; left: 50%; transform: translateX(-50%); width: min(650px, calc(100vw - 28px)); border: 1px solid var(--border-strong); border-radius: 16px; background: color-mix(in srgb, var(--sidebar) 97%, transparent); box-shadow: 0 35px 100px rgba(0,0,0,.5); overflow: hidden; backdrop-filter: blur(30px) saturate(150%); animation: command-in .16s ease; }
.command-input { width: 100%; height: 57px; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 0 17px; outline: none; font-size: 14px; }
.command-list { max-height: 430px; overflow-y: auto; padding: 7px; }
.command-group-label { padding: 9px 9px 5px; color: var(--subtle); font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.command-item { width: 100%; min-height: 43px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 10px; padding: 7px 9px; text-align: left; }
.command-item:hover, .command-item.selected { background: rgba(124,140,255,.10); color: var(--text); }
.command-item svg { width: 18px; height: 18px; color: var(--accent-2); }
.command-item span { font-size: 10px; font-weight: 760; }
.command-item kbd { margin-left: auto; color: var(--subtle); border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; font-size: 8px; }

.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; width: min(350px, calc(100vw - 32px)); }
.toast { min-height: 52px; border: 1px solid var(--border-strong); border-radius: 12px; background: color-mix(in srgb, var(--sidebar) 96%, transparent); box-shadow: var(--shadow); display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 9px 11px; animation: toast-in .20s ease; backdrop-filter: blur(24px); }
.toast-icon { width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center; color: var(--success); background: rgba(73,215,160,.12); }
.toast-copy strong { display: block; font-size: 10px; }
.toast-copy span { display: block; color: var(--subtle); margin-top: 3px; font-size: 8px; line-height: 1.4; }
.toast button { border: 0; background: transparent; color: var(--subtle); }

.empty-state { min-height: 320px; display: grid; place-items: center; text-align: center; padding: 30px; }
.empty-state-icon { width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 15px; background: rgba(124,140,255,.12); color: var(--accent-2); }
.empty-state-icon svg { width: 31px; height: 31px; }
.empty-state h2 { margin: 0; font-size: 16px; }
.empty-state p { max-width: 440px; margin: 7px auto 14px; color: var(--subtle); font-size: 10px; line-height: 1.6; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.10), rgba(255,255,255,.04)); background-size: 220% 100%; animation: shimmer 1.2s infinite; }
hr.soft { border: 0; border-top: 1px solid var(--border); margin: 15px 0; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(25px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes modal-in { from { transform: translate(-50%,-47%) scale(.98); opacity: 0; } to { transform: translate(-50%,-50%) scale(1); opacity: 1; } }
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes command-in { from { opacity: 0; transform: translate(-50%,-8px) scale(.98); } to { opacity: 1; transform: translate(-50%,0) scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .calendar-shell { grid-template-columns: 1fr; }
  .calendar-shell > aside { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 76px; }
  .brand-copy, .nav-text, .nav-badge, .nav-label, .collapse-btn span { display: none; }
  .brand { padding: 0 18px; }
  .nav-item { justify-content: center; padding: 0; }
  .collapse-btn { justify-content: center; padding: 0; }
  .workspace-switcher { min-width: 45px; width: 45px; padding: 0; justify-content: center; }
  .workspace-switcher > span:not(.workspace-dot) { display: none; }
  .top-btn span { display: none; }
  .top-btn { width: 39px; padding: 0; }
  .inbox-layout { grid-template-columns: 265px minmax(0,1fr); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: none; }
  .search-results { left: 100px; width: calc(100vw - 130px); }
}

@media (max-width: 680px) {
  body { overflow: auto; }
  .app-shell, .app-shell.sidebar-collapsed { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr) 66px; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: 66px; border-right: 0; border-top: 1px solid var(--border); flex-direction: row; z-index: 60; }
  .brand, .sidebar-footer, .nav-label { display: none; }
  .nav-scroll { width: 100%; padding: 7px 8px; overflow-x: auto; overflow-y: hidden; }
  .nav-section { display: contents; }
  .nav-scroll { display: flex; gap: 3px; }
  .nav-item { width: 58px; min-width: 58px; height: 52px; flex-direction: column; justify-content: center; gap: 3px; padding: 0; margin: 0; }
  .nav-item.active::before { left: 50%; top: -7px; width: 24px; height: 3px; transform: translateX(-50%); }
  .nav-text { display: block; opacity: 1; width: auto; font-size: 7px; max-width: 55px; }
  .nav-icon { width: 18px; height: 18px; }
  .nav-icon svg { width: 18px; height: 18px; }
  .app-main { grid-row: 1; height: calc(100vh - 66px); }
  .topbar { padding: 0 10px; gap: 7px; }
  .workspace-switcher { display: none; }
  .global-search { min-width: 0; }
  .global-search kbd { display: none; }
  .global-search input { padding-right: 10px; }
  .top-actions .icon-btn:nth-of-type(1), .top-actions .top-btn:not(.create-btn) { display: none; }
  .avatar { display: none; }
  .contextbar { padding: 8px 10px; }
  .context-title p { display: none; }
  .context-title h1 { font-size: 15px; }
  .toolbar-input, .filter-select { min-width: 120px; width: 120px; }
  .content { padding: 10px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .kanban { height: calc(100vh - 210px); }
  .kanban-column { width: 265px; min-width: 265px; }
  .inbox-layout { height: calc(100vh - 205px); grid-template-columns: 1fr; }
  .conversation-list { border-right: 0; }
  .chat-pane { display: none; }
  .inbox-layout.chat-open .conversation-list { display: none; }
  .inbox-layout.chat-open .chat-pane { display: grid; }
  .knowledge-layout { height: calc(100vh - 205px); grid-template-columns: 1fr; }
  .knowledge-nav { display: none; }
  .calendar-day { min-height: 79px; padding: 4px; }
  .calendar-event { padding: 3px; font-size: 0; width: 8px; height: 8px; border: 0; border-radius: 50%; display: inline-block; background: var(--event-color); }
  .quick-create-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-block.full, .form-field.full { grid-column: auto; }
  .search-results { top: 58px; left: 10px; width: calc(100vw - 20px); }
  .task-board { min-width: 900px; }
}

body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.segmented button svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

/* ── Login / access gate ──────────────────────────────────────────────────── */
.login-mode {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  grid-template-columns: none !important;
}
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 20%, rgba(124,140,255,.14) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 80%, rgba(233,111,183,.12) 0%, transparent 60%);
}
.login-card {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 410px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  margin: auto;
}
.login-card input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(124,140,255,.18);
}
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.google-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}
.login-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: var(--subtle);
  font-size: 11px;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.login-divider span {
  padding: 0 10px;
}
.accent-blue { color: var(--info); }
