/* Umbral admin console — builds on the tokens defined in styles.css */
body.admin {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(216,180,118,.08), transparent 60%),
    var(--void);
  color: var(--soft);
  font-family: var(--sans);
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: .85rem clamp(1rem, 3vw, 2.4rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--void) 82%, transparent);
  backdrop-filter: blur(24px) saturate(1.2);
}
.admin-brand { display: inline-flex; align-items: center; gap: .8rem; text-decoration: none; }
.admin-brand img { width: 128px; }
[data-theme="dark"] .admin-brand img { filter: none; }
.admin-brand span {
  padding-left: .8rem;
  border-left: 1px solid var(--line-strong);
  color: var(--gold);
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .26em;
  text-transform: uppercase;
}

.admin-tabs { display: flex; gap: .3rem; margin: 0 auto; padding: 4px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--glass); }
.admin-tabs button {
  padding: .55rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ghost);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: color .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease);
}
.admin-tabs button:hover { color: var(--soft); }
.admin-tabs button.active { color: var(--gold-bright); border-color: var(--gold-dim); background: var(--gold-glow); }

.admin-actions { display: flex; align-items: center; gap: .7rem; }
.admin-who { color: var(--ghost); font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; }
.admin-btn {
  padding: .5rem 1.1rem;
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  background: linear-gradient(118deg, var(--gold-deep), var(--gold) 60%);
  color: #140d03;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: transform .2s var(--ease), filter .2s var(--ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.admin-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.admin-btn.ghost { background: var(--glass); border-color: var(--hairline); color: var(--muted); }
.admin-btn.ghost:hover { color: var(--gold-bright); border-color: var(--line-strong); }
.admin-btn.small { padding: .4rem .85rem; font-size: .72rem; }
.admin-btn.danger { background: transparent; border-color: rgba(220,120,100,.4); color: #e79c8a; }
.admin-btn.danger:hover { background: rgba(220,120,100,.12); }

.admin-main { max-width: 1320px; margin: 0 auto; padding: clamp(1.4rem, 3vw, 2.6rem); }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.admin-kicker { margin: 0 0 .3rem; color: var(--gold); font-family: var(--mono); font-size: .62rem; letter-spacing: .28em; text-transform: uppercase; }
.admin-head h1 { margin: 0; font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 500; }

/* KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.kpi {
  padding: 1.3rem 1.4rem;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: linear-gradient(165deg, var(--glass), transparent 70%), color-mix(in srgb, var(--obsidian) 52%, transparent);
}
.kpi .k-label { color: var(--gold); font-family: var(--mono); font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; }
.kpi .k-value { margin-top: .5rem; font-family: var(--serif); font-size: 2.2rem; font-weight: 500; color: var(--cream); line-height: 1; }
.kpi .k-sub { margin-top: .4rem; color: var(--ghost); font-size: .76rem; }

.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
@media (max-width: 900px) { .admin-grid-2 { grid-template-columns: 1fr; } }

.admin-card {
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: color-mix(in srgb, var(--obsidian) 46%, transparent);
  overflow: hidden;
}
.admin-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem .6rem; }
.admin-card-head h2 { margin: 0; font-family: var(--serif); font-size: 1.2rem; font-weight: 500; color: var(--cream); }
.admin-hint { color: var(--ghost); font-size: .72rem; }
.admin-scroll { max-height: 480px; overflow: auto; padding: .3rem 1.3rem 1.2rem; }
/* The document library is long — let it flow and scroll the page, grouped by section. */
#docs-table.admin-scroll { max-height: none; overflow: visible; padding-bottom: .4rem; }
.doc-section { margin-top: 1.4rem; }
.doc-section:first-child { margin-top: .2rem; }
.doc-section-head {
  display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .4rem;
  padding: 0 .2rem .45rem; border-bottom: 1px solid var(--hairline);
}
.doc-section-head h3 { margin: 0; font-family: var(--serif); font-size: 1.02rem; font-weight: 500; color: var(--cream); }
.doc-section-head .count { font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; color: var(--gold); }

/* Tables */
table.admin-t { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.admin-t th {
  position: sticky; top: 0;
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--obsidian) 82%, transparent);
  color: var(--gold);
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
table.admin-t td { padding: .65rem .7rem; border-bottom: 1px solid var(--hairline); color: var(--muted); vertical-align: middle; }
table.admin-t tbody tr:hover, table.admin-t tbody tr:hover { background: var(--glass); }
table.admin-t tr:last-child td { border-bottom: 0; }
table.admin-t .num { font-family: var(--mono); color: var(--cream); }
.t-strong { color: var(--cream); font-weight: 600; }
.t-muted { color: var(--ghost); font-size: .78rem; }

.pill { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-family: var(--mono); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
.pill.read { background: rgba(133,184,120,.16); color: var(--emerald); }
.pill.progress { background: rgba(227,185,95,.16); color: var(--amber); }
.pill.unread { background: var(--glass); color: var(--ghost); }
.pill.admin { background: var(--gold-glow); color: var(--gold-bright); }
.pill.investor { background: var(--glass); color: var(--muted); }
.pill.inactive { background: rgba(220,120,100,.14); color: #e79c8a; }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.mini-btn { padding: .32rem .7rem; border: 1px solid var(--hairline); border-radius: 8px; background: transparent; color: var(--ghost); font-size: .72rem; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.mini-btn:hover { color: var(--gold-bright); border-color: var(--gold-dim); background: var(--gold-glow); }
.mini-btn.danger:hover { color: #e79c8a; border-color: rgba(220,120,100,.4); background: rgba(220,120,100,.1); }

/* meter bar in tables */
.meter { position: relative; height: 6px; width: 100px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.meter > span { position: absolute; inset: 0; width: var(--w, 0%); border-radius: 999px; background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-bright)); }

/* Document visibility toggle */
.vis-toggle { position: relative; width: 44px; height: 24px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--glass); cursor: pointer; transition: background .25s, border-color .25s; }
.vis-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ghost); transition: transform .25s var(--ease), background .25s; }
.vis-toggle[aria-pressed="true"] { background: var(--gold-glow); border-color: var(--gold-dim); }
.vis-toggle[aria-pressed="true"]::after { transform: translateX(20px); background: var(--gold-bright); }

.doc-filter { display: inline-flex; gap: .3rem; padding: 4px; border: 1px solid var(--hairline); border-radius: 11px; background: var(--glass); }
.doc-filter button { padding: .45rem .9rem; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ghost); font-size: .76rem; font-weight: 600; cursor: pointer; }
.doc-filter button.active { color: var(--gold-bright); border-color: var(--gold-dim); background: var(--gold-glow); }

/* Modals */
.admin-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.admin-modal[hidden] { display: none; }
.admin-modal-backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--void) 78%, #000 22%); backdrop-filter: blur(8px); }
.admin-modal-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem 1.6rem 1.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--canopy) 92%, transparent), var(--obsidian));
  box-shadow: var(--shadow);
}
.admin-modal-panel.wide { width: min(820px, 100%); }
.admin-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.admin-modal-head h2 { margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 500; }
.admin-icon-btn { width: 34px; height: 34px; border: 1px solid var(--hairline); border-radius: 9px; background: transparent; color: var(--ghost); cursor: pointer; }
.admin-icon-btn:hover { color: var(--gold-bright); border-color: var(--gold-dim); }

#user-form, #doc-form { display: grid; gap: .9rem; }
.admin-modal label { display: grid; gap: .4rem; color: var(--gold); font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; }
.admin-modal input, .admin-modal select, .admin-modal textarea {
  padding: .7rem .85rem;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: var(--cream);
  font-family: var(--sans);
  font-size: .92rem;
  letter-spacing: .01em;
}
.admin-modal textarea { font-family: var(--mono); font-size: .8rem; line-height: 1.5; resize: vertical; }

/* Rich text editor */
.rt-wrap { display: grid; gap: 0; border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.03); }
.rt-wrap:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--gold-glow); }
.rt-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem .55rem; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--obsidian) 70%, transparent); }
.rt-btn {
  min-width: 32px; height: 30px; padding: 0 .55rem; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--ghost); font-family: var(--sans); font-size: .82rem; cursor: pointer;
  transition: color .18s, background .18s, border-color .18s;
}
.rt-btn:hover { color: var(--gold-bright); background: var(--gold-glow); }
.rt-btn.active { color: var(--gold-bright); border-color: var(--gold-dim); background: var(--gold-glow); }
.rt-btn b { font-weight: 700; }
.rt-btn i { font-style: italic; }
.rt-sep { width: 1px; margin: .2rem .3rem; background: var(--hairline); }
.rt-editor {
  min-height: 320px; max-height: 52vh; overflow: auto; padding: 1.1rem 1.3rem 1.6rem;
  color: var(--soft); font-family: var(--serif); font-size: 1rem; line-height: 1.7; letter-spacing: .002em;
}
.rt-editor:focus { outline: none; }
.rt-editor h2 { margin: 1.3em 0 .5em; font-family: var(--serif); font-size: 1.4rem; font-weight: 500; color: var(--cream); }
.rt-editor h2:first-child { margin-top: 0; }
.rt-editor h3 { margin: 1.1em 0 .4em; font-size: 1.15rem; font-weight: 500; color: var(--gold-bright); }
.rt-editor h4 { margin: 1em 0 .3em; font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-family: var(--sans); }
.rt-editor p { margin: 0 0 .9em; }
.rt-editor ul, .rt-editor ol { margin: 0 0 1em; padding-left: 1.4em; }
.rt-editor li { margin-bottom: .35em; }
.rt-editor li::marker { color: var(--gold); }
.rt-editor strong { color: var(--cream); font-weight: 600; }
.rt-editor em { color: var(--gold-bright); }
.rt-editor blockquote { margin: 1em 0; padding: .5em 1.1em; border-left: 2px solid var(--gold); background: var(--gold-glow); font-style: italic; color: var(--cream); }
.rt-editor table { width: 100%; border-collapse: collapse; margin: 1em 0; font-family: var(--sans); font-size: .85em; }
.rt-editor th, .rt-editor td { padding: .5rem .7rem; border: 1px solid var(--hairline); text-align: left; }
.rt-note { display: flex; align-items: center; gap: .5rem; margin: .2rem 0 0; font-size: .74rem; color: var(--ghost); }
.rt-note .pill { flex: none; }
.admin-modal input:focus, .admin-modal select:focus, .admin-modal textarea:focus { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--gold-glow); }
.admin-form-row { display: flex; gap: 1rem; align-items: end; }
.admin-modal label.inline { flex: 1; }
.admin-modal label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--muted); text-transform: none; font-family: var(--sans); font-size: .85rem; letter-spacing: 0; }
.admin-modal label.check input { width: auto; }
.admin-modal-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: .5rem; }
.admin-form-error { min-height: 1.1em; margin: 0; color: #e79c8a; font-size: .8rem; }

.admin-toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%) translateY(10px);
  padding: .8rem 1.3rem; border-radius: 12px; border: 1px solid var(--gold-dim);
  background: color-mix(in srgb, var(--canopy) 90%, transparent); color: var(--gold-bright);
  font-size: .85rem; box-shadow: var(--shadow-soft); opacity: 0; transition: opacity .3s, transform .3s; z-index: 90;
}
.admin-toast[hidden] { display: none; }
.admin-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.admin-toast.error { border-color: rgba(220,120,100,.5); color: #f0b4a5; }

.admin-empty { padding: 2rem 1rem; text-align: center; color: var(--ghost); font-size: .9rem; }

/* ============================================================
   CRM — pipeline board, cards, KPIs, investor drawer, timeline
   ============================================================ */
.pipe-actions { display: flex; align-items: center; gap: .7rem; }
.pipe-search input {
  width: 220px; padding: .55rem .85rem; border: 1px solid var(--hairline); border-radius: 10px;
  background: var(--glass); color: var(--cream); font-size: .85rem;
}
.pipe-search input:focus { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--gold-glow); }

/* Stage accent colours */
.stage-slate   { --sc: #8aa0b4; }
.stage-sky     { --sc: #6fb7d8; }
.stage-amber   { --sc: #e3b95f; }
.stage-violet  { --sc: #b090e0; }
.stage-gold    { --sc: #d8b476; }
.stage-emerald { --sc: #85b878; }
.stage-rose    { --sc: #e08a8a; }

/* Kanban board */
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: 300px; gap: 1rem;
  overflow-x: auto; padding: .3rem .2rem 1.4rem; align-items: start;
  scroll-snap-type: x proximity;
}
.kanban::-webkit-scrollbar { height: 10px; }
.kanban::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 999px; }
.kan-col {
  scroll-snap-align: start;
  display: flex; flex-direction: column; min-height: 160px;
  border: 1px solid var(--hairline); border-radius: 16px;
  background: color-mix(in srgb, var(--obsidian) 42%, transparent);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.kan-col.drop-target { border-color: var(--sc); background: color-mix(in srgb, var(--sc) 12%, transparent); box-shadow: inset 0 0 0 1px var(--sc); }
.kan-col-head {
  display: flex; align-items: center; gap: .5rem; padding: .85rem 1rem .7rem;
  border-bottom: 1px solid var(--hairline); position: sticky; top: 0;
}
.kan-col-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 10px color-mix(in srgb, var(--sc) 70%, transparent); flex: none; }
.kan-col-head h3 { margin: 0; font-family: var(--sans); font-size: .8rem; font-weight: 600; letter-spacing: .04em; color: var(--cream); flex: 1; }
.kan-col-head .col-count { font-family: var(--mono); font-size: .68rem; color: var(--ghost); }
.kan-col-sub { padding: 0 1rem .6rem; font-family: var(--mono); font-size: .62rem; letter-spacing: .05em; color: var(--sc); }
.kan-list { display: flex; flex-direction: column; gap: .6rem; padding: .7rem; flex: 1; min-height: 40px; }
.kan-empty { padding: 1.2rem .5rem; text-align: center; color: var(--faint); font-size: .74rem; }

/* Investor card */
.inv-card {
  border: 1px solid var(--hairline); border-left: 3px solid var(--sc); border-radius: 12px;
  background: color-mix(in srgb, var(--canopy) 60%, transparent);
  padding: .8rem .85rem; cursor: grab; transition: transform .15s, border-color .2s, box-shadow .2s, background .2s;
}
.inv-card:hover { transform: translateY(-2px); border-color: var(--gold-dim); box-shadow: var(--shadow-soft); background: color-mix(in srgb, var(--canopy) 80%, transparent); }
.inv-card.dragging { opacity: .45; }
.inv-card-top { display: flex; align-items: flex-start; gap: .5rem; }
.inv-avatar { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; font-family: var(--serif); font-size: .9rem; color: var(--void); background: linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 55%, #fff)); }
.inv-id { min-width: 0; flex: 1; }
.inv-name { font-weight: 600; color: var(--cream); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-company { color: var(--ghost); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prio { width: 8px; height: 8px; border-radius: 50%; margin-top: .35rem; flex: none; }
.prio.high { background: #e08a8a; box-shadow: 0 0 8px rgba(224,138,138,.6); }
.prio.medium { background: var(--amber); }
.prio.low { background: var(--ghost); opacity: .5; }
.inv-amount { margin: .55rem 0 .5rem; font-family: var(--serif); font-size: 1.05rem; color: var(--gold-bright); }
.inv-amount small { font-family: var(--mono); font-size: .6rem; color: var(--ghost); letter-spacing: .1em; margin-left: .3rem; }
.inv-meta { display: flex; flex-wrap: wrap; gap: .35rem .7rem; font-size: .68rem; color: var(--ghost); }
.inv-meta .m { display: inline-flex; align-items: center; gap: .28rem; }
.inv-eng { margin-top: .55rem; display: flex; align-items: center; gap: .5rem; }
.inv-eng .bar { flex: 1; height: 5px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.inv-eng .bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); }
.inv-eng .val { font-family: var(--mono); font-size: .6rem; color: var(--ghost); }
.inv-flags { margin-top: .5rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.flag { font-family: var(--mono); font-size: .56rem; letter-spacing: .08em; text-transform: uppercase; padding: .18rem .5rem; border-radius: 999px; }
.flag.overdue { background: rgba(224,138,138,.16); color: #f0b4a5; }
.flag.hot { background: rgba(227,185,95,.16); color: var(--amber); }
.flag.due { background: var(--glass); color: var(--ghost); }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 85; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--void) 72%, #000 28%); backdrop-filter: blur(6px); animation: fade .25s ease; }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(560px, 100%);
  overflow-y: auto; padding: 1.6rem 1.7rem 3rem;
  border-left: 1px solid var(--line-strong);
  background: linear-gradient(200deg, color-mix(in srgb, var(--canopy) 92%, transparent), var(--obsidian));
  box-shadow: -30px 0 80px rgba(0,0,0,.5); animation: slidein .32s var(--ease);
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dr-head { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: 1.1rem; }
.dr-avatar { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; font-family: var(--serif); font-size: 1.5rem; color: var(--void); background: linear-gradient(135deg, var(--sc, var(--gold)), color-mix(in srgb, var(--sc, var(--gold)) 55%, #fff)); }
.dr-title { flex: 1; min-width: 0; }
.dr-title h2 { margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 500; color: var(--cream); }
.dr-title p { margin: .15rem 0 0; color: var(--ghost); font-size: .82rem; }
.dr-close { width: 34px; height: 34px; border: 1px solid var(--hairline); border-radius: 9px; background: transparent; color: var(--ghost); cursor: pointer; flex: none; }
.dr-close:hover { color: var(--gold-bright); border-color: var(--gold-dim); }

.dr-stagebar { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1.1rem; }
.dr-stage-btn { padding: .4rem .7rem; border: 1px solid var(--hairline); border-radius: 999px; background: transparent; color: var(--ghost); font-size: .72rem; font-weight: 600; cursor: pointer; transition: all .18s; }
.dr-stage-btn:hover { color: var(--cream); border-color: var(--line-strong); }
.dr-stage-btn.active { color: var(--void); background: var(--sc); border-color: var(--sc); }

.dr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1.2rem; }
.dr-field { display: grid; gap: .3rem; }
.dr-field label { font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.dr-field input, .dr-field select { padding: .55rem .7rem; border: 1px solid var(--hairline); border-radius: 9px; background: rgba(255,255,255,.04); color: var(--cream); font-size: .86rem; font-family: var(--sans); }
.dr-field input:focus, .dr-field select:focus { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--gold-glow); }
.dr-field.wide { grid-column: 1 / -1; }
.dr-save-row { display: flex; justify-content: flex-end; gap: .6rem; margin: -.4rem 0 1.3rem; }

.dr-section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 1.4rem 0 .7rem; }
.dr-section-title h3 { margin: 0; font-family: var(--serif); font-size: 1.12rem; font-weight: 500; color: var(--cream); }
.dr-section-title .hint { color: var(--ghost); font-size: .72rem; }

/* Engagement mini-panel */
.eng-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; }
.eng-cell { padding: .7rem .5rem; border: 1px solid var(--hairline); border-radius: 11px; background: var(--glass); text-align: center; }
.eng-cell b { display: block; font-family: var(--serif); font-size: 1.15rem; color: var(--gold-bright); }
.eng-cell span { font-family: var(--mono); font-size: .54rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ghost); }
.eng-docs { margin-top: .7rem; display: grid; gap: .3rem; }
.eng-doc { display: flex; align-items: center; gap: .55rem; font-size: .78rem; color: var(--muted); }
.eng-doc .lbl { font-family: var(--mono); font-size: .62rem; color: var(--ghost); min-width: 34px; }
.eng-doc .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eng-doc .s { font-family: var(--mono); font-size: .66rem; color: var(--gold); }

/* Log interaction form */
.log-form { border: 1px solid var(--hairline); border-radius: 14px; padding: .9rem; background: color-mix(in srgb, var(--obsidian) 50%, transparent); display: grid; gap: .6rem; margin-bottom: 1rem; }
.log-kinds { display: flex; gap: .35rem; }
.log-kind { flex: 1; padding: .5rem; border: 1px solid var(--hairline); border-radius: 9px; background: transparent; color: var(--ghost); font-size: .74rem; cursor: pointer; transition: all .18s; }
.log-kind.active { color: var(--gold-bright); border-color: var(--gold-dim); background: var(--gold-glow); }
.log-form textarea { min-height: 62px; padding: .6rem .75rem; border: 1px solid var(--hairline); border-radius: 9px; background: rgba(255,255,255,.04); color: var(--cream); font-family: var(--sans); font-size: .86rem; resize: vertical; }
.log-form textarea:focus, .log-form input:focus { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--gold-glow); }
.log-row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.log-row input, .log-row select { padding: .5rem .65rem; border: 1px solid var(--hairline); border-radius: 9px; background: rgba(255,255,255,.04); color: var(--cream); font-size: .82rem; font-family: var(--sans); }
.log-row label { display: grid; gap: .25rem; font-family: var(--mono); font-size: .55rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }

/* Timeline */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 34px 1fr; gap: .7rem; padding-bottom: 1rem; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: -2px; width: 1px; background: var(--hairline); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .95rem; border: 1px solid var(--hairline); background: var(--glass); z-index: 1; }
.tl-icon.call { color: var(--emerald); } .tl-icon.note { color: var(--gold); } .tl-icon.email { color: #6fb7d8; } .tl-icon.meeting { color: #b090e0; } .tl-icon.stage { color: var(--amber); }
.tl-body { min-width: 0; }
.tl-top { display: flex; align-items: baseline; gap: .5rem; }
.tl-kind { font-weight: 600; color: var(--cream); font-size: .84rem; text-transform: capitalize; }
.tl-when { font-family: var(--mono); font-size: .62rem; color: var(--ghost); }
.tl-del { margin-left: auto; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: .8rem; opacity: 0; transition: opacity .15s, color .15s; }
.tl-item:hover .tl-del { opacity: 1; } .tl-del:hover { color: #e08a8a; }
.tl-summary { margin: .2rem 0 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.tl-tags { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.tl-tag { font-family: var(--mono); font-size: .58rem; padding: .12rem .5rem; border-radius: 999px; background: var(--glass); color: var(--ghost); }
.tl-tag.next { background: rgba(227,185,95,.14); color: var(--amber); }

@media (max-width: 720px) {
  .dr-grid, .eng-grid { grid-template-columns: 1fr 1fr; }
  .drawer-panel { width: 100%; }
}
