/* =========================================================
   MakHome Hub — design system
   All brand colours live in the :root block below. To rebrand,
   swap the --brand-* values (e.g. from the brand HTML file).
   ========================================================= */

:root {
  /* ----- MakHome BRAND ----- warm, low-chroma, editorial.
     Primary action = charcoal ink on warm milk (no colour accent). ----- */
  --brand:        oklch(18% 0.005 60);   /* ink — the "accent" is the near-black */
  --brand-strong: oklch(28% 0.005 60);
  --brand-soft:   oklch(93% 0.010 80);   /* linen wash for active states */
  --brand-ink:    oklch(30% 0.006 60);   /* readable text on brand-soft */

  /* ----- Neutrals (warm) ----- */
  --bg:        oklch(97% 0.005 78);      /* paper */
  --surface:   oklch(99% 0.003 80);      /* milk */
  --surface-2: oklch(98% 0.004 80);      /* bone */
  --rule:      color-mix(in oklch, oklch(18% 0.005 60) 12%, transparent);
  --rule-soft: color-mix(in oklch, oklch(18% 0.005 60) 7%, transparent);

  --ink:       oklch(18% 0.005 60);
  --ink-soft:  oklch(40% 0.006 60);      /* charcoal */
  --ink-faint: oklch(58% 0.006 60);      /* slate */
  --ink-mute:  oklch(74% 0.006 60);      /* mist */

  /* ----- Status (muted, warm-leaning) ----- */
  --good:      oklch(52% 0.10 155);  --good-soft: oklch(94% 0.04 155);
  --warn:      oklch(60% 0.11 70);   --warn-soft: oklch(94% 0.05 75);
  --bad:       oklch(54% 0.16 28);   --bad-soft:  oklch(94% 0.05 30);
  --info:      oklch(48% 0.07 230);  --info-soft: oklch(94% 0.03 230);
  --purple:    oklch(52% 0.10 300);  --purple-soft: oklch(94% 0.04 300);

  --sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --mono: 'Manrope', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20,24,33,.06), 0 1px 3px rgba(20,24,33,.05);
  --shadow-md: 0 4px 16px rgba(20,24,33,.08);
  --shadow-lg: 0 12px 40px rgba(20,24,33,.16);
  --content-width: 1240px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--brand); color: #fff; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain { color: inherit; }
a.plain:hover { text-decoration: none; }

h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
p { margin: 0 0 1rem; }

.muted { color: var(--ink-faint); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .74rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--rule);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 16px 14px; gap: 14px; overflow-y: auto; }
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 750; font-size: 1.02rem; letter-spacing: -0.02em; color: var(--ink);
  padding: 4px 6px;
}
.brand .logo {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: grid; place-items: center;
}
.brand .logo img { width: 100%; height: 100%; object-fit: contain; }

/* Wordmark lockup: MakHome + "hub v.1" */
.brand-mark { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 6px 6px 4px; }
.brand-mark .wordmark { height: 21px; width: auto; display: block; }
.brand-mark .brand-sub {
  font-size: .66rem; font-weight: 700; letter-spacing: .26em; text-transform: uppercase;
  color: var(--ink-faint); padding-left: 2px;
}
.brand-mark .brand-sub span { color: var(--ink-mute); letter-spacing: .12em; }
.brand-mark.topbar-brand { padding: 0; }
.brand-mark.auth-brand { align-items: center; margin-bottom: 18px; gap: 4px; }
.brand-mark.auth-brand .wordmark { height: 26px; }
.sidebar-search { position: relative; }
.sidebar-search input {
  width: 100%; border: 1px solid var(--rule); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 8px 10px 8px 34px; font-size: .85rem; color: var(--ink);
}
.sidebar-search input:focus { outline: none; border-color: var(--brand); background: #fff; }
.sidebar-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }

.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-weight: 500; font-size: .9rem;
}
.sidebar-nav a:hover { background: var(--rule-soft); text-decoration: none; color: var(--ink); }
.sidebar-nav a.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.sidebar-nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.sidebar-nav a .count {
  margin-left: auto; font-size: .72rem; background: var(--rule); color: var(--ink-soft);
  border-radius: 20px; padding: 1px 7px; font-weight: 600;
}
.sidebar-nav a.is-active .count { background: var(--brand); color: #fff; }

.sidebar-cta {
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid var(--rule); }
.sidebar-bottom a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink-faint); font-size: .85rem; }
.sidebar-bottom a:hover { background: var(--rule-soft); color: var(--ink); text-decoration: none; }
.sidebar-bottom a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 8px 8px 2px; }
.sidebar-user .who { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-user .who b { font-size: .85rem; font-weight: 600; }
.sidebar-user .who span { font-size: .72rem; color: var(--ink-faint); }

.content-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* Topbar (mobile + actions) */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-bottom: 1px solid var(--rule);
  background: var(--surface); position: sticky; top: 0; z-index: 30;
}
.topbar-brand { display: none; }
.nav-toggle { display: none; }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--rule);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-soft);
  position: relative;
}
.icon-btn:hover { background: var(--rule-soft); color: var(--ink); }
.icon-btn.accent { background: var(--brand); border-color: var(--brand); color: #fff; }
.icon-btn.accent:hover { background: var(--brand-strong); }
.badge-dot { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .64rem; display: grid; place-items: center; font-weight: 700; }

.main { flex: 1 1 auto; }
.shell { max-width: var(--content-width); margin: 0 auto; padding: 26px 26px 80px; }
.footer { border-top: 1px solid var(--rule); padding: 16px 26px; color: var(--ink-mute); font-size: .78rem; display: flex; justify-content: space-between; }

/* =========================================================
   PAGE HEADER
   ========================================================= */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; }
.page-head .sub { color: var(--ink-faint); font-size: .9rem; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; font-weight: 600; color: var(--brand); }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: .87rem; font-weight: 550;
  font-family: inherit; transition: background .12s, border-color .12s, box-shadow .12s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--rule-soft); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--bad); border-color: var(--rule); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: .8rem; }
.btn.full { width: 100%; justify-content: center; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--rule-soft); }
.btn svg { width: 15px; height: 15px; }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }

/* =========================================================
   CARDS / PANELS
   ========================================================= */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 18px; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.dash { grid-template-columns: 2fr 1fr; align-items: start; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .n { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.stat .l { font-size: .78rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }

/* =========================================================
   BADGES / CHIPS / AVATARS
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .73rem; font-weight: 600;
  padding: 2px 9px; border-radius: 20px; background: var(--rule-soft); color: var(--ink-soft);
  white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.planned { background: oklch(94% 0.02 265); color: oklch(46% 0.06 265); }
.badge.todo { background: var(--rule-soft); color: var(--ink-soft); }
.badge.in_progress { background: var(--info-soft); color: var(--info); }
.badge.blocked { background: var(--bad-soft); color: var(--bad); }
.badge.review { background: var(--purple-soft); color: var(--purple); }
.badge.done { background: var(--good-soft); color: var(--good); }
.badge.prio-1 { background: var(--bad-soft); color: var(--bad); }
.badge.prio-2 { background: var(--warn-soft); color: var(--warn); }
.badge.due-over { background: var(--bad-soft); color: var(--bad); }
.badge.due-today { background: var(--warn-soft); color: var(--warn); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: .72rem; font-weight: 700; flex: 0 0 auto; text-transform: uppercase;
}
.avatar.sm { width: 22px; height: 22px; font-size: .62rem; }
.avatar.lg { width: 40px; height: 40px; font-size: .9rem; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -7px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.dot-color { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

/* =========================================================
   TASK LIST
   ========================================================= */
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px;
  border: 1px solid var(--rule); border-bottom: none; background: var(--surface);
}
.task-row:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.task-row:last-child { border-bottom: 1px solid var(--rule); border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.task-row:hover { background: var(--surface-2); }
.task-row.is-done .task-title { color: var(--ink-mute); text-decoration: line-through; }
.task-check {
  width: 19px; height: 19px; border-radius: 50%; border: 1.6px solid var(--ink-mute);
  cursor: pointer; flex: 0 0 auto; display: grid; place-items: center; background: var(--surface);
  transition: border-color .12s, background .12s;
}
.task-check:hover { border-color: var(--good); }
.task-check.checked { background: var(--good); border-color: var(--good); }
.task-check svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.task-check.checked svg { opacity: 1; }
.task-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 500; color: var(--ink); }
.task-title a { color: inherit; }
.task-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: .76rem; color: var(--ink-faint); }
.task-aside { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.subtask-row { padding-left: 42px; background: var(--surface-2); }

/* Inline new-task composer */
.quick-add { display: flex; gap: 8px; margin-bottom: 14px; }
.quick-add input { flex: 1; }

/* =========================================================
   KANBAN BOARD
   ========================================================= */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }
.board-col { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 80px; }
.board-col-head { padding: 11px 13px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .82rem; border-bottom: 1px solid var(--rule); }
.board-col-head .n { margin-left: auto; color: var(--ink-faint); font-weight: 600; }
.board-cards { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 30px; }
.kard {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 11px 12px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; cursor: pointer;
}
.kard:hover { border-color: var(--ink-mute); }
.kard-title { font-weight: 500; font-size: .88rem; line-height: 1.35; }
.kard-foot { display: flex; align-items: center; gap: 7px; }
.kard-foot .spacer { flex: 1; }

/* =========================================================
   PROJECT CARDS
   ========================================================= */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.proj-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; position: relative; overflow: hidden; }
.proj-card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.proj-card h3 { font-size: 1.02rem; }
.proj-card .desc { color: var(--ink-faint); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-card .row { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.progress { height: 6px; border-radius: 6px; background: var(--rule); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--good); border-radius: 6px; }

/* =========================================================
   FORMS
   ========================================================= */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.form.wide { max-width: 860px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .76rem; color: var(--ink-faint); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=date], input[type=datetime-local], input[type=number], input[type=time],
select, textarea {
  width: 100%; font-family: inherit; font-size: .9rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 9px 11px; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 84px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.checkrow { display: flex; align-items: center; gap: 8px; }
.checkrow input { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; }
.seg a { padding: 6px 12px; font-size: .82rem; color: var(--ink-soft); border-right: 1px solid var(--rule); }
.seg a:last-child { border-right: none; }
.seg a:hover { background: var(--rule-soft); text-decoration: none; }
.seg a.is-active { background: var(--brand); color: #fff; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch input { display: none; }
.swatch.sel { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

/* =========================================================
   TABLES
   ========================================================= */
.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-2); }

/* =========================================================
   CALENDAR
   ========================================================= */
.cal { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--rule); }
.cal-head div { padding: 8px; text-align: center; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.dim { background: var(--surface-2); }
.cal-cell.today .daynum { background: var(--brand); color: #fff; }
.daynum { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.cal-ev { font-size: .72rem; padding: 2px 6px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 2px solid var(--brand); }
.cal-ev.task { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.cal-ev.rem { background: var(--purple-soft); color: var(--purple); border-color: var(--purple); }
.cal-ev:hover { text-decoration: none; filter: brightness(.97); }

/* =========================================================
   DISCUSSION / COMMENTS
   ========================================================= */
.feed { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head b { font-size: .85rem; font-weight: 600; }
.msg-head .t { font-size: .72rem; color: var(--ink-faint); }
.msg-text { font-size: .9rem; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.composer { display: flex; gap: 10px; margin-top: 14px; }
.composer textarea { min-height: 42px; }

/* =========================================================
   FLASH
   ========================================================= */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .88rem; border: 1px solid; }
.flash.success { background: var(--good-soft); border-color: #BBE6D2; color: #0F6F49; }
.flash.error { background: var(--bad-soft); border-color: #F2C7C2; color: #A82C22; }

/* =========================================================
   EMPTY STATES
   ========================================================= */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-faint); }
.empty .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--rule-soft); display: grid; place-items: center; margin: 0 auto 12px; color: var(--ink-mute); }

/* =========================================================
   NOTIFICATIONS PANEL
   ========================================================= */
.notif-panel, .bell-panel {
  position: absolute; right: 0; top: 44px; width: 340px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden;
}
.bell-wrap { position: relative; }
.notif-head { padding: 12px 15px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { padding: 11px 15px; border-bottom: 1px solid var(--rule-soft); display: flex; gap: 10px; }
.notif-item.unread { background: var(--brand-soft); }
.notif-item .nt { font-size: .85rem; font-weight: 600; }
.notif-item .nb { font-size: .8rem; color: var(--ink-soft); }
.notif-item .na { font-size: .72rem; color: var(--ink-faint); margin-top: 2px; }

/* =========================================================
   AUTH PAGES
   ========================================================= */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(900px 500px at 80% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 30px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 1.2rem; }
.auth-card h1 { font-size: 1.3rem; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--ink-faint); font-size: .88rem; margin-bottom: 22px; }

/* =========================================================
   AI ASSISTANT — floating widget + full page
   ========================================================= */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 80; }
.ai-fab-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff;
  border: none; border-radius: 26px; padding: 11px 18px; font: inherit; font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-lg);
}
.ai-fab-btn .spark { width: 18px; height: 18px; }
.ai-panel {
  position: fixed; right: 22px; bottom: 22px; width: 380px; max-width: calc(100vw - 28px); height: 560px; max-height: calc(100vh - 44px);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 81; display: flex; flex-direction: column; overflow: hidden;
}
.ai-panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.ai-ava { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-strong)); display: grid; place-items: center; color: #fff; }
.ai-id { display: flex; flex-direction: column; line-height: 1.2; }
.ai-id b { font-size: .92rem; }
.ai-id span { font-size: .72rem; color: var(--ink-faint); }
.ai-panel-actions { margin-left: auto; display: flex; gap: 4px; }
.ai-iconbtn { width: 28px; height: 28px; border-radius: 7px; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; display: grid; place-items: center; }
.ai-iconbtn:hover { background: var(--rule-soft); color: var(--ink); }
.ai-chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-bubble { max-width: 86%; padding: 9px 13px; border-radius: 13px; font-size: .88rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.ai-bubble.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.ai-bubble.assistant { align-self: flex-start; background: var(--rule-soft); color: var(--ink); border-bottom-left-radius: 4px; }
.ai-bubble.tool { align-self: flex-start; background: transparent; color: var(--ink-faint); font-size: .76rem; font-family: var(--mono); padding: 2px 6px; }
.ai-welcome { color: var(--ink-faint); font-size: .86rem; text-align: center; margin: auto 10px; }
.ai-form { border-top: 1px solid var(--rule); padding: 10px; }
.ai-input-wrap { display: flex; align-items: flex-end; gap: 8px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 12px; padding: 7px 8px 7px 12px; }
.ai-input-wrap:focus-within { border-color: var(--brand); }
.ai-input-wrap textarea { border: none; background: transparent; resize: none; min-height: 22px; max-height: 120px; padding: 2px 0; box-shadow: none !important; }
.ai-input-wrap textarea:focus { outline: none; }
.ai-send, .ai-mic { width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.ai-mic { background: transparent; color: var(--ink-faint); }
.ai-mic:hover { background: var(--rule); color: var(--ink); }
.ai-mic.recording { background: var(--bad); color: #fff; animation: pulse 1.1s infinite; }
.ai-send { background: var(--brand); color: #fff; }
.ai-send:hover { background: var(--brand-strong); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.typing { display: inline-flex; gap: 3px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-mute); animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay:.2s } .typing span:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,80%,100%{ opacity:.3 } 40%{ opacity:1 } }

/* Full-page assistant */
.ai-page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 420px; }
.ai-page .ai-chat { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }

/* =========================================================
   MOBILE
   ========================================================= */
.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 85; }
  .topbar-brand { display: flex; }
  .nav-toggle { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
  .grid.dash { grid-template-columns: 1fr; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .shell { padding: 18px 16px 80px; }
}
