/* =========================================================
   Hlasito Admin — design tokens & shared styles
   ========================================================= */

:root {
  --accent-50:  #ecfdf5;
  --accent-100: #d1fae5;
  --accent-200: #a7f3d0;
  --accent-300: #6ee7b7;
  --accent-400: #2dd4bf;
  --accent-500: #14b8a6;
  --accent-600: #0d9488;
  --accent-700: #0f766e;
  --accent-800: #115e59;
  --accent-900: #134e4a;
  --accent-soft: #e6fbf7;

  --ink-950: #0a0f1c;
  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #eef2f7;
  --ink-50:  #f6f8fb;
  --ink-0:   #ffffff;

  --bg-page:    #f4f6fa;
  --bg-surface: #ffffff;
  --bg-subtle:  #f8fafc;
  --border:     #e5e9f0;
  --border-strong: #d8dde6;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-tertiary:  #64748b;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  --danger-50:  #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  --warn-50:  #fffbeb;
  --warn-500: #f59e0b;
  --warn-700: #b45309;

  --ok-50:  #ecfdf5;
  --ok-500: #10b981;
  --ok-600: #059669;
  --ok-700: #047857;

  --nav-bg: #0b1220;
  --nav-bg-2: #111a2e;
  --nav-border: #1f2a44;
  --nav-text: #e6ecf5;
  --nav-text-dim: #9aa6bd;
  --nav-active: rgba(20, 184, 166, 0.14);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 20px 60px rgba(15, 23, 42, 0.18);

  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

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

/* =========================================================
   Layout shell
   ========================================================= */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

/* SIDEBAR (desktop) */
.sidebar {
  width: 220px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 50;
}
.sidebar__brand {
  padding: 18px 16px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--nav-text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar__nav {
  flex: 1;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__link {
  color: var(--nav-text-dim);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--r-md);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.sidebar__link:hover {
  color: var(--nav-text);
  background: rgba(255,255,255,0.04);
}
.sidebar__link.is-active {
  color: var(--nav-text);
  background: var(--nav-active);
}
.sidebar__link.is-active .nav-icon { color: var(--accent-400); }
.sidebar__footer {
  padding: 12px 10px;
  border-top: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.sidebar__profile {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: var(--r-md);
  padding: 6px 8px;
  transition: background 0.15s ease;
  min-width: 0;
}
.sidebar__profile:hover { background: rgba(255,255,255,0.05); }
.sidebar__user-name {
  color: var(--nav-text-dim);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* TOP NAVBAR (mobile only on desktop — hidden by default) */
.topnav {
  height: 56px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: none;
  align-items: center;
  padding: 0 20px;
  gap: 28px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--nav-text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.topnav__nav {
  display: flex;
  gap: 2px;
  align-items: center;
  flex: 1;
}

.topnav__link {
  color: var(--nav-text-dim);
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r-md);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: none;
  background: transparent;
  text-decoration: none;
}
.topnav__link:hover {
  color: var(--nav-text);
  background: rgba(255,255,255,0.04);
}
.topnav__link.is-active {
  color: var(--nav-text);
  background: var(--nav-active);
}
.topnav__link.is-active .nav-icon {
  color: var(--accent-400);
}
.nav-icon {
  width: 16px;
  height: 16px;
  color: var(--nav-text-dim);
  flex-shrink: 0;
}
.topnav__link.is-active .nav-icon { color: var(--accent-400); }

.topnav__user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topnav__profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: var(--r-md);
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background 0.15s ease;
}
.topnav__profile-link:hover {
  background: rgba(255,255,255,0.05);
}
.topnav__user-email {
  color: var(--nav-text-dim);
  font-size: 13px;
}
.topnav__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.topnav__logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--nav-text-dim);
  padding: 6px 11px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.topnav__logout:hover {
  color: var(--nav-text);
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.04);
}

.app__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   Page content shell
   ========================================================= */

.page {
  flex: 1;
  padding: 24px 28px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin: 0;
}
.page__subtitle {
  color: var(--text-tertiary);
  font-size: 13.5px;
  margin: 4px 0 0;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.crumbs__sep { opacity: 0.6; }
.crumbs a { cursor: pointer; }
.crumbs a:hover { color: var(--text-secondary); }

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { box-shadow: var(--shadow-xs); }
.btn:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent-600);
  color: white;
  border-color: var(--accent-600);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.18), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn--primary:hover {
  background: var(--accent-700);
  border-color: var(--accent-700);
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.22), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn--secondary {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn--secondary:hover {
  background: var(--ink-50);
  border-color: var(--ink-300);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 6px 9px;
}
.btn--ghost:hover {
  background: var(--ink-100);
  color: var(--text-primary);
}

.btn--danger {
  background: var(--bg-surface);
  color: var(--danger-700);
  border-color: var(--border);
}
.btn--danger:hover {
  background: var(--danger-50);
  border-color: var(--danger-100);
  color: var(--danger-700);
}

.btn--sm { padding: 5px 9px; font-size: 12px; gap: 5px; }
.btn--lg { padding: 10px 16px; font-size: 14px; }
.btn--block { width: 100%; }

.btn .ic { width: 14px; height: 14px; flex-shrink: 0; }
.btn--sm .ic { width: 13px; height: 13px; }
.btn--lg .ic { width: 16px; height: 16px; }

/* =========================================================
   Cards / panels
   ========================================================= */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.card__sub {
  color: var(--text-tertiary);
  font-size: 12.5px;
  margin: 2px 0 0;
}
.card__body {
  padding: 18px;
}
.card__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================================================
   Tables
   ========================================================= */

.tablewrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.tabletools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.tabletools__left { display: flex; gap: 8px; align-items: center; }
.tabletools__right { display: flex; gap: 8px; align-items: center; color: var(--text-muted); font-size: 12.5px; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr {
  transition: background 0.12s ease;
}
.tbl tbody tr:hover {
  background: var(--bg-subtle);
}
.tbl tbody tr.is-clickable { cursor: pointer; }

.tbl__cell-strong { font-weight: 600; color: var(--text-primary); }
.tbl__cell-mute { color: var(--text-tertiary); }
.tbl__cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.tbl__cell-num {
  font-variant-numeric: tabular-nums;
}
.tbl__actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}
.tbl th.tbl__th-actions, .tbl td.tbl__td-actions { text-align: right; }
.tbl th.tbl__th-num, .tbl td.tbl__td-num { text-align: right; }

.tbl__row-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}
.tbl__row-icon--neutral {
  background: var(--ink-100);
  color: var(--ink-700);
}
.tbl__cell-flex { display: flex; align-items: center; }

/* =========================================================
   Badges & status
   ========================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  background: var(--ink-100);
  color: var(--ink-700);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge--accent { background: var(--accent-soft); color: var(--accent-700); border-color: rgba(20,184,166,0.18); }
.badge--violet { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }
.badge--amber  { background: var(--warn-50); color: var(--warn-700); border-color: #fde68a; }
.badge--rose   { background: #fff1f2; color: #be123c; border-color: #ffe4e6; }
.badge--ink    { background: var(--ink-900); color: var(--ink-100); border-color: var(--ink-900); }
.badge--soft   { background: var(--ink-50); color: var(--ink-600); border-color: var(--border); }
.badge--success{ background: var(--ok-50); color: var(--ok-700); border-color: #a7f3d0; }
.badge--green  { background: var(--ok-50); color: var(--ok-700); border-color: #a7f3d0; }

/* Calendar provider cards */
.calendar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 16px;
}
.calendar-card--connected {
  border-left: 3px solid var(--ok-500);
}
.calendar-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.calendar-card__name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.calendar-card__info {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.calendar-card__email {
  font-size: 11.5px;
  color: var(--text-muted);
}
.calendar-card__status {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* live status dot */
.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ok-700);
}
.live__dot {
  width: 8px;
  height: 8px;
  background: var(--ok-500);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.live__dot::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--ok-500);
  opacity: 0.4;
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0%   { transform: scale(0.6); opacity: 0.55; }
  80%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* role badge dots */
.role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid;
}
.role::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.role--super  { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }
.role--tenant { background: var(--accent-soft); color: var(--accent-700); border-color: rgba(20,184,166,0.18); }

/* =========================================================
   Forms
   ========================================================= */

.form-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.field__label--req::after {
  content: "*";
  color: var(--accent-600);
  margin-left: 2px;
}
.field__hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.field__count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.input, .textarea, .select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: all 0.15s ease;
  outline: none;
}
.input:hover, .textarea:hover, .select:hover {
  border-color: var(--ink-400);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--font-sans);
  line-height: 1.55;
}
.textarea--mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
}

.input-group {
  position: relative;
}
.input-group .input { padding-left: 36px; }
.input-group__icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

.alert {
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  border: 1px solid;
}
.alert--danger {
  background: var(--danger-50);
  color: var(--danger-700);
  border-color: #fecaca;
}
.alert--info {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(20,184,166,0.2);
}
.alert .ic { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* validation errors */
.field-error {
  font-size: 12px;
  color: var(--danger-600);
  margin-top: 2px;
}

/* =========================================================
   Login page
   ========================================================= */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(20,184,166,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(99,102,241,0.12), transparent 60%),
    linear-gradient(180deg, #0a0f1c 0%, #0b1426 100%);
  color: white;
  position: relative;
  overflow: hidden;
}
.login::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black, transparent);
  pointer-events: none;
}

.login__shell {
  width: 100%;
  max-width: 410px;
  position: relative;
  z-index: 1;
}
.login__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.login__card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--r-xl);
  padding: 28px 28px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.login__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.login__sub {
  color: rgba(230,236,245,0.65);
  font-size: 13.5px;
  margin: 0 0 22px;
}
.login__field { margin-bottom: 14px; }
.login__label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(230,236,245,0.7);
  margin-bottom: 6px;
}
.login__input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  color: white;
  font-size: 14px;
  outline: none;
  transition: all 0.15s ease;
}
.login__input::placeholder { color: rgba(230,236,245,0.4); }
.login__input:focus {
  border-color: var(--accent-400);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.18);
}
.login__btn {
  width: 100%;
  padding: 11px;
  margin-top: 6px;
  background: linear-gradient(180deg, var(--accent-500), var(--accent-600));
  border: 1px solid var(--accent-700);
  color: white;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px rgba(20,184,166,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login__btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 18px rgba(20,184,166,0.4), inset 0 1px 0 rgba(255,255,255,0.18);
}
.login__alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fecaca;
  padding: 9px 11px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.login__foot {
  text-align: center;
  font-size: 12px;
  color: rgba(230,236,245,0.45);
  margin-top: 18px;
}

/* =========================================================
   Wordmark
   ========================================================= */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wordmark__bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  color: var(--accent-400);
}
.wordmark__bars span {
  width: 2.5px;
  background: currentColor;
  border-radius: 2px;
  display: inline-block;
}
.wordmark__text {
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* =========================================================
   Conversation transcript (Call Detail)
   ========================================================= */

.transcript {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  background: var(--bg-subtle);
  background-image:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 22px 22px;
  border-radius: var(--r-lg);
}

.bubble-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 75%;
}
.bubble-row--caller {
  align-self: flex-start;
}
.bubble-row--ai {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
}
.bubble-row--caller .bubble-avatar {
  background: linear-gradient(135deg, #475569, #1e293b);
}
.bubble-row--ai .bubble-avatar {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
}

.bubble {
  padding: 9px 13px 8px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
  box-shadow: var(--shadow-xs);
}
.bubble-row--caller .bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.bubble-row--ai .bubble {
  background: var(--accent-600);
  color: white;
  border-bottom-right-radius: 4px;
}

.bubble__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
  opacity: 0.8;
}
.bubble-row--ai .bubble__meta { color: rgba(255,255,255,0.85); }
.bubble-row--caller .bubble__meta { color: var(--text-tertiary); }

.bubble__time {
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  opacity: 0.7;
  margin-top: 4px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.transcript__day {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 4px 0;
}

/* =========================================================
   Detail meta header
   ========================================================= */

.detailhead {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}
.detailhead__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detailhead__main {
  min-width: 0;
}
.detailhead__caller {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 3px;
}
.detailhead__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}
.detailhead__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.detailhead__meta-item .ic {
  width: 13px; height: 13px; color: var(--text-muted);
}
.detailhead__meta-item code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--ink-100);
  padding: 1.5px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.detailhead__stats {
  display: flex;
  gap: 22px;
  align-items: center;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.stat__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.stat__value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* =========================================================
   Two-column edit layout
   ========================================================= */
.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
.edit-layout__sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* integration status rows */
.integrations__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.integrations__row:last-child {
  border-bottom: none;
}
.integrations__name {
  color: var(--text-secondary);
}

/* =========================================================
   Utility
   ========================================================= */
.u-row { display: flex; align-items: center; gap: 8px; }
.u-row-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.u-mt-2 { margin-top: 8px; }
.u-mt-4 { margin-top: 16px; }
.u-mb-4 { margin-bottom: 16px; }
.u-grow { flex: 1; }
.u-mono { font-family: var(--font-mono); }
.u-muted { color: var(--text-muted); }
.u-num { font-variant-numeric: tabular-nums; }
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* =========================================================
   Dashboard stat cards
   ========================================================= */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat-card__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon--teal   { background: var(--accent-soft); color: var(--accent-600); }
.stat-card__icon--violet { background: #f5f3ff; color: #6d28d9; }
.stat-card__icon--amber  { background: var(--warn-50); color: var(--warn-700); }
.stat-card__icon--blue   { background: #eff6ff; color: #2563eb; }

.stat-card__value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-card__foot {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -6px;
}

/* =========================================================
   Minute bar
   ========================================================= */

.min-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.min-bar__fill {
  height: 100%;
  border-radius: 99px;
}

.min-bar__fill--green  { background: #22c55e; }
.min-bar__fill--yellow { background: #f59e0b; }
.min-bar__fill--red    { background: #ef4444; }

.min-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.mini-bar {
  height: 5px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  width: 100px;
}

.mini-bar__fill {
  height: 100%;
  border-radius: 99px;
}

.mini-bar__fill--green  { background: #22c55e; }
.mini-bar__fill--yellow { background: #f59e0b; }
.mini-bar__fill--red    { background: #ef4444; }

.mini-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
}

.stat-card--minutes.is-warning {
  border-color: #fde68a;
  background: linear-gradient(160deg, var(--bg-surface) 0%, #fffdf5 100%);
}

.stat-card--minutes.is-danger {
  border-color: #fecaca;
  background: linear-gradient(160deg, var(--bg-surface) 0%, #fff8f8 100%);
}

/* =========================================================
   Bottom navigation (mobile only)
   ========================================================= */

.bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottomnav__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  min-height: 52px;
  color: var(--nav-text-dim);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.bottomnav__link .nav-icon {
  width: 20px;
  height: 20px;
}
.bottomnav__link.is-active {
  color: var(--accent-400);
}
.bottomnav__link:hover { color: var(--nav-text); }

/* =========================================================
   Responsive — 768px and below
   ========================================================= */

@media (max-width: 768px) {
  /* Page padding */
  .page { padding: 14px 14px 36px; }

  /* Page head: wrap on narrow screens */
  .page__head { flex-wrap: wrap; gap: 12px 16px; }
  .page__head > .btn--primary,
  .page__head > a.btn--primary { width: 100%; justify-content: center; }

  /* Layout: column on mobile */
  .app { flex-direction: column; }

  /* Sidebar: hidden on mobile */
  .sidebar { display: none; }

  /* Topnav: show on mobile, hide desktop nav, push brand/user to edges */
  .topnav { display: flex; padding: 0 14px; gap: 12px; justify-content: space-between; }
  .topnav__nav { display: none; }
  .topnav__user-email { display: none; }
  .topnav__logout-label { display: none; }
  .topnav__logout { padding: 6px 8px; gap: 0; }

  /* Bottom nav: show on mobile */
  .bottomnav { display: flex; }
  .app__main { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }

  /* Stat cards: 2 columns on tablet */
  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  /* Tables: horizontal scroll */
  .tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 500px; }

  /* Tabletools: stack vertically, full-width search */
  .tabletools { flex-direction: column; align-items: stretch; gap: 8px; }
  .tabletools__left { width: 100%; }
  .tabletools__right { justify-content: space-between; }
  .tabletools .input-group { width: 100% !important; }

  /* Two-column layouts: single column */
  .form-row-2 { grid-template-columns: 1fr; }
  .edit-layout { grid-template-columns: 1fr; }

  /* Detail head: stack to single column */
  .detailhead { grid-template-columns: 1fr; gap: 12px; }
  .detailhead__stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 18px;
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    width: 100%;
  }
  .stat__value { font-size: 15px; }

  /* Card foot: wrap buttons */
  .card__foot { flex-wrap: wrap; }
  .card__foot .btn:not(.u-grow ~ .btn):not(.btn--ghost) {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }

  /* Transcript bubbles */
  .bubble-row { max-width: 88%; }
  .transcript { padding: 14px; gap: 10px; }
}

/* Very small phones (< 480px) */
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .page { padding: 10px 10px 36px; }
  .topnav { padding: 0 10px; gap: 8px; }
  .topnav__avatar { width: 24px; height: 24px; font-size: 10px; }
  .detailhead { padding: 14px; }
  .detailhead__caller { font-size: 15px; }
  .detailhead__stats { gap: 12px; }
  .stat__value { font-size: 14px; }
  .page__title { font-size: 19px; }
}
