/* yayce — dark, minimal, Supabase-inspired. Dark is the only mode. */

:root {
  --bg: #171717;
  --surface: #1c1c1c;
  --raised: #222222;
  --border: #2e2e2e;
  --border-strong: #3a3a3a;
  --text: #ededed;
  --muted: #8f8f8f;
  --accent: #3ecf8e;
  --accent-text: #0a1f15;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 6px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a.link { color: var(--accent); }
a.link:hover { text-decoration: underline; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }

/* ---- app shell ---- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 16px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}

.ws-switch { padding: 12px 12px 4px; }
.ws-switch select {
  width: 100%;
  background: var(--raised);
  font-size: 12.5px;
  padding: 6px 8px;
}

.invite-link { min-width: 260px; max-width: 420px; cursor: copy; }

.sidebar nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }

.sidebar nav a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13.5px;
}
.sidebar nav a:hover { color: var(--text); background: var(--raised); }
.sidebar nav a.active { color: var(--text); background: var(--raised); }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.user-email:hover { color: var(--text); text-decoration: underline; }

.main { flex: 1; padding: 36px 44px; max-width: 1060px; }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); margin-top: 3px; font-size: 13.5px; }

/* ---- cards ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

.card h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.card .card-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat { padding: 18px 20px; margin: 0; }
.stat .stat-label { color: var(--muted); font-size: 12.5px; }
.stat .stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.stat .stat-note { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---- tables ---- */

.table-card { padding: 0; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--raised) 55%, transparent); }

.cell-strong { font-weight: 500; }

.chip {
  display: inline-block;
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.chip.ok {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.chip.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
}

/* ---- forms ---- */

label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
}

input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: #5c5c5c; }

.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.form-inline .field { flex: 1; min-width: 170px; }

.form-grid { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }

.form-error { color: var(--danger); font-size: 12.5px; width: 100%; }
.form-notice { color: var(--accent); font-size: 12.5px; width: 100%; margin-bottom: 8px; }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { border-color: #4a4a4a; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.primary:hover { filter: brightness(1.08); }

.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

.plan-assign {
  display: flex;
  gap: 6px;
  align-items: center;
}
.plan-assign select {
  width: auto;
  min-width: 110px;
  padding: 4px 8px;
  font-size: 12.5px;
}

select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
select:focus { border-color: var(--accent); }

.saved-chip {
  display: inline-block;
  color: var(--accent);
  font-size: 12.5px;
  margin-left: 10px;
}

/* ---- CRM ---- */

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.row-link { cursor: pointer; }

.tag-chip { font-size: 11px; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 7fr) minmax(280px, 5fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.field-pair { display: flex; gap: 12px; }
.field-pair .field { flex: 1; }

textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
textarea:focus { border-color: var(--accent); }

.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: flex; gap: 10px; }
.timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  margin-top: 6px;
  flex-shrink: 0;
}
.timeline-dot.accent { background: var(--accent); }
.timeline-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.timeline-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.kanban {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-col {
  flex: 1;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.kanban-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.kanban-head .muted { font-size: 11.5px; font-weight: 400; }
.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}
.deal-card {
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
}
.deal-card:active { cursor: grabbing; }
.deal-ghost { opacity: 0.4; border-style: dashed; }
.deal-title { font-size: 13px; font-weight: 500; }
.deal-contact { font-size: 12px; color: var(--muted); margin-top: 2px; }
.deal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.deal-value { font-size: 12.5px; color: var(--accent); font-weight: 500; }
.deal-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s; }
.deal-card:hover .deal-actions { opacity: 1; }
.deal-actions form { display: inline; }
.deal-actions button {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 4px;
  width: 22px; height: 22px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.deal-actions button:hover { color: var(--text); border-color: #4a4a4a; }

/* ---- bare pages (login / landing) ---- */

.bare {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

.hero { text-align: center; max-width: 520px; }
.hero .brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 22px;
}
.hero h1 {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 14px;
}
.hero p { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
