/* =========================================================
   MODERN UI CSS (FULL REPLACEMENT)
   - Drop-in replacement for your previous stylesheet
   - Keeps your existing class names and layout
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg: #f2f6fb;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-solid: #ffffff;
  --panel-2: rgba(236, 243, 252, 0.85);
  --panel-3: rgba(228, 236, 248, 0.96);
  --glass: rgba(255, 255, 255, 0.72);

  /* Text */
  --text: #0b1220;   /* deep slate */
  --muted: #5b6b80;

  /* Brand */
  --accent: #1254a3;
  --accent-strong: #0d3f7d;
  --accent-2: #0fb0c6;
  --accent-soft: rgba(18, 84, 163, 0.12);
  --accent-glow: rgba(18, 84, 163, 0.28);
  --danger: #ef4444;
  --success: #22c55e;
  --success: #22c55e;

  /* Lines / radii / shadows */
  --border: rgba(148, 163, 184, 0.28);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);

  --focus: 0 0 0 4px rgba(31, 75, 153, 0.18);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background:
    radial-gradient(900px 360px at 10% -10%, rgba(18, 84, 163, 0.10), transparent 70%),
    radial-gradient(700px 360px at 90% 0%, rgba(15, 176, 198, 0.12), transparent 70%),
    linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
  color: var(--text);
}

img {
  max-width: 100%;
  height: auto;
}

a, button, input, select, textarea {
  transition:
    background-color .18s var(--ease),
    border-color .18s var(--ease),
    box-shadow .18s var(--ease),
    color .18s var(--ease),
    transform .18s var(--ease),
    opacity .18s var(--ease);
}

a {
  color: inherit;
}

summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::marker {
  content: "";
}

.main details > summary {
  list-style: none;
}

.main details > summary::-webkit-details-marker {
  display: none;
}

.main details > summary::marker {
  content: "";
}

/* =========================
   App shell / Layout
   ========================= */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.main {
  padding: 4px 28px 24px;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  background:
    radial-gradient(800px 320px at 90% 10%, rgba(15, 176, 198, 0.08), transparent 70%);
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(245,248,252,0.94) 100%);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-overlay {
  display: none;
}

.sidebar::after {
  position: absolute;
  top: 20px;
  bottom: 20px;
  right: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent 0%, rgba(31, 75, 153, 0.22) 30%, transparent 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;

  background:
    radial-gradient(18px 18px at 30% 30%, rgba(255,255,255,0.42), transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Nav */
.nav {
  display: grid;
  gap: 6px;
}

.nav-section {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.nav-section:last-child {
  border-bottom: 0;
}

/* details/summary accordion */
.nav-title {
  padding: 8px 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(100, 116, 139, 0.95);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
}

.nav-title:hover {
  background: rgba(31, 75, 153, 0.08);
  color: var(--accent-strong);
}

.nav-section[open] .nav-title {
  background: rgba(31, 75, 153, 0.10);
  color: var(--accent-strong);
}

.nav-title::after {
  font-size: 0.8rem;
  color: rgba(100, 116, 139, 0.95);
}

details.nav-section:not([open]) .nav-title::after {
  content: "^";
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

/* links */
.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  position: relative;
}

.nav a.active {
  background: var(--accent-soft);
  border-color: rgba(31, 75, 153, 0.28);
  color: var(--accent-strong);
  font-weight: 700;
}

.nav a.active i {
  color: var(--accent-strong);
}

.nav a.active::before {
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, #12346c 100%);
  box-shadow: 0 6px 12px rgba(31, 75, 153, 0.28);
}

.nav a i {
  width: 18px;
  text-align: center;
  color: rgba(100, 116, 139, 0.95);
  opacity: 0.9;
}

.nav a span {
  flex: 1;
}

.nav a:hover {
  background: rgba(31, 75, 153, 0.10);
  border-color: rgba(31, 75, 153, 0.20);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.nav a:hover i {
  color: var(--accent-strong);
}

.nav a:active {
  transform: translateY(0px);
}

/* Language switch */
.lang-switch {
  margin-top: auto;
  display: flex;
  gap: 12px;
  padding: 10px 6px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.lang-switch a {
  color: rgba(100, 116, 139, 0.95);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-switch a:hover {
  color: var(--accent-strong);
}

.flag {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.flag-it {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'><rect width='5.33' height='12' fill='%23008C45'/><rect x='5.33' width='5.34' height='12' fill='%23FFFFFF'/><rect x='10.67' width='5.33' height='12' fill='%23CD212A'/></svg>");
}

.flag-us {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'><rect width='16' height='12' fill='%23B22234'/><rect y='1.5' width='16' height='1.5' fill='%23FFFFFF'/><rect y='3' width='16' height='1.5' fill='%23B22234'/><rect y='4.5' width='16' height='1.5' fill='%23FFFFFF'/><rect y='6' width='16' height='1.5' fill='%23B22234'/><rect y='7.5' width='16' height='1.5' fill='%23FFFFFF'/><rect y='9' width='16' height='1.5' fill='%23B22234'/><rect y='10.5' width='16' height='1.5' fill='%23FFFFFF'/><rect width='7' height='6' fill='%23003D7D'/></svg>");
}

/* =========================
   Panels / Cards
   ========================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: scroll;
  max-width: 100%;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 100%;
}

.panel:hover,
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.panel::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 50%);
  opacity: 0.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-body {
  display: grid;
  gap: 12px;
}

/* =========================
   Create panel (details)
   ========================= */
.create-panel {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(240, 244, 250, 0.70);
  border-radius: 18px;
  padding: 8px 10px;
}

.create-toggle {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 14px;
}

.create-toggle:hover {
  background: rgba(26, 162, 180, 0.08);
}

.create-toggle::-webkit-details-marker {
  display: none;
}

.create-toggle i {
  color: var(--accent-strong);
}

.create-toggle .chevron {
  margin-left: auto;
  color: rgba(100, 116, 139, 0.95);
  transition: transform 0.2s var(--ease);
}

.create-panel[open] .create-toggle .chevron {
  transform: rotate(180deg);
}

.create-body {
  margin-top: 12px;
}

/* =========================
   Grids
   ========================= */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* =========================
   Table
   ========================= */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  border-radius: 14px;
  display: table;
  overflow: visible;
  table-layout: auto;
  max-width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  padding: 10px 10px;
  text-align: left;
  font-size: 0.9rem;
  white-space: nowrap;
}

.table th {
  color: rgba(100, 116, 139, 0.95);
  font-weight: 700;
  background: linear-gradient(180deg, rgba(236, 243, 252, 0.95) 0%, rgba(228, 236, 248, 0.7) 100%);
  position: sticky;
  top: 0;
  z-index: 2;
}

.report-table thead th {
  position: sticky;
  padding-right: 26px;
}

.report-table thead th::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid rgba(100, 116, 139, 0.45);
  border-bottom: 2px solid rgba(100, 116, 139, 0.45);
  transform: translateY(-50%) rotate(45deg);
}

.report-table thead th[data-sort-dir="asc"]::after {
  border-right-color: rgba(100, 116, 139, 0.9);
  border-bottom-color: rgba(100, 116, 139, 0.9);
  transform: translateY(-50%) rotate(-135deg);
}

.report-table thead th[data-sort-dir="desc"]::after {
  border-right-color: rgba(100, 116, 139, 0.9);
  border-bottom-color: rgba(100, 116, 139, 0.9);
  transform: translateY(-50%) rotate(45deg);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table::-webkit-scrollbar {
  height: 10px;
}

.table::-webkit-scrollbar-thumb {
  background: rgba(18, 84, 163, 0.35);
  border-radius: 999px;
}

.table::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
}

.table tr:hover td {
  background: rgba(31, 75, 153, 0.06);
}

.table tbody tr:nth-child(odd) td {
  background: rgba(240, 244, 250, 0.35);
}

.table td:last-child,
.table th:last-child {
  text-align: right;
}

/* =========================
   Pagination
   ========================= */
.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
}

.page-link {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(240, 244, 250, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.page-link:hover {
  border-color: rgba(31, 75, 153, 0.35);
  color: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.page-link.active {
  background: linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  font-weight: 800;
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(26, 162, 180, 0.22);
}

/* =========================
   Links / Text utilities
   ========================= */
.link {
  color: var(--accent-strong);
  text-decoration: none;
  margin-left: 8px;
}

.link:hover {
  text-decoration: underline;
}

.link.danger {
  color: var(--danger);
}

/* URL icon for external links */
a[href^="http://"],
a[href^="https://"] {
  position: relative;
  padding-right: 18px;
}

a[href^="http://"]::after,
a[href^="https://"]::after {
  content: ">";
  display: inline-block;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
  font-size: 0.85em;
  color: rgba(100, 116, 139, 0.9);
}

a[href^="http://"]:hover::after,
a[href^="https://"]:hover::after {
  color: var(--accent-strong);
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92rem;
  word-break: break-word;
}

/* =========================
   Code block
   ========================= */
.code {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 12px;
  white-space: pre-wrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.pill.trace-user {
  background: #eaf2ff;
  color: #1f3b7a;
  border: 1px solid #d6e3ff;
}

.pill.trace-trunk {
  background: #eaf7f0;
  color: #1d5b3a;
  border: 1px solid #d2efdf;
}

.pill.trace-server {
  background: #f6eefb;
  color: #5a2d7a;
  border: 1px solid #e7d6f5;
}

.code.trace-user {
  border-color: #cfe0ff;
  background: #f3f7ff;
}

.code.trace-trunk {
  border-color: #cdebdc;
  background: #f2fbf6;
}

.code.trace-server {
  border-color: #e2d2f3;
  background: #f7f2fb;
}

/* =========================
   Header
   ========================= */
.page-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin: 0;
}

/* =========================
   Dashboard hero
   ========================= */
.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 24px;
  background:
    radial-gradient(340px 180px at 10% 0%, rgba(26, 162, 180, 0.22), transparent 70%),
    radial-gradient(260px 180px at 95% 10%, rgba(245, 158, 11, 0.14), transparent 65%),
    linear-gradient(135deg, rgba(255,255,255,0.86) 0%, rgba(242, 247, 251, 0.78) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dashboard-hero h1 {
  margin: 6px 0 4px;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.kicker {
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  color: rgba(100, 116, 139, 0.95);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.74);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: rgba(100, 116, 139, 0.95);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-meta i {
  color: var(--accent-strong);
}

/* =========================
   Stats
   ========================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card.accent {
  border-color: rgba(26, 162, 180, 0.22);
  background:
    radial-gradient(360px 200px at 0% 0%, rgba(26, 162, 180, 0.16), transparent 70%),
    rgba(255, 255, 255, 0.78);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(20px 20px at 30% 30%, rgba(26, 162, 180, 0.18), transparent 60%),
    rgba(240, 244, 250, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.stat-label {
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.88rem;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.user-pill {
  background: rgba(255,255,255,0.75);
  padding: 8px 14px;
  border-radius: 999px;
  color: rgba(100, 116, 139, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

/* =========================
   Small metric cards (inside card)
   ========================= */
.card-title {
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 900;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

/* =========================
   Chart bars
   ========================= */
.chart {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
}

.chart-label {
  font-size: 0.92rem;
  color: rgba(100, 116, 139, 0.95);
}

.chart-bar {
  background: rgba(240, 244, 250, 0.75);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.chart-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #3cc2d0);
  border-radius: 999px;
}

.chart-value {
  font-weight: 700;
  color: var(--text);
}

/* =========================
   Login
   ========================= */
.login-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 20px;
  border-radius: 26px;
  background:
    radial-gradient(520px 240px at 10% 10%, rgba(31, 75, 153, 0.12), transparent 70%),
    radial-gradient(420px 220px at 90% 10%, rgba(14, 165, 183, 0.14), transparent 70%),
    linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(244, 248, 252, 0.88) 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-card {
  width: min(440px, 100%);
  margin: 0 auto;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  padding: 26px;
  box-shadow:
    0 30px 60px rgba(15, 23, 42, 0.16),
    0 2px 8px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: login-card-in 0.5s var(--ease);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(18px 18px at 30% 30%, rgba(255,255,255,0.35), transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(26, 162, 180, 0.22);
}

.login-title {
  font-weight: 900;
  letter-spacing: -0.02em;
}

.login-card h1 {
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
}

.login-card .form-grid {
  gap: 12px;
}

.login-card .btn.primary {
  width: 100%;
  padding: 11px 16px;
  font-size: 0.95rem;
}

.login-card .link {
  text-align: center;
  margin-top: 2px;
}

/* Profile summary */
.profile-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.profile-summary-item {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.profile-summary-item span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(100, 116, 139, 0.9);
  margin-bottom: 4px;
}

.profile-summary-item strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  word-break: break-word;
}

@keyframes login-card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================
   Forms
   ========================= */
.form-grid {
  display: grid;
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.82rem;
  font-weight: 600;
}

label {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255,255,255,0.92);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(26, 162, 180, 0.35);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(26, 162, 180, 0.85);
  box-shadow: var(--focus), 0 8px 20px rgba(15, 23, 42, 0.08);
  background: rgba(255,255,255,0.95);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(100,116,139,0.95) 50%),
    linear-gradient(135deg, rgba(100,116,139,0.95) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 10px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.input-wrap {
  position: relative;
}

.input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(100, 116, 139, 0.95);
  pointer-events: none;
  opacity: 0.9;
}

.input-wrap input {
  padding-left: 36px;
}

.captcha-row .captcha-wrap .input-wrap {
  width: 100%;
}

.form-grid .grid-2,
.form-grid .grid-3 {
  gap: 10px;
}

/* Captcha */
.captcha-row .captcha-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  align-items: center;
}

.captcha-img {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  width: 150px;
  height: 46px;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

/* =========================
   Buttons
   ========================= */
.btn {
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.30);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(236,243,252,0.9) 100%);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.btn:hover {
  border-color: rgba(31, 75, 153, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.btn:active {
  transform: translateY(0px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.btn.primary {
  background:
    radial-gradient(20px 20px at 30% 30%, rgba(255,255,255,0.30), transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, #0c3d7d 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 16px 36px var(--accent-glow);
}

.btn.primary:hover {
  box-shadow: 0 18px 40px rgba(31, 75, 153, 0.35);
}

.btn.secondary {
  background: rgba(255,255,255,0.7);
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--text);
}

.btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(239, 68, 68, 0.28);
}

.btn.danger:hover {
  box-shadow: 0 16px 34px rgba(239, 68, 68, 0.35);
}

/* =========================
   Legend / details panels
   ========================= */
.legend-panel {
  margin-top: 18px;
}

.legend summary {
  list-style: none;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(240, 244, 250, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.legend summary:hover {
  border-color: rgba(26, 162, 180, 0.35);
  background: rgba(26, 162, 180, 0.08);
}

.legend summary::-webkit-details-marker {
  display: none;
}

.legend-body {
  margin-top: 12px;
}

.legend-section {
  font-weight: 900;
  color: var(--text);
  margin: 12px 0 6px;
  letter-spacing: -0.01em;
}

/* =========================
   Alerts
   ========================= */
.alert {
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.65);
}

.alert.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.30);
  color: #b91c1c;
}

.alert.warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.30);
  color: #b45309;
}

/* =========================
   Tabs
   ========================= */
.tabbed {
  display: grid;
  gap: 12px;
}

.tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.75);
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 900;
  color: rgba(100, 116, 139, 0.95);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.tab-btn:hover {
  border-color: rgba(26, 162, 180, 0.35);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(31, 75, 153, 0.22);
}

.tab-panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tab-panel.active {
  display: block;
}

.tab-panel h3 {
  margin-top: 0;
  letter-spacing: -0.01em;
}

/* =========================
   Code / Pre
   ========================= */
.code-block {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  overflow-x: auto;
  white-space: pre-wrap;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

/* =========================
   Badges
   ========================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(240, 244, 250, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 900;
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.28);
  color: #15803d;
}

.badge-warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: #92400e;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #b91c1c;
}

/* =========================
   Footer
   ========================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.topbar-title {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
  color: var(--text);
  padding-left: 6px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 0.85rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(236,243,252,0.9) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.topbar-btn i {
  color: var(--accent-strong);
}

.topbar-btn:hover {
  color: var(--accent-strong);
  border-color: rgba(18, 84, 163, 0.35);
  transform: translateY(-1px);
}

.topbar-btn.danger {
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.28);
}

.topbar-btn.danger i {
  color: #ffffff;
}

.app-footer {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.footer-item {
  background: rgba(240, 244, 250, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 10px 12px;
}

.footer-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(100, 116, 139, 0.95);
  font-weight: 800;
}

.footer-value {
  font-weight: 800;
  margin-top: 4px;
}

.footer-copy {
  text-align: center;
  color: rgba(100, 116, 139, 0.9);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* =========================
   IVR options
   ========================= */
.ivr-options {
  display: grid;
  gap: 10px;
  margin: 10px 0 18px;
}

.ivr-row {
  display: grid;
  grid-template-columns: 60px repeat(5, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(240, 244, 250, 0.70);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.ivr-digit {
  font-weight: 900;
  font-size: 1.12rem;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.70);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  height: 46px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
    z-index: 90;
  }

  body.nav-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .brand {
    justify-content: center;
  }

  .nav {
    grid-auto-flow: row;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
  }

  .main {
    padding: 18px;
  }

  .panel,
  .card,
  .table {
    max-width: 100%;
  }

  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: max-content;
    min-width: 100%;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 80;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .topbar {
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .topbar-btn span {
    display: none;
  }

  .mobile-title {
    font-weight: 900;
    letter-spacing: -0.01em;
  }

  .menu-toggle {
    padding: 8px 12px;
  }

  /* menu-fab removed */

  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .hero-meta {
    width: 100%;
    justify-content: space-between;
  }

  .ivr-row {
    grid-template-columns: 60px 1fr;
    gap: 10px;
  }

  .login-shell {
    padding: 16px;
  }
}

@media (min-width: 901px) {
  .mobile-topbar {
    display: none;
  }

  /* menu-fab removed */
}
