/* ============================================================================
   GRIND — Operating System
   Brand: teal #0C3030 + gold #F0B40C, Montserrat.
   ============================================================================ */
:root {
  --teal: #0c3030;
  --teal-700: #124040;
  --teal-600: #1a4d4d;
  --yellow: #f0b40c;
  --yellow-600: #d09e08;
  --ink: #16201f;
  --muted: #6b7c7b;
  --line: #e3eae9;
  --bg: #f4f7f6;
  --card: #ffffff;
  --ok: #1f9d6b;
  --warn: #e08c00;
  --danger: #d64545;
  --info: #2f73c4;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 51, 51, 0.08), 0 6px 24px rgba(0, 51, 51, 0.06);
  --sidebar-w: 248px;
  --font: "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Boot screen ─────────────────────────────────────────────── */
.app-loading { display: grid; place-items: center; height: 100vh; }
.boot { text-align: center; }
.boot__logo-img { height: 150px; width: auto; max-width: 70vw; animation: floaty 2.6s ease-in-out infinite; }
.boot__spin {
  margin: 22px auto 0; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--yellow);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* ── Buttons & form controls ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid transparent; border-radius: 9px; padding: 9px 15px;
  font-weight: 600; font-size: 13px; background: var(--teal); color: #fff;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--teal-600); }
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--yellow); color: var(--teal); box-shadow: 0 4px 12px rgba(251, 191, 21, 0.3); }
.btn--accent:hover { background: var(--yellow-600); box-shadow: 0 6px 18px rgba(251, 191, 21, 0.42); }
.btn--ghost { background: transparent; color: var(--teal); border-color: var(--line); }
.btn--ghost:hover { background: #eef3f2; }
.btn--danger { background: var(--danger); }
.btn--sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

label { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--ink);
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--yellow); border-color: var(--yellow); }
textarea { resize: vertical; min-height: 72px; }
.field { margin-bottom: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Auth / login ────────────────────────────────────────────── */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; position: relative; overflow: hidden;
  background: radial-gradient(1100px 620px at 78% -12%, #0d5757 0%, var(--teal) 55%, #001d1d 100%); }
.auth::before, .auth::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(8px); opacity: 0.5; pointer-events: none;
}
.auth::before { width: 340px; height: 340px; left: -80px; bottom: -90px; background: radial-gradient(circle, rgba(251,191,21,0.28), transparent 70%); }
.auth::after { width: 260px; height: 260px; right: -60px; top: -40px; background: radial-gradient(circle, rgba(31,157,107,0.22), transparent 70%); }
.auth__card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 20, 20, 0.35); padding: 34px 30px; animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.auth__logo-img { display: block; height: 128px; width: auto; margin: 2px auto 6px; }
.auth__sub { text-align: center; color: var(--muted); margin: 6px 0 24px; font-size: 12.5px; letter-spacing: 0.02em; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.auth__hint { margin-top: 14px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ── App shell ───────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #013a3a 0%, var(--teal) 55%, #002626 100%);
  color: #cfe0df; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  box-shadow: 4px 0 24px rgba(0, 30, 30, 0.16); z-index: 6;
}
.sidebar__brand { display: flex; flex-direction: column; gap: 9px; padding: 20px 22px 16px; text-decoration: none; }
.sidebar__brand-badge { display: inline-flex; align-self: flex-start; background: #fff; border-radius: 14px; padding: 11px 16px; box-shadow: 0 6px 18px rgba(0, 20, 20, 0.28); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.sidebar__brand:hover .sidebar__brand-badge { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(0, 20, 20, 0.34); }
.sidebar__brand-img { height: 68px; width: auto; display: block; }
.sidebar__brand-sub { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); padding-left: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 10px;
  color: #bcd2d1; font-weight: 600; font-size: 13px; margin-bottom: 3px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.nav__item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(2px); }
.nav__item.active { background: var(--yellow); color: var(--teal); box-shadow: 0 6px 16px rgba(251, 191, 21, 0.32); }
.nav__item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--yellow);
}
.nav__icon { width: 18px; text-align: center; opacity: 0.95; font-size: 14px; }
.sidebar__foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; }
.sidebar__user { color: #fff; font-weight: 600; }
.sidebar__role { color: var(--yellow); font-size: 11px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 13px 24px; background: rgba(255, 255, 255, 0.82); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.topbar__spacer { flex: 1; }
.search { position: relative; width: 280px; }
.search input { padding-left: 32px; }
.search__icon { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search__results { position: absolute; top: 42px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; z-index: 20; }
.search__results a { display: flex; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.search__results a:hover { background: #f1f6f5; }
.content { padding: 22px 24px 60px; }

/* Hamburger (mobile only) + off-canvas backdrop — hidden on desktop */
.topbar__burger { display: none; flex: none; width: 40px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; align-items: center; justify-content: center; }
.topbar__burger:hover { background: #eef3f2; }
.topbar__burger-bars, .topbar__burger-bars::before, .topbar__burger-bars::after {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--teal);
  transition: transform 0.22s ease, opacity 0.18s ease; }
.topbar__burger-bars { position: relative; }
.topbar__burger-bars::before, .topbar__burger-bars::after { content: ''; position: absolute; left: 0; }
.topbar__burger-bars::before { top: -6px; }
.topbar__burger-bars::after { top: 6px; }
.shell.nav-open .topbar__burger-bars { background: transparent; }
.shell.nav-open .topbar__burger-bars::before { top: 0; transform: rotate(45deg); }
.shell.nav-open .topbar__burger-bars::after { top: 0; transform: rotate(-45deg); }
.nav-backdrop { display: none; }

/* ── Cards, tables, badges ───────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow 0.2s ease, transform 0.2s ease; }
.card:hover { box-shadow: 0 2px 6px rgba(0,51,51,0.08), 0 14px 40px rgba(0,51,51,0.10); }
.card__head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card__head h3 { margin: 0; font-size: 15px; }
.card__body { padding: 16px 18px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 20px; }
.section-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow); overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.stat::after { content: ''; position: absolute; right: -18px; top: -18px; width: 66px; height: 66px; border-radius: 50%; background: radial-gradient(circle, rgba(251,191,21,0.12), transparent 70%); }
.stat:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,51,51,0.12); }
.stat__label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat__value { font-size: 27px; font-weight: 800; color: var(--teal); margin-top: 6px; letter-spacing: -0.02em; }
.stat__sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.stat--accent { border-top: 3px solid var(--yellow); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: #f8fbfa; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .row-link { cursor: pointer; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; background: #eef3f2; color: var(--teal); }
.badge--ok { background: #e3f6ee; color: var(--ok); }
.badge--warn { background: #fdf1da; color: var(--warn); }
.badge--danger { background: #fbe6e6; color: var(--danger); }
.badge--info { background: #e6f0fb; color: var(--info); }
.badge--muted { background: #eef1f1; color: var(--muted); }

.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }

/* ── Pipeline (kanban) ───────────────────────────────────────── */
.pipeline { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.pl-col { min-width: 240px; flex: 1; background: #eef3f2; border-radius: var(--radius); padding: 10px; }
.pl-col__head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; padding: 4px 6px 10px; }
.pl-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; margin-bottom: 9px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.pl-card:active { cursor: grabbing; }
.pl-card.dragging { opacity: 0.5; }
.pl-col.drop { outline: 2px dashed var(--yellow); }
.pl-card__name { font-weight: 700; font-size: 13px; }
.pl-card__meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ── Modal & toast ───────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 24, 24, 0.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal__head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__close { margin-left: auto; background: none; border: none; font-size: 20px; color: var(--muted); }
.modal__body { padding: 18px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }

#toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 80; }
.toast { background: var(--teal); color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; font-weight: 600; max-width: 340px; animation: pop 0.18s ease; }
.toast--err { background: var(--danger); }
.toast--ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.timeline-item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }

.errmsg { color: var(--danger); font-size: 12.5px; margin-top: 8px; min-height: 16px; }

@media (max-width: 900px) {
  /* Single-column shell; sidebar becomes an off-canvas drawer. */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: min(84vw, 288px);
    transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 60;
  }
  .shell.nav-open .sidebar { transform: none; }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0, 20, 20, 0.45);
    opacity: 0; visibility: hidden; transition: opacity 0.28s ease, visibility 0.28s ease; z-index: 50;
  }
  .shell.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
  .topbar__burger { display: inline-flex; }

  .detail-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 11px 14px; gap: 10px; }
  .topbar__title { font-size: 16px; }
  .content { padding: 16px 14px 48px; }
  .search { width: 190px; }
  .section-head { flex-wrap: wrap; }
  /* Wide tables scroll horizontally inside their card instead of overflowing. */
  .card { overflow-x: auto; }
}

@media (max-width: 640px) {
  .search { display: none; }               /* free up room for title + bells */
  .topbar__title { font-size: 15px; }
  .stat__value { font-size: 23px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .modal__foot { flex-wrap: wrap; }
}

/* ── Nav badges ──────────────────────────────────────────────── */
.nav__label { flex: 1; }
.nav__badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px;
  background: var(--yellow); color: var(--teal); font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Topbar dropdowns (notifications & alerts) ───────────────── */
.tb-drop { position: relative; }
.tb-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--teal); display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}
.tb-btn:hover { background: #eef3f2; }
.tb-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 10px; background: var(--info); color: #fff; font-size: 10.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.tb-badge--warn { background: var(--warn); }
.tb-badge--danger { background: var(--danger); }
.tb-panel {
  position: absolute; top: 46px; right: 0; width: 340px; max-width: 86vw; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 30; overflow: hidden;
}
.tb-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tb-panel__list { max-height: 360px; overflow-y: auto; }
.tb-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tb-item:last-child { border-bottom: none; }
.tb-item:hover { background: #f6faf9; }
.tb-item--unread { background: #f3f9ff; }
.tb-item__txt { min-width: 0; }
.tb-item__txt > div:first-child { font-weight: 600; font-size: 13px; }
.tb-item__txt .muted { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Notification icons & full-page list ─────────────────────── */
.notif__icon {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; background: #e6f0fb; color: var(--info);
}
.notif__icon--info { background: #e6f0fb; color: var(--info); }
.notif__icon--warn, .notif__icon--warning { background: #fdf1da; color: var(--warn); }
.notif__icon--danger, .notif__icon--critical { background: #fbe6e6; color: var(--danger); }
.notif__icon--success { background: #e3f6ee; color: var(--ok); }

.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: none; }
.notif:hover { background: #f8fbfa; }
.notif--unread { background: #f3f9ff; }
.notif__main { flex: 1; min-width: 0; }
.notif__title { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); display: inline-block; }
.notif__body { font-size: 12.5px; margin-top: 2px; }
.notif__meta { font-size: 11px; margin-top: 4px; }
.notif__actions { display: flex; gap: 4px; align-items: center; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert {
  display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line);
  border-left: 4px solid var(--info); border-radius: 10px; padding: 12px 14px;
}
.alert--critical { border-left-color: var(--danger); }
.alert--warning { border-left-color: var(--warn); }
.alert--info { border-left-color: var(--info); }
.alert__icon { font-size: 18px; flex: none; }
.alert__main { flex: 1; min-width: 0; }
.alert__head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 13.5px; }
.alert__detail { font-size: 12px; margin-top: 3px; }

/* Active tab/filter button */
.btn--ghost.is-active { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ============================================================================
   Modern interaction layer — page transitions, contacts, toggles, chips
   ============================================================================ */

/* Gentle fade-up as views mount */
.content > * { animation: fadeUp 0.34s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .content > *, .card, .stat, .nav__item, .boot__logo-img { animation: none !important; transition: none !important; }
}

/* Pipeline cards get a little lift on hover */
.pl-card { transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease; }
.pl-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 51, 51, 0.12); border-color: #cfe0df; }
.pl-col { transition: background 0.15s ease; }
.pl-col.drop { background: #fff7e2; }

/* Table rows: subtle affordance for clickable rows */
.tbl .row-link { transition: background 0.12s ease; }
.tbl .row-link:hover td { background: #fff8e6; }

/* Contacts list */
.contact-list { display: flex; flex-direction: column; }
.contact { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.contact:last-child { border-bottom: none; }
.contact__avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--teal-600), var(--teal)); }
.contact__main { flex: 1; min-width: 0; }
.contact__name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.contact__role { font-size: 12px; color: var(--muted); }
.contact__meta { font-size: 12px; color: var(--muted); margin-top: 1px; display: flex; gap: 12px; flex-wrap: wrap; }
.contact__meta a { color: var(--info); }
.contact__actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s ease; }
.contact:hover .contact__actions { opacity: 1; }

/* Toggle switch (notification settings) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: none; }
.switch-row__txt b { font-size: 13.5px; }
.switch-row__txt .muted { font-size: 12px; }
.switch { position: relative; flex: none; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider { position: absolute; inset: 0; border-radius: 24px; background: #d3dddc; transition: background 0.2s ease; cursor: pointer; }
.switch__slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + .switch__slider { background: var(--ok); }
.switch input:checked + .switch__slider::before { transform: translateX(18px); }

/* Recipient chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: #eef3f2; color: var(--teal); border-radius: 20px; padding: 5px 6px 5px 12px; font-size: 12.5px; font-weight: 600; }
.chip button { border: 0; background: rgba(0,51,51,0.08); color: var(--teal); width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1; display: grid; place-items: center; }
.chip button:hover { background: var(--danger); color: #fff; }

/* Config banner (SMTP status) */
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 16px; }
.banner--info { background: #e6f0fb; color: var(--info); }
.banner--ok { background: #e3f6ee; color: var(--ok); }
.banner--warn { background: #fdf1da; color: var(--warn); }

/* Avatars for user rows / topbar */
.user-chip { display: inline-flex; align-items: center; gap: 9px; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; background: linear-gradient(135deg, var(--teal-600), var(--teal)); }

/* Sidebar sign-out spacing + footer polish */
.sidebar__foot .avatar { background: linear-gradient(135deg, var(--yellow), var(--yellow-600)); color: var(--teal); }

@media (max-width: 900px) {
  .sidebar__brand { padding: 14px 16px; }
  .switch-row { flex-wrap: wrap; }
}

/* ── Sortable table headers ─────────────────────────────────── */
.tbl th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.th-sort:hover { color: var(--teal); }
.tbl .sort-arrow { color: var(--muted); font-size: 10px; }

/* ── Form sections & detail rows ────────────────────────────── */
.form-section { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  font-weight: 700; margin: 16px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; }
.emp-detail { max-height: 62vh; overflow-y: auto; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv-row__k { color: var(--muted); }
.kv-row__v { font-weight: 600; text-align: right; }

/* ── Permission editor ──────────────────────────────────────── */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; max-height: 55vh; overflow-y: auto; }
.perm-row { display: flex; gap: 9px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.perm-row input { margin-top: 3px; }

/* ── Leave calendar ─────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal__dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); text-align: center; padding: 4px 0; }
.cal__cell { min-height: 84px; border: 1px solid var(--line); border-radius: 8px; padding: 5px; background: #fff; overflow: hidden; }
.cal__cell--empty { background: #f7faf9; border-style: dashed; }
.cal__cell--today { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.cal__num { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.cal__pill { display: block; font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__pill--ok { background: #e3f6ee; color: var(--ok); }
.cal__pill--pending { background: #fdf1da; color: var(--warn); }
@media (max-width: 720px) { .cal__cell { min-height: 60px; } .perm-grid { grid-template-columns: 1fr; } }

/* ── Loading & error states ─────────────────────────────────── */
.load-state { display: flex; align-items: center; gap: 10px; padding: 26px 4px; color: var(--muted); }
.load-spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: load-spin 0.7s linear infinite; }
@keyframes load-spin { to { transform: rotate(360deg); } }
.load-error { display: flex; gap: 12px; align-items: flex-start; padding: 22px; background: #fbe6e6; border: 1px solid #f3c9c9; border-radius: var(--radius); color: var(--danger); }
.load-error__ico { font-size: 18px; line-height: 1.2; }
.load-error__msg { font-weight: 600; color: #7a1f1f; }
@media (prefers-reduced-motion: reduce) { .load-spin { animation: none; } }

/* ── System popups (live alerts & notifications) ────────────── */
#popup-host { position: fixed; top: 16px; right: 16px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); }
.popup { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--info);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(0,51,51,0.18); padding: 12px 12px 12px 14px; animation: popup-in 0.24s cubic-bezier(.2,.8,.2,1); }
.popup--out { animation: popup-out 0.22s ease forwards; }
.popup--success { border-left-color: var(--ok); }
.popup--warn, .popup--warning { border-left-color: var(--warn); }
.popup--critical, .popup--danger { border-left-color: var(--danger); }
.popup__icon { font-size: 16px; line-height: 1.3; }
.popup__main { flex: 1; min-width: 0; }
.popup__title { font-weight: 700; font-size: 13.5px; color: var(--teal); }
.popup__body { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.popup__close { border: 0; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; }
.popup__close:hover { color: var(--danger); }
@keyframes popup-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes popup-out { to { opacity: 0; transform: translateX(28px); } }
@media (prefers-reduced-motion: reduce) { .popup { animation: none; } .popup--out { animation: none; } }

/* Record attribution footer — created/edited by & when, on detail/edit panels */
.record-meta { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line);
  display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.record-meta__item strong { color: var(--teal); font-weight: 700; }
