:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4f8;
  --ink: #17212b;
  --muted: #667381;
  --line: #dbe4ec;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --mint: #ccfbf1;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.08), transparent 32%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  outline-color: var(--teal);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.brand,
.nav-item,
.topbar,
.top-actions,
.section-heading,
.person-cell,
.table-actions,
.form-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span,
.person-cell strong,
.person-cell small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.sidebar-panel p,
.nav-item {
  color: #b8c5d4;
}

.eyebrow,
.metric-label,
.panel-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 20px;
  background: #111c26;
  color: #eff6ff;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.nav-list {
  display: grid;
  gap: 6px;
}

.language-switcher {
  display: grid;
  gap: 8px;
}

.language-switcher span {
  color: #9ee7dd;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.language-switcher select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #eff6ff;
  font-weight: 800;
}

.language-switcher option {
  color: var(--ink);
}

.auth-language-switcher {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.auth-language-switcher span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.auth-language-switcher select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.nav-item {
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.logout-item {
  margin-top: 8px;
  background: rgba(190, 18, 60, 0.14);
  color: #fecdd3;
}

.nav-item.logout-item:hover {
  background: rgba(190, 18, 60, 0.22);
  color: #fff;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #9ee7dd;
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-panel .panel-label {
  color: #9ee7dd;
}

.sidebar-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.sidebar-panel p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.main-content {
  min-width: 0;
  min-height: 100vh;
  padding: 28px;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  min-height: 84px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  max-width: min(720px, 100%);
}

.search-box {
  position: relative;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search-box input {
  width: min(330px, 32vw);
  max-width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.primary-button,
.secondary-button,
.icon-button,
.text-button,
.danger-button,
.button-link {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  min-height: 48px;
  padding: 0 18px;
  background: var(--teal);
  color: #fff;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
}

.secondary-button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-button {
  width: 44px;
  height: 44px;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--teal-dark);
}

.text-button.danger,
.danger-button {
  background: var(--rose-soft);
  color: var(--rose);
}

.danger-button {
  min-height: 44px;
  padding: 0 16px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card,
.section-block,
.profile-card,
.form-card-wide,
.form-helper-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.metric-card,
.section-block,
.profile-card,
.form-card-wide,
.form-helper-card {
  padding: 20px;
}

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 32px;
}

.metric-card small,
.person-cell small {
  color: var(--muted);
  font-weight: 600;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.section-heading.tight {
  margin-bottom: 16px;
}

.segmented-control {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.segmented-control span {
  padding: 8px 12px;
  border-radius: 6px;
}

.segmented-control .selected {
  background: var(--surface);
  color: var(--teal-dark);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.person-cell {
  gap: 10px;
}

.person-cell span,
.user-chip > span:first-child,
.employee-avatar {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--teal-dark);
  font-weight: 800;
}

.person-cell span {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

code {
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-family: "Inter", Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.table-actions {
  gap: 8px;
  white-space: nowrap;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.success,
.online {
  background: var(--mint);
  color: var(--teal-dark);
}

.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.exit {
  background: var(--rose-soft);
  color: var(--rose);
}

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

.form-field span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
}

.form-field input,
.form-field select {
  height: 48px;
  padding: 0 14px;
}

.form-field textarea {
  min-height: 116px;
  padding: 12px 14px;
  resize: vertical;
}

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

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

.form-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

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

.form-helper-card h2 {
  margin-bottom: 12px;
}

.form-helper-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.form-helper-card pre {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 16px 0 0;
  padding: 16px;
  border-radius: 8px;
  background: #111c26;
  color: #eff6ff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: normal;
}

.section-divider {
  height: 1px;
  margin: 8px 0;
  background: var(--line);
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

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

.filter-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}

.form-actions {
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.split-actions {
  justify-content: space-between;
}

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

.content-column,
.insights-column,
.side-column {
  display: grid;
  gap: 20px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px 0 6px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.user-chip > span:first-child {
  width: 32px;
  height: 32px;
}

.is-hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 40px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111c26;
  color: #eff6ff;
  box-shadow: var(--shadow);
  font-weight: 700;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px 12px;
    align-items: center;
  }

  .brand div:last-child,
  .nav-item:not(.active),
  .nav-item.active,
  .nav-item.logout-item,
  .sidebar-panel {
    font-size: 0;
  }

  .nav-item {
    justify-content: center;
    width: 52px;
    padding: 0;
  }

  .nav-icon {
    font-size: 17px;
  }

  .sidebar-panel {
    display: none;
  }

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

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-direction: row;
    justify-content: space-between;
    min-height: auto;
    height: auto;
    padding: 12px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .main-content {
    padding: 18px;
  }

  .topbar,
  .top-actions,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box input {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel,
  .filter-panel.compact {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    align-items: stretch;
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 30px;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .split-actions,
  .split-actions div {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-card,
  .section-block,
  .profile-card,
  .form-card-wide,
  .form-helper-card {
    padding: 14px;
  }
}
