/* ==========================================================================
   ServiceNow V2 — visual system
   One palette for every screen. Deep teal chrome, "Now green" used only as a
   light source (glows, active markers), teal-green for actions.
   Designed by FutureHive Systems.
   ========================================================================== */
:root {
  /* chrome */
  --ink-950: #061a1d;
  --ink-900: #0b2327;
  --ink-800: #12363b;
  --ink-700: #1a4a50;
  --now: #62d84e;

  /* surfaces */
  --bg: #edf2f0;
  --bg-card: #ffffff;
  --bg-stripe: #f6f9f8;
  --code-bg: #e8eeec;
  --border: #d3dedb;

  /* text */
  --text: #14262a;
  --text-muted: #566b6b;
  --text-on-dark: #e3eeec;
  --text-on-dark-muted: #94b3af;

  /* sidebar (kept as variables because other rules reference them) */
  --bg-sidebar: var(--ink-900);
  --bg-sidebar-active: rgba(255, 255, 255, 0.08);

  /* actions + states */
  --accent: #1a7a5e;
  --accent-hover: #146449;
  --accent-edge: #0e4f3a;
  --accent-soft: #e0f2ec;
  --success: #2f7a17;
  --success-soft: #e3f1d9;
  --warn: #9a5700;
  --warn-soft: #fcecd0;
  --danger: #b3202f;
  --danger-soft: #fbe4e6;
  --info: #1f6f8b;
  --info-soft: #e0f0f5;

  /* depth */
  --shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 1px 2px rgba(11,35,39,.07), 0 10px 22px -12px rgba(11,35,39,.18);
  --shadow-lg: 0 18px 40px -12px rgba(6,26,29,.35), 0 4px 10px rgba(6,26,29,.12);
  --shadow-raise: 0 1px 0 rgba(255,255,255,.95) inset, 0 2px 3px rgba(11,35,39,.08), 0 16px 28px -14px rgba(11,35,39,.3);

  --radius: 8px;
  --radius-lg: 12px;

  --font-ui: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Manrope", "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#root { min-height: 100%; }
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Brand mark + footer credit
   ========================================================================== */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  font-family: var(--font-display); font-size: 0.8rem; font-weight: 800; letter-spacing: 0;
  color: #06280f;
  background: linear-gradient(150deg, #9af088 0%, #62d84e 45%, #2fa25a 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.65) inset,
    0 -2px 0 rgba(0,0,0,.18) inset,
    0 6px 12px rgba(0,0,0,.35);
}
.credit {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--text-muted);
}
.credit svg { flex: none; }
.credit b { font-family: var(--font-display); font-weight: 800; color: var(--text); letter-spacing: -0.005em; }
.app-footer {
  margin-top: auto; padding: 14px 24px; display: flex; justify-content: center;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,.95));
}

/* ==========================================================================
   Login
   ========================================================================== */
.login-wrap {
  --mx: 0; --my: 0;
  position: relative; min-height: 100vh; overflow: hidden; isolation: isolate;
  display: grid; grid-template-rows: auto 1fr auto;
  color: var(--text-on-dark);
  background:
    radial-gradient(60% 55% at 12% 8%, rgba(31,111,139,.38), transparent 70%),
    radial-gradient(55% 60% at 92% 96%, rgba(98,216,78,.20), transparent 70%),
    var(--ink-950);
}
/* faint floor grid that fades toward the edges */
.login-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(148,179,175,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,179,175,.09) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 70% at 40% 50%, #000 20%, transparent 85%);
          mask-image: radial-gradient(70% 70% at 40% 50%, #000 20%, transparent 85%);
}
.login-brand {
  display: flex; align-items: center; gap: 12px; padding: 24px 32px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #fff; letter-spacing: -0.01em;
}
.login-main {
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 32px 24px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, 430px);
  gap: 56px; align-items: center;
}
.login-hero h1 {
  margin: 0 0 16px; color: #fff;
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em;
  font-size: clamp(2.1rem, 4.2vw, 3.3rem); line-height: 1.05; max-width: 14ch;
}
.login-hero p { margin: 0; max-width: 46ch; font-size: 1.05rem; color: var(--text-on-dark-muted); line-height: 1.55; }

/* ---- 3D ticket stack ---- */
.scene { position: relative; height: 380px; margin-top: 10px; perspective: 1300px; }
.stack {
  position: absolute; left: 46%; top: 50%; width: 430px; height: 280px; margin: -140px 0 0 -215px;
  transform-style: preserve-3d;
  transform: rotateX(calc(58deg + var(--my) * -7deg)) rotateZ(calc(-35deg + var(--mx) * 9deg));
  transition: transform .25s ease-out;
}
.layer { position: absolute; inset: 0; border-radius: 14px; transform-style: preserve-3d; }
.layer-base {
  transform: translateZ(0);
  background: linear-gradient(145deg, rgba(26,74,80,.75), rgba(11,35,39,.85));
  border: 1px solid rgba(98,216,78,.45);
  box-shadow: 0 0 0 6px rgba(98,216,78,.06), 0 40px 60px rgba(0,0,0,.55), 0 0 60px rgba(98,216,78,.22);
}
.layer-base::after {
  content: ""; position: absolute; inset: 14px; border-radius: 8px;
  background-image:
    linear-gradient(rgba(98,216,78,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98,216,78,.18) 1px, transparent 1px);
  background-size: 28px 28px;
}
.layer-list {
  transform: translateZ(46px);
  inset: 22px 26px 30px 22px;
  background: linear-gradient(160deg, #ffffff, #e9f1ef);
  color: var(--text);
  box-shadow: 0 28px 34px -8px rgba(0,0,0,.5);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 9px;
  animation: stack-float 7s ease-in-out infinite;
}
.t-row {
  display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px; background: #fff; border: 1px solid #dbe5e2;
  font-size: 12px; font-weight: 700;
}
.t-row i { width: 10px; height: 10px; border-radius: 50%; }
.t-row .crit { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.t-row .high { background: #d98a00; box-shadow: 0 0 0 3px var(--warn-soft); }
.t-row .low { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.t-row small { font-size: 10.5px; font-weight: 700; color: var(--text-muted); }
.t-head { font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--ink-900); padding: 0 2px 2px; }
.layer-sla {
  transform: translateZ(104px);
  inset: auto -74px -58px auto; width: 156px; height: 104px;
  background: linear-gradient(160deg, var(--ink-800), var(--ink-950));
  border: 1px solid rgba(98,216,78,.5);
  box-shadow: 0 26px 30px -6px rgba(0,0,0,.6), 0 0 34px rgba(98,216,78,.25);
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  animation: stack-float 7s ease-in-out -2.4s infinite;
}
.ring {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--now) 0 88%, rgba(255,255,255,.14) 0);
  -webkit-mask: radial-gradient(circle, transparent 17px, #000 18px);
          mask: radial-gradient(circle, transparent 17px, #000 18px);
}
.layer-sla b { display: block; font-family: var(--font-display); font-size: 20px; color: #fff; line-height: 1.1; }
.layer-sla span { font-size: 11px; color: var(--text-on-dark-muted); }
.layer-chip {
  transform: translateZ(84px);
  inset: auto auto 2px 46px; width: auto; height: auto; padding: 7px 14px;
  background: var(--now); color: #06280f; font-weight: 800; font-size: 12px; border-radius: 999px;
  box-shadow: 0 20px 24px -6px rgba(0,0,0,.55), 0 0 26px rgba(98,216,78,.55);
  animation: stack-float 7s ease-in-out -4.6s infinite;
}
@keyframes stack-float { 0%, 100% { translate: 0 0 0; } 50% { translate: 0 0 16px; } }

/* ---- sign-in card ---- */
.login-stage { perspective: 1100px; }
.login-card {
  background: #ffffff; color: var(--text);
  border-radius: 18px; padding: 34px 32px 28px; width: 100%;
  box-shadow:
    0 1px 0 rgba(255,255,255,.9) inset,
    0 40px 70px -20px rgba(0,0,0,.65),
    0 0 0 1px rgba(255,255,255,.06);
  transform: rotateY(calc(var(--mx) * -3.2deg)) rotateX(calc(var(--my) * 2.4deg));
  transition: transform .25s ease-out;
  position: relative;
}
.login-card::before {
  content: ""; position: absolute; left: 32px; right: 32px; top: 0; height: 4px;
  border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--accent), var(--now));
}
.login-card h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.login-card .sub { margin: 0 0 24px; color: var(--text-muted); font-size: 0.95rem; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 700; color: var(--text); }
.input-wrap { position: relative; }
.input-wrap > svg.lead { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; }
.input-wrap input {
  width: 100%; height: 46px; padding: 0 44px 0 42px; font-size: 0.98rem; color: var(--text);
  background: #f5f9f8; border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: inset 0 2px 3px rgba(11,35,39,.06);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.input-wrap input:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), inset 0 1px 2px rgba(11,35,39,.04); }
.reveal {
  position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 34px; height: 34px;
  display: grid; place-items: center; border: none; border-radius: 8px; background: transparent; color: var(--text-muted);
}
.reveal:hover { background: var(--code-bg); color: var(--text); }
.login-btn {
  width: 100%; height: 48px; margin-top: 6px; font-size: 1rem; border-radius: 11px; justify-content: center;
}
.login-error {
  margin: 14px 0 0; min-height: 1.3em; font-size: 0.88rem; color: var(--danger); font-weight: 600;
}
.login-error:empty { margin: 0; min-height: 0; }
.login-help { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 0.84rem; color: var(--text-muted); text-align: center; }
.login-footer { display: flex; justify-content: center; padding: 18px 24px 24px; }
.login-footer .credit { color: var(--text-on-dark-muted); }
.login-footer .credit b { color: #fff; }

/* one entrance, on load */
.login-hero, .login-stage { animation: login-in .7s cubic-bezier(.2,.7,.2,1) both; }
.login-stage { animation-delay: .12s; }
@keyframes login-in { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

.login-wrap :focus-visible { outline-color: var(--now); }
.login-card :focus-visible { outline-color: var(--accent); }

@media (max-width: 960px) {
  .login-main { grid-template-columns: 1fr; gap: 28px; padding: 8px 20px 20px; max-width: 520px; }
  .login-hero h1 { font-size: 2rem; max-width: none; }
  .login-hero p { font-size: 0.98rem; }
  .scene { display: none; }
  .login-brand { padding: 20px; }
  .login-card { padding: 28px 22px 22px; transform: none; }
}

/* ==========================================================================
   Avatar
   ========================================================================== */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem; flex: none;
  font-family: var(--font-display);
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 -2px 0 rgba(0,0,0,.18) inset, 0 3px 6px rgba(11,35,39,.25);
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex: none; color: var(--text-on-dark);
  background: linear-gradient(180deg, var(--ink-900) 0%, #081c20 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.05), 10px 0 30px -12px rgba(6,26,29,.5);
  padding: 0; display: flex; flex-direction: column; gap: 0;
  position: relative; z-index: 25;
}
.sidebar .brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; padding: 18px 18px; color: #ffffff;
  border-bottom: 1px solid rgba(255,255,255,0.07); letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 11px; margin-bottom: 8px;
}
.nav-item {
  display: flex; align-items: center; padding: 11px 18px; margin: 1px 10px; width: calc(100% - 20px);
  border: none; border-left: 3px solid transparent; border-radius: 8px;
  color: var(--text-on-dark-muted); font-size: 0.93rem; font-weight: 600; background: transparent; text-align: left;
  transition: background-color .14s ease, color .14s ease, transform .14s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text-on-dark); transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(98,216,78,.18), rgba(255,255,255,.05));
  color: #ffffff; border-left-color: var(--now); font-weight: 700;
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 6px 14px -6px rgba(0,0,0,.5);
}
.sidebar :focus-visible { outline-color: var(--now); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 28px; position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid rgba(11,35,39,.1);
  box-shadow: 0 8px 18px -14px rgba(11,35,39,.35);
}
.topbar h2 { margin: 0; font-family: var(--font-display); font-size: 1.12rem; font-weight: 800; letter-spacing: -0.015em; color: var(--text); flex: none; }
.quick-search { display: flex; gap: 6px; flex: 1; justify-content: center; max-width: 340px; margin: 0 16px; }
.quick-search input {
  width: 100%; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-stripe); color: var(--text); font-size: 0.86rem;
  box-shadow: inset 0 1px 2px rgba(11,35,39,.06);
}
.quick-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }

.profile-wrap { position: relative; flex: none; }
.who {
  display: flex; align-items: center; gap: 9px; font-size: 0.88rem; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  padding: 5px 10px 5px 8px;
}
.who:hover { background: #fff; border-color: var(--border); box-shadow: var(--shadow); }
.who .chevron { font-size: 0.6rem; color: var(--text-muted); margin-left: 2px; }
.profile-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 30; overflow: hidden;
}
.profile-menu.open { display: block; }
.profile-menu-info { padding: 13px 15px; }
.profile-menu-name { font-weight: 800; font-family: var(--font-display); font-size: 0.92rem; color: var(--text); }
.profile-menu-email { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
.profile-menu-divider { height: 1px; background: var(--border); margin: 0; }
.profile-menu-item {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  padding: 11px 15px; font-size: 0.9rem; color: var(--text);
}
.profile-menu-item:hover { background: var(--accent-soft); color: var(--accent-hover); }

.content { padding: 24px 28px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ==========================================================================
   Components
   ========================================================================== */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card h3 {
  margin: 0 0 14px; font-family: var(--font-display); font-size: 1.02rem; font-weight: 800; letter-spacing: -0.01em;
  color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 10px;
}

/* Stat tiles: raised plates that tilt toward you on hover */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 16px; margin-bottom: 20px; perspective: 900px; }
.stat {
  --tone: var(--accent);
  position: relative; overflow: hidden;
  background: linear-gradient(165deg, #ffffff 0%, #f1f6f4 100%);
  border: 1px solid var(--border); border-bottom: 3px solid var(--tone);
  border-radius: var(--radius-lg); padding: 16px 18px 14px;
  box-shadow: var(--shadow-raise);
  transition: transform .22s cubic-bezier(.2,.7,.2,1), box-shadow .22s ease;
  transform-style: preserve-3d;
}
.stat::after {
  content: ""; position: absolute; right: -26px; top: -26px; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--tone) 28%, transparent), transparent 70%);
  pointer-events: none;
}
.grid-stats .stat:nth-child(2) { --tone: var(--info); }
.grid-stats .stat:nth-child(3) { --tone: var(--success); }
.grid-stats .stat:nth-child(4) { --tone: #d98a00; }
.stat:hover { transform: translateY(-4px) rotateX(5deg); box-shadow: 0 1px 0 rgba(255,255,255,.95) inset, 0 4px 8px rgba(11,35,39,.1), 0 26px 34px -16px rgba(11,35,39,.4); }
.stat .num { font-family: var(--font-display); font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; }
.stat .lbl { color: var(--text-muted); font-size: 0.86rem; font-weight: 600; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  color: var(--text-muted); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.01em;
  background: linear-gradient(180deg, #f3f7f6, var(--code-bg)); position: sticky; top: 0; z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}
tbody tr:nth-child(even) td { background: var(--bg-stripe); }
tr.clickable { cursor: pointer; }
tr.clickable td { transition: background-color .12s ease; }
tr.clickable:hover td { background: var(--accent-soft); }
/* Quick-scan priority indicator: a colored left border strip per row */
tr.clickable td:first-child { border-left: 4px solid transparent; }
tr.pri-accent-critical td:first-child { border-left-color: var(--danger); }
tr.pri-accent-high td:first-child { border-left-color: #d98a00; }
tr.pri-accent-moderate td:first-child { border-left-color: var(--info); }
tr.pri-accent-low td:first-child { border-left-color: var(--border); }
.table-scroll { overflow-x: auto; overflow-y: auto; max-height: 65vh; border-radius: var(--radius); }

/* Buttons: physical keys with a lit top edge and a dark bottom edge */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 9px;
  padding: 8px 18px; font-size: 0.9rem; font-weight: 700; letter-spacing: 0.005em;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .12s ease, transform .12s ease, filter .15s ease;
}
.btn-primary {
  color: #fff; border-color: var(--accent-edge);
  background: linear-gradient(180deg, #1e8463 0%, var(--accent) 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 3px 0 var(--accent-edge), 0 8px 14px -4px rgba(14,79,58,.45);
}
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 4px 0 var(--accent-edge), 0 12px 18px -4px rgba(14,79,58,.5); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 0 var(--accent-edge), 0 2px 4px rgba(14,79,58,.4); }
.btn-secondary {
  background: linear-gradient(180deg, #ffffff, #eef6f3); color: var(--accent); border-color: var(--accent);
  box-shadow: 0 2px 0 rgba(26,122,94,.35), 0 6px 10px -6px rgba(11,35,39,.25);
}
.btn-secondary:hover { background: var(--accent-soft); transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn-outline {
  background: linear-gradient(180deg, #ffffff, #f2f6f5); color: var(--text); border-color: var(--border);
  box-shadow: 0 2px 0 var(--border), 0 6px 10px -6px rgba(11,35,39,.2);
}
.btn-outline:hover { background: #fff; border-color: #aebfba; transform: translateY(-1px); }
.btn-outline:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn-danger {
  background: linear-gradient(180deg, #ffffff, #fdf1f2); color: var(--danger); border-color: var(--danger);
  box-shadow: 0 2px 0 rgba(179,32,47,.35), 0 6px 10px -6px rgba(179,32,47,.25);
}
.btn-danger:hover { background: var(--danger-soft); transform: translateY(-1px); }
.btn-danger:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none !important; filter: none; }

.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.84rem; color: var(--text); font-weight: 700; }
.field input, .field select, .field textarea {
  padding: 9px 11px; border: 1.5px solid var(--border); border-radius: 9px; background: #fbfdfc; color: var(--text); font-size: 0.94rem;
  box-shadow: inset 0 2px 3px rgba(11,35,39,.05);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); }
.field textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; white-space: nowrap; letter-spacing: 0.005em; box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 1px 2px rgba(11,35,39,.1); }
.pill-New, .pill-Reopened { background: var(--info-soft); color: var(--info); }
.pill-Open { background: var(--accent-soft); color: var(--accent); }
.pill-InProgress { background: var(--warn-soft); color: var(--warn); }
.pill-OnHold { background: #f3e3ec; color: #8a2a5c; }
.pill-Resolved { background: var(--success-soft); color: var(--success); }
.pill-Closed { background: var(--code-bg); color: var(--text-muted); }
.pri-critical { background: var(--danger-soft); color: var(--danger); }
.pri-high { background: var(--warn-soft); color: var(--warn); }
.pri-moderate { background: var(--info-soft); color: var(--info); }
.pri-low { background: var(--code-bg); color: var(--text-muted); }

.pill-type-incident { background: var(--danger-soft); color: var(--danger); }
.pill-type-change { background: var(--info-soft); color: var(--info); }
.pill-type-problem { background: var(--warn-soft); color: var(--warn); }
.pill-type-task { background: var(--code-bg); color: var(--text-muted); }

.pill-approval-pending { background: var(--warn-soft); color: var(--warn); }
.pill-approval-approved { background: var(--success-soft); color: var(--success); }
.pill-approval-rejected { background: var(--danger-soft); color: var(--danger); }
.pill-approval-not_required { background: var(--code-bg); color: var(--text-muted); }

.sla-ok { color: var(--success); font-weight: 700; }
.sla-warn { color: var(--warn); font-weight: 700; }
.sla-breach { color: var(--danger); font-weight: 800; }

.sla-bar-track {
  width: 100%; max-width: 170px; height: 7px; border-radius: 4px;
  background: var(--code-bg); overflow: hidden; margin-top: 6px;
  box-shadow: inset 0 1px 2px rgba(11,35,39,.18);
}
.sla-bar-fill { height: 100%; border-radius: 4px; transition: width .3s ease; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset; }
.sla-bar-fill.sla-ok { background: linear-gradient(180deg, #46a02a, var(--success)); }
.sla-bar-fill.sla-warn { background: linear-gradient(180deg, #d98a00, var(--warn)); }
.sla-bar-fill.sla-breach { background: linear-gradient(180deg, #d9384a, var(--danger)); }

/* donut / ring charts get a lifted, 3D look */
svg.donut { filter: drop-shadow(0 8px 8px rgba(11,35,39,.22)); }


/* ---------- Agent team dashboard ---------- */
.team-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.team-head .th-title { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.02em; margin-bottom: 2px; }
.team-head .th-meta { display: flex; align-items: center; gap: 10px; }
.badge-you {
  margin-left: 8px; padding: 1px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; color: var(--accent);
  background: var(--accent-soft); border: 1px solid #b9dccf; vertical-align: 1px;
}
table.workload th.num-cell, table.workload td.num-cell { text-align: center; }
td.num-cell { font-variant-numeric: tabular-nums; }
td.num-cell.zero { color: #9bb0ab; }
td.num-cell.strong { font-weight: 800; color: var(--text); }
td.num-cell.breach { font-weight: 800; color: var(--danger); }

.member-block { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; background: #fff; overflow: hidden; box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 4px 10px -8px rgba(11,35,39,.3); }
.member-block summary {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; list-style: none;
  background: linear-gradient(180deg, #f6faf9, #eef4f2); font-size: 0.95rem;
}
.member-block summary::-webkit-details-marker { display: none; }
.member-block summary::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg); transition: transform .15s ease; flex: none; margin-right: 2px;
}
.member-block[open] summary::before { transform: rotate(45deg); }
.member-block summary .mb-name { flex: 1; font-family: var(--font-display); font-weight: 800; }
.member-block .mb-body { padding: 4px 10px 10px; border-top: 1px solid var(--border); }

/* ---------- Loading skeleton ---------- */
.skeleton-line {
  height: 14px; border-radius: 5px; margin: 10px 0;
  background: linear-gradient(90deg, var(--code-bg) 25%, var(--border) 37%, var(--code-bg) 63%);
  background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.skeleton-boot { max-width: 420px; margin: 120px auto; padding: 0 20px; }

.empty {
  color: var(--text-muted); font-size: 0.94rem; padding: 40px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty::before {
  content: ""; width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, var(--code-bg)); border: 1.5px dashed #b4c6c1; flex: none;
  box-shadow: 0 6px 10px -4px rgba(11,35,39,.2);
}

/* ---------- Ticket record form ---------- */
.ticket-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 6px; }
.sn-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin: 16px 0; }
.sn-row { display: flex; border-bottom: 1px solid var(--border); padding: 9px 0; align-items: baseline; }
.sn-row .sn-label { width: 160px; flex: none; color: var(--text-muted); font-size: 0.84rem; font-weight: 700; padding-right: 10px; }
.sn-row .sn-value { flex: 1; font-size: 0.94rem; color: var(--text); word-break: break-word; }
@media (max-width: 700px) { .sn-form { grid-template-columns: 1fr; } }

.comment {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; background: #f7faf9;
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 4px 8px -6px rgba(11,35,39,.25);
}
.comment.internal { background: var(--warn-soft); border-left-color: #d98a00; }
.comment .c-head { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 5px; }
.comment .c-head b { color: var(--text); }

.history-item { display: flex; gap: 10px; font-size: 0.86rem; color: var(--text-muted); padding: 8px 0; border-bottom: 1px dashed var(--border); }
.history-item:last-child { border-bottom: none; }

.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-bottom: 12px; }
.badge-role {
  font-size: 0.74rem; padding: 3px 11px; border-radius: 999px; font-weight: 800; letter-spacing: 0.01em; color: #fff;
  background: linear-gradient(180deg, #1e8463, var(--accent));
  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 2px 4px rgba(14,79,58,.35);
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input {
  padding: 8px 11px; border-radius: 9px; border: 1.5px solid var(--border); background: #fff; color: var(--text); font-size: 0.9rem;
  box-shadow: inset 0 2px 3px rgba(11,35,39,.05);
}
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--text-muted); }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 0; gap: 0; align-items: center; box-shadow: 0 8px 18px -10px rgba(6,26,29,.5); }
  .sidebar .brand { padding: 10px 14px; white-space: nowrap; border-bottom: none; border-right: 1px solid rgba(255,255,255,0.08); margin-bottom: 0; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; border-radius: 0; margin: 0; width: auto; white-space: nowrap; }
  .nav-item:hover { transform: none; }
  .nav-item.active { border-left: none; border-bottom-color: var(--now); }
  .content { padding: 16px; }
  .topbar { padding: 11px 16px; }
  .quick-search { display: none; }
}

/* ---------- Toasts ---------- */
#toast-container {
  position: fixed; top: 76px; right: 18px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border); border-left: 5px solid var(--accent);
  border-radius: 10px; padding: 13px 17px; box-shadow: var(--shadow-lg);
  font-size: 0.92rem; color: var(--text); line-height: 1.4;
  opacity: 0; transform: translateX(16px); transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--success); }

/* ---------- Confirm modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6,26,29,0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
  opacity: 0; transition: opacity .15s ease; padding: 20px;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: var(--bg-card); border-radius: 16px; padding: 24px 26px;
  max-width: 440px; width: 100%; box-shadow: var(--shadow-lg);
  transform: scale(0.96); transition: transform .15s ease;
}
.modal-overlay.show .modal-box { transform: scale(1); }
.modal-box p { margin: 0 0 18px; color: var(--text); font-size: 0.98rem; line-height: 1.5; }


/* ==========================================================================
   Icons, charts, ticket record, edit pop-ups
   ========================================================================== */
.nav-item { gap: 12px; }
.nav-item .ni { width: 19px; height: 19px; flex: none; opacity: .75; transition: opacity .14s ease, color .14s ease; }
.nav-item:hover .ni { opacity: 1; }
.nav-item.active .ni { opacity: 1; color: var(--now); filter: drop-shadow(0 0 6px rgba(98,216,78,.55)); }

.stat::after { display: none; }
.stat .stat-ico {
  position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--tone);
  background: linear-gradient(160deg, #ffffff, color-mix(in srgb, var(--tone) 16%, #ffffff));
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 6px 12px -5px color-mix(in srgb, var(--tone) 60%, transparent), 0 0 0 1px color-mix(in srgb, var(--tone) 24%, transparent);
}
.stat .si { width: 21px; height: 21px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.dash-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 980px) { .dash-grid, .dash-grid.even { grid-template-columns: minmax(0, 1fr); } }
.donut-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.bar-chart { width: 100%; height: auto; display: block; }
.bar-chart rect { filter: drop-shadow(0 4px 3px rgba(11,35,39,.16)); }

.hbars { display: flex; flex-direction: column; gap: 15px; padding-top: 4px; }
.hbar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 12px; font-size: 0.92rem; }
.hb-label { color: var(--text-muted); font-weight: 600; }
.hb-track { height: 14px; border-radius: 8px; background: var(--code-bg); box-shadow: inset 0 2px 3px rgba(11,35,39,.18); overflow: hidden; }
.hb-fill { height: 100%; border-radius: 8px; position: relative; box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 3px 6px -2px rgba(11,35,39,.35); transition: width .5s cubic-bezier(.2,.7,.2,1); }
.hb-fill::after { content: ""; position: absolute; inset: 2px 4px auto 4px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.34); }
.hb-val { text-align: right; font-family: var(--font-display); font-weight: 800; }

.person { display: inline-flex; align-items: center; gap: 8px; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill-role-admin { background: #efe3f6; color: #6a2a8f; }
.pill-role-agent { background: var(--accent-soft); color: var(--accent); }
.pill-role-requester { background: var(--info-soft); color: var(--info); }

/* ---------- ticket header + life-cycle tracker ---------- */
.ticket-top { padding: 22px 26px 20px; background: linear-gradient(180deg, #ffffff 0%, #f3f9f6 100%); }
.tt-id { font-size: 0.86rem; color: var(--text-muted); }
.tt-title { margin: 4px 0 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.65rem; letter-spacing: -0.02em; line-height: 1.2; }
.tt-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.tt-desc { margin: 14px 0 4px; max-width: 80ch; line-height: 1.55; }

.stepper { display: flex; align-items: center; margin: 22px 0 10px; max-width: 660px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 64px; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
  background: linear-gradient(180deg, #ffffff, #e8eeec); border: 2px solid var(--border); box-shadow: 0 2px 0 var(--border);
}
.step .sl { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.step.done .dot { color: #fff; border-color: var(--accent-edge); background: linear-gradient(180deg, #1e8463, var(--accent)); box-shadow: 0 2px 0 var(--accent-edge); }
.step.done .sl { color: var(--text); }
.step.current .dot { color: #06280f; border-color: #2fa25a; background: linear-gradient(180deg, #9af088, #62d84e); box-shadow: 0 2px 0 #2fa25a, 0 0 0 5px rgba(98,216,78,.24); }
.step.current .sl { color: var(--text); font-weight: 800; }
.step.hold .dot { color: #3a2100; border-color: #9a5700; background: linear-gradient(180deg, #ffd27a, #d98a00); box-shadow: 0 2px 0 #9a5700, 0 0 0 5px rgba(217,138,0,.24); }
.step-line { flex: 1; min-width: 26px; height: 4px; border-radius: 3px; margin: 0 -2px 23px; background: var(--code-bg); box-shadow: inset 0 1px 2px rgba(11,35,39,.2); }
.step-line.done { background: linear-gradient(90deg, var(--accent), #2fa25a); }
@media (max-width: 560px) { .step { min-width: 46px; } .step .sl { font-size: 0.68rem; } }

/* ---------- unified ticket record ---------- */
.rec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.rec-head h3 { margin: 0; padding: 0; border: 0; }
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-section { padding: 16px 0 6px; }
.rec-section + .rec-section { border-top: 1px dashed var(--border); margin-top: 10px; }
.rec-title { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; font-family: var(--font-display); font-weight: 800; font-size: 0.96rem; color: var(--accent-hover); }
.rec-title::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--now), var(--accent)); }
.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 36px; }
.rec-field { min-width: 0; }
.rec-field.wide { grid-column: 1 / -1; }
.rec-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.rec-view { font-size: 0.97rem; word-break: break-word; min-height: 1.4em; }
.rec-edit, .record .edit-only { display: none; }
.record.editing .rec-field.has-edit .rec-view { display: none; }
.record.editing .rec-field.has-edit .rec-edit { display: block; }
.record.editing .rec-field.edit-only { display: block; }
.record.editing { box-shadow: 0 0 0 2px var(--accent), var(--shadow-raise); }
.when-edit { display: none; }
.record.editing .when-edit { display: inline-flex; }
.record.editing .when-view { display: none; }
.rec-edit input, .rec-edit select, .rec-edit textarea {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 9px; background: #fbfdfc; color: var(--text);
  font-size: 0.94rem; box-shadow: inset 0 2px 3px rgba(11,35,39,.05);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.rec-edit input[type="checkbox"] { width: auto; box-shadow: none; }
.rec-edit input:focus, .rec-edit select:focus, .rec-edit textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }
.rec-edit textarea { min-height: 92px; resize: vertical; }
.rec-hint { display: block; margin-top: 4px; font-size: 0.76rem; }
.link-btn { background: none; border: none; padding: 0 0 0 8px; color: var(--accent); font-weight: 700; font-size: 0.86rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent-hover); }
@media (max-width: 760px) { .rec-grid { grid-template-columns: minmax(0, 1fr); } }

/* customer on the ticket header */
.tt-customer { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.tt-customer.none { padding: 6px 0; font-size: 0.9rem; }
.tt-cname { font-family: var(--font-display); font-weight: 800; font-size: 1rem; line-height: 1.2; }
.tt-csub { font-size: 0.84rem; }

/* out-of-date server warning (admins only) */
.version-banner {
  padding: 11px 28px; font-size: 0.9rem; line-height: 1.45; color: #5a3300;
  background: linear-gradient(180deg, #fff1d6, #fde6b8); border-bottom: 1px solid #e9bf6a;
}
.version-banner code { background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 5px; }

/* ---------- edit pop-ups ---------- */
.modal-form { max-width: 580px; max-height: 92vh; overflow-y: auto; }
.modal-form h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 1.28rem; letter-spacing: -0.015em; }
.modal-box .fm-intro { margin: 0 0 4px; color: var(--text-muted); font-size: 0.92rem; }
.modal-form .form-grid { margin-top: 16px; }
.modal-form .field.full { grid-column: 1 / -1; }
.fm-hint { font-size: 0.78rem; }
.fm-error { color: var(--danger); font-weight: 700; font-size: 0.88rem; min-height: 1.2em; margin: 2px 0 8px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stat:hover { transform: none; }
  .stack, .login-card { transform: rotateX(58deg) rotateZ(-35deg); }
  .login-card { transform: none; }
}

/* ---------- Print / "Save as PDF" (Reports page) ---------- */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .app-footer, #toast-container { display: none !important; }
  .app-shell, .main, .content { display: block !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }
  body, .content { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .print-only { display: block; margin: 0 0 16px; }
}
