:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --surface-muted: #f8fafc;
  --text: #152033;
  --text-soft: #5f6b7d;
  --text-muted: #8b97a9;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.14);
  --success: #0f9f6e;
  --warning: #d97706;
  --danger: #dc2626;
  --border: rgba(148, 163, 184, 0.24);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --radius-lg: 20px;
  --sidebar-width: 272px;
  --header-height: 76px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #111c33;
  --surface-soft: #172440;
  --surface-muted: #12203b;
  --text: #edf2ff;
  --text-soft: #bcc7db;
  --text-muted: #8190a8;
  --border: rgba(148, 163, 184, 0.16);
  --shadow: 0 18px 48px rgba(2, 6, 23, 0.45);
  --shadow-soft: 0 12px 28px rgba(2, 6, 23, 0.35);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 32%),
    var(--bg);
  color: var(--text);
}

body.login-body {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-fade {
  animation: pageFade 0.5s ease;
}

@keyframes pageFade {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 520px);
  min-height: 100vh;
}

.login-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background:
    linear-gradient(140deg, rgba(37, 99, 235, 0.95), rgba(29, 78, 216, 0.88)),
    url("../assets/background.svg") center/cover no-repeat;
  color: #fff;
}

.login-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 32%),
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.18), transparent 26%);
}

.login-hero {
  position: relative;
  z-index: 1;
  max-width: 540px;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  font-size: 0.95rem;
}

.login-hero h1 {
  margin: 26px 0 16px;
  font-size: clamp(2.4rem, 4vw, 4.3rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.login-hero p {
  margin: 0;
  max-width: 500px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.hero-card {
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(10, 19, 43, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.hero-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.hero-card span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.95rem;
}

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.login-card {
  width: min(100%, 440px);
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand img {
  width: 40px;
  height: 40px;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 60px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.theme-switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease;
}

.theme-switch[data-enabled="true"]::after {
  transform: translateX(26px);
}

.login-card h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.login-subtitle {
  margin: 8px 0 28px;
  color: var(--text-soft);
}

.form-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.inline-link {
  color: var(--primary);
  font-weight: 600;
}

.inline-link:hover {
  color: var(--primary-strong);
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 20px 34px rgba(37, 99, 235, 0.28);
}

.button:disabled {
  opacity: 0.9;
}

.button.ripple-active .ripple {
  animation: ripple 0.7s ease-out forwards;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transform: scale(0);
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(5);
    opacity: 0;
  }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-banner {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding: 0 18px;
  border-radius: 16px;
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.35s ease, margin-top 0.35s ease, opacity 0.35s ease, transform 0.35s ease, border-color 0.35s ease, padding 0.35s ease;
}

[data-theme="dark"] .error-banner {
  color: #fecaca;
  background: rgba(220, 38, 38, 0.12);
}

.error-banner.visible {
  max-height: 160px;
  margin-top: 18px;
  padding: 16px 18px;
  border-color: rgba(220, 38, 38, 0.2);
  opacity: 1;
  transform: translateY(0);
}

.error-banner strong {
  display: block;
  margin-bottom: 6px;
}

.login-footer {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px 20px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 8px 18px;
}

.sidebar-header img {
  width: 42px;
  height: 42px;
}

.sidebar-title strong,
.sidebar-title span {
  display: block;
}

.sidebar-title span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-label {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--text-soft);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
  transform: translateX(4px);
}

.nav-link[aria-current="page"] {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.08));
  color: var(--primary);
  font-weight: 700;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: currentColor;
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
  box-shadow: var(--shadow-soft);
}

.sidebar-card strong {
  display: block;
  margin-bottom: 8px;
}

.sidebar-card p {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}

.sidebar-card a {
  color: var(--primary);
  font-weight: 700;
}

.app-main {
  min-width: 0;
  padding: 24px 28px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-height);
  margin-bottom: 26px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-1px);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.25);
}

.search {
  position: relative;
  min-width: min(100%, 420px);
}

.search svg {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.user-panel {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}

.user-meta {
  text-align: left;
}

.user-meta strong,
.user-meta span {
  display: block;
}

.user-meta span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown a,
.dropdown button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.dropdown a:hover,
.dropdown button:hover,
.dropdown a:focus-visible,
.dropdown button:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}

.page-head p {
  margin: 10px 0 0;
  color: var(--text-soft);
  max-width: 680px;
  line-height: 1.65;
}

.page-actions {
  display: flex;
  gap: 12px;
}

.button-secondary {
  width: auto;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.button-secondary:hover {
  border-color: rgba(37, 99, 235, 0.24);
  color: var(--primary);
}

.grid {
  display: grid;
  gap: 20px;
}

.section-gap {
  margin-top: 20px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.content-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
  align-items: start;
}

.dual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.triple-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header,
.card-body,
.card-footer {
  padding: 20px 22px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.card-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.kpi-card {
  padding: 22px;
}

.kpi-label {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.kpi-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--success);
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 22px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
}

.status.active,
.status.confirmed,
.status.closed {
  background: rgba(15, 159, 110, 0.12);
  color: var(--success);
}

.status.pending,
.status.review,
.status.followup {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.status.escalated,
.status.high,
.status.overdue {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.list {
  display: grid;
  gap: 14px;
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.list-item:first-child {
  padding-top: 0;
}

.list-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.list-content strong,
.list-content span {
  display: block;
}

.list-content strong {
  margin-bottom: 6px;
}

.list-content span {
  color: var(--text-soft);
  line-height: 1.55;
}

.quick-actions {
  display: grid;
  gap: 12px;
}

.action-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.action-tile:hover,
.action-tile:focus-visible {
  transform: translateX(4px);
  border-color: rgba(37, 99, 235, 0.22);
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stat {
  padding: 18px;
  border-radius: 16px;
  background: var(--surface-muted);
}

.mini-stat strong,
.mini-stat span {
  display: block;
}

.mini-stat strong {
  margin-top: 10px;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.mini-stat span {
  color: var(--text-soft);
}

.form-section {
  display: grid;
  gap: 18px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.switch {
  position: relative;
  width: 56px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}

.switch[aria-pressed="true"] {
  background: var(--primary);
}

.switch[aria-pressed="true"]::after {
  transform: translateX(24px);
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .dual-grid,
  .triple-grid,
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid > :first-child,
  .content-grid > :last-child {
    grid-column: span 2;
  }
}

@media (max-width: 980px) {
  body.login-body {
    overflow: auto;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 360px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 30;
  }

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

  .app-main {
    padding: 18px 18px 30px;
  }

  .topbar {
    padding: 12px;
  }

  .search {
    min-width: 0;
    width: 100%;
  }
}

@media (min-width: 981px) {
  .sidebar-toggle,
  .mobile-overlay {
    display: none;
  }
}

@media (max-width: 720px) {
  .hero-grid,
  .kpi-grid,
  .dual-grid,
  .triple-grid,
  .metric-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .content-grid > :first-child,
  .content-grid > :last-child {
    grid-column: auto;
  }

  .page-head,
  .form-row,
  .topbar,
  .topbar-left,
  .topbar-right,
  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .user-trigger {
    justify-content: space-between;
  }

  .login-card {
    padding: 28px 22px;
  }

  .login-panel {
    padding: 32px 24px;
  }

  th,
  td,
  .card-header,
  .card-body,
  .card-footer,
  .kpi-card {
    padding-left: 16px;
    padding-right: 16px;
  }
}
