@font-face { font-family: "Vazirmatn"; src: url('/static/fonts/vazirmatn-arabic-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url('/static/fonts/vazirmatn-arabic-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-soft: #f7f7f5;
  --surface-strong: #efefec;
  --ink: #2f3437;
  --muted: #6b7280;
  --line: #e8e8e5;
  --line-strong: #d8d8d4;

  --primary: #2f6feb;
  --primary-strong: #1f5fe0;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;

  --sidebar-bg: #f7f7f5;
  --sidebar-ink: #4b5563;
  --sidebar-active: #e9eefc;
  --topbar-bg: rgba(251, 251, 250, 0.9);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 28px;
  --space-7: 36px;
  --space-8: 48px;

  --font-xs: 12px;
  --font-sm: 13px;
  --font-md: 14px;
  --font-lg: 16px;
  --font-xl: 22px;
  --font-2xl: 30px;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --tracking-tight: -0.01em;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: none;
  --shadow-md: 0 1px 2px rgba(15, 15, 15, 0.04);
  --shadow-lg: 0 4px 16px rgba(15, 15, 15, 0.08);

  /* backward-compatible aliases for existing inline vars */
  --prim: var(--primary);
  --prim2: var(--primary-strong);
  --ok: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);
  --border: var(--line);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Vazirmatn, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  font-size: var(--font-md);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-tight);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); font-weight: 650; }
h1 { font-size: var(--font-2xl); }
h2 { font-size: var(--font-xl); margin-bottom: var(--space-3); font-weight: 650; }
h3 { font-size: var(--font-md); margin-bottom: var(--space-2); color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); font-size: var(--font-sm); }
.hint { margin-top: var(--space-2); font-size: 12px; color: var(--muted); }
.inline { display: inline; }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 99px; display: inline-block; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: linear-gradient(180deg, #f8f8f7 0%, #f1f1ee 100%);
}
.login-box {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-7);
}
.login-box h1 {
  color: var(--primary);
  margin-bottom: var(--space-2);
  font-size: 22px;
  line-height: 1.45;
}
.login-box p { margin-top: 0; }
.login-box .hint {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--line);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 248px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 60;
  transition: transform .22s ease;
  padding: var(--space-4) var(--space-3) var(--space-6);
  border-left: 1px solid var(--line);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-5);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}
.sidebar .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}
.brand-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  max-width: 170px;
}
.close-sidebar {
  display: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.close-sidebar:hover { color: var(--ink); background: var(--surface-strong); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-group {
  padding: var(--space-5) var(--space-3) var(--space-2);
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav-group-with-action { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-group-action {
  min-height: auto;
  padding: 2px 4px;
  background: transparent;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 600;
}
.nav-group-action:hover { background: transparent; color: var(--ink); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  padding: 9px var(--space-3);
  border-radius: 10px;
  color: var(--sidebar-ink);
  font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.nav-item .ic,
.ic {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: .72;
  stroke-width: 1.75;
}
.nav-item:hover { background: #ececea; color: var(--ink); }
.nav-item.active {
  background: var(--sidebar-active);
  color: #1f4fc4;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #d8e3ff;
}
.nav-item.active .ic { opacity: 1; }

/* ---------- Topbar + main ---------- */
.content { margin-right: 248px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(6px);
}
.topbar-left { display: flex; align-items: center; gap: var(--space-3); }
.page-title { font-size: 16px; font-weight: 700; }
.menu-toggle,
.menu-toggle-inline {
  display: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover,
.menu-toggle-inline:hover { background: var(--surface-strong); }
.user-box { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; }
.uname { font-weight: 600; }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-soft); }

main {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-6) var(--space-8);
}
.overlay { display: none; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 55; }

/* ---------- Surfaces / layout ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.card-soft { background: var(--surface-soft); }
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.card-link:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---------- Forms ---------- */
label { font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  margin: var(--space-2) 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  flex: none;
  accent-color: var(--primary, #2f6feb);
}
input[type="color"] {
  width: 48px;
  min-width: 48px;
  max-width: 64px;
  padding: 4px;
}
textarea { min-height: 88px; resize: vertical; }
input::placeholder,
textarea::placeholder { color: #94a3b8; }

button {
  border: 0;
  min-height: 38px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, transform .08s ease;
}
button:hover { background: var(--primary-strong); }
button:active { transform: translateY(1px); }
button.secondary { background: #e2e8f0; color: #334155; }
button.secondary:hover { background: #cfd8e6; }
button.link {
  min-height: auto;
  padding: 0 4px;
  background: transparent;
  color: var(--muted);
}
button.link:hover { color: var(--ink); background: transparent; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
}
.button:hover { background: var(--primary-strong); }

/* ---------- States ---------- */
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 1px;
}
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: .6;
  cursor: not-allowed;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

/* ---------- Feedback ---------- */
.alert {
  margin-bottom: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.alert.error { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.alert.success { background: #ecfdf5; border-color: #a7f3d0; color: var(--success); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge.ok { background: #dcfce7; color: #059669; border-color: #86efac; }
.badge.warn { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.badge.bad { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.b-todo { background: #f1f5f9; color: #475569; border-color: #d1d9e6; }
.b-doing { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.b-review { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.b-done { background: #dcfce7; color: #15803d; border-color: #86efac; }
.role-admin { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.role-manager { background: #cffafe; color: #0e7490; border-color: #67e8f9; }
.role-staff { background: #f1f5f9; color: #475569; border-color: #d1d9e6; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; background: color-mix(in srgb, var(--surface-soft) 76%, transparent); }
.strong { font-weight: 700; background: var(--surface-soft); }
table.lines input { width: 100px; }
.table-scroll { overflow-x: auto; }

/* ---------- Stats ---------- */
.stat {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.stat .v { font-size: 28px; font-weight: 700; color: #111827; }
.stat .l { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ---------- Misc ---------- */
.timeline {
  position: relative;
  margin: 6px 0;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.slot {
  position: absolute;
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 11px;
}
.free-window {
  margin: 4px 0;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px dashed #86efac;
  background: #ecfdf5;
  color: #15803d;
  font-size: 13px;
}
.kpi-bar {
  height: 24px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

/* ---------- Chat primitives ---------- */
.chat-message { display: flex; margin-bottom: 8px; }
.chat-message.mine { justify-content: flex-end; }
.chat-message.other { justify-content: flex-start; }
.chat-bubble {
  max-width: 80%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 8px 12px;
  font-size: var(--font-sm);
}
.chat-message.mine .chat-bubble {
  background: #111827;
  border-color: transparent;
  color: #fff;
}
html.dark .chat-message.mine .chat-bubble {
  background: #e5e7eb;
  color: #111827;
}
.chat-meta { opacity: .7; font-size: 11px; }

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.w-auto { width: auto; }

/* ---------- Dark theme ---------- */
html.dark {
  --bg: #0b1120;
  --surface: #111c30;
  --surface-soft: #0e1729;
  --surface-strong: #17243c;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: #23314a;
  --line-strong: #31445f;

  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --sidebar-bg: #111111;
  --sidebar-ink: #a1a1aa;
  --sidebar-active: #1f2937;
  --topbar-bg: rgba(11, 11, 11, 0.9);

  --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.35);
  --shadow-md: 0 10px 26px rgba(2, 6, 23, 0.4);
  --shadow-lg: 0 20px 48px rgba(2, 6, 23, 0.45);
}
html.dark .strong { background: #0f1a2e; }
html.dark .free-window { background: #042b24; border-color: #10b981; color: #6ee7b7; }
html.dark .badge.ok { background: #093523; color: #86efac; border-color: #10b981; }
html.dark .badge.warn { background: #3e2a06; color: #fcd34d; border-color: #d97706; }
html.dark .badge.bad { background: #3e1117; color: #fca5a5; border-color: #dc2626; }
html.dark .icon-btn { background: #0f1a2e; border-color: var(--line); }
html.dark .chat-bubble { background: #0d1728; }
html.dark .nav-item:hover { background: #1a1a1a; color: #f3f4f6; }
html.dark .nav-item.active { color: #93c5fd; box-shadow: inset 0 0 0 1px #374151; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4,
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .sidebar { transform: translateX(100%); box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4); }
  .sidebar.open { transform: translateX(0); }
  .sidebar .close-sidebar { display: inline-grid; place-items: center; }
  .content { margin-right: 0; }
  .menu-toggle,
  .menu-toggle-inline { display: inline-grid; place-items: center; }
  .overlay.show { display: block; }
  .topbar { padding: 0 var(--space-4); }
}
@media (max-width: 760px) {
  main { padding: var(--space-4); }
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5 { grid-template-columns: 1fr; }
  .chat-bubble { max-width: 94%; }
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Notion-style database view ---------- */
.db-view {
  background: transparent;
  margin-bottom: var(--space-6);
}
.db-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: 0 2px;
}
.db-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.db-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink);
  flex: none;
}
.db-icon .ic { width: 18px; height: 18px; opacity: .9; }
.db-title {
  margin: 0;
  font-size: var(--font-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.db-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--font-sm);
}
.db-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.db-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-2);
  border-bottom: 1px solid transparent;
}
.db-chip,
.db-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.db-chip:hover,
.db-filter:hover {
  background: var(--surface-strong);
  color: var(--ink);
}
.db-chip.active,
.db-filter.active {
  background: #e8f0fe;
  color: #1d4ed8;
  border-color: #d2e1fc;
}
html.dark .db-chip.active,
html.dark .db-filter.active {
  background: #1e293b;
  color: #93c5fd;
  border-color: #334155;
}
.db-search {
  min-height: 28px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: var(--font-sm);
  width: min(220px, 100%);
}
.db-search:hover,
.db-search:focus {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}
.db-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.db-panel + .db-panel { margin-top: var(--space-4); }
.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}
.db-table th,
.db-table td {
  text-align: right;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.db-table th {
  background: transparent;
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 500;
  letter-spacing: 0;
}
.db-table tbody tr {
  transition: background .08s ease;
}
.db-table tbody tr:hover {
  background: rgba(55, 53, 47, 0.04);
}
html.dark .db-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}
.db-table tbody tr:last-child td { border-bottom: 0; }
.clickable-row { cursor: pointer; }
.db-cell-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 550;
  color: var(--ink);
}
.db-cell-main:hover { color: var(--primary); }
.db-empty {
  padding: var(--space-7) var(--space-4);
  text-align: center;
  color: var(--muted);
  font-size: var(--font-sm);
}
.db-form {
  display: none;
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.db-form.open { display: block; }
.btn-ghost {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: var(--font-sm);
}
.btn-ghost:hover {
  background: var(--surface-strong);
  color: var(--ink);
}
.btn-soft {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 550;
  font-size: var(--font-sm);
}
.btn-soft:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}
.btn-primary-soft {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 550;
  font-size: var(--font-sm);
}
.btn-primary-soft:hover { background: #1f2326; filter: none; }
html.dark .btn-primary-soft { background: #e5e7eb; color: #111827; }
html.dark .btn-primary-soft:hover { background: #fff; }

/* Notion chat layout */
.chat-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}
.chat-sidebar {
  border-left: 1px solid var(--line);
  background: var(--surface-soft);
  padding: var(--space-3);
  overflow-y: auto;
}
.chat-sidebar h3 {
  margin: var(--space-2) var(--space-2) var(--space-3);
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.chat-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--font-sm);
  margin-bottom: 2px;
}
.chat-channel:hover { background: var(--surface-strong); color: var(--ink); }
.chat-channel.active {
  background: #e8f0fe;
  color: #1d4ed8;
  font-weight: 600;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.chat-main-header h2 {
  margin: 0;
  font-size: var(--font-lg);
}
.chat-composer {
  display: flex;
  gap: var(--space-2);
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-composer input {
  margin: 0;
  flex: 1;
  min-height: 40px;
  border-radius: 8px;
  background: var(--surface-soft);
}
.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: auto;
  min-height: 420px;
  max-height: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  padding: 16px 18px;
}
.chat-bubble {
  border-radius: 8px;
  box-shadow: none;
}
@media (max-width: 920px) {
  .chat-shell { grid-template-columns: 1fr; min-height: auto; }
  .chat-sidebar { border-left: 0; border-bottom: 1px solid var(--line); max-height: 180px; }
}

/* ---------- Notion page dashboard ---------- */
.notion-page {
  position: relative;
  max-width: none;
  width: 100%;
  margin: 0;
  padding-bottom: var(--space-8);
}
.notion-cover {
  height: 168px;
  margin: calc(var(--space-5) * -1) calc(var(--space-6) * -1) 0;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(47, 111, 235, 0.12), rgba(124, 58, 237, 0.08)),
    linear-gradient(180deg, #f1f1ee, #fbfbfa);
  border-bottom: 1px solid var(--line);
}
html.dark .notion-cover {
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(124, 58, 237, 0.12)),
    linear-gradient(180deg, #151515, #0b0b0b);
}
.notion-page-icon {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}
/* Icon overlaps cover when it follows cover directly (dashboard style) */
.notion-page > .notion-cover + .notion-page-icon {
  margin-top: -44px;
}
.notion-page-icon .ic { width: 32px; height: 32px; opacity: .95; }
.notion-page-title {
  margin: 0 0 6px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.notion-page-desc {
  color: var(--muted);
  font-size: var(--font-md);
  margin-bottom: var(--space-5);
}
.notion-props {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: var(--space-5);
}
.notion-prop {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: start;
  min-height: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.notion-prop:hover { background: var(--surface-soft); }
html.dark .notion-prop:hover { background: #171717; }
.notion-prop-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--font-sm);
}
.notion-prop-value {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.notion-favorites {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.notion-fav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: background .15s ease, border-color .15s ease;
}
.notion-fav:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}
.notion-fav .ic { opacity: .8; }
.notion-fav span { font-size: var(--font-sm); font-weight: 550; }
.notion-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7f6f3;
  margin-bottom: var(--space-3);
}
html.dark .notion-callout { background: #171717; }
.notion-callout.warn {
  background: #fef9ec;
  border-color: #f5e6b8;
}
html.dark .notion-callout.warn { background: #2a230f; border-color: #5c4d1d; }
.notion-callout.info {
  background: #eef3ff;
  border-color: #d7e3ff;
}
html.dark .notion-callout.info { background: #132038; border-color: #243b61; }
.notion-callout.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
html.dark .notion-callout.ok { background: #052e1a; border-color: #14532d; }
.notion-callout .ic { margin-top: 2px; opacity: .85; }
.notion-callout-body { flex: 1; min-width: 0; font-size: var(--font-sm); }
.notion-callout-body strong { display: block; margin-bottom: 2px; }
.notion-section {
  margin: var(--space-6) 0 var(--space-4);
}
.notion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--font-lg);
  font-weight: 650;
  text-align: right;
  cursor: pointer;
  border-radius: 6px;
}
.notion-toggle:hover { background: rgba(55, 53, 47, 0.04); }
.notion-caret {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform .15s ease;
}
.notion-toggle[aria-expanded="false"] .notion-caret { transform: rotate(-90deg); }
.notion-toggle-panel { margin-top: var(--space-2); }
.notion-toggle-panel[hidden] { display: none !important; }
.notion-kpi-item {
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.notion-kpi-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.notion-kpi-lbl {
  margin-top: 6px;
  font-size: var(--font-xs);
  color: var(--muted);
}
.notion-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.notion-kpi {
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.notion-kpi .v {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.notion-kpi .l {
  margin-top: 6px;
  font-size: var(--font-xs);
  color: var(--muted);
}
.notion-kpi:has(.notion-kpi-item) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
  padding: 0;
  border: 0;
  background: transparent;
  margin-bottom: var(--space-4);
}
.notion-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: var(--space-3) 0 var(--space-5);
}
.notion-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.notion-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .notion-favorites { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notion-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  main { padding: var(--space-4); }
  .notion-cover {
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) 0;
    height: 120px;
  }
  .db-view > .db-header::before {
    height: 100px;
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) 14px;
  }
  .notion-page-title { font-size: 28px; }
  .notion-props { grid-template-columns: 1fr 1fr; gap: 8px; }
  .notion-prop { padding: 12px; }
  .notion-prop-value { font-size: 16px; }
  .notion-favorites,
  .notion-kpi-row { grid-template-columns: 1fr 1fr; }
  .page-notes { padding-inline: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
  .notion-caret,
  .notion-fav,
  .db-chip,
  .btn-ghost,
  .btn-soft { transition: none !important; }
}

/* ---------- Sidebar search / favorites / stars ---------- */
.sb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  margin: 0 4px 10px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: var(--font-sm);
  cursor: pointer;
}
.sb-search:hover { background: var(--surface-strong); color: var(--ink); }
.sb-search span { flex: 1; text-align: right; }
.sb-search kbd,
.topbar-cmd kbd,
.cmd-input-wrap kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--muted);
  background: var(--surface-soft);
}
.nav-item {
  position: relative;
  padding-left: 28px;
}
.nav-star {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #c4c4c0;
  font-size: 13px;
  line-height: 1;
  border-radius: 4px;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  min-height: auto;
}
.nav-item:hover .nav-star,
.nav-star.on { opacity: 1; }
.nav-star.on { color: #d4a017; }
.nav-star:hover { background: var(--surface-strong); color: #b45309; }
.nav-soft-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.nav-recent-row { display: flex; align-items: center; gap: 2px; }
.nav-recent-row .nav-item-soft { flex: 1; min-width: 0; }
.nav-recent-remove {
  min-height: 26px;
  padding: 2px 7px;
  background: transparent;
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  opacity: .65;
}
.nav-recent-row:hover .nav-recent-remove,
.nav-recent-remove:focus-visible { opacity: 1; }
.nav-recent-remove:hover { background: var(--surface-strong); color: var(--danger, #dc2626); }
.nav-item-soft {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 13px;
}
.nav-empty {
  padding: 4px 12px 10px;
  color: #9ca3af;
  font-size: 12px;
}
.nav-fold {
  margin: 2px 0 4px;
  border-radius: 10px;
}
.nav-fold-sum {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  user-select: none;
}
.nav-fold-sum::-webkit-details-marker { display: none; }
.nav-fold-sum::after {
  content: "▾";
  font-size: 11px;
  opacity: .7;
  transition: transform .18s ease;
}
.nav-fold:not([open]) .nav-fold-sum::after { transform: rotate(-90deg); }
.nav-fold-sum:hover { background: #ececea; color: var(--ink); }
html.dark .nav-fold-sum:hover { background: #1a1a1a; }
.nav-fold[open] > .nav-item {
  animation: navItemIn .18s ease both;
}
.nav-badge {
  margin-right: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.nav-badge[hidden],
.top-notif-badge[hidden] {
  display: none !important;
}
.topbar-notif { position: relative; }
.top-notif-badge {
  position: absolute;
  top: -2px;
  left: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}
@keyframes navItemIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes softRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.notion-page,
.db-view,
.wiki-workspace {
  animation: softRise .28s ease both;
}
.topbar-cmd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

/* ---------- Command palette ---------- */
.cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: transparent;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
}
.cmd-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(15, 15, 15, 0.35);
  cursor: pointer;
}
.cmd-palette[hidden] { display: none !important; }
.cmd-dialog {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 640px);
}
.cmd-sheet-handle { display: none; }
.cmd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 0;
  border-bottom: 1px solid transparent;
}
.cmd-head .cmd-tabs {
  flex: 1;
  border-bottom: 0;
  padding: 0;
}
.cmd-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.cmd-close:hover { background: var(--surface-soft, #f3f3f1); color: var(--ink); }
.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.cmd-slash {
  color: var(--muted);
  font-weight: 700;
}
.cmd-input-wrap input {
  margin: 0;
  border: 0;
  box-shadow: none !important;
  min-height: 28px;
  padding: 0;
  background: transparent;
}
.cmd-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: right;
  cursor: pointer;
}
.cmd-item:hover,
.cmd-item.active { background: #eef3ff; }
html.dark .cmd-item:hover,
html.dark .cmd-item.active { background: #1f2937; }
.cmd-item-hint { color: var(--muted); font-size: 12px; }
.cmd-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.cmd-hint {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-soft);
}
.cmd-hint code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- Soft link cards / week grid ---------- */
.notion-card-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.notion-card-link:hover {
  background: var(--surface-strong);
  border-color: #93b4f5;
}
.week-cell {
  text-align: center;
  font-size: 11px;
  line-height: 1.35;
  vertical-align: middle;
  min-width: 52px;
}
.week-cell span { display: block; }
.week-present { background: #dcfce7; }
.week-late { background: #fef3c7; }
.week-absent { background: #fee2e2; }
.week-half { background: #fed7aa; }
html.dark .week-present { background: #14532d66; }
html.dark .week-late { background: #854d0e55; }
html.dark .week-absent { background: #7f1d1d55; }
html.dark .week-half { background: #9a341255; }

.nav-item-soft {
  padding-left: 10px;
}
.nav-soft-list .nav-item.active,
.nav-soft-list .nav-item-soft[href].active {
  background: #eef3ff;
  color: #1d4ed8;
}
html.dark .nav-soft-list .nav-item.active {
  background: #1f2937;
  color: #93c5fd;
}

/* ---------- Jalali date widget ---------- */
.jdate-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: 140px;
}
.jdate-display {
  margin: 0 !important;
  min-height: 32px;
  width: 100%;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  direction: ltr;
  text-align: center;
}
.jdate-display.jdate-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.15);
}
.db-form .jdate-wrap,
.row .jdate-wrap,
.grid .jdate-wrap { width: 100%; }


/* ---------- Notion database elevation ---------- */
.notion-page-wide {
  max-width: none;
  width: 100%;
}
.notion-page-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}
.notion-page > .notion-cover + .notion-page-top {
  margin-top: -44px;
}
.notion-page-top .notion-page-icon { margin-top: 0; margin-bottom: 0; }
.notion-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.notion-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 13px;
  position: relative;
  z-index: 3;
}
/* Breadcrumbs sit on the banner — no clash with the page icon */
.notion-page > .notion-cover + .notion-crumbs {
  position: absolute;
  top: 14px;
  inset-inline: 0;
  margin: 0;
  padding: 0 2px;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.notion-page > .notion-cover + .notion-crumbs + .notion-page-top,
.notion-page > .notion-cover + .notion-crumbs + .notion-page-icon {
  margin-top: -44px;
}
.notion-crumbs a { color: inherit; }
.notion-crumbs a:hover { color: var(--ink); }
.notion-crumb-sep { opacity: .5; }
.notion-crumb-current { color: var(--ink); font-weight: 600; }

.notion-cover.tone-blue {
  background:
    linear-gradient(125deg, rgba(37,99,235,.22), rgba(14,165,233,.08) 55%, transparent),
    linear-gradient(180deg, #e8eefc, #fbfbfa);
}
.notion-cover.tone-teal {
  background:
    linear-gradient(125deg, rgba(13,148,136,.2), rgba(45,212,191,.08) 55%, transparent),
    linear-gradient(180deg, #e6f7f5, #fbfbfa);
}
.notion-cover.tone-green {
  background:
    linear-gradient(125deg, rgba(5,150,105,.18), rgba(52,211,153,.08) 55%, transparent),
    linear-gradient(180deg, #e8f8f0, #fbfbfa);
}
.notion-cover.tone-amber {
  background:
    linear-gradient(125deg, rgba(217,119,6,.18), rgba(251,191,36,.08) 55%, transparent),
    linear-gradient(180deg, #fff6e8, #fbfbfa);
}
.notion-cover.tone-rose {
  background:
    linear-gradient(125deg, rgba(225,29,72,.14), rgba(251,113,133,.08) 55%, transparent),
    linear-gradient(180deg, #fff0f3, #fbfbfa);
}
.notion-cover.tone-violet {
  background:
    linear-gradient(125deg, rgba(109,40,217,.16), rgba(167,139,250,.08) 55%, transparent),
    linear-gradient(180deg, #f3eefc, #fbfbfa);
}
.notion-cover.tone-slate {
  background:
    linear-gradient(125deg, rgba(71,85,105,.16), rgba(148,163,184,.08) 55%, transparent),
    linear-gradient(180deg, #eef1f4, #fbfbfa);
}
html.dark .notion-cover.tone-blue { background: linear-gradient(125deg, rgba(59,130,246,.28), rgba(14,165,233,.1)), linear-gradient(180deg,#151515,#0b0b0b); }
html.dark .notion-cover.tone-teal { background: linear-gradient(125deg, rgba(45,212,191,.22), rgba(13,148,136,.1)), linear-gradient(180deg,#151515,#0b0b0b); }
html.dark .notion-cover.tone-green { background: linear-gradient(125deg, rgba(16,185,129,.24), rgba(52,211,153,.1)), linear-gradient(180deg,#151515,#0b0b0b); }
html.dark .notion-cover.tone-amber { background: linear-gradient(125deg, rgba(245,158,11,.24), rgba(251,191,36,.1)), linear-gradient(180deg,#151515,#0b0b0b); }
html.dark .notion-cover.tone-rose { background: linear-gradient(125deg, rgba(244,63,94,.22), rgba(251,113,133,.1)), linear-gradient(180deg,#151515,#0b0b0b); }
html.dark .notion-cover.tone-violet { background: linear-gradient(125deg, rgba(139,92,246,.24), rgba(167,139,250,.1)), linear-gradient(180deg,#151515,#0b0b0b); }
html.dark .notion-cover.tone-slate { background: linear-gradient(125deg, rgba(148,163,184,.2), rgba(100,116,139,.1)), linear-gradient(180deg,#151515,#0b0b0b); }

/* Elevate every db-view to feel like a Notion database page */
.db-view {
  position: relative;
  max-width: none;
  width: 100%;
  margin: 0;
}
.db-view > .db-header {
  position: relative;
  padding-top: 8px;
  margin-bottom: 18px;
}
.db-view > .db-header::before {
  content: "";
  display: block;
  height: 140px;
  margin: calc(var(--space-5) * -1) calc(var(--space-6) * -1) 18px;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(47,111,235,.12), rgba(124,58,237,.06)),
    linear-gradient(180deg, #f3f3f0, transparent);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}
html.dark .db-view > .db-header::before {
  background:
    linear-gradient(135deg, rgba(59,130,246,.16), rgba(124,58,237,.08)),
    linear-gradient(180deg, #171717, transparent);
}
.db-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}
.db-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  background: var(--surface);
}
.db-subtitle { margin-top: 4px; font-size: 14px; }

.notion-views,
.db-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  width: fit-content;
  max-width: 100%;
}
.notion-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.notion-view-tab .ic { width: 14px; height: 14px; opacity: .75; }
.notion-view-tab:hover { color: var(--ink); background: var(--surface); }
.notion-view-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Board (kanban) */
.notion-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: start;
}
.notion-board-col {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 160px;
}
.notion-board-col-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 650;
}
.notion-board-card {
  display: block;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .12s ease, transform .12s ease;
}
.notion-board-card:hover {
  border-color: #93b4f5;
  transform: translateY(-1px);
}
.notion-board-card .t { font-weight: 600; margin-bottom: 6px; }
.notion-board-card .m { color: var(--muted); font-size: 12px; }

/* Gallery */
.notion-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.notion-gallery-card {
  display: flex;
  flex-direction: column;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.notion-gallery-card:hover {
  border-color: #93b4f5;
  box-shadow: var(--shadow-md);
}
.notion-gallery-cover {
  height: 64px;
  background: linear-gradient(135deg, rgba(47,111,235,.14), rgba(16,185,129,.1));
}
.notion-gallery-body { padding: 12px 14px 14px; flex: 1; }
.notion-gallery-body .t { font-weight: 650; margin-bottom: 4px; }
.notion-gallery-body .m { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* List view */
.notion-list { display: flex; flex-direction: column; gap: 2px; }
.notion-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.notion-list-item:hover { background: rgba(55,53,47,.04); }
html.dark .notion-list-item:hover { background: rgba(255,255,255,.04); }
.notion-list-item .t { flex: 1; font-weight: 550; }
.notion-list-item .m { color: var(--muted); font-size: 12px; }

.db-table tbody tr { transition: background .1s ease; }
.db-table tbody tr:hover { background: rgba(47,111,235,.04); }
html.dark .db-table tbody tr:hover { background: rgba(59,130,246,.08); }
.db-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background:
    radial-gradient(circle at top, rgba(47,111,235,.05), transparent 55%);
}
.db-panel {
  border-radius: 12px;
  overflow: hidden;
}
.db-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg, #fbfbfa) 88%, transparent);
  padding: 8px 0;
  margin-bottom: 10px;
}
html.dark .db-toolbar {
  background: color-mix(in srgb, #0b0b0b 88%, transparent);
}

.notion-page .db-view { max-width: none; }
.notion-page .db-view > .db-header { display: none; }
.notion-page .db-view > .db-header::before { display: none; }
.db-view:has(> .notion-cover) > .db-header::before { display: none; }

@media (max-width: 760px) {
  .db-title { font-size: 28px; }
  .notion-page-title { font-size: 30px; }
  .notion-favorites { grid-template-columns: 1fr 1fr; }
}

/* ---------- PWA / Mobile web-app shell ---------- */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 0px;
}
body.app-shell {
  min-height: 100dvh;
  padding-top: var(--safe-top);
}
body.has-user {
  --tabbar-h: calc(64px + var(--safe-bottom));
}

.mobile-tabbar,
.fab-create,
.pwa-install,
.more-sheet {
  display: none;
}

@media (max-width: 920px) {
  body.has-user {
    padding-bottom: var(--tabbar-h);
  }
  body.has-user .content {
    min-height: calc(100dvh - var(--safe-top) - var(--tabbar-h));
  }
  body.has-user main {
    padding-bottom: calc(var(--space-6) + 56px);
  }

  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 90;
    height: calc(64px + var(--safe-bottom));
    padding: 6px 4px calc(6px + var(--safe-bottom));
    background: color-mix(in srgb, var(--surface, #fff) 92%, transparent);
    backdrop-filter: blur(14px) saturate(1.2);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.06);
  }
  html.dark .mobile-tabbar {
    background: color-mix(in srgb, #111 92%, transparent);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
  }
  .mtab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    border: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    padding: 4px 2px;
    -webkit-tap-highlight-color: transparent;
  }
  .mtab .ic { width: 22px; height: 22px; opacity: .85; }
  .mtab.active {
    color: var(--accent, #2f6feb);
    background: rgba(47, 111, 235, 0.08);
  }
  html.dark .mtab.active { background: rgba(59, 130, 246, 0.14); }

  .fab-create {
    display: grid;
    place-items: center;
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    bottom: calc(var(--tabbar-h) + 14px);
    z-index: 95;
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.38);
    -webkit-tap-highlight-color: transparent;
  }
  .fab-plus {
    font-size: 30px;
    line-height: 1;
    font-weight: 400;
    margin-top: -2px;
  }
  .fab-create:active { transform: scale(0.96); }

  .topbar-cmd span,
  .topbar-cmd kbd,
  .user-box .uname,
  .topbar-user-dot,
  .topbar-theme,
  .topbar-logout { display: none; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--bg, #fbfbfa) 86%, transparent);
    min-height: 52px;
    padding-top: 4px;
  }
  .user-box { gap: 4px; }
  .topbar-cmd {
    min-width: 36px;
    padding: 0 8px;
    justify-content: center;
  }
  .online-dot { margin-inline: 2px; }
  body.has-user main {
    padding-bottom: calc(var(--space-6) + 72px);
    padding-inline-start: max(12px, env(safe-area-inset-left));
    padding-inline-end: max(12px, env(safe-area-inset-right));
  }
  .notion-page-top {
    flex-wrap: wrap;
    margin-top: -28px;
    align-items: flex-start;
  }
  .notion-page-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .att-self-status {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
  }
  .notion-crumbs {
    position: relative;
    z-index: 2;
    margin-bottom: 8px;
  }
  .db-toolbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: calc(10px + 4px);
  }
  .db-toolbar .db-chip {
    flex: 0 0 auto;
  }
  .more-sheet-head {
    align-items: center;
    margin-bottom: 8px;
  }
  .more-sheet-title { margin-bottom: 0; }
  .more-grid {
    max-height: min(62vh, 520px);
    overflow-y: auto;
    padding-bottom: 4px;
  }
  .more-sheet-push { display: none !important; }
  html.dark .topbar {
    background: color-mix(in srgb, #0b0b0b 86%, transparent);
  }
  .menu-toggle { display: none !important; }

  .cmd-palette {
    align-items: end;
    place-items: end center;
    padding: 0;
  }
  .cmd-dialog {
    width: 100%;
    max-width: none;
    height: auto;
    max-height: min(88vh, 720px);
    border-radius: 18px 18px 0 0;
    border: 0;
    padding-bottom: var(--safe-bottom);
    animation: sheetUp .22s ease;
  }
  .cmd-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--line);
    margin: 8px auto 4px;
  }
  .cmd-results { max-height: none; flex: 1; min-height: 180px; }
  .cmd-input-wrap kbd { display: none; }

  .more-sheet { display: block; }
  .more-sheet[hidden] { display: none !important; }
  .more-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(15, 23, 42, 0.42);
  }
  .more-sheet-panel {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 120;
    background: var(--surface, #fff);
    border-radius: 20px 20px 0 0;
    padding: 10px 16px calc(18px + var(--safe-bottom));
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
    animation: sheetUp .22s ease;
  }
  html.dark .more-sheet-panel { background: #141414; }
  .more-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--line);
    margin: 4px auto 14px;
  }
  .more-sheet-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
  }
  .more-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .more-grid a,
  .more-grid button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 78px;
    padding: 10px 6px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-soft, #f7f7f5);
    color: inherit;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
  }
  .more-grid .ic { width: 22px; height: 22px; }
  html.dark .more-grid a,
  html.dark .more-grid button { background: #1a1a1a; }

  .more-reload-btn {
    grid-column: 1 / -1;
    flex-direction: row !important;
    gap: 10px !important;
    min-height: 48px !important;
    background: rgba(47, 111, 235, 0.1) !important;
    border-color: rgba(47, 111, 235, 0.35) !important;
    color: #1d4ed8 !important;
  }
  html.dark .more-reload-btn {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #93c5fd !important;
  }
  .more-reload-ico { font-size: 18px; font-weight: 700; line-height: 1; }
  .more-reload-hint {
    margin: 12px 4px 4px;
    font-size: 11px;
    line-height: 1.55;
    color: var(--muted);
  }

  .pwa-update {
    display: block;
    position: fixed;
    inset-inline: 12px;
    bottom: calc(var(--tabbar-h) + 78px);
    z-index: 110;
  }
  .pwa-update[hidden] { display: none !important; }
  .pwa-update-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(47, 111, 235, 0.35);
    background: var(--surface, #fff);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
  }
  html.dark .pwa-update-inner { background: #171717; }
  .pwa-update-inner strong { font-size: 13px; }
  .pwa-update-inner span { font-size: 12px; color: var(--muted); flex: 1 1 120px; }

  .pwa-install {
    display: block;
    position: fixed;
    inset-inline: 12px;
    bottom: calc(var(--tabbar-h) + 78px);
    z-index: 100;
  }
  .pwa-install[hidden] { display: none !important; }
  .pwa-install-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--surface, #fff);
    border: 1px solid var(--line);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
  }
  html.dark .pwa-install-inner { background: #171717; }
  .pwa-install-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #2f6feb;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    flex: none;
  }
  .pwa-install-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--muted);
  }
  .pwa-install-copy strong {
    color: var(--ink);
    font-size: 13px;
  }
  .pwa-dismiss {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    padding: 6px;
  }

  .notion-page { padding-bottom: 24px; }
  .notion-page-title { font-size: 28px; }
  .notion-props { grid-template-columns: 1fr 1fr; }
  .db-actions { width: 100%; }
  .db-actions .btn-primary-soft,
  .db-actions .btn-soft { width: 100%; justify-content: center; }
  .db-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .db-form { grid-template-columns: 1fr !important; }
}

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

/* Standalone / installed PWA */
@media (display-mode: standalone) {
  body.app-shell { background: var(--bg, #fbfbfa); }
  .topbar { border-bottom-color: transparent; }
}

/* ---------- Notion polish: cover always visible ---------- */
.notion-cover-wrap { position: relative; }
.notion-cover-tools,
[data-cover-tools],
button.notion-cover-toggle,
.cover-tone-picker {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.att-self-status {
  margin: 0 0 14px;
  font-size: 13px;
}

/* Project contacts */
.proj-contacts-block {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-soft, #f7f7f5);
}
html.dark .proj-contacts-block { background: #141414; }
.proj-contact-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proj-contact-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1.2fr auto;
  gap: 8px;
  align-items: center;
}
.proj-contact-row input {
  margin: 0;
  min-width: 0;
}
@media (max-width: 920px) {
  .proj-contact-row { grid-template-columns: 1fr 1fr; }
  .proj-contact-row .contact-del { grid-column: 2; justify-self: end; }
}

/* iOS install sheet */
.ios-install-sheet {
  position: fixed;
  inset: 0;
  z-index: 140;
}
.ios-install-sheet[hidden] { display: none !important; }
.ios-install-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.ios-install-panel {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,.18);
  animation: sheetUp .22s ease;
}
html.dark .ios-install-panel { background: #141414; }
.ios-install-steps {
  margin: 0;
  padding-inline-start: 18px;
  display: grid;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.notion-empty-pro {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(47,111,235,.07), transparent 55%);
}
.notion-empty-pro .ic {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  opacity: .7;
}
.notion-empty-pro h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.notion-empty-pro p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.db-table tbody tr {
  position: relative;
}
.row-hover-actions {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 4px;
}
.db-table tbody tr:hover .row-hover-actions { display: flex; }
.row-hover-actions a,
.row-hover-actions button {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
@media (max-width: 920px) {
  .row-hover-actions { display: none !important; }
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.online-dot.offline { background: #ef4444; }

/* Calendar database view */
.notion-cal {
  display: grid;
  gap: 10px;
}
.notion-cal-day {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
}
.notion-cal-day-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.notion-cal-item {
  display: block;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(47, 111, 235, 0.06);
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
}
.notion-cal-item:hover { background: rgba(47, 111, 235, 0.12); }
html.dark .notion-cal-item { background: rgba(59, 130, 246, 0.12); }

/* ---------- Page notes / Notion blocks ---------- */
.page-notes {
  position: relative;
  max-width: none;
  width: min(1480px, 100%);
  margin: 28px auto 40px;
  padding: 0 var(--space-6) 24px;
}
.page-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.page-notes-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 4px 2px;
  font: inherit;
}
.page-notes-toggle strong { font-size: 15px; }
.page-notes-hint { color: var(--muted); font-size: 12px; font-weight: 500; }
.page-notes-caret { color: var(--muted); transition: transform .15s ease; }
.page-notes.is-collapsed .page-notes-caret { transform: rotate(-90deg); }
.page-notes.is-collapsed .page-notes-body { display: none; }
.page-notes-tools { display: flex; align-items: center; gap: 8px; }
.page-notes-status { font-size: 11px; color: var(--muted); }

.notion-editor {
  position: relative;
  min-height: 48px;
  /* Gutter for block controls sits outside text (inline-start = right in RTL) */
  padding-inline-start: 36px;
  padding-inline-end: 4px;
}
.nb {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 3px 4px;
  border-radius: 6px;
  margin: 2px 0;
  min-height: 32px;
}
.nb:hover { background: rgba(55, 53, 47, 0.03); }
html.dark .nb:hover { background: rgba(255,255,255,0.03); }
.nb.dragging { opacity: .45; }
.nb.drag-over { box-shadow: inset 0 2px 0 #2f6feb; }
 .nb-actions {
  position: absolute;
  inset-inline-start: -38px;
  top: 4px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 5;
  padding: 1px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface, #fff) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  pointer-events: auto;
  width: 28px;
}
.nb:hover > .nb-actions,
.nb:focus-within > .nb-actions,
.nb.has-comments > .nb-actions { display: flex; }
.nb-actions button {
  width: 24px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  font-size: 11px;
  line-height: 1;
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
}
.nb-actions button:hover {
  background: rgba(55,53,47,.08);
  color: var(--ink);
}
.nb-actions .nb-plus,
.nb-actions .nb-more,
.nb-actions .nb-comment,
.nb-actions .nb-up,
.nb-actions .nb-down,
.nb-actions .nb-delete { cursor: pointer; }
.nb-actions .nb-delete { color: #dc2626; }
.nb-actions .nb-delete:hover { background: rgba(220,38,38,.12); }
.nb-comment.has-count { color: var(--accent, #2f6feb); }
.nb-comments {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(55,53,47,.04);
  border: 1px solid var(--line);
  font-size: 12px;
}
.nb-comment-item { padding: 4px 0; border-bottom: 1px solid var(--line); }
.nb-comment-item:last-child { border-bottom: 0; }
.nb-comment-meta { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.nb-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.nb-prefix {
  flex: none;
  width: 22px;
  text-align: center;
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
}
.nb-check { margin-top: 8px; width: 16px; height: 16px; flex: none; }
.nb-toggle-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 22px; margin-top: 4px; font-size: 12px; flex: none;
}
.nb-text {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 15px;
  padding: 4px 2px;
}
.nb-text:empty:before {
  content: attr(data-placeholder);
  color: #9b9a97;
  pointer-events: none;
}
.nb-h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.nb-h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.nb-h3 { font-size: 18px; font-weight: 650; line-height: 1.35; }
.nb-quote {
  border-right: 3px solid var(--line);
  padding-right: 12px;
  color: var(--muted);
  font-size: 16px;
}
.nb-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: rgba(55,53,47,.06);
  border-radius: 8px;
  padding: 10px 12px;
  direction: ltr;
  text-align: left;
}
html.dark .nb-code { background: rgba(255,255,255,.06); }
.nb-type-callout .nb-row {
  background: rgba(47,111,235,.06);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(47,111,235,.12);
}
.nb-type-todo.is-checked .nb-text { text-decoration: line-through; color: var(--muted); }
.nb-divider { padding: 3px 4px; }
.nb-divider hr {
  border: 0; border-top: 1px solid var(--line); margin: 14px 0;
}
.nb-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 3px 4px;
}
.nb-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.nb-table table { width: 100%; border-collapse: collapse; }
.nb-table td {
  border: 1px solid var(--line);
  min-width: 120px;
  padding: 8px 10px;
  outline: none;
  vertical-align: top;
}
.nb-col {
  min-height: 64px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  outline: none;
}
.nb-col:empty:before {
  content: attr(data-placeholder);
  color: #9b9a97;
}
.nb-media img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.nb-placeholder {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.nb-url {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}
.nb-bookmark-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface-soft, #f7f7f5);
}
.nb-bookmark-title { font-weight: 650; margin-bottom: 6px; }
.nb-toggle-body { padding: 4px 0 4px 30px; }

.slash-menu {
  position: absolute;
  z-index: 50;
  max-height: 320px;
  overflow: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.16);
  padding: 6px;
}
html.dark .slash-menu { background: #171717; }
.slash-cat {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 10px 4px;
  text-transform: none;
}
.slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: right;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.slash-item:hover,
.slash-item.active { background: rgba(47,111,235,.08); }
.slash-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  background: var(--surface-soft, #f7f7f5);
  font-size: 12px; font-weight: 700; flex: none;
}
.slash-label { display: flex; flex-direction: column; gap: 1px; }
.slash-label strong { font-size: 13px; font-weight: 650; }
.slash-label small { color: var(--muted); font-size: 11px; }
.slash-empty { padding: 16px; color: var(--muted); text-align: center; }

.cmd-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
}
.cmd-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.cmd-tab.active {
  background: rgba(47,111,235,.1);
  color: var(--accent, #2f6feb);
}
.cmd-cat {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 12px 4px;
}
.cmd-item-ico {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700;
  margin-left: 8px;
  flex: none;
}
.cmd-item { display: flex; align-items: center; }

@media (max-width: 920px) {
  .page-notes { margin: 16px 0 88px; padding: 0 4px 20px; }
  .page-notes-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }
  .page-notes-toggle {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 4px;
  }
  .page-notes-hint { display: none; }
  .page-notes-tools {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-notes-tools .btn-soft,
  .page-notes-add,
  .page-notes-wiki-link {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
  }
  .page-notes-mobile-tip {
    display: block !important;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(47, 111, 235, 0.08);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
  }
  .notion-editor { padding-inline-start: 36px; }
  .nb { padding: 4px 6px; border-radius: 8px; }
  .nb-actions {
    display: flex !important;
    opacity: 0.7;
    inset-inline-start: -36px;
    width: 30px;
  }
  .nb-actions button {
    width: 26px;
    height: 24px;
    font-size: 12px;
  }
  .nb:active > .nb-actions,
  .nb.is-focused > .nb-actions,
  .nb:focus-within > .nb-actions {
    opacity: 1;
  }
  .nb-columns { grid-template-columns: 1fr; padding-left: 8px; }
  .slash-menu { max-height: 45vh; }
  .topbar-reload {
    display: inline-grid !important;
    place-items: center;
    font-size: 18px;
    font-weight: 700;
  }
}

/* ---------- Wiki pages ---------- */
.wiki-nav-create { margin: 2px 8px 8px; }
.wiki-nav-create .nav-create-page {
  width: 100%;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
  justify-content: flex-start;
}
.wiki-nav-create .nav-create-page:hover {
  color: var(--ink);
  background: rgba(47,111,235,.06);
  border-style: solid;
}
.wiki-nav-ico { margin-left: 6px; }

.wiki-create-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.wiki-create-input {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.wiki-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  transition: transform .12s ease, box-shadow .12s ease;
}
.wiki-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
}
.wiki-card-cover { height: 72px; }
.wiki-card-cover.tone-blue { background: linear-gradient(135deg, rgba(47,111,235,.2), rgba(14,165,233,.08)); }
.wiki-card-cover.tone-green { background: linear-gradient(135deg, rgba(16,185,129,.2), rgba(52,211,153,.08)); }
.wiki-card-cover.tone-amber { background: linear-gradient(135deg, rgba(245,158,11,.22), rgba(251,191,36,.08)); }
.wiki-card-cover.tone-rose { background: linear-gradient(135deg, rgba(244,63,94,.18), rgba(251,113,133,.08)); }
.wiki-card-cover.tone-slate { background: linear-gradient(135deg, rgba(100,116,139,.18), rgba(148,163,184,.08)); }
.wiki-card-body { padding: 12px 14px 16px; }
.wiki-card-icon { font-size: 28px; margin-top: -28px; margin-bottom: 6px; }
.wiki-card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.wiki-card-meta { color: var(--muted); font-size: 12px; }

.wiki-workspace .notion-page-icon,
.wiki-icon-btn {
  border: 0;
  cursor: pointer;
  font-size: 40px;
  line-height: 1;
  background: var(--surface);
}
.wiki-title:empty:before {
  content: attr(data-placeholder);
  color: #9b9a97;
}
.wiki-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--space-5);
}
.wiki-subpages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft, #f7f7f5);
}
.wiki-subpages-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.wiki-subpage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.wiki-subpage:hover { background: rgba(47,111,235,.06); }

.wiki-editor-shell {
  position: relative;
  min-height: 280px;
  padding: 8px 0 48px;
  border-top: 1px solid var(--line);
}
.wiki-main-editor { max-width: 100%; }

.nb-page-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(47,111,235,.06);
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  margin: 2px 0;
}
.nb-page-chip:hover { background: rgba(47,111,235,.12); }
.nb-page-chip-ico { font-size: 16px; }

.page-notes-mobile-tip { display: none; }
.page-notes-mobile-tip[hidden] { display: none !important; }

.topbar-reload {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.page-notes {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 18px;
}
.notion-props {
  position: relative;
  z-index: 1;
}

/* Entity picker (replaces prompt) */
.entity-picker {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
}
.entity-picker[hidden] { display: none !important; }
.entity-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.entity-picker-panel {
  position: relative;
  width: min(440px, 100%);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}
html.dark .entity-picker-panel { background: #171717; }
.entity-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
#entityPickerInput {
  margin: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: var(--surface-soft, #f7f7f5);
  color: inherit;
}
.entity-picker-list {
  overflow: auto;
  padding: 6px;
  flex: 1;
}
.entity-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: right;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.entity-picker-item:hover { background: rgba(47,111,235,.08); }
.entity-picker-item small { display: block; color: var(--muted); font-size: 11px; }
.entity-picker-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line);
}
.entity-tpl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
}

.wiki-tpl-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 20px;
}
.wiki-tpl-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  color: inherit;
}
.wiki-tpl-card:hover { border-color: #2f6feb; background: rgba(47,111,235,.05); }
.wiki-tpl-ico { font-size: 20px; }
.wiki-tpl-select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.wiki-backlinks {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.wiki-backlinks-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.wiki-backlink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.wiki-backlink:hover { background: rgba(47,111,235,.06); }

/* Kiosk: strip Notion chrome */
body.kiosk-mode .sidebar,
body.kiosk-mode .tabbar,
body.kiosk-mode .fab-create,
body.kiosk-mode #pageNotes,
body.kiosk-mode .pwa-install-banner,
body.kiosk-mode .more-sheet,
body.kiosk-mode .menu-toggle,
body.kiosk-mode .top-nav-extra,
body.kiosk-mode #wikiNavList { display: none !important; }
body.kiosk-mode .app-shell { background: var(--bg, #f7f7f5); }
body.kiosk-mode main { max-width: 560px; margin: 0 auto; padding-top: 48px; }

/* Project workspace tabs */
.ws-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 8px;
  border-bottom: 1px solid var(--line);
}
.ws-tab {
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
  font-size: 13px;
}
.ws-tab:hover { color: var(--ink); background: rgba(55,53,47,.04); }
.ws-tab.active {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-color: var(--surface);
  margin-bottom: -1px;
}

/* Wiki custom database */
.wiki-db-panel {
  margin: 18px 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.wiki-db-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(55,53,47,.02);
}
.wiki-db-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.wiki-db-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wiki-db-table th,
.wiki-db-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: right;
  vertical-align: middle;
}
.wiki-db-table th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  background: rgba(55,53,47,.03);
}
.wiki-db-table input,
.wiki-db-table select {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  outline: none;
  padding: 4px 0;
}
.wiki-db-table input:focus,
.wiki-db-table select:focus {
  background: rgba(47,111,235,.06);
  border-radius: 4px;
  padding: 4px 6px;
}
.wiki-db-filter {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  align-items: center;
}
.wiki-db-filter input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  background: var(--bg, #fff);
  color: inherit;
}
.wiki-db-status { font-size: 11px; color: var(--muted); }

.editor-toolbar-mini {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.editor-toolbar-mini button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}
.editor-toolbar-mini button:hover { color: var(--ink); background: rgba(55,53,47,.04); }

.wiki-db-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
}
.wiki-db-board-col {
  background: rgba(55,53,47,.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-height: 120px;
}
.wiki-db-board-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.wiki-db-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.wiki-db-cal { padding: 12px; display: grid; gap: 10px; }
.wiki-db-cal-day {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.wiki-db-cal-h { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.wiki-db-cal-item { font-size: 13px; padding: 4px 0; }

/* ---------- Departments org cards ---------- */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.dept-card {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e8e8e5);
  border-radius: 14px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: softRise .35s ease both;
}
html.dark .dept-card { background: #141414; border-color: #2a2a2a; }
.dept-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dept-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}
.dept-members { display: flex; flex-direction: column; gap: 6px; min-height: 48px; }
.dept-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f6f6f4;
}
html.dark .dept-member { background: #1a1a1a; }
.dept-member-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.dept-assign-row {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--line, #e8e8e5);
}
.dept-assign-row select { flex: 1; margin: 0; min-height: 36px; }
.btn-icon-ghost {
  border: 0;
  background: transparent;
  color: var(--muted, #888);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}
.btn-icon-ghost:hover { background: #eee; color: var(--bad, #b91c1c); }
html.dark .btn-icon-ghost:hover { background: #222; }

/* ---------- Employee profile ---------- */
.emp-profile-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
}
@media (max-width: 900px) {
  .emp-profile-grid { grid-template-columns: 1fr; }
}
.emp-panel h3 { font-size: 15px; margin-bottom: 8px; }
.emp-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted, #6b6b6b);
}
.emp-edit-form label.emp-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.emp-edit-form input,
.emp-edit-form select { margin: 0; }
.db-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.db-form label > input,
.db-form label > select { margin: 0; }
.nb-mention-chip,
.nb-page-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft, #f7f7f5);
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  max-width: 100%;
}
.nb-mention-chip:hover,
.nb-page-chip:hover { border-color: var(--primary, #2f6feb); background: rgba(47,111,235,.06); }
.nb-mention-kind {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.nb-bookmark-card .nb-bookmark-name {
  font-weight: 650;
  margin: 4px 0 8px;
}
.nb-bookmark-card .nb-bookmark-href {
  font-size: 12px;
  color: var(--muted);
  direction: ltr;
  text-align: left;
  word-break: break-all;
}
.emp-dl { margin: 0; display: grid; gap: 10px; }
.emp-dl dt { font-size: 12px; color: var(--muted); }
.emp-dl dd { margin: 2px 0 0; font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  text-decoration: none;
  color: inherit;
}
.chip-xs { padding: 2px 8px; font-size: 12px; margin-inline-end: 4px; }
.emp-list { list-style: none; padding: 0; margin: 0; }
.emp-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line, #eee);
}
.emp-att-actions { flex-wrap: wrap; }

/* ---------- Checkout report modal ---------- */
.checkout-modal[hidden] { display: none !important; }
.checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 16px;
}
.checkout-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
}
.checkout-modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--panel, #fff);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
  animation: sheetUp .22s ease;
}
html.dark .checkout-modal-card { background: #161616; }
.checkout-modal-card h2 { margin: 0 0 6px; font-size: 18px; }
.co-guidance {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent, #2383e2) 28%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #2383e2) 8%, transparent);
  font-size: 13px;
}
.co-guidance span { color: var(--muted, #6b7280); }
.co-rows { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.co-row {
  display: grid;
  grid-template-columns: auto 1.3fr .6fr 1.5fr auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line, #eee);
  border-radius: 10px;
}
.co-row-number { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--muted, #6b7280); }
.co-row input, .co-row select { margin: 0; min-height: 36px; }
.co-add-row { width: 100%; border-style: dashed; font-weight: 700; }
.co-error {
  margin-top: 10px;
  padding: 9px 11px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 9px;
  font-size: 13px;
}
html.dark .co-error { color: #fecaca; background: rgba(127,29,29,.22); border-color: #7f1d1d; }
.attendance-project-line {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line, #eee);
}
.attendance-project-line small { grid-column: 2 / -1; color: var(--muted, #6b7280); }
.co-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #eee);
}
.kiosk-wrap { max-width: 520px; margin: 24px auto; }
.kiosk-card { text-align: center; padding: 22px 18px; }
@media (max-width: 640px) {
  .co-row { grid-template-columns: 1fr auto; }
  .co-row-number, .co-project, .co-hours, .co-note { grid-column: 1 / -1; }
  .co-del { grid-column: 2; grid-row: 1; }
  .co-footer { flex-direction: column; align-items: stretch; }
}

/* ---------- Dashboard clock in/out ---------- */
.dash-clock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 22px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line, #e7e7e4);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(34, 197, 94, 0.10), transparent 55%),
    radial-gradient(100% 120% at 0% 100%, rgba(59, 130, 246, 0.08), transparent 50%),
    var(--panel, #fff);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 30px rgba(15, 23, 42, 0.04);
  animation: softRise .35s ease both;
}
html.dark .dash-clock {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(34, 197, 94, 0.12), transparent 55%),
    radial-gradient(100% 120% at 0% 100%, rgba(59, 130, 246, 0.10), transparent 50%),
    #141414;
  border-color: #2a2a2a;
  box-shadow: none;
}
.dash-clock-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.dash-clock-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  flex-shrink: 0;
}
html.dark .dash-clock-icon { background: #e5e7eb; color: #111; }
.dash-clock-kicker {
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted, #6b7280);
  margin-bottom: 2px;
}
.dash-clock-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}
.dash-clock-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}
.dash-clock-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.dash-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.dash-btn:active { transform: translateY(0); }
.dash-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.dash-btn-in {
  background: linear-gradient(135deg, #0f766e 0%, #059669 55%, #16a34a 100%);
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.28);
}
.dash-btn-out {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}
.dash-btn-done {
  background: linear-gradient(135deg, #374151 0%, #111827 100%);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
}
.dash-btn-ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.18);
  font-size: 18px;
  font-weight: 700;
}
.dash-btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: right;
}
.dash-btn-text strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.dash-btn-text small {
  font-size: 11px;
  opacity: .88;
}
.dash-clock-link {
  font-size: 13px;
  color: var(--muted, #6b7280);
  text-decoration: none;
  white-space: nowrap;
}
.dash-clock-link:hover { color: var(--ink, #111); text-decoration: underline; }
@media (max-width: 720px) {
  .dash-clock {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  .dash-clock-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-btn { min-width: 0; width: 100%; justify-content: flex-start; }
  .dash-clock-link { text-align: center; }
}

.task-project-picker { min-height: 34px; }
.task-attachments { position: relative; }
.task-attachments > summary { cursor: pointer; list-style: none; font-size: 12px; color: var(--muted, #6b7280); border: 1px solid var(--line, #e8e8e5); border-radius: 8px; padding: 4px 10px; background: var(--surface-soft, #f7f7f5); white-space: nowrap; }
.task-attachments > summary::-webkit-details-marker { display: none; }
.task-attachments[open] > summary { color: var(--ink, #2f3437); border-color: var(--line-strong, #d8d8d4); }
.task-attachments .task-attach-box { position: absolute; z-index: 30; right: 0; top: 34px; width: 300px; max-width: 80vw; background: var(--surface, #fff); border: 1px solid var(--line-strong, #d8d8d4); border-radius: 10px; box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,.12)); padding: 10px; }
.task-attachments form.inline { display: inline-flex; align-items: center; gap: 6px; }
.task-attachments input[type=file] { width: 100%; margin-bottom: 8px; }
.task-attachment { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line, #e8e8e5); font-size: 12px; }
.task-attachment a { color: var(--primary, #2f6feb); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-attachment a:hover { text-decoration: underline; }
.wiki-attachments .table-scroll { overflow-x: auto; }
.task-attachments[open] > form,
.task-attachments[open] > div { position: absolute; z-index: 30; right: 0; top: 34px; width: 300px; max-width: 80vw; background: var(--surface, #fff); border: 1px solid var(--line-strong, #d8d8d4); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.12); padding: 10px; }

/* Enterprise suite */
.enterprise-page { padding-bottom: 56px; }
.enterprise-page .notion-page-top { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:20px; }
.enterprise-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:18px 0; }
.enterprise-kpis > div { padding:16px; border:1px solid var(--line,#e8e8e5); border-radius:14px; background:var(--surface,#fff); display:flex; flex-direction:column; gap:6px; box-shadow:0 4px 14px rgba(15,23,42,.04); }
.enterprise-kpis strong { font-size:22px; color:var(--ink,#1f2937); }
.enterprise-kpis span { color:var(--muted,#6b7280); font-size:12px; }
.enterprise-module-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.enterprise-module { display:flex; gap:13px; min-height:130px; padding:18px; color:inherit; text-decoration:none; border:1px solid var(--line,#e8e8e5); border-radius:16px; background:var(--surface,#fff); transition:.18s ease; }
.enterprise-module:hover { transform:translateY(-2px); border-color:var(--primary,#2f6feb); box-shadow:0 12px 26px rgba(15,23,42,.08); }
.enterprise-module-icon { width:42px; height:42px; flex:0 0 42px; display:grid; place-items:center; border-radius:12px; background:var(--surface-soft,#f3f4f6); font-size:22px; }
.enterprise-module h3 { margin:0 0 6px; font-size:15px; }
.enterprise-module p { margin:0; color:var(--muted,#6b7280); font-size:12px; line-height:1.8; }
.enterprise-panel { margin:14px 0; }
.enterprise-panel > summary { cursor:pointer; padding:3px 0 12px; }
.enterprise-panel form:not(.row):not(.risk-row):not(.check-row) { gap:9px; }
.enterprise-panel textarea { min-height:78px; }
.enterprise-search { display:flex; gap:8px; margin:18px 0; }
.enterprise-search input { flex:1; min-height:44px; }
.search-result-panel { display:grid; gap:4px; }
.search-result-panel a { display:flex; align-items:center; gap:10px; padding:10px; color:inherit; text-decoration:none; border-radius:9px; }
.search-result-panel a:hover { background:var(--surface-soft,#f7f7f5); }
.enterprise-forms section form { display:grid; gap:8px; }
.ai-output { margin:18px 0; padding:18px; border:1px solid rgba(124,58,237,.25); border-radius:14px; background:rgba(124,58,237,.06); }
.ai-output pre { margin:14px 0 0; white-space:pre-wrap; font-family:inherit; line-height:2; }
.risk-row { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:10px 4px; color:inherit; text-decoration:none; border:0; border-bottom:1px solid var(--line,#e8e8e5); background:transparent; text-align:right; }
.risk-row > span:first-child { display:flex; flex-direction:column; gap:3px; }
.risk-row small { display:block; color:var(--muted,#6b7280); font-size:11px; }
.capacity-row { display:grid; grid-template-columns:minmax(130px,1fr) 2fr 60px; align-items:center; gap:12px; padding:8px 0; }
.capacity-track { height:8px; overflow:hidden; border-radius:999px; background:var(--surface-soft,#eceef2); }
.capacity-track i { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,#3b82f6,#22c55e); }
.capacity-track.overloaded i { background:#ef4444; }.capacity-track.underloaded i { background:#f59e0b; }
.document-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-top:16px; }
.document-card { position:relative; padding:16px; border:1px solid var(--line,#e8e8e5); border-radius:15px; background:var(--surface,#fff); }
.document-card.is-deleted { opacity:.65; border-style:dashed; }
.document-card h3 { margin:12px 0 6px; }.document-card code { font-size:11px; }
.document-card details { position:relative; }.mini-pop { position:absolute; z-index:20; top:35px; right:0; width:260px; padding:10px; border:1px solid var(--line,#ddd); border-radius:12px; background:var(--surface,#fff); box-shadow:0 12px 30px rgba(0,0,0,.14); display:grid; gap:8px; }
.attendance-action-bar { position:sticky; top:58px; z-index:8; margin:14px 0; padding:10px; border:1px solid var(--line,#e8e8e5); border-radius:14px; background:color-mix(in srgb,var(--surface,#fff) 92%,transparent); backdrop-filter:blur(14px); }
.attendance-action-bar form { display:flex; flex-wrap:wrap; gap:8px; }
.timeline-item { display:flex; gap:12px; padding:10px 2px; border-bottom:1px solid var(--line,#e8e8e5); }
.timeline-item > i { width:10px; height:10px; margin-top:6px; border-radius:50%; background:#3b82f6; box-shadow:0 0 0 4px rgba(59,130,246,.12); }
.timeline-item span { flex:1; }.timeline-item small { display:block; margin-top:3px; color:var(--muted,#6b7280); }
.phase-card { padding:12px; margin:8px 0; border:1px solid var(--line,#e8e8e5); border-radius:12px; }.phase-card .capacity-track { margin:9px 0; }
.compact-form { display:grid; gap:8px; margin-top:12px; padding-top:12px; border-top:1px dashed var(--line,#ddd); }
.task-control-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }.task-control-grid article { padding:13px; border:1px solid var(--line,#e8e8e5); border-radius:12px; }.task-control-grid .capacity-track { margin:9px 0; }
.row.between,.between { justify-content:space-between; }.row.wrap,.wrap { flex-wrap:wrap; }
.check-row { display:flex; align-items:center; gap:8px; padding:6px 0; }.check-btn { width:28px; height:28px; border:0; border-radius:8px; }.check-btn.done { color:#15803d; background:#dcfce7; }
.monthly-bars { display:flex; align-items:flex-end; gap:10px; min-height:220px; overflow-x:auto; padding:28px 8px 4px; }.monthly-bars > div { display:grid; grid-template-rows:20px 150px 24px; align-items:end; justify-items:center; gap:5px; min-width:62px; }.monthly-bars i { display:block; width:30px; min-height:3px; border-radius:8px 8px 3px 3px; background:linear-gradient(#3b82f6,#22c55e); }.monthly-bars span,.monthly-bars small { font-size:10px; white-space:nowrap; }
.gantt-board { display:grid; gap:8px; margin-top:14px; overflow:auto; }.gantt-row { display:grid; grid-template-columns:minmax(130px,220px) minmax(460px,1fr); align-items:center; gap:12px; font-size:13px; }.gantt-row>div { position:relative; height:24px; border-radius:8px; background:repeating-linear-gradient(90deg,var(--surface-soft,#f5f7fb) 0,var(--surface-soft,#f5f7fb) calc(10% - 1px),var(--line,#dfe4ea) 10%); }.gantt-row i { position:absolute; top:4px; height:16px; min-width:6px; border-radius:999px; }.gantt-phase { background:#8b5cf6; }.gantt-task { background:#3b82f6; }.gantt-task.done { background:#10b981; }

@media (max-width:980px) {
  .enterprise-module-grid,.document-grid,.task-control-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .enterprise-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:640px) {
  .enterprise-page .notion-page-top { flex-direction:column; }
  .enterprise-module-grid,.document-grid,.task-control-grid,.enterprise-kpis { grid-template-columns:1fr; }
  .enterprise-search { flex-direction:column; }.capacity-row { grid-template-columns:1fr; }
  .attendance-action-bar { top:8px; }.attendance-action-bar form > * { flex:1 1 45%; }
}
