/* ============================================================
   KARNA DESKTOP — Poppin design system (Phase 0)
   Scoped under .kd so mobile Warm Clay in karna.css stays untouched.
   ============================================================ */

body:has(.kd),
#app:has(.kd) {
  background: #FEF7F0;
  color: #1B1618;
}

#app:has(.kd) {
  padding-top: 0;
}

.kd {
  /* Poppin colour system */
  --background: #FEF7F0;
  --surface: #FBF6E6;
  --surface-alt: #F5EDE0;
  --text-primary: #1B1618;
  --text-secondary: #5F5F5F;
  --accent: #CE7A1A;
  --accent-hover: #B3642E;
  --accent-soft: #FFE7C2;
  --success: #2E7033;
  --info: #2C90E4;
  --purple: #6B46C1;
  --red: #E45735;
  --border: #E3D0C2;
  --divider: #ECE5DB;
  --focus: #CE7A1A;
  --success-soft: #E2EDE1;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 24px;
  --r-full: 999px;

  --e-1: 0 1px 2px rgba(58, 42, 26, 0.05);
  --e-2: 0 1px 3px rgba(58, 42, 26, 0.06), 0 6px 16px rgba(58, 42, 26, 0.05);

  --t: 170ms cubic-bezier(0.25, 0.6, 0.3, 1);

  --rail: 266px;
  --aside: 352px;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.kd .orbit { display: block; flex: none; }

/* ═══ chrome ═══ */
.kd .chrome { flex: none; padding: 12px 16px 0; }
.kd .chrome-row { display: flex; align-items: center; gap: 16px; padding-bottom: 12px; }
.kd .lights { display: flex; gap: 8px; }
.kd .lights i { width: 11px; height: 11px; border-radius: var(--r-full); display: block; }
.kd .lights i:nth-child(1) { background: #E4675A; }
.kd .lights i:nth-child(2) { background: #E0A93F; }
.kd .lights i:nth-child(3) { background: #5EAE5E; }
.kd .wordmark { display: flex; align-items: center; gap: 9px; }
.kd .wordmark b { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.kd .wordmark span { font-size: 16px; font-weight: 600; color: var(--accent); letter-spacing: -0.02em; }
.kd .chrome-acts { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.kd .ib {
  width: 32px; height: 32px; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; cursor: pointer;
  color: var(--text-secondary); transition: background var(--t), border-color var(--t);
  padding: 0; font: inherit;
}
.kd .ib:hover { background: var(--surface); border-color: var(--border); }
.kd .ib:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.kd .ib svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kd .avatar {
  width: 32px; height: 32px; border-radius: var(--r-full); background: var(--surface-alt);
  border: 1px solid var(--border); display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
}

/* ═══ tabs — reset Warm Clay .tab / .tabs (64px column bottom-nav) ═══ */
.kd .tabs {
  display: flex; align-items: flex-end; gap: 6px; padding: 0 2px;
  border-bottom: none; margin: 0; overflow: visible; flex-shrink: 0;
  -webkit-overflow-scrolling: auto; scrollbar-width: auto;
}
.kd .tab {
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  width: auto; max-width: 250px; min-width: 0;
  padding: 11px 14px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: transparent; border: 1px solid transparent; border-bottom: none;
  cursor: pointer; transition: all var(--t); position: relative; top: 2px;
  color: inherit; font: inherit; font-size: 13px; font-family: inherit;
  min-height: 0; box-shadow: none; transform: none; margin: 0;
}
.kd .tab .ti { width: 15px; height: 15px; flex: none; display: grid; place-items: center; }
.kd .tab .ti svg { width: 15px; height: 15px; stroke: var(--text-secondary); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kd .tab .tt { font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd .tab .tx { width: 17px; height: 17px; border-radius: var(--r-sm); display: grid; place-items: center; opacity: 0; transition: opacity var(--t), background var(--t); flex: none; }
.kd .tab:hover .tx { opacity: 1; }
.kd .tab .tx:hover { background: var(--surface-alt); }
.kd .tab .tx svg { width: 10px; height: 10px; stroke: var(--text-secondary); stroke-width: 2; fill: none; stroke-linecap: round; }
.kd .tab:hover { background: var(--surface); top: 0; }
.kd .tab.on { background: var(--background); border-color: var(--border); box-shadow: var(--e-2); top: 0; }
.kd .tab.on .tt { color: var(--text-primary); font-weight: 600; }
.kd .tab.on .ti svg { stroke: var(--accent); }
.kd .tab.on .tx { opacity: 1; }
.kd .tab.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--accent); border-radius: 1px; }
.kd .tab-add { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; cursor: pointer; color: var(--text-secondary); transition: background var(--t); margin-bottom: 3px; border: 0; background: transparent; padding: 0; }
.kd .tab-add:hover { background: var(--surface); }
.kd .tab-add svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }

/* ═══ four-pane shell: rail | centre | aside ; command bar below ═══ */
.kd .shell {
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail) 1fr var(--aside);
  grid-template-rows: 1fr auto;
  min-height: 0;
  border-top: 1px solid var(--border);
}
.kd .rail { grid-column: 1; grid-row: 1; border-right: 1px solid var(--divider); display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 0; }
.kd .centre { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.kd .aside { grid-column: 3; grid-row: 1; border-left: 1px solid var(--divider); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.kd .bar { grid-column: 1 / -1; grid-row: 2; flex: none; border-top: 1px solid var(--border); padding: 14px 16px; display: flex; align-items: center; gap: 10px; background: var(--surface); }

.kd .search {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 16px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: border-color var(--t);
}
.kd .search:hover { border-color: var(--accent); }
.kd .search svg { width: 14px; height: 14px; stroke: var(--text-secondary); fill: none; stroke-width: 1.7; stroke-linecap: round; }
.kd .search .p { font-size: 13px; color: var(--text-secondary); flex: 1; }
.kd .search .k { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-secondary); opacity: 0.7; }

.kd .nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
.kd .nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md);
  color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background var(--t), color var(--t);
}
.kd .nav a:hover { background: var(--surface); }
.kd .nav a.on { background: var(--accent-soft); color: var(--text-primary); font-weight: 600; }
.kd .nav a.on .ic svg { stroke: var(--accent); }
.kd .nav a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.kd .ic { width: 16px; flex: none; display: flex; }
.kd .ic svg { width: 16px; height: 16px; stroke: var(--text-secondary); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kd .nav .badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--surface-alt); color: var(--text-secondary); font-size: 11px; font-weight: 600;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.kd .nav a.on .badge { background: #F7D9AE; color: var(--accent-hover); }

.kd .eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); padding: 0 12px; margin-bottom: 8px; }
.kd .threads { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.kd .threads::-webkit-scrollbar { width: 6px; }
.kd .threads::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }
.kd .grp { margin-bottom: 16px; }
.kd .th { padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; transition: background var(--t), box-shadow var(--t); }
.kd .th:hover { background: var(--surface); }
.kd .th.on { background: var(--surface); box-shadow: var(--e-1); border-left: 2px solid var(--accent); padding-left: 10px; }
.kd .th .t { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.kd .th .m { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.kd .th .m em { font-style: normal; color: var(--accent); font-weight: 500; }

.kd .chead { flex: none; padding: 20px 32px 16px; border-bottom: 1px solid var(--divider); display: flex; align-items: flex-start; gap: 16px; }
.kd .chead h2 { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.02em; }
.kd .chead .sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); margin-top: 2px; }
.kd .chead .acts { margin-left: auto; display: flex; gap: 6px; }

.kd .stream { flex: 1; overflow-y: auto; padding: 24px 32px 32px; }
.kd .stream::-webkit-scrollbar { width: 8px; }
.kd .stream::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }
.kd .turn { margin-bottom: 24px; max-width: 720px; }
.kd .who { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.kd .said { font-size: 14px; line-height: 22px; }
.kd .said.you { background: var(--surface); border: 1px solid var(--border); padding: 14px 16px; border-radius: var(--r-lg); }
.kd .said p + p { margin-top: 12px; }

.kd .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.kd .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px;
  border-radius: var(--r-full); font-family: "JetBrains Mono", monospace; font-size: 11px; font-weight: 500;
  background: var(--success-soft); color: var(--success); border: 1px solid #CBDDC9;
}
.kd .chip svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.kd .kd-chips:empty { display: none; }
.kd .kd-stream-text { min-height: 1em; }
.kd .kd-stream-text p + p { margin-top: 12px; }

.kd .card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e-2); overflow: hidden; margin-top: 14px; }
.kd .card-h { padding: 12px 16px; border-bottom: 1px solid var(--divider); display: flex; align-items: center; gap: 10px; background: var(--surface-alt); }
.kd .card-h .lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.kd .card-h .to { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-secondary); }
.kd .card-b { padding: 16px; background: var(--background); }
.kd .card-b .subj { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 10px; }
.kd .card-b .body { font-size: 14px; line-height: 22px; color: var(--text-secondary); }
.kd .card-b .body p + p { margin-top: 10px; }

.kd .gate { margin-top: 14px; border: 1px solid #EBC98E; border-radius: var(--r-lg); background: var(--accent-soft); overflow: hidden; }
.kd .gate-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.kd .gate-h .w { width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--accent); display: grid; place-items: center; flex: none; }
.kd .gate-h .w svg { width: 13px; height: 13px; stroke: var(--background); fill: none; stroke-width: 2.4; stroke-linecap: round; }
.kd .gate-h b { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.kd .gate-h .tag { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 11px; padding: 3px 9px; border-radius: var(--r-full); background: #F7DCB0; color: var(--accent-hover); }
.kd .gate p { padding: 0 16px 12px 48px; font-size: 13px; line-height: 19px; color: #7A5424; }
.kd .gate-acts { display: flex; gap: 8px; padding: 0 16px 16px 48px; }

.kd .btn {
  padding: 8px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; font-family: inherit; transition: all var(--t);
  width: auto; min-height: 0; box-shadow: none; color: inherit; background: transparent;
}
.kd .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.kd .btn-primary { background: var(--accent); color: var(--background); box-shadow: var(--e-1); }
.kd .btn-primary:hover { background: var(--accent-hover); }
.kd .btn-secondary { background: transparent; border-color: var(--accent); color: var(--accent); }
.kd .btn-secondary:hover { background: rgba(206, 122, 26, 0.08); }
.kd .btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.kd .btn-ghost:hover { background: rgba(0, 0, 0, 0.04); color: var(--text-secondary); }

.kd .aside::-webkit-scrollbar { width: 8px; }
.kd .aside::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }
.kd .sect { padding: 16px; border-bottom: 1px solid var(--divider); }
.kd .sect-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.kd .sect-h .eyebrow { padding: 0; margin: 0; }
.kd .sect-h .act { margin-left: auto; font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 500; }
.kd .sect-h .act:hover { color: var(--accent-hover); text-decoration: underline; }

.kd .ctx { display: flex; flex-direction: column; gap: 2px; }
.kd .ctxi { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: var(--r-md); cursor: pointer; transition: background var(--t); }
.kd .ctxi:hover { background: var(--surface); }
.kd .tick {
  width: 16px; height: 16px; border-radius: var(--r-sm); flex: none; margin-top: 1px;
  border: 1.5px solid var(--border); background: var(--background); display: grid; place-items: center; transition: all var(--t);
}
.kd .ctxi.on .tick { background: var(--accent); border-color: var(--accent); }
.kd .tick svg { width: 9px; height: 9px; stroke: var(--background); fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity var(--t); }
.kd .ctxi.on .tick svg { opacity: 1; }
.kd .ctxi .n { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.kd .ctxi .d { font-size: 12px; line-height: 16px; color: var(--text-secondary); font-family: "JetBrains Mono", monospace; margin-top: 1px; }
.kd .ctxi:not(.on) .n { color: var(--text-secondary); }
.kd .ctxi:not(.on) .d { opacity: 0.7; }

.kd .payload {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-alt);
  border: 1px solid var(--border); display: flex; align-items: center; gap: 9px; cursor: pointer; transition: border-color var(--t);
}
.kd .payload:hover { border-color: var(--accent); }
.kd .payload .n { font-size: 13px; font-weight: 600; }
.kd .payload .c { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.kd .payload svg { width: 14px; height: 14px; stroke: var(--text-secondary); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.kd .task-row { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.kd .task-row .st { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--accent); flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.kd .task-row b { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.kd .task-row .stx { margin-left: auto; font-size: 12px; color: var(--accent-hover); font-weight: 600; flex: none; }
.kd .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.kd .mchip { font-family: "JetBrains Mono", monospace; font-size: 11px; padding: 3px 9px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }

.kd .ledger { font-family: "JetBrains Mono", ui-monospace, monospace; border-left: 1px solid var(--border); margin-left: 5px; }
.kd .lrow { position: relative; padding: 0 0 14px 16px; }
.kd .lrow:last-child { padding-bottom: 2px; }
.kd .lrow::before { content: ""; position: absolute; left: -4.5px; top: 5px; width: 8px; height: 8px; border-radius: 2px; background: var(--success); border: 1.5px solid var(--background); }
.kd .lrow.held::before { background: var(--accent); }
.kd .lrow.held .fn, .kd .lrow.held .stamp { color: var(--accent-hover); }
.kd .lrow .top { display: flex; align-items: baseline; gap: 8px; }
.kd .lrow .ts { font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; opacity: 0.8; }
.kd .lrow .fn { font-size: 12px; font-weight: 700; color: var(--success); letter-spacing: -0.01em; }
.kd .lrow .arg { font-size: 11px; color: var(--text-secondary); margin-top: 3px; opacity: 0.85; word-break: break-all; }
.kd .lrow .res { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.kd .lrow .res b { color: var(--text-primary); font-weight: 700; }
.kd .stamp { margin-left: auto; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--success); font-weight: 700; }
.kd .ledger-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-secondary); }
.kd .ledger-foot b { color: var(--success); }
.kd .ledger-foot .z { color: var(--text-primary); font-weight: 700; }

.kd .rec { display: flex; flex-direction: column; gap: 2px; }
.kd .reci { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); cursor: pointer; transition: background var(--t); }
.kd .reci:hover { background: var(--surface); }
.kd .reci .rd { width: 7px; height: 7px; border-radius: var(--r-full); flex: none; }
.kd .reci .rd.ok { background: var(--success); }
.kd .reci .rd.wait { background: var(--accent); }
.kd .reci .rn { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd .reci .rs { margin-left: auto; font-size: 11px; color: var(--text-secondary); flex: none; font-family: "JetBrains Mono", monospace; }

.kd .selector {
  display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-radius: var(--r-full);
  background: var(--background); border: 1px solid var(--border); cursor: pointer; transition: border-color var(--t);
}
.kd .selector:hover { border-color: var(--accent); }
.kd .selector .rot { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.kd .selector .nm { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--text-secondary); }
.kd .selector svg { width: 13px; height: 13px; stroke: var(--text-secondary); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.kd .field {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px;
  border-radius: var(--r-full); background: var(--background); border: 1px solid var(--border);
  transition: border-color var(--t), box-shadow var(--t); margin-bottom: 0;
}
.kd .field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(206, 122, 26, 0.15); }
.kd .field label { display: none; }
.kd .field input {
  flex: 1; border: 0; background: transparent; outline: none; font-family: inherit;
  font-size: 14px; color: var(--text-primary); padding: 0; margin: 0; border-radius: 0;
  box-shadow: none; width: auto; min-height: 0;
}
.kd .field input:focus { box-shadow: none; border: 0; }
.kd .field input::placeholder { color: var(--text-secondary); }
.kd .clip { width: 17px; height: 17px; stroke: var(--text-secondary); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; cursor: pointer; flex: none; }
.kd .kbd { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-secondary); opacity: 0.7; flex: none; }
.kd .send {
  width: 34px; height: 34px; border-radius: var(--r-full); background: var(--accent);
  display: grid; place-items: center; cursor: pointer; flex: none; border: 0; box-shadow: var(--e-1); transition: background var(--t); padding: 0;
}
.kd .send:hover { background: var(--accent-hover); }
.kd .send svg { width: 15px; height: 15px; stroke: var(--background); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Phase 5 — centre view tabs (Documents, Digests, Memory, Skills, Schedules) */
.kd.view-mode .aside { display: none; }
.kd.view-mode .shell { grid-template-columns: var(--rail) 1fr; }
.kd.view-mode .bar { opacity: 0.55; pointer-events: none; }

.kd .chrome { position: relative; }
.kd .kd-notif-btn { position: relative; }
.kd .kd-notif-btn .notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
  background: var(--accent); color: var(--background); font-size: 9px; font-weight: 700;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px; pointer-events: none;
}
.kd .kd-notif-btn .notif-badge.hidden { display: none; }
.kd .kd-notif-dropdown {
  position: absolute; top: calc(100% - 4px); right: 16px; width: 340px; max-width: min(340px, calc(100vw - 32px));
  max-height: 420px; z-index: 200; display: none; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--e-2);
}
.kd .kd-notif-dropdown.open { display: flex; }
.kd .kd-notif-dropdown .notif-header,
.kd .kd-notif-dropdown .notif-footer {
  padding: 12px 14px; border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.kd .kd-notif-dropdown .notif-footer { border-bottom: 0; border-top: 1px solid var(--divider); }
.kd .kd-notif-dropdown .notif-header-title { font-size: 13px; font-weight: 700; }
.kd .kd-notif-dropdown .notif-list { overflow-y: auto; flex: 1; padding: 6px 0; }
.kd .kd-notif-dropdown .notif-empty { padding: 24px 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.kd .kd-notif-dropdown .notif-footer-btn {
  width: 100%; border: 0; background: transparent; font-family: inherit; font-size: 13px;
  font-weight: 600; color: var(--text-primary); cursor: pointer; text-align: left; padding: 4px 0;
}
.kd .kd-notif-dropdown .notif-footer-btn:hover { color: var(--accent); }
.kd .kd-view.kd-embed { max-width: none; padding: 0; }
.kd .kd-view.kd-embed .page-view { padding: 0; }
.kd .kd-view.kd-embed .page-header { padding: 0 0 12px; }

.kd .kd-view { padding: 4px 4px 32px; max-width: 920px; }
.kd .kd-view.kd-doc, .kd .kd-view.kd-digest { max-width: 760px; }
.kd .kd-muted { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.kd .kd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.kd .kd-btn {
  font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  padding: 7px 12px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary); cursor: pointer; transition: border-color var(--t), background var(--t);
}
.kd .kd-btn:hover { border-color: var(--accent); }
.kd .kd-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--background); }
.kd .kd-btn.primary:hover { background: var(--accent-hover); }
.kd .kd-btn.danger { color: var(--red, #c45c4a); }
.kd .kd-pill {
  font-family: inherit; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer;
}
.kd .kd-pill:hover { background: var(--surface); }
.kd .kd-pill.on { background: var(--accent-soft); color: var(--text-primary); border-color: transparent; }
.kd .kd-input {
  font-family: inherit; font-size: 13px; padding: 7px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--background); color: var(--text-primary); min-width: 180px; flex: 1;
}
.kd .kd-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(206, 122, 26, 0.15); }
.kd .kd-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.kd .kd-row {
  display: flex; align-items: baseline; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; cursor: pointer; font-family: inherit; color: inherit; transition: background var(--t), border-color var(--t);
}
.kd .kd-row:hover { background: var(--surface); }
.kd .kd-row.on { background: var(--accent-soft); border-color: transparent; }
.kd .kd-row-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.kd .kd-row-meta { margin-left: auto; font-size: 12px; color: var(--text-secondary); font-family: "JetBrains Mono", monospace; flex: none; }
.kd .kd-panel {
  margin-top: 16px; padding: 16px 18px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
}
.kd .kd-panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.kd .kd-prose { font-size: 14px; line-height: 1.65; color: var(--text-primary); white-space: pre-wrap; }
.kd .kd-kv { display: grid; gap: 8px; }
.kd .kd-kv > div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; }
.kd .kd-kv b { font-weight: 600; color: var(--text-secondary); }
.kd .kd-bullets { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.kd .kd-check-head { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.kd .kd-check {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer;
  font-size: 14px; line-height: 1.45; border-bottom: 1px solid var(--divider);
}
.kd .kd-check.on span { text-decoration: line-through; color: var(--text-secondary); }
.kd .kd-check input { margin-top: 3px; accent-color: var(--accent); }
.kd .kd-bullet-row { font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--divider); color: var(--text-primary); }
.kd .kd-card {
  margin-top: 10px; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
}
.kd .kd-card-h { display: flex; align-items: baseline; gap: 10px; font-size: 14px; font-weight: 600; }
.kd .kd-card-b { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
.kd .kd-card-a { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kd .kd-tag { font-size: 11px; font-weight: 600; color: var(--text-secondary); font-family: "JetBrains Mono", monospace; }
.kd .kd-split { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 20px; min-height: 320px; }
.kd .kd-split-list { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--divider); padding-right: 12px; }
.kd .kd-split-editor { min-width: 0; }

/* Desktop Settings — config centre tab (not Warm Clay) */
.kd .kd-view.kd-settings { max-width: none; padding-right: 8px; }
.kd .kd-set-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 0; min-height: 420px;
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden;
  background: var(--surface);
}
.kd .kd-set-nav {
  border-right: 1px solid var(--divider); padding: 12px 8px 20px; overflow-y: auto;
  background: var(--background);
}
.kd .kd-set-group {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-secondary); padding: 12px 10px 6px;
}
.kd .kd-set-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
  padding: 8px 10px; border: 0; border-radius: var(--r-md); background: transparent; cursor: pointer;
  transition: background var(--t);
}
.kd .kd-set-item:hover { background: var(--surface); }
.kd .kd-set-item.on { background: var(--accent-soft); font-weight: 600; }
.kd .kd-set-item.rail { color: var(--text-secondary); }
.kd .kd-set-ico { width: 18px; text-align: center; flex: none; font-size: 13px; }
.kd .kd-set-ext { margin-left: auto; font-size: 11px; opacity: 0.7; }
.kd .kd-set-content {
  padding: 20px 22px 32px; overflow-y: auto; min-width: 0;
  background: var(--background);
}
.kd .kd-set-content .field { margin-bottom: 14px; }
.kd .kd-set-content .field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}
.kd .kd-set-content .field input,
.kd .kd-set-content .field select,
.kd .kd-set-content .field textarea {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px;
  padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary);
}
.kd .kd-set-content .field input:focus,
.kd .kd-set-content .field select:focus,
.kd .kd-set-content .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(206, 122, 26, 0.15);
}
.kd .kd-set-content .btn {
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px;
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--accent);
  color: var(--background); cursor: pointer;
}
.kd .kd-set-content .btn-danger { background: transparent; color: var(--red); border-color: var(--border); }
.kd .kd-set-content .btn-small { padding: 6px 10px; font-size: 12px; }

@media (max-width: 1400px) {
  .kd .kd-set-layout { grid-template-columns: 200px 1fr; }
}

@media (max-width: 1199px) {
  .kd .shell { grid-template-columns: var(--rail) 1fr; }
  .kd .aside { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .kd, .kd * { transition: none !important; animation: none !important; }
}
