/* ZNCRM — dense dark theme. Accent follows the active workspace. */
:root {
  --bg: #0a0a0a; --surface: #141414; --surface2: #1c1c1c; --border: #262626;
  --text: #e6e2da; --muted: #8a8a84; --accent: #c8b88a;
  --green: #7dbf8e; --red: #c87d7d; --yellow: #cdb35f; --blue: #6ba4c8;
}
body.ws-zummi { --accent: #6ba4c8; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 13px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
h1 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
h2 { font-size: 14px; margin: 16px 0 8px; font-weight: 600; }

/* sidebar */
.sidebar {
  width: 168px; min-width: 168px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.ws-switch { padding: 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.ws-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); cursor: pointer; font-weight: 700; font-size: 11px;
}
.ws-btn.active { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }
.ws-name { font-weight: 600; color: var(--accent); font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
.sidebar nav a { color: var(--text); padding: 7px 14px; font-size: 13px; border-left: 2px solid transparent; }
.sidebar nav a:hover { background: var(--surface2); text-decoration: none; }
.sidebar nav a.active { border-left-color: var(--accent); color: var(--accent); background: var(--surface2); }
.sidebar-foot { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 11px; display:flex; flex-direction:column; gap:2px; }
main { flex: 1; padding: 16px 20px; max-width: 1600px; min-width: 0; }

/* toolbar / filters */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.toolbar .spacer { flex: 1; }
input, select, textarea, button {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 5px 8px; font-size: 12.5px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #0a0a0a; border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--red); }
button.link { background: none; border: none; color: var(--accent); padding: 2px 4px; }

/* tables — dense */
table { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--border); }
th, td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
td.wrap { white-space: normal; }
th { background: var(--surface2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
     color: var(--muted); position: sticky; top: 0; cursor: pointer; user-select: none; }
tbody tr:hover { background: var(--surface2); }
tbody tr.kb-active { outline: 1px solid var(--accent); outline-offset: -1px; }
.table-wrap { overflow-x: auto; }

/* badges */
.badge { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10.5px; font-weight: 600; }
.b-new { background:#2a2a2a; color:#aaa; } .b-qualified { background:#233427; color:var(--green); }
.b-drafted { background:#2c2a1e; color:var(--yellow); } .b-sent { background:#1e2733; color:var(--blue); }
.b-replied { background:#332a1e; color:var(--accent); } .b-converted { background:#233427; color:var(--green); }
.b-dead { background:#331e1e; color:var(--red); }
.b-opened { background:#2c2a1e; color:var(--yellow); } .b-clicked { background:#2c2a1e; color:var(--yellow); }
.b-bounced { background:#331e1e; color:var(--red); } .b-unsubscribed { background:#331e1e; color:var(--red); }
.score { font-weight: 700; color: var(--accent); }

/* cards / panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.stat .n { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.delta-up { color: var(--green); font-size: 11px; } .delta-down { color: var(--red); font-size: 11px; }

/* kanban */
.kanban { display: flex; gap: 10px; overflow-x: auto; align-items: flex-start; padding-bottom: 12px; }
.kcol { min-width: 210px; width: 210px; background: var(--surface); border: 1px solid var(--border);
        border-radius: 8px; flex-shrink: 0; }
.kcol h3 { font-size: 11.5px; margin: 0; padding: 8px 10px; text-transform: uppercase; letter-spacing: .04em;
           color: var(--muted); border-bottom: 1px solid var(--border); display:flex; justify-content:space-between; }
.kcol.won h3 { color: var(--green); } .kcol.lost h3 { color: var(--red); }
.kcards { min-height: 40px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.kcard { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
         padding: 7px 9px; cursor: grab; font-size: 12px; }
.kcard:hover { border-color: var(--accent); }
.kcard .t { font-weight: 600; }
.kcard .m { color: var(--muted); font-size: 11px; display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.sortable-ghost { opacity: .4; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; width: 6px; height: 6px; background: var(--accent); border-radius: 50%;
                       position: absolute; left: -4px; top: 12px; }
.timeline .who { color: var(--muted); font-size: 11px; }
.timeline .body { white-space: pre-wrap; }

/* notes board */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.note-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--surface); position: relative; }
.note-card.pinned { border-color: var(--accent); }
.note-card h4 { margin: 0 0 6px; font-size: 13px; }
.note-card .body { white-space: pre-wrap; font-size: 12.5px; }
.note-card .meta { color: var(--muted); font-size: 10.5px; margin-top: 8px; }
.note-card.c-gold { background: #1d1a12; } .note-card.c-blue { background: #121a1d; }
.note-card.c-green { background: #12190f; } .note-card.c-red { background: #1d1212; }
.note-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }

/* calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border);
            border-radius: 8px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-cell { background: var(--surface); min-height: 92px; padding: 4px 6px; font-size: 11px; }
.cal-cell.other { opacity: .38; }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-cell .d { color: var(--muted); font-weight: 600; }
.cal-item { border-radius: 4px; padding: 1px 5px; margin-top: 3px; font-size: 10.5px; cursor: pointer;
            background: var(--surface2); border-left: 2px solid var(--accent);
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.k-event { border-left-color: var(--blue); }
.cal-item.k-reminder { border-left-color: var(--yellow); }
.cal-item.done { opacity: .4; text-decoration: line-through; }

/* modal */
#modal-root { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 60;
              display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
         width: min(640px, 92vw); max-height: 80vh; overflow-y: auto; padding: 16px; }
.modal h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; align-items: center; }
.form-grid label { color: var(--muted); font-size: 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* cmd+k */
.cmdk { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 70; padding-top: 12vh; }
.cmdk-box { width: min(560px, 90vw); margin: 0 auto; background: var(--surface);
            border: 1px solid var(--accent); border-radius: 10px; overflow: hidden; }
.cmdk-box input { width: 100%; border: none; border-bottom: 1px solid var(--border);
                  border-radius: 0; padding: 12px 14px; font-size: 14px; }
#cmdk-results .hit { padding: 7px 14px; display: flex; gap: 8px; align-items: center; }
#cmdk-results .hit:hover, #cmdk-results .hit.kb-active { background: var(--surface2); }
#cmdk-results .cat { color: var(--muted); font-size: 10px; text-transform: uppercase; padding: 6px 14px 2px; }

/* toast */
#toast { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 6px; }
#toast .t { background: var(--surface2); border: 1px solid var(--accent); border-radius: 6px;
            padding: 8px 14px; font-size: 12.5px; animation: fadein .15s; }
.hidden { display: none !important; }

/* misc */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }
.filters-row select, .filters-row input { min-width: 0; }
.inline-edit { border-bottom: 1px dashed var(--border); cursor: text; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.metric-note { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 8px; }
.login-wrap { margin: 14vh auto; width: 320px; }
.checkcol { width: 26px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; } }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { flex-direction: row; }
  .sidebar-foot { border-top: none; margin-left: auto; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  main { padding: 10px; }
}
