/* ============ SFW — Schedule Flow WPP ============ */

:root {
  /* ACCENT (set by tweaks) */
  --accent: #EE6B3B;
  --accent-hover: #D85B2D;
  --accent-soft: #FCE6DA;
  --accent-tint: #FFF3EC;

  /* LIGHT THEME */
  --bg: #F4F1EA;
  --bg-2: #EFEBE0;
  --surface: #FFFFFF;
  --surface-2: #FBF9F4;
  --sidebar: #FBF9F4;
  --border: #E8E2D2;
  --border-strong: #D5CDB8;
  --text: #1A1612;
  --text-2: #4A4338;
  --text-muted: #807766;
  --text-faint: #B5AC9A;

  --success: #2DA565;
  --success-soft: #DDF2E5;
  --warning: #D89028;
  --warning-soft: #FCEBC8;
  --error: #C53030;
  --error-soft: #FBE2E2;
  --info: #3E78C6;
  --info-soft: #DDEAF8;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-sm: 0 2px 6px rgba(60, 50, 30, 0.05), 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-md: 0 8px 24px rgba(60, 50, 30, 0.08), 0 2px 6px rgba(60, 50, 30, 0.04);
  --shadow-lg: 0 24px 48px rgba(40, 30, 15, 0.12), 0 8px 16px rgba(40, 30, 15, 0.06);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "Instrument Serif", Georgia, serif;
}

/* DARK THEME */
.theme-dark {
  --bg: #0E0C18;
  --bg-2: #131020;
  --surface: #1A1626;
  --surface-2: #15121F;
  --sidebar: #120F1C;
  --border: #2A2538;
  --border-strong: #3A3450;
  --text: #F5F1E8;
  --text-2: #C8C0B0;
  --text-muted: #8A8298;
  --text-faint: #5A5470;

  --accent-soft: rgba(238, 107, 59, 0.18);
  --accent-tint: rgba(238, 107, 59, 0.08);
  --success-soft: rgba(45, 165, 101, 0.18);
  --warning-soft: rgba(216, 144, 40, 0.18);
  --error-soft: rgba(197, 48, 48, 0.18);
  --info-soft: rgba(62, 120, 198, 0.18);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============================== APP SHELL ============================== */

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* ============================== SIDEBAR ============================== */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 9px;
  display: grid; place-items: center;
  color: white;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  position: relative;
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--accent) 50%, transparent);
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 50%);
  pointer-events: none;
}
.brand-name {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.015em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 1px;
}
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 6px;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  position: relative;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .nav-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 999px;
}
.nav-item.active .nav-count { background: var(--accent-soft); color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.usage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 12px;
}
.usage-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.usage-label-text {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.usage-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}
.usage-bar {
  height: 4px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 4px;
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  margin-top: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F0B585, #C25527);
  color: white;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .btn-icon { flex-shrink: 0; }

/* ============================== TOPBAR ============================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-trail {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ============================== BUTTONS ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 140ms ease;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-2); border-color: var(--border-strong); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.btn-icon:hover { background: var(--bg-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 12px 18px; font-size: 14px; }

/* ============================== PAGE LAYOUT ============================== */
.page {
  padding: 28px 32px 60px;
}
.page-grid {
  display: grid;
  gap: 18px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title .label-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--bg-2);
  border-radius: 4px;
}

/* ============================== CARDS ============================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px;
}
.card-elevated { box-shadow: var(--shadow-sm); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ============================== BADGES ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-success .badge-dot { background: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-warning .badge-dot { background: var(--warning); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-error .badge-dot { background: var(--error); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-info .badge-dot { background: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-accent .badge-dot { background: var(--accent); }
.badge-neutral { background: var(--bg-2); color: var(--text-2); }
.badge-neutral .badge-dot { background: var(--text-muted); }

/* ============================== FORMS ============================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  display: flex; justify-content: space-between; align-items: center;
}
.field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}
.field-input,
.field-textarea,
.field-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border 120ms, box-shadow 120ms;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field-textarea { resize: vertical; min-height: 100px; font-family: inherit; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

/* ============================== AVATAR STACK / CONTACT CHIPS ============================== */
.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.contact-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.contact-chip-x {
  margin-left: 2px;
  color: var(--text-muted);
  font-size: 11px;
  width: 14px; height: 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  cursor: pointer;
}
.contact-chip-x:hover { background: var(--border); color: var(--text); }

/* ============================== SEGMENTED CONTROL ============================== */
.segmented {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented-item {
  padding: 5px 11px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms;
}
.segmented-item:hover { color: var(--text); }
.segmented-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ============================== CALENDAR ============================== */
.cal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.cal-month {
  display: flex; align-items: center; gap: 14px;
}
.cal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.cal-title .month-year {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-weekday {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 118px;
  padding: 6px 6px 6px 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  transition: background 120ms;
  cursor: pointer;
}
.cal-cell:hover { background: var(--bg-2); }
.cal-cell.muted { background: var(--surface-2); }
.cal-cell.muted .cal-day-num { color: var(--text-faint); }
.cal-cell:nth-child(7n+7) { border-right: none; }
.cal-day-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 2px;
}
.cal-day-num.today {
  background: var(--accent);
  color: white;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600;
}
.cal-event {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-left: 2px solid;
  background: var(--accent-tint);
  border-left-color: var(--accent);
  color: var(--text);
}
.cal-event-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cal-event-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.evt-success { background: var(--success-soft); border-left-color: var(--success); }
.cal-event.evt-error { background: var(--error-soft); border-left-color: var(--error); }
.cal-event.evt-warning { background: var(--warning-soft); border-left-color: var(--warning); }
.cal-event.evt-info { background: var(--info-soft); border-left-color: var(--info); }

.cal-more {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
}

/* WEEK VIEW */
.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
}
.week-hour {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 8px;
  text-align: right;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.week-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 36px;
  position: relative;
}
.week-cell:nth-child(8n+8) { border-right: none; }
.week-event {
  position: absolute;
  left: 4px; right: 4px;
  border-radius: 5px;
  background: var(--accent);
  color: white;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
}
.week-event.evt-success { background: var(--success); }
.week-event.evt-error { background: var(--error); }

/* LIST VIEW */
.day-list {
  border-top: 1px solid var(--border);
}
.day-list-day {
  display: grid;
  grid-template-columns: 90px 1fr;
  border-bottom: 1px solid var(--border);
}
.day-list-date {
  padding: 16px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}
.day-list-date .dnum {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.day-list-date .dweek {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 4px;
}
.day-list-events {
  display: flex;
  flex-direction: column;
}
.day-list-row {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.day-list-row:last-child { border-bottom: none; }
.day-list-row:hover { background: var(--bg-2); }
.day-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

/* KANBAN */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 18px;
}
.kanban-col {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 200px;
}
.kanban-col-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.kanban-col-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.kanban-col-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 120ms;
}
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ============================== TABLES ============================== */
.tbl-wrap { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  background: var(--surface-2);
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--bg-2); cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-msg-preview {
  font-size: 12.5px;
  color: var(--text-2);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================== STAT TILES ============================== */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-num {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-top: 10px;
}
.stat-num .stat-decoration {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--text-muted);
  margin-left: 6px;
  letter-spacing: 0;
}
.stat-trend {
  margin-top: 8px;
  font-size: 11.5px;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted);
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--error); }
.stat-spark {
  position: absolute;
  right: -10px;
  bottom: -6px;
  width: 130px;
  height: 60px;
  opacity: 0.95;
}

/* ============================== LOGIN ============================== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 540px;
  background: #07050E;
  color: #F5F1E8;
  position: relative;
  overflow: hidden;
}
.login-stage {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
}
.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.7;
  pointer-events: none;
}
.login-bg-orb.o1 { width: 600px; height: 600px; background: radial-gradient(circle, #EE6B3B 0%, transparent 70%); top: -120px; left: -100px; }
.login-bg-orb.o2 { width: 700px; height: 700px; background: radial-gradient(circle, #5B3FE0 0%, transparent 70%); bottom: -200px; left: 30%; opacity: 0.45; }
.login-bg-orb.o3 { width: 400px; height: 400px; background: radial-gradient(circle, #22D3B6 0%, transparent 70%); top: 30%; right: -80px; opacity: 0.3; }
.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 30%, black 30%, transparent 75%);
  pointer-events: none;
}
.login-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.login-brand {
  position: relative; z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-brand .brand-mark {
  width: 40px; height: 40px;
  font-size: 16px;
}
.login-brand-text { line-height: 1.15; }
.login-brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.login-brand-sub { font-family: var(--font-mono); font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 0.1em; text-transform: uppercase; }

.login-hero {
  position: relative; z-index: 2;
  max-width: 540px;
}
.login-hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.login-hero-eyebrow::before {
  content: ''; width: 32px; height: 1px; background: rgba(255,255,255,0.3);
}
.login-hero h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 18px;
}
.login-hero h1 .italic-em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: #F0B585;
}
.login-hero p {
  font-size: 15px;
  color: rgba(245, 241, 232, 0.66);
  max-width: 460px;
  line-height: 1.55;
  margin: 0 0 28px;
}

.login-pills {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 32px;
}
.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(245, 241, 232, 0.7);
  backdrop-filter: blur(10px);
}
.login-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #22D3B6; box-shadow: 0 0 8px #22D3B6; }

.login-footer {
  position: relative; z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-form-wrap {
  background: rgba(13, 11, 22, 0.6);
  border-left: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 3;
}
.login-form {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}
.login-form h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.login-form-sub {
  font-size: 14px;
  color: rgba(245, 241, 232, 0.55);
  margin-bottom: 28px;
}
.login-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: #F5F1E8;
  font-size: 14px;
  font-family: inherit;
  transition: all 140ms ease;
  outline: none;
}
.login-input:focus {
  border-color: rgba(238, 107, 59, 0.6);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(238, 107, 59, 0.18);
}
.login-input::placeholder { color: rgba(245, 241, 232, 0.35); }
.login-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(245, 241, 232, 0.7);
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.login-label a { color: var(--accent); font-weight: 500; }
.login-field { margin-bottom: 16px; }
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px -8px var(--accent), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 140ms ease;
}
.login-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 12px 28px -8px var(--accent), inset 0 1px 0 rgba(255,255,255,0.2); }
.login-btn-ghost {
  background: transparent;
  color: rgba(245, 241, 232, 0.8);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: none;
  padding: 11px;
  font-size: 13px;
  margin-top: 10px;
  font-weight: 500;
}
.login-btn-ghost:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.2); }

.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(245, 241, 232, 0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.08);
}
.login-foot-link {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: rgba(245, 241, 232, 0.55);
}
.login-foot-link a { color: var(--accent); font-weight: 500; }

.login-floating-card {
  position: absolute;
  z-index: 2;
  background: rgba(20, 17, 32, 0.75);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  font-size: 12px;
}

/* ============================== TEMPLATE PILLS ============================== */
.tpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 140ms;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tpl-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.tpl-card-h { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.tpl-card-name { font-size: 13.5px; font-weight: 600; }
.tpl-card-preview {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  font-family: var(--font-mono);
  max-height: 78px;
  overflow: hidden;
  position: relative;
}
.tpl-card-preview::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 24px;
  background: linear-gradient(to bottom, transparent, var(--surface-2));
}
.tpl-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================== MESSAGE COMPOSER ============================== */
.composer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.composer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}
.composer-tab {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.composer-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.composer-tab:hover { color: var(--text); }

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.composer-toolbar .btn-icon {
  width: 28px; height: 28px;
  border: none;
  background: transparent;
}
.composer-toolbar .btn-icon:hover { background: var(--bg-2); }
.composer-toolbar .sep {
  width: 1px; height: 16px; background: var(--border); margin: 0 4px;
}

.composer-area {
  padding: 16px;
  min-height: 240px;
}
.composer-textarea {
  width: 100%;
  min-height: 220px;
  border: none;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: transparent;
  color: var(--text);
}

.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px 16px;
}
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.attachment-pill .att-icon {
  width: 28px; height: 28px;
  background: var(--accent-soft);
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--accent);
}
.attachment-pill .att-name { font-weight: 500; font-size: 12.5px; }
.attachment-pill .att-size { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; }

/* PREVIEW (WhatsApp-ish chat bubble preview) */
.chat-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 420px;
  position: relative;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(238, 107, 59, 0.03), transparent 40%),
    radial-gradient(circle at 75% 75%, rgba(34, 211, 182, 0.03), transparent 40%);
}
.chat-bubble {
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13.5px;
  max-width: 78%;
  line-height: 1.5;
  margin-left: auto;
  position: relative;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble .var-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}
.chat-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.chat-attachment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-left: auto;
  margin-top: 10px;
  max-width: 78%;
  padding: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.chat-attachment-thumb {
  width: 48px; height: 48px;
  background: var(--accent-soft);
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}

/* TIMING PICKER */
.timing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.timing-pill {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 120ms;
}
.timing-pill:hover { border-color: var(--border-strong); background: var(--bg-2); }
.timing-pill.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* RECURRENCE CHECKBOX */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.checkbox-box {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid; place-items: center;
  transition: all 120ms;
}
.checkbox.checked .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.checkbox-box svg { width: 10px; height: 10px; opacity: 0; }
.checkbox.checked .checkbox-box svg { opacity: 1; }

.toggle {
  width: 32px; height: 18px;
  background: var(--border-strong);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 140ms;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 140ms;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(14px); }

/* ============================== ANIM ============================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.fade-in { animation: fadeIn 280ms ease forwards; }
.slide-up { animation: slideUp 380ms ease forwards; }
.scale-in { animation: scaleIn 240ms ease forwards; }
.stagger-1 { animation-delay: 60ms; opacity: 0; }
.stagger-2 { animation-delay: 120ms; opacity: 0; }
.stagger-3 { animation-delay: 180ms; opacity: 0; }
.stagger-4 { animation-delay: 240ms; opacity: 0; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 12, 0.45);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: grid;
  place-items: center;
  animation: fadeIn 200ms ease forwards;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: min(640px, 92vw);
  max-height: 86vh;
  overflow: auto;
  animation: scaleIn 200ms ease forwards;
}
.modal-h {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 22px; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================== UTIL ============================== */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.muted-2 { color: var(--text-2); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-xs { font-size: 11px; } .text-sm { font-size: 13px; } .text-md { font-size: 15px; } .text-lg { font-size: 18px; } .text-xl { font-size: 24px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.grow { flex: 1; }
.italic-serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; }
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.divider-v {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

.icon-tag {
  width: 28px; height: 28px;
  background: var(--accent-soft);
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.icon-tag.success { background: var(--success-soft); color: var(--success); }
.icon-tag.error { background: var(--error-soft); color: var(--error); }
.icon-tag.warning { background: var(--warning-soft); color: var(--warning); }
.icon-tag.info { background: var(--info-soft); color: var(--info); }
.icon-tag.neutral { background: var(--bg-2); color: var(--text-2); }
