/* ==========================================================================
   Incident Manager — ServiceNow-inspired console
   Design tokens + layout + components
   ========================================================================== */

:root {
  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Chrome (sidebar + rails) */
  --nav-bg: #0d1a2b;
  --nav-bg-2: #0a1422;
  --nav-border: #1d2c42;
  --nav-text: #9fb0c9;
  --nav-text-dim: #6b7d99;
  --nav-text-strong: #ffffff;
  --nav-active-bg: #14273f;
  --nav-active-bar: #17b3a0;

  /* Brand accent (teal — evokes the "Now" feel without copying it) */
  --accent: #10a294;
  --accent-strong: #0c8578;
  --accent-weak: #e2f5f2;
  --accent-ring: rgba(16, 162, 148, 0.22);

  /* Surfaces */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #f1f4f9;
  --border: #e3e8f0;
  --border-strong: #d3dae4;

  /* Text */
  --text: #17202e;
  --text-muted: #5a6675;
  --text-soft: #8a94a3;

  /* Priority */
  --p1: #c81e1e; --p1-bg: #fdecec;
  --p2: #c2410c; --p2-bg: #fdf1e8;
  --p3: #a16207; --p3-bg: #fdf6e3;
  --p4: #3f6212; --p4-bg: #f3f8e8;

  /* Radii + shadows */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 6px 20px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.16);

  --sidebar-w: 250px;
  --topbar-h: 58px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell { min-height: 100%; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  border-right: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: var(--topbar-h);
  padding: 0 1.1rem;
  color: var(--nav-text-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--nav-border);
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #24d1b8, #10a294 55%, #0c7d84);
  color: #04211e;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-text strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-text small {
  display: block;
  color: var(--nav-text-dim);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  margin-top: 2px;
}

.sidebar__nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 0.6rem 1.5rem;
}

.nav-group + .nav-group { margin-top: 1.35rem; }

.nav-group__label {
  padding: 0 0.7rem;
  margin-bottom: 0.4rem;
  color: var(--nav-text-dim);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  margin: 1px 0;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 550;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-link:hover { background: #ffffff0f; color: var(--nav-text-strong); }
.nav-link.active {
  background: var(--nav-active-bg);
  color: var(--nav-text-strong);
  border-left-color: var(--nav-active-bar);
  font-weight: 650;
}
.nav-link svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: 0.9; }
.nav-link.is-cta {
  margin-top: 0.35rem;
  background: var(--accent);
  color: #04211e;
  border-left-color: transparent;
  font-weight: 700;
  justify-content: center;
}
.nav-link.is-cta:hover { background: #14b7a6; color: #04211e; }

.sidebar__foot {
  flex: 0 0 auto;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--nav-border);
  color: var(--nav-text-dim);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: #2ec7a5; box-shadow: 0 0 0 3px #2ec7a52e; }

/* ---- Main column ---- */
.main-col {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.4rem;
}
.topbar__crumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
  font-size: 0.83rem;
  min-width: 0;
}
.topbar__crumbs .sep { color: var(--border-strong); }
.topbar__crumbs .here { color: var(--text); font-weight: 650; }
.topbar__crumbs a { color: var(--text-muted); text-decoration: none; }
.topbar__crumbs a:hover { color: var(--accent-strong); }

.topbar__user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.28rem 0.4rem 0.28rem 0.28rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.topbar__user:hover { border-color: var(--border-strong); background: var(--surface-2); }
/* signed-in identity is server-rendered and not clickable */
.topbar__user.is-static { cursor: default; margin-left: 0; }
.topbar__user.is-static:hover { border-color: var(--border); background: var(--surface); }
.topbar__identity { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.topbar__signout {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted);
  font-size: 0.8rem; font-weight: 650; text-decoration: none;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}
.topbar__signout:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.topbar__signout svg { width: 15px; height: 15px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #10a294, #0c6f7d);
  color: #fff; font-size: 0.74rem; font-weight: 700;
}
.topbar__user .who { font-size: 0.82rem; font-weight: 600; color: var(--text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hamburger {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  align-items: center; justify-content: center; cursor: pointer;
  padding: 0;
}
.hamburger svg { width: 20px; height: 20px; }

/* ---- Content ---- */
.content {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.6rem 1.9rem 3rem;
}

/* ==========================================================================
   Page header
   ========================================================================== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0.15rem 0 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.page-head p { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.eyebrow {
  display: inline-block;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 0.95rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: 650 0.85rem var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.btn:hover { background: var(--accent-strong); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn--subtle { background: var(--surface-3); color: var(--text); }
.btn--subtle:hover { background: #e7ecf3; }
.btn--danger { background: #d92d20; }
.btn--danger:hover { background: #b42318; }
.btn--danger-ghost { background: var(--surface); color: #c0392b; border-color: #f0c5be; }
.btn--danger-ghost:hover { background: #fdecec; color: #a93226; border-color: #eab6ad; }
.btn--sm { height: 32px; font-size: 0.8rem; padding: 0 0.7rem; }
.btn--block { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 0.4rem 0.3rem; cursor: pointer;
  color: var(--accent-strong); font: 600 0.83rem var(--font);
}
.link-btn:hover { text-decoration: underline; }

/* ==========================================================================
   KPI tiles
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin-bottom: 1.3rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.95rem 1.05rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.kpi.is-p1::before { background: var(--p1); }
.kpi.is-p2::before { background: var(--p2); }
.kpi.is-open::before { background: #2563eb; }
.kpi.is-resolved::before { background: #12855b; }
.kpi__label {
  display: flex; align-items: center; gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi__value {
  margin-top: 0.35rem;
  font-size: 1.9rem;
  font-weight: 760;
  letter-spacing: -0.03em;
  line-height: 1;
}
.kpi__value small { font-size: 0.85rem; color: var(--text-soft); font-weight: 600; letter-spacing: 0; }
.kpi__sub { margin-top: 0.3rem; font-size: 0.74rem; color: var(--text-soft); }

/* ==========================================================================
   Card / list view
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.card__head h2 { margin: 0; font-size: 0.98rem; font-weight: 700; }
.card__head .count { color: var(--text-soft); font-size: 0.78rem; font-weight: 600; }

/* Queue pagination */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--border);
}
.pager:empty { display: none; }
.pager__btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}
.pager__btn:hover:not(:disabled):not(.is-current) { border-color: var(--accent); color: var(--accent); }
.pager__btn:disabled { opacity: 0.45; cursor: default; }
.pager__btn.is-current { background: var(--accent); border-color: var(--accent); color: #fff; cursor: default; }
.pager__gap { padding: 0 0.15rem; color: var(--text-soft); font-size: 0.8rem; }

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 1fr 1fr 1fr 1.1fr auto;
  gap: 0.6rem;
  padding: 0.8rem 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.filters .field-search { position: relative; }
.filters .field-search svg { position: absolute; left: 0.65rem; top: 9px; width: 16px; height: 16px; color: var(--text-soft); }
.filters .field-search input { padding-left: 2rem; }
.filters input, .filters select { height: 36px; margin: 0; font-size: 0.83rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list thead th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.list tbody td {
  padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  vertical-align: middle;
}
.list tbody tr { cursor: pointer; transition: background 0.1s ease; }
.list tbody tr:hover { background: var(--accent-weak); }
.list tbody tr:last-child td { border-bottom: 0; }

.col-ind { width: 6px; padding: 0 !important; }
.pind { display: block; width: 4px; height: 30px; border-radius: 3px; margin-left: 6px; background: var(--border-strong); }
.pind.p1 { background: var(--p1); }
.pind.p2 { background: var(--p2); }
.pind.p3 { background: var(--p3); }
.pind.p4 { background: var(--p4); }

.inc-num { color: var(--accent-strong); font-weight: 700; text-decoration: none; white-space: nowrap; }
.inc-num:hover { text-decoration: underline; }
.cell-desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cell-muted { color: var(--text-soft); }
.cell-time { color: var(--text-soft); font-size: 0.78rem; white-space: nowrap; }
.chev { color: var(--border-strong); text-align: right; width: 28px; }
tr:hover .chev { color: var(--accent); }

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-soft);
}
.empty svg { width: 34px; height: 34px; opacity: 0.5; margin-bottom: 0.6rem; }

.skeleton-row td { padding: 0.85rem 0.9rem; }
.skl { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef1f6 25%, #e2e7ef 37%, #eef1f6 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.4;
}
.badge .tick { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Priority */
.prio-1 { color: var(--p1); background: var(--p1-bg); }
.prio-2 { color: var(--p2); background: var(--p2-bg); }
.prio-3 { color: var(--p3); background: var(--p3-bg); }
.prio-4 { color: var(--p4); background: var(--p4-bg); }

/* State */
.state { border: 1px solid transparent; }
.state-new       { color: #175cd3; background: #eff4ff; border-color: #d3e2ff; }
.state-progress  { color: #5b2ecb; background: #f3efff; border-color: #e2d7fb; }
.state-hold      { color: #b54708; background: #fff5eb; border-color: #fbe1c6; }
.state-resolved  { color: #067647; background: #ecfdf3; border-color: #cdf3df; }
.state-closed    { color: #475467; background: #f2f4f7; border-color: #e3e7ee; }
.state-reopened  { color: #c01048; background: #fff0f4; border-color: #ffd6e1; }
.state-cancelled { color: #9a5b64; background: #fbf1f2; border-color: #efdcdf; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form-card {
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.6rem;
}
.field { display: block; margin-bottom: 1.15rem; }
.field:last-child { margin-bottom: 0; }
.field > .lbl,
label > .lbl { display: block; margin-bottom: 0.4rem; color: var(--text); font-size: 0.82rem; font-weight: 650; }
.field .hint { display: block; margin-top: 0.35rem; color: var(--text-soft); font-size: 0.75rem; }
.req { color: #d92d20; }

input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font: 400 0.9rem var(--font);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input::placeholder, textarea::placeholder { color: #a7b0bd; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
textarea { min-height: 116px; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6675' stroke-width='2.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 0.6rem center;
  padding-right: 2rem;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.4rem; }
.form-msg { margin-top: 0.9rem; font-size: 0.85rem; font-weight: 600; }
.form-msg.error { color: #b42318; }

/* Segmented severity control (used on create form) */
.seg { display: flex; gap: 0.5rem; }
.seg label {
  flex: 1;
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg label small { display: block; font-weight: 500; font-size: 0.68rem; color: var(--text-soft); margin-top: 2px; }
.seg label:hover { border-color: var(--accent); }
.seg label.on-1 { border-color: var(--p1); background: var(--p1-bg); color: var(--p1); }
.seg label.on-2 { border-color: var(--p2); background: var(--p2-bg); color: var(--p2); }
.seg label.on-3 { border-color: var(--p3); background: var(--p3-bg); color: var(--p3); }
.seg label.on-4 { border-color: var(--p4); background: var(--p4-bg); color: var(--p4); }
.seg label.on-1 small, .seg label.on-2 small, .seg label.on-3 small, .seg label.on-4 small { color: inherit; opacity: 0.85; }

/* ==========================================================================
   Incident detail (ServiceNow-style form)
   ========================================================================== */
.detail-loading { padding: 2.5rem; text-align: center; color: var(--text-soft); }

.inc-ribbon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.1rem;
}
.inc-ribbon__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.inc-ribbon__id { display: flex; align-items: center; gap: 0.6rem; color: var(--text-soft); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; }
.inc-ribbon h1 { margin: 0.5rem 0 0.7rem; font-size: 1.3rem; font-weight: 720; letter-spacing: -0.01em; line-height: 1.25; }
.inc-ribbon__badges { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inc-ribbon__meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem;
  margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-muted);
}
.inc-ribbon__meta .m b { color: var(--text-soft); font-weight: 650; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; display: block; }
.inc-ribbon__meta .m span { color: var(--text); font-weight: 600; }
.inc-ribbon__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr); gap: 1.1rem; align-items: start; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.1rem;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.85rem 1.15rem; border-bottom: 1px solid var(--border);
}
.panel__head h2 { margin: 0; font-size: 0.92rem; font-weight: 700; }
.panel__body { padding: 1.15rem; }
.panel--flush .panel__body { padding: 0; }

.identity-note { color: var(--text-soft); font-size: 0.78rem; margin: 0.5rem 0 0; }

/* State changer */
.state-row { display: flex; gap: 0.55rem; align-items: stretch; }
.state-row select { flex: 1; }
.transition-hint { margin: 0.7rem 0 0; font-size: 0.78rem; color: var(--text-soft); }

/* Activity stream */
.stream-tabs { display: flex; gap: 0.3rem; padding: 0.6rem 0.9rem 0; }
.stream-tab {
  border: 0; background: none; cursor: pointer;
  padding: 0.5rem 0.7rem; border-radius: 7px 7px 0 0;
  color: var(--text-muted); font: 650 0.8rem var(--font);
  border-bottom: 2px solid transparent;
}
.stream-tab:hover { color: var(--text); }
.stream-tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.stream-tab .pill { margin-left: 0.35rem; font-size: 0.68rem; color: var(--text-soft); }

.stream { padding: 0.4rem 1.15rem 1rem; max-height: 460px; overflow-y: auto; }
.stream-item { display: flex; gap: 0.7rem; padding: 0.75rem 0; border-bottom: 1px dashed var(--border); }
.stream-item:last-child { border-bottom: 0; }
.stream-item__avatar { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; color: #fff; background: #8090a6; }
.stream-item.is-comment .stream-item__avatar { background: linear-gradient(135deg, #10a294, #0c6f7d); }
.stream-item.is-status .stream-item__avatar { background: #6b4ee6; }
.stream-item.is-created .stream-item__avatar { background: #2f7ce0; }
.stream-item.is-notification .stream-item__avatar { background: #0f766e; }
.stream-item.is-archive .stream-item__avatar { background: #64748b; }
.stream-item__body { min-width: 0; flex: 1; }
.stream-item__head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: baseline; }
.stream-item__who { font-weight: 700; font-size: 0.82rem; }
.stream-item__tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-soft); }
.stream-item__time { margin-left: auto; color: var(--text-soft); font-size: 0.73rem; white-space: nowrap; }
.stream-item__text { margin: 0.25rem 0 0; font-size: 0.86rem; color: var(--text); white-space: pre-wrap; line-height: 1.5; }
.stream-item__text .chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.05rem 0.4rem; border-radius: 5px; background: var(--surface-3);
  font-size: 0.78rem; font-weight: 600;
}

.composer { padding: 0.9rem 1.15rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.composer textarea { min-height: 78px; background: #fff; }
.composer .composer-actions { display: flex; justify-content: flex-end; margin-top: 0.6rem; }

/* ==========================================================================
   Modal (identity)
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(9, 16, 27, 0.5);
  display: grid; place-items: center; padding: 1.2rem;
  animation: fade-in 0.14s ease;
}
.modal {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem 1.5rem 1.3rem;
  animation: toast-in 0.18s ease;
}
.modal h3 { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 720; }
.modal p { margin: 0 0 0.9rem; color: var(--text-muted); font-size: 0.85rem; line-height: 1.45; }
.modal input { margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.55rem; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-wrap { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 60; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  min-width: 250px; max-width: 360px;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  background: #10233a; color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem; font-weight: 600;
  animation: toast-in 0.22s ease;
}
.toast.success { background: #0c6b52; }
.toast.error { background: #b42318; }
.toast svg { width: 18px; height: 18px; flex: 0 0 auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Scrim for mobile nav */
.scrim { display: none; position: fixed; inset: 0; background: rgba(9, 16, 27, 0.5); z-index: 35; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1040px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 250px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .main-col { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .topbar__crumbs { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field-search { grid-column: 1 / -1; }
  .content { padding: 1.2rem 1.1rem 2.5rem; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .topbar__user .who { display: none; }
  .topbar__signout span { display: none; }
  .inc-ribbon__actions { width: 100%; }
  .seg { flex-direction: column; }
}

/* ---------- sign-in page ---------------------------------------------------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--surface-2);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.9rem 1.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 12px);
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.6rem; }
.login-brand .brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #10a294, #0c6f7d);
  color: #fff; font-size: 0.8rem; font-weight: 800;
}
.login-brand .brand-text { display: grid; line-height: 1.25; }
.login-brand strong { font-size: 0.92rem; }
.login-brand small { font-size: 0.72rem; color: var(--text-soft); }
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.3rem; }
.login-sub { margin: 0 0 1.3rem; font-size: 0.85rem; color: var(--text-muted); }
.login-card .field { margin-bottom: 0.9rem; }
.login-submit { width: 100%; justify-content: center; margin-top: 0.4rem; }
.login-foot { margin: 1.3rem 0 0; font-size: 0.76rem; color: var(--text-soft); line-height: 1.5; }
.login-card .form-msg.error {
  margin: 0 0 1rem;
  padding: 0.6rem 0.75rem;
  background: #fdecec;
  border: 1px solid #f5c6c6;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
}
