/* Kangers — design tokens.
   Human actors are indigo, agents are terracotta. That one distinction runs
   through avatars, activity rows and assignee chips, so at a glance you can
   always tell which changes were yours and which an agent made. */

:root {
  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #f1f3f6;
  --surface-hover: #eceff3;
  --border:        #e2e5ea;
  --border-strong: #cdd2da;

  --text:          #16181d;
  --text-muted:    #62697a;
  --text-faint:    #8b92a3;

  --accent:        #5b5bd6;
  --accent-hover:  #4b4bc4;
  --accent-soft:   #eeeefc;
  --agent:         #c2643f;
  --agent-soft:    #fbeee7;

  --danger:        #d4453b;
  --danger-soft:   #fdecea;
  --success:       #1a7f52;
  --warning:       #b06a00;

  --p-urgent:      #d4453b;
  --p-high:        #d97706;
  --p-medium:      #2563eb;
  --p-low:         #64748b;

  --radius:        10px;
  --radius-sm:     7px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 2px rgba(16,18,24,.06), 0 1px 3px rgba(16,18,24,.04);
  --shadow:        0 4px 14px rgba(16,18,24,.09), 0 1px 3px rgba(16,18,24,.05);
  --shadow-lg:     0 18px 48px rgba(16,18,24,.18), 0 2px 8px rgba(16,18,24,.08);

  --sidebar-w:     252px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0e1014;
    --surface:       #171a20;
    --surface-2:     #1e222a;
    --surface-hover: #252a33;
    --border:        #282d37;
    --border-strong: #3a414e;

    --text:          #e8eaef;
    --text-muted:    #9aa3b4;
    --text-faint:    #6f7889;

    --accent:        #8b8bf0;
    --accent-hover:  #9d9df5;
    --accent-soft:   #23233c;
    --agent:         #e08a63;
    --agent-soft:    #33241d;

    --danger:        #f0736a;
    --danger-soft:   #331e1d;
    --success:       #4ec38a;
    --warning:       #dda23c;

    --p-urgent:      #f0736a;
    --p-high:        #e0a13c;
    --p-medium:      #6f9dfa;
    --p-low:         #8b93a5;

    --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
    --shadow:        0 4px 14px rgba(0,0,0,.45);
    --shadow-lg:     0 18px 48px rgba(0,0,0,.6);
  }
}

[data-theme="dark"] {
  --bg:            #0e1014;
  --surface:       #171a20;
  --surface-2:     #1e222a;
  --surface-hover: #252a33;
  --border:        #282d37;
  --border-strong: #3a414e;
  --text:          #e8eaef;
  --text-muted:    #9aa3b4;
  --text-faint:    #6f7889;
  --accent:        #8b8bf0;
  --accent-hover:  #9d9df5;
  --accent-soft:   #23233c;
  --agent:         #e08a63;
  --agent-soft:    #33241d;
  --danger:        #f0736a;
  --danger-soft:   #331e1d;
  --success:       #4ec38a;
  --warning:       #dda23c;
  --p-urgent:      #f0736a;
  --p-high:        #e0a13c;
  --p-medium:      #6f9dfa;
  --p-low:         #8b93a5;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --shadow:        0 4px 14px rgba(0,0,0,.45);
  --shadow-lg:     0 18px 48px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* --- boot / auth ---------------------------------------------------------- */

.boot { display: grid; place-items: center; height: 100vh; }
.boot-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px; box-shadow: var(--shadow);
}
.auth-logo {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-bottom: 6px;
}
.auth-logo svg { width: 76px; height: 76px; box-shadow: var(--shadow); border-radius: 17px; }
.auth-logo span { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.auth-sub { color: var(--text-muted); margin: 0 0 24px; font-size: 13.5px; text-align: center; }
.auth-card label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-muted); margin: 14px 0 5px; }
.auth-card input {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg);
}
.auth-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.auth-error { background: var(--danger-soft); color: var(--danger); padding: 9px 11px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 16px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* --- layout --------------------------------------------------------------- */

.app { height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.app.is-loading, .app.is-auth { display: block; }

.sidebar {
  background: var(--surface-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head { padding: 14px 14px 10px; display: flex; align-items: center; gap: 9px; }
.sidebar-head svg { width: 24px; height: 24px; flex: none; }
.sidebar-head .ws-name { font-weight: 640; letter-spacing: -.01em; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-search {
  margin: 2px 10px 10px; display: flex; align-items: center; gap: 7px;
  padding: 6px 9px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-faint); cursor: pointer;
  font-size: 13px; width: calc(100% - 20px); text-align: left;
}
.sidebar-search:hover { border-color: var(--border-strong); }
.sidebar-search kbd { margin-left: auto; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.nav-group { margin-bottom: 16px; }
.nav-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint);
}
.nav-label button {
  background: none; border: 0; color: var(--text-faint); cursor: pointer;
  padding: 2px 4px; border-radius: 4px; line-height: 1; font-size: 15px;
}
.nav-label button:hover { background: var(--surface-hover); color: var(--text); }

.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6.5px 8px; border: 0; background: none; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer; text-align: left; font-size: 13.5px;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 560; }
.nav-item .icon { width: 16px; flex: none; display: grid; place-items: center; opacity: .85; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.nav-item .count { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: var(--accent); }
.nav-item .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 8px; }

/* --- main ----------------------------------------------------------------- */

.main { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex: none;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 640; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }
.topbar .sub { color: var(--text-faint); font-size: 12.5px; font-weight: 450; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.seg { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; }
.seg button {
  border: 0; background: none; padding: 4px 11px; border-radius: 5px;
  font-size: 12.5px; color: var(--text-muted); cursor: pointer; font-weight: 520;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6.5px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 520; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }

kbd {
  font-family: var(--font); font-size: 10.5px; padding: 1.5px 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface-2); color: var(--text-faint);
}

.content { flex: 1; overflow: auto; }

/* --- board ---------------------------------------------------------------- */

.board { display: flex; gap: 14px; padding: 18px 20px 28px; align-items: flex-start; min-height: 100%; }
.column { width: 292px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 130px); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 9px; }
.column-head .name { font-weight: 600; font-size: 13.5px; }
.column-head .n { font-size: 11.5px; color: var(--text-faint); background: var(--surface-2); padding: 1px 7px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.column-head .col-menu { margin-left: auto; opacity: 0; }
.column:hover .col-menu { opacity: 1; }
.column-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px; min-height: 40px; }
.column.drop-target .column-body { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: var(--radius); }
.column-add {
  margin-top: 8px; padding: 7px 10px; border: 1px dashed var(--border-strong);
  background: none; border-radius: var(--radius-sm); color: var(--text-faint);
  cursor: pointer; font-size: 13px; text-align: left; width: 100%;
}
.column-add:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 11px; cursor: pointer;
  box-shadow: var(--shadow-sm); position: relative;
}
.card:hover { border-color: var(--border-strong); }
.card.dragging { opacity: .4; }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%   { box-shadow: 0 0 0 2px var(--agent); }
  100% { box-shadow: var(--shadow-sm); }
}
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-title { font-size: 13.5px; line-height: 1.4; flex: 1; word-break: break-word; }
.card.done .card-title { color: var(--text-faint); text-decoration: line-through; }
.card-meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.card-meta:empty { display: none; }

.check {
  width: 16px; height: 16px; flex: none; border-radius: 50%; margin-top: 1px;
  border: 1.5px solid var(--border-strong); background: none; cursor: pointer;
  display: grid; place-items: center; padding: 0; color: transparent;
}
.check:hover { border-color: var(--success); color: var(--success); }
.check.checked { background: var(--success); border-color: var(--success); color: #fff; }
.check svg { width: 10px; height: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
  padding: 1.5px 7px; border-radius: 20px; background: var(--surface-2);
  color: var(--text-muted); white-space: nowrap;
}
.chip.due-today { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.chip.due-over  { background: var(--danger-soft); color: var(--danger); font-weight: 550; }
.chip svg { width: 11px; height: 11px; }

.prio { font-size: 11px; font-weight: 640; letter-spacing: .03em; text-transform: uppercase; }
.prio-urgent { color: var(--p-urgent); } .prio-high { color: var(--p-high); }
.prio-medium { color: var(--p-medium); } .prio-low { color: var(--p-low); }

.tag { font-size: 11px; padding: 1px 7px; border-radius: 20px; font-weight: 520; }

.avatar {
  width: 21px; height: 21px; border-radius: 50%; flex: none; display: grid;
  place-items: center; font-size: 9.5px; font-weight: 680; color: #fff;
  letter-spacing: .02em; text-transform: uppercase;
}
.avatar.agent { border-radius: 6px; box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--agent); }
.avatar.lg { width: 28px; height: 28px; font-size: 11px; }
.avatar.sm { width: 18px; height: 18px; font-size: 8.5px; }

/* --- list view ------------------------------------------------------------ */

.list { padding: 12px 20px 30px; max-width: 940px; }
.list-section { margin-bottom: 22px; }
.list-section > h3 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); margin: 0 0 7px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
}
.row {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 5px; cursor: pointer;
}
.row:hover { border-color: var(--border-strong); }
.row.flash { animation: flash 1.6s ease-out; }
.row-title { flex: 1; font-size: 13.5px; word-break: break-word; }
.row.done .row-title { color: var(--text-faint); text-decoration: line-through; }
.row-meta { display: flex; align-items: center; gap: 8px; flex: none; }

.quick-add { display: flex; gap: 8px; margin-bottom: 14px; }
.quick-add input {
  flex: 1; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: 13.5px;
}
.quick-add input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.empty { text-align: center; padding: 64px 20px; color: var(--text-faint); }
.empty h3 { color: var(--text); font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.empty p { margin: 0 auto 18px; max-width: 380px; font-size: 13.5px; line-height: 1.6; }

/* --- task detail drawer --------------------------------------------------- */

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10,12,16,.32);
  z-index: 40; animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 41; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slide .18s cubic-bezier(.3,.8,.4,1);
}
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-head .crumb { font-size: 12.5px; color: var(--text-faint); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

.detail-title {
  width: 100%; border: 0; background: none; font-size: 19px; font-weight: 620;
  letter-spacing: -.02em; padding: 2px 0; resize: none; overflow: hidden;
  line-height: 1.35; font-family: inherit;
}
.detail-title:focus { outline: none; }
.detail-title.done { color: var(--text-faint); text-decoration: line-through; }

.fields { display: grid; grid-template-columns: 96px 1fr; gap: 3px 10px; margin: 18px 0 22px; align-items: center; }
.fields > dt { font-size: 12.5px; color: var(--text-muted); }
.fields > dd { margin: 0; }

.field-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 4.5px 9px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: none;
  cursor: pointer; font-size: 13px; color: var(--text); width: 100%; text-align: left;
}
.field-btn:hover { background: var(--surface-2); border-color: var(--border); }
.field-btn.placeholder { color: var(--text-faint); }
.field-input {
  padding: 4.5px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg); width: 100%;
}

.detail-section { margin-top: 24px; }
.detail-section > h4 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); margin: 0 0 9px; font-weight: 650;
}
.notes {
  width: 100%; min-height: 76px; padding: 10px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); resize: vertical;
  font-size: 13.5px; line-height: 1.6; font-family: inherit;
}
.notes:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.subtask { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: var(--radius-sm); }
.subtask:hover { background: var(--surface-2); }
.subtask .t { flex: 1; font-size: 13px; }
.subtask.done .t { color: var(--text-faint); text-decoration: line-through; }

.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 2px; }
.comment-head .who { font-weight: 600; font-size: 13px; }
.comment-head .when { font-size: 11.5px; color: var(--text-faint); }
.comment-text { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.comment.by-agent .comment-body { background: var(--agent-soft); padding: 8px 11px; border-radius: var(--radius-sm); }

.badge-agent {
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--agent); background: var(--agent-soft); padding: 1px 5px; border-radius: 4px;
}

.composer { display: flex; gap: 9px; margin-top: 10px; }
.composer textarea {
  flex: 1; min-height: 62px; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg); resize: vertical;
  font-family: inherit; font-size: 13.5px;
}
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.activity-row { display: flex; gap: 9px; align-items: baseline; padding: 5px 0; font-size: 12.5px; color: var(--text-muted); }
.activity-row .who { font-weight: 580; color: var(--text); }
.activity-row.by-agent .who { color: var(--agent); }
.activity-row .when { margin-left: auto; color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }

/* --- popovers, modals, toasts --------------------------------------------- */

.popover {
  position: fixed; z-index: 60; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 5px; min-width: 210px;
  max-height: 320px; overflow-y: auto;
}
.popover-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6.5px 9px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; text-align: left; color: var(--text);
}
.popover-item:hover, .popover-item.cursor { background: var(--surface-hover); }
.popover-item.danger { color: var(--danger); }
.popover-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.popover-label { padding: 7px 9px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 650; }
.popover input[type="date"], .popover input[type="text"] {
  width: 100%; padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg);
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,12,16,.4); z-index: 70;
  display: grid; place-items: start center; padding: 12vh 16px 16px; overflow-y: auto;
  animation: fade .12s ease-out;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; overflow: hidden;
}
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 15.5px; font-weight: 640; letter-spacing: -.01em; }
.modal-body { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2); }
.modal label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-muted); margin: 14px 0 5px; }
.modal label:first-child { margin-top: 0; }
.modal input[type="text"], .modal input[type="email"], .modal input[type="password"], .modal textarea, .modal select {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg); font-family: inherit;
}
.modal input:focus, .modal textarea:focus, .modal select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; line-height: 1.5; }

.search-input {
  width: 100%; padding: 14px 20px; border: 0; background: none;
  font-size: 15.5px; border-bottom: 1px solid var(--border);
}
.search-input:focus { outline: none; }
.search-results { max-height: 400px; overflow-y: auto; padding: 6px; }
.search-empty { padding: 32px; text-align: center; color: var(--text-faint); font-size: 13.5px; }

.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 9px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 9px 13px; font-size: 13px;
  max-width: 380px; animation: toast-in .2s cubic-bezier(.3,.8,.4,1);
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.toast.agent { border-left: 3px solid var(--agent); }
.toast.error { border-left: 3px solid var(--danger); }
.toast .t-body { flex: 1; }
.toast .t-body b { font-weight: 600; }

/* --- settings ------------------------------------------------------------- */

.settings { padding: 22px 24px 48px; max-width: 780px; }
.settings h2 { font-size: 15px; margin: 0 0 4px; font-weight: 640; }
.settings > p { color: var(--text-muted); margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 13.5px; font-weight: 620; }
.panel-head .btn { margin-left: auto; }
.panel-body { padding: 4px 0; }
.panel-body.pad { padding: 16px; }
.item { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .name { font-size: 13.5px; font-weight: 550; }
.item .meta { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.item .meta code { font-family: var(--mono); font-size: 11.5px; }

pre.code {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12px;
  line-height: 1.65; margin: 0 0 12px; white-space: pre;
}
.token-reveal {
  display: flex; align-items: center; gap: 9px; background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 11px 13px; margin-top: 12px;
}
.token-reveal code { font-family: var(--mono); font-size: 12px; flex: 1; word-break: break-all; }

.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 26px; }
.shortcut { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.shortcut .keys { margin-left: auto; display: flex; gap: 3px; }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
    transform: translateX(-100%); transition: transform .18s ease-out;
  }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10,12,16,.4); z-index: 45; }
  .nav-toggle { display: inline-flex !important; }
  .board { padding: 14px; }
  .column { width: 84vw; max-width: 300px; }
  .list, .settings { padding: 14px; }
  .drawer { width: 100vw; }
  .shortcut-grid { grid-template-columns: 1fr; }
}
.nav-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Inline SVG icons have no intrinsic size, so constrain them everywhere they
   are used as glyphs rather than as the logo. */
.btn svg,
.nav-item .icon svg,
.sidebar-search > svg,
.field-btn > svg,
.nav-label button svg,
.popover-item > svg,
.subtask .check svg,
.activity-row svg { width: 15px; height: 15px; flex: none; display: block; }

.btn svg { width: 14px; height: 14px; }
.sidebar-search > svg { width: 14px; height: 14px; }
.check svg { width: 10px; height: 10px; }
.chip svg { width: 11px; height: 11px; flex: none; }
.column-add svg { width: 12px; height: 12px; vertical-align: -1px; }

/* --- folders, plans and team ------------------------------------------------ */

.folder-head { font-weight: 560; }
.folder-head .chev { transition: transform .15s ease; }
.folder-head .chev.open { transform: rotate(90deg); }
.folder-head .folder-menu {
  opacity: 0; display: grid; place-items: center; width: 18px; height: 18px;
  border-radius: 4px; color: var(--text-faint); flex: none;
}
.folder-head .folder-menu svg { width: 13px; height: 13px; }
.folder-head:hover .folder-menu { opacity: 1; }
.folder-head .folder-menu:hover { background: var(--border); color: var(--text); }

.plan-now { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; font-size: 15px; }
.plan-price { color: var(--text-muted); font-size: 13px; }

.usage { display: grid; gap: 9px; margin-bottom: 20px; }
.usage-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: block; }
.meter-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter-fill.full { background: var(--warning); }
.meter-text { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.meter-text.full { color: var(--warning); font-weight: 600; }
.meter-free { font-size: 12px; color: var(--success); }

.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.plan-card.current { border-color: var(--accent); background: var(--accent-soft); }
.plan-name { font-weight: 620; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.plan-cost { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 6px 0 10px; }
.plan-cost span { font-size: 12.5px; font-weight: 450; color: var(--text-muted); }
.plan-card ul { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }

.role-select {
  padding: 4px 8px; border-radius: var(--radius-sm); font-size: 12.5px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
}

@media (max-width: 620px) { .plan-grid { grid-template-columns: 1fr; } }
