/* SafeSpeak — Shared design tokens & utility components */

:root {
  --green: #5ba94e;
  --green-dark: #1e6d19;
  --green-light: #e8f3e6;
  --navy: #1a1a2e;
  --navy-soft: #2d2d44;
  --surface: #f7f9fc;
  --surface-card: #ffffff;
  --surface-low: #f2f4f7;
  --surface-high: #e6e8eb;
  --border: #e0e3e6;
  --border-soft: #eef2f6;
  --text: #191c1e;
  --text-muted: #40493c;
  --text-light: #707a6b;
  --error: #ba1a1a;
  --warning: #d97706;
  --info: #2563eb;
  --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.05), 0 1px 2px rgba(26, 26, 46, 0.03);
  --shadow: 0 4px 12px rgba(26, 26, 46, 0.06), 0 2px 4px rgba(26, 26, 46, 0.04);
  --shadow-lg: 0 10px 25px rgba(26, 26, 46, 0.08), 0 4px 10px rgba(26, 26, 46, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
}

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

html, body {
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

input, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
textarea { resize: none; }

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d4db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a0a8b3; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #4d9342; box-shadow: var(--shadow); }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-low); color: var(--text); }
.btn-danger { background: #fff; color: var(--error); border: 1px solid var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* ── Pills / badges ────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill-green { background: var(--green-light); color: var(--green-dark); }
.pill-amber { background: #fef3c7; color: #92400e; }
.pill-blue { background: #dbeafe; color: #1e40af; }
.pill-red { background: #fee2e2; color: #991b1b; }
.pill-gray { background: var(--surface-high); color: var(--text-muted); }

/* ── Form fields ────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.field-input,
.field-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all 0.15s;
}
.field-input:focus,
.field-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(91, 169, 78, 0.12);
}
.field-textarea { min-height: 90px; resize: vertical; line-height: 1.5; }

/* ── Layout helpers ────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }
.hidden { display: none !important; }

/* ── Animations ────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseSoft { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.fade-in { animation: fadeIn 0.3s ease; }
.pulse-soft { animation: pulseSoft 1.4s ease-in-out infinite; }

/* ── Toast ────────────────────────────────────── */
.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  pointer-events: auto;
  animation: fadeIn 0.25s ease;
  max-width: 320px;
}
.toast.error { background: var(--error); }
.toast.success { background: var(--green-dark); }

/* ── Loading ────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(91, 169, 78, 0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty states ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}
.empty-state .material-symbols-outlined {
  font-size: 40px;
  opacity: 0.4;
  margin-bottom: 12px;
}
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto; line-height: 1.6; }

/* ── App shell (employee chat header) ────────────────────────────────────── */
.app-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.app-header-mark {
  width: 40px;
  height: 40px;
  background: var(--green);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.app-header-mark .material-symbols-outlined {
  color: #fff;
  font-size: 22px;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}
.app-header-title-wrap { min-width: 0; }
.app-header-title {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.app-header-sub {
  font-size: 12px;
  color: var(--green-dark);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.app-header-sub::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
}
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.app-header-actions .btn-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.app-header-actions .btn-header:hover {
  color: var(--green-dark);
  background: var(--surface-low);
}
.app-header-actions .btn-header-exit {
  margin-left: 4px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  color: var(--navy);
  background: transparent;
}
.app-header-actions .btn-header-exit:hover {
  background: var(--surface-low);
  color: var(--navy);
  border-color: var(--border);
}

@media (max-width: 640px) {
  .app-header-inner { min-height: 64px; padding: 0 14px; gap: 10px; }
  .app-header-mark { width: 36px; height: 36px; }
  .app-header-mark .material-symbols-outlined { font-size: 20px; }
  .app-header-title { font-size: 17px; }
  .app-header-actions .btn-header { padding: 8px 10px; font-size: 13px; }
  .app-header-actions .btn-header .btn-label { display: none; }
  .app-header-actions .btn-header-exit .btn-label { display: inline; }
}

/* ── Admin shell (sidebar layout) ────────────────────────────────────── */
.admin-shell { display: flex; min-height: 100vh; }
#sidebar-mount { flex-shrink: 0; }
.admin-sidebar {
  width: 240px;
  background: var(--surface-card);
  border-right: 1px solid var(--border-soft);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  flex-shrink: 0;
}
.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 12px;
  min-width: 0;
}
.admin-sidebar-mark {
  width: 36px;
  height: 36px;
  background: var(--green);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.admin-sidebar-mark .material-symbols-outlined {
  color: #fff;
  font-size: 20px;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}
.admin-sidebar-brand-text-wrap { min-width: 0; }
.admin-sidebar-brand-text {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.admin-sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
  line-height: 1.3;
}
.admin-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.admin-nav:hover { background: var(--surface-low); color: var(--text); text-decoration: none; }
.admin-nav.active { background: rgba(91, 169, 78, 0.1); color: var(--green-dark); font-weight: 600; }
.admin-nav .material-symbols-outlined { font-size: 20px; }
.admin-sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 11px; color: var(--text-light); }

.admin-main { flex: 1; min-width: 0; overflow: hidden; }
.admin-topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
.admin-topbar > div { min-width: 0; }
.admin-topbar h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.admin-topbar p {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
  line-height: 1.4;
}
.admin-content { padding: 28px 32px; max-width: 1100px; }

@media (max-width: 800px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: relative; flex-direction: row; gap: 6px; overflow-x: auto; padding: 12px; }
  .admin-sidebar-brand, .admin-sidebar-footer { display: none; }
  .admin-nav { flex-shrink: 0; padding: 8px 12px; }
  .admin-content { padding: 20px; }
}
