:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #17202e;
  --muted: #677487;
  --line: #dbe2ea;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #9a3412;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 10px 25px rgba(20, 31, 48, 0.08);
}

.single-column-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
}

.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.channel-detail-view .panel,
.billing-pool-detail-view .panel {
  max-width: 1280px;
}

.channel-detail-view .form-grid,
.billing-pool-detail-view .form-grid {
  align-items: start;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button:disabled:hover {
  color: #fff;
  background: var(--primary);
}

button.secondary {
  color: var(--primary);
  border: 1px solid var(--primary);
  background: #fff;
}

button.secondary:hover {
  color: #fff;
  background: var(--primary);
}

button.secondary:disabled:hover {
  color: var(--primary);
  background: #fff;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #8f1d13;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

.required-mark {
  margin-left: 3px;
  color: var(--danger);
  font-weight: 700;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.confirm-modal {
  width: min(720px, 100%);
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.confirm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.confirm-head h3 {
  margin: 0;
  font-size: 18px;
}

.confirm-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.confirm-details {
  display: grid;
  gap: 8px;
  padding: 16px 22px;
  max-height: 52vh;
  overflow: auto;
}

.confirm-detail-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.confirm-detail-item span {
  color: var(--muted);
  font-size: 12px;
}

.confirm-detail-item strong {
  min-width: 0;
  font-size: 13px;
  word-break: break-word;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 22px;
}

.image-preview-modal {
  width: min(920px, 100%);
  max-height: min(90vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.image-preview-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  min-height: 0;
  padding: 18px 22px 22px;
  overflow: auto;
}

.image-preview-canvas {
  display: grid;
  min-height: 360px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: auto;
}

.image-preview-canvas img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.image-preview-meta {
  align-content: start;
  max-height: none;
  padding: 0;
  overflow: visible;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  background:
    linear-gradient(90deg, #12343b 0%, #12343b 44%, #f5f7fb 44%, #f5f7fb 100%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: center;
  padding: 64px;
  color: #e7eef3;
}

.login-brand .brand-mark {
  width: 54px;
  height: 54px;
  font-size: 18px;
}

.login-brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.18;
}

.login-brand p {
  margin: 8px 0 0;
  color: #b7c7cf;
}

.login-card {
  align-self: center;
  width: min(420px, calc(100% - 48px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card-head {
  margin-bottom: 22px;
}

.login-card-head h2 {
  margin: 0;
  font-size: 24px;
}

.login-card-head span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-self-service-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.self-service-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 23, 31, 0.46);
}

.self-service-dialog.hidden {
  display: none;
}

.self-service-card {
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.language-switcher label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.language-switcher select {
  width: auto;
  min-width: 108px;
  min-height: 32px;
  padding: 6px 28px 6px 9px;
  border-radius: 6px;
  font-size: 12px;
}

.language-switcher-login {
  margin-top: 12px;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 46px;
}

.login-card .password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 34px;
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 15px;
  transform: translateY(-50%);
}

.login-card .password-toggle:hover,
.login-card .password-toggle.active {
  color: var(--primary);
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(15, 118, 110, 0.08);
}

.login-card button {
  width: 100%;
  margin-top: 6px;
}

.login-message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
  font-size: 13px;
}

.slider-captcha {
  display: grid;
  gap: 8px;
  margin: 6px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.slider-captcha-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .slider-refresh {
  width: auto;
  min-height: 28px;
  margin: 0;
  padding: 0 10px;
  color: var(--primary);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}

.login-card .slider-refresh:hover {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.slider-track {
  position: relative;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef4f8;
  user-select: none;
  touch-action: none;
}

.slider-target {
  position: absolute;
  top: 5px;
  width: 38px;
  height: 30px;
  border: 2px dashed rgba(15, 118, 110, 0.8);
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.1);
  transform: translateX(-50%);
}

.slider-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(15, 118, 110, 0.16);
}

.login-card .slider-handle {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 36px;
  min-height: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(15, 118, 110, 0.24);
  cursor: grab;
  z-index: 2;
}

.login-card .slider-handle::before {
  content: "→";
  font-weight: 700;
}

.login-card .slider-handle:active {
  cursor: grabbing;
}

.slider-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-left: 44px;
  padding-right: 10px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.slider-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.slider-captcha[data-state="ready"] .slider-status {
  color: var(--muted);
}

.slider-captcha[data-state="success"] {
  border-color: rgba(6, 118, 71, 0.5);
  background: rgba(6, 118, 71, 0.07);
}

.slider-captcha[data-state="success"] .slider-status,
.slider-captcha[data-state="success"] .slider-text {
  color: var(--ok);
}

.slider-captcha[data-state="success"] .slider-target {
  border-color: rgba(6, 118, 71, 0.9);
  background: rgba(6, 118, 71, 0.13);
}

.slider-captcha[data-state="error"] {
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.05);
}

.slider-captcha[data-state="error"] .slider-status {
  color: var(--danger);
}

.portal-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(18, 52, 59, 0.98), rgba(15, 118, 110, 0.9)),
    #12343b;
}

.portal-shell {
  width: min(1160px, 100%);
  color: #e7eef3;
}

.portal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.portal-head .language-switcher {
  margin-left: auto;
  padding: 8px 10px;
  border: 1px solid rgba(231, 238, 243, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.portal-head .language-switcher label {
  color: #d7e5ea;
}

.portal-head p {
  margin: 0 0 6px;
  color: #b7c7cf;
  font-size: 14px;
}

.portal-head h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

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

.portal-card {
  min-height: 214px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: space-between;
  border: 1px solid rgba(231, 238, 243, 0.18);
  border-radius: 8px;
  padding: 26px;
  color: #17202e;
  text-decoration: none;
  background: #fff;
  box-shadow: 0 20px 50px rgba(6, 18, 26, 0.24);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.portal-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.58);
  box-shadow: 0 26px 62px rgba(6, 18, 26, 0.32);
}

.portal-card-admin {
  background: #f7fbfb;
}

.portal-card-quota {
  background: #f8fbff;
}

.portal-card-security {
  background: #fff8f1;
}

.portal-card-security .portal-kicker {
  border-color: rgba(180, 83, 9, 0.28);
  color: #92400e;
  background: rgba(180, 83, 9, 0.1);
}

.portal-card-security .portal-action {
  background: #b45309;
}

.portal-card-security:hover .portal-action {
  background: #92400e;
}

.portal-kicker {
  width: fit-content;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--primary-dark);
  background: rgba(15, 118, 110, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.portal-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
}

.portal-card small {
  display: block;
  min-height: 48px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.portal-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.portal-card:hover .portal-action {
  background: var(--primary-dark);
}

.portal-foot {
  margin-top: 20px;
  color: #c8d6dc;
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: #e7eef3;
  background: #12343b;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #12343b;
  background: #99f6e4;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
}

.brand p {
  margin: 4px 0 0;
  color: #b7c7cf;
  font-size: 13px;
}

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

.nav-item,
.employee-nav-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  text-align: left;
  color: #d9e7eb;
  background: transparent;
}

.nav-item:hover,
.nav-item.active,
.employee-nav-item:hover,
.employee-nav-item.active {
  background: rgba(153, 246, 228, 0.16);
}

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

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

.topbar h2 {
  margin: 0;
  font-size: 26px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.userbar {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px 8px 12px;
  background: #fff;
}

.userbar .language-switcher {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.userbar span,
.userbar small {
  display: block;
}

.userbar span {
  font-weight: 700;
}

.userbar small {
  margin-top: 2px;
  color: var(--muted);
}

.form-grid label {
  color: var(--muted);
  font-size: 13px;
}

.view {
  display: none;
}

.view.active,
.employee-view.active {
  display: block;
}

.employee-view {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric .label {
  color: var(--muted);
  font-size: 13px;
}

.metric .value {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 750;
}

.profile-panel {
  margin-bottom: 18px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px 18px;
}

.profile-item {
  min-width: 0;
}

.profile-item .label {
  color: var(--muted);
  font-size: 12px;
}

.profile-item .value {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 650;
  word-break: break-word;
}

.profile-item-wide {
  grid-column: span 2;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.inline-form select {
  min-width: 190px;
}

.profile-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.security-foreign-policy {
  margin: 16px 18px 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.section-subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-subhead h4 {
  margin: 0;
  font-size: 15px;
}

.section-subhead span,
.security-foreign-policy small {
  color: var(--muted);
  line-height: 1.5;
}

.security-foreign-policy .detail-summary {
  margin-bottom: 12px;
}

.review-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 18px 16px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.review-context-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}

.review-context-title strong {
  font-size: 14px;
  color: #1d4ed8;
}

.review-context-title span {
  color: var(--muted);
  font-size: 12px;
}

.review-context-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.review-context-item .label {
  color: var(--muted);
  font-size: 12px;
}

.review-context-item .value {
  margin-top: 5px;
  font-size: 16px;
  font-weight: 750;
  word-break: break-word;
}

.review-context-item.warning .value {
  color: var(--danger);
}

.review-context-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 18px;
}

.view > .two-column + .two-column {
  margin-top: 18px;
}

.split-table {
  border-top: 1px solid var(--line);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 17px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.list-toolbar,
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.list-toolbar strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 14px;
}

.list-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.list-toolbar select {
  width: auto;
  min-width: 92px;
}

.pagination-bar {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.pagination-bar span {
  min-width: 96px;
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.form-grid label small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.form-grid.compact {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.usage-filter-panel {
  margin-bottom: 18px;
}

.usage-filters {
  padding-bottom: 12px;
}

.usage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.quick-actions,
.usage-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.toggle-line input {
  width: auto;
}

.usage-metrics {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.consumption-cards {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.consumption-card {
  min-height: 138px;
  box-shadow: none;
}

.consumption-card.blue {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.consumption-card.green {
  border-color: #99f6e4;
  background: #ecfdf5;
}

.consumption-card.violet {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.consumption-card.amber {
  border-color: #fde68a;
  background: #fffbeb;
}

.consumption-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.consumption-card-head strong {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 4px 9px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.consumption-value {
  margin-top: 12px;
  color: #0f766e;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
}

.consumption-card.blue .consumption-value {
  color: #2563eb;
}

.consumption-card.violet .consumption-value {
  color: #7c3aed;
}

.consumption-card.amber .consumption-value {
  color: #d97706;
}

.consumption-hint,
.consumption-subline {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
}

.consumption-subline {
  margin-top: 5px;
}

.employee-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.department-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.department-dashboard-head h3 {
  margin: 0;
  font-size: 18px;
}

.department-dashboard-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.employee-chart-panel {
  min-height: 360px;
}

.employee-chart-panel-wide {
  min-width: 0;
}

.panel-head > div {
  min-width: 0;
}

.compact-select {
  width: auto;
  min-width: 140px;
}

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f8fafc;
}

.segmented-control button {
  min-height: 32px;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.segmented-control button.active {
  color: #fff;
  background: var(--primary);
}

.bar-chart {
  display: grid;
  grid-template-columns: 70px 1fr;
  min-height: 292px;
  padding: 20px 22px 18px;
}

.bar-chart-scale {
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  align-items: start;
  padding-right: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.bar-chart-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10px, 1fr));
  align-items: end;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to bottom, #e8eef5 1px, transparent 1px) 0 0 / 100% 33.33%;
}

.bar-item {
  display: grid;
  grid-template-rows: 1fr 24px;
  align-items: end;
  min-width: 10px;
  height: 250px;
}

.bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.bar-fill {
  width: min(24px, 70%);
  border-radius: 7px 7px 0 0;
  background: #14a391;
  box-shadow: 0 8px 18px rgba(20, 163, 145, 0.18);
}

.bar-item span {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.muted-label {
  color: transparent;
}

.chart-empty {
  grid-column: 1 / -1;
  align-self: center;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  align-items: center;
  gap: 22px;
  padding: 28px 24px 26px;
}

.donut-chart {
  position: relative;
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  border-radius: 50%;
}

.donut-chart::after {
  position: absolute;
  content: "";
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut-center {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  text-align: center;
}

.donut-center strong {
  font-size: 28px;
  line-height: 1;
}

.donut-center span {
  color: var(--muted);
  font-size: 12px;
}

.donut-legend {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.donut-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 52px 78px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.donut-legend-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.metric.cost {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.metric.cost .value {
  color: #047857;
}

.metric.saving {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.metric.saving .value {
  color: #1d4ed8;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.hint {
  grid-column: 1 / -1;
  min-height: 28px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 18px 16px;
}

.key-detail-extra {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.key-detail-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.key-detail-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.mode-banner {
  display: grid;
  gap: 4px;
  margin: 0 18px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
}

.mode-banner strong {
  color: var(--ink);
  font-size: 13px;
}

.mode-banner span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mode-banner.create-mode {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.mode-banner.edit-mode {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.detail-summary-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #f8fafc;
}

.detail-summary-item span,
.detail-summary-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-summary-item span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.detail-summary-item strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.actions {
  display: flex;
  gap: 10px;
  padding: 0 18px 18px;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.table-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.icon-table-button {
  width: 30px;
  padding: 0;
  font-size: 15px;
}

.key-toggle-button {
  min-width: 66px;
}

.key-toggle-button.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.employee-key-cell {
  display: flex;
  min-width: 360px;
  max-width: 560px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.employee-key-value {
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-key-value.revealed {
  color: var(--ink);
}

.employee-key-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.divider {
  height: 1px;
  background: var(--line);
}

.output {
  min-height: 120px;
  max-height: 300px;
  margin: 0 18px 18px;
  overflow: auto;
  border: 1px solid #d7e1e8;
  border-radius: 8px;
  padding: 12px;
  color: #12343b;
  background: #f8fafc;
  white-space: pre-wrap;
}

.compact-output {
  min-height: 74px;
  max-height: 180px;
}

.error-output {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.25);
  background: #fff7f5;
}

.log-filter-panel {
  margin-bottom: 18px;
}

.request-log-panel,
.ledger-panel {
  margin-bottom: 18px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 650;
}

.selectable-row {
  cursor: pointer;
}

.selectable-row:hover td {
  background: #f8fafc;
}

.selected-row td {
  background: #ecfdf5;
}

.selected-row td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

.stacked-cell {
  display: grid;
  gap: 3px;
  min-width: max-content;
}

.stacked-cell strong {
  color: var(--ink);
  font-weight: 650;
}

.stacked-cell small {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-tree-cell {
  display: grid;
  gap: 3px;
  min-width: 280px;
}

.org-tree-cell strong {
  color: var(--ink);
  font-weight: 650;
}

.org-tree-cell small {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.request-log-table td,
.request-log-table th {
  padding-top: 9px;
  padding-bottom: 9px;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef6f3;
  color: var(--ok);
}

.status.blocked,
.status.failed,
.status.over_limit {
  background: #fff1f0;
  color: var(--danger);
}

.docs {
  padding: 18px;
  max-width: 900px;
}

.docs h4 {
  margin: 16px 0 8px;
}

.docs pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.employee-chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 150px);
  min-width: 0;
}

.employee-chat-sidebar,
.employee-chat-main {
  display: flex;
  min-height: 0;
  flex-direction: column;
  min-width: 0;
}

.employee-chat-sidebar {
  padding: 0;
  overflow: hidden;
}

.employee-chat-sidebar .panel-head,
.employee-chat-main .employee-chat-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.employee-chat-workspace-label {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.employee-chat-workspace-label select {
  width: 100%;
}

.employee-chat-meta {
  display: grid;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.employee-chat-meta div {
  display: grid;
  gap: 3px;
}

.employee-chat-meta span,
.employee-chat-message-meta,
.employee-chat-hint,
#employee-chat-hint {
  color: var(--muted);
  font-size: 12px;
}

.employee-chat-meta strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
}

.employee-chat-conversations {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 14px;
  min-width: 0;
}

.employee-chat-conversation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}

.employee-chat-conversation:hover,
.employee-chat-conversation.active {
  border-color: #2563eb;
  background: #eff6ff;
}

.employee-chat-conversation-main {
  display: grid;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 62px;
  justify-items: start;
  border: 0;
  padding: 10px 0 10px 14px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.employee-chat-conversation-main:hover {
  color: inherit;
  background: transparent;
}

.employee-chat-conversation-main strong,
.employee-chat-conversation-main span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-chat-conversation-main span {
  color: var(--muted);
  font-size: 12px;
}

.employee-chat-rename {
  min-height: 30px;
  margin-right: 10px;
  padding: 0 8px;
  font-size: 12px;
}

.employee-chat-main {
  padding: 0;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.employee-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.employee-chat-header h3 {
  margin: 0;
}

.employee-chat-header span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.employee-chat-status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.employee-chat-messages {
  display: flex;
  flex: 1;
  min-height: 360px;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 18px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  min-width: 0;
}

.employee-chat-message {
  display: grid;
  gap: 6px;
  max-width: min(760px, 88%);
  min-width: 0;
}

.employee-chat-message.user {
  align-self: flex-end;
}

.employee-chat-message.assistant {
  align-self: flex-start;
}

.employee-chat-message-role {
  color: var(--muted);
  font-size: 12px;
}

.employee-chat-message.user .employee-chat-message-role {
  text-align: right;
}

.employee-chat-message-content {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: #fff;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  min-width: 0;
}

.employee-chat-message-text {
  white-space: pre-wrap;
  min-width: 0;
}

.employee-chat-message.user .employee-chat-message-content {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.employee-chat-composer {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  min-width: 0;
}

.employee-chat-composer textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
}

.employee-chat-attachments {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.employee-chat-composer.is-dragging {
  border-top-color: #2563eb;
  background: #eff6ff;
}

.employee-chat-main.is-dragging {
  outline: 2px dashed #2563eb;
  outline-offset: -8px;
}

.employee-chat-drop-hint {
  position: absolute;
  inset: 76px 18px 126px;
  z-index: 8;
  display: none;
  place-items: center;
  gap: 6px;
  border: 2px dashed #2563eb;
  border-radius: 10px;
  background: rgba(239, 246, 255, 0.94);
  color: #1d4ed8;
  text-align: center;
  pointer-events: none;
}

.employee-chat-main.is-dragging .employee-chat-drop-hint {
  display: grid;
}

.employee-chat-drop-hint strong {
  font-size: 16px;
}

.employee-chat-drop-hint span {
  max-width: 520px;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.employee-chat-attachment {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
  min-width: 0;
}

.employee-chat-attachment.file {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.employee-chat-file-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.employee-chat-attachment img {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
}

.employee-chat-attachment strong,
.employee-chat-attachment span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-chat-attachment span,
.employee-chat-attachment-hint {
  color: var(--muted);
  font-size: 12px;
}

.employee-chat-message-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 180px));
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.employee-chat-message-images img {
  width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
}

.employee-chat-message-files {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.employee-chat-message-file {
  display: grid;
  gap: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
}

.employee-chat-message.assistant .employee-chat-message-file {
  border-color: var(--line);
}

.employee-chat-message-file strong,
.employee-chat-message-file span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.employee-chat-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.employee-chat-composer-buttons {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

#employee-chat-voice.active {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
}

.employee-chat-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.employee-chat-empty-large {
  margin: auto;
  max-width: 420px;
}

@media (max-width: 980px) {
  .login-screen {
    grid-template-columns: 1fr;
    background: var(--bg);
  }

  .login-brand {
    align-self: end;
    padding: 28px 24px 0;
    color: var(--ink);
  }

  .login-brand p {
    color: var(--muted);
  }

  .portal-screen {
    align-items: start;
    padding: 22px;
  }

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

  .portal-card {
    min-height: 210px;
  }

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

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .image-preview-body {
    grid-template-columns: 1fr;
  }

  .image-preview-canvas {
    min-height: 260px;
  }

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

  .usage-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .consumption-cards,
  .employee-dashboard-grid,
  .donut-layout {
    grid-template-columns: 1fr;
  }

  .department-dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .bar-chart {
    grid-template-columns: 52px 1fr;
    padding: 16px;
  }

  .donut-chart {
    justify-self: center;
  }

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

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

  .employee-chat-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 12px;
  }

  .employee-chat-sidebar {
    max-height: none;
  }

  .employee-chat-conversations {
    grid-template-columns: 1fr;
    max-height: 240px;
    padding: 12px;
  }

  .userbar {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    background: #eef3f7;
  }

  button {
    min-height: 42px;
    padding: 0 12px;
  }

  input,
  select,
  textarea {
    min-height: 42px;
    font-size: 16px;
  }

  textarea {
    min-height: 118px;
  }

  .employee-chat-layout {
    gap: 12px;
  }

  .employee-chat-conversations {
    grid-template-columns: 1fr;
    max-height: 220px;
    padding: 10px;
  }

  .employee-chat-header,
  .employee-chat-composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-chat-composer-buttons {
    justify-content: stretch;
    width: 100%;
  }

  .employee-chat-composer-buttons button {
    flex: 1 1 100%;
  }

  .employee-chat-drop-hint {
    inset: 72px 12px 178px;
    padding: 16px;
  }

  .employee-chat-attachment {
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
  }

  .employee-chat-attachment button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .employee-chat-status {
    align-self: flex-start;
  }

  .employee-chat-messages {
    min-height: 52svh;
    padding: 14px;
  }

  .employee-chat-message {
    max-width: 96%;
  }

  .employee-chat-message-images {
    grid-template-columns: 1fr;
  }

  .employee-chat-message-images img {
    max-height: 220px;
  }

  .employee-chat-composer textarea {
    min-height: 104px;
  }

  .login-screen {
    min-height: 100svh;
    align-content: start;
    gap: 16px;
    padding: 18px 14px 28px;
  }

  .login-brand {
    align-self: auto;
    padding: 0;
    gap: 10px;
  }

  .login-brand .brand-mark,
  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    flex: 0 0 auto;
  }

  .login-brand h1,
  .brand h1 {
    font-size: 17px;
    line-height: 1.2;
  }

  .login-brand p,
  .brand p {
    font-size: 12px;
  }

  .login-card,
  .portal-card {
    width: 100%;
    border-radius: 8px;
    padding: 18px;
  }

  .login-card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .slider-captcha-head,
  .slider-status {
    font-size: 12px;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    padding: 12px 12px 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  }

  .brand {
    margin-bottom: 10px;
  }

  nav {
    display: flex;
    gap: 8px;
    margin: 0 -12px;
    padding: 0 12px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar,
  .table-wrap::-webkit-scrollbar,
  .table-pagination-frame::-webkit-scrollbar {
    height: 6px;
  }

  nav::-webkit-scrollbar-thumb,
  .table-wrap::-webkit-scrollbar-thumb,
  .table-pagination-frame::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.35);
  }

  .nav-item,
  .employee-nav-item {
    width: auto;
    min-width: max-content;
    min-height: 36px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 13px;
    scroll-snap-align: start;
  }

  .main {
    width: 100%;
    padding: 14px 12px 28px;
  }

  .topbar {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar h2 {
    font-size: 22px;
    line-height: 1.25;
  }

  .topbar p {
    font-size: 13px;
    line-height: 1.45;
  }

  .userbar {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .userbar > div {
    min-width: 0;
  }

  .userbar span,
  .userbar small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .metrics,
  .usage-metrics,
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .metric {
    padding: 14px;
  }

  .metric .value {
    margin-top: 6px;
    font-size: 22px;
  }

  .two-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .view > .two-column + .two-column {
    margin-top: 12px;
  }

  .panel {
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 14px;
  }

  .panel-head h3 {
    font-size: 16px;
    line-height: 1.3;
  }

  .panel-head span {
    font-size: 12px;
    line-height: 1.45;
  }

  .panel-head-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .employee-chat-header {
    gap: 10px;
  }

  .employee-chat-status {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .form-grid,
  .form-grid.compact {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .form-grid label,
  .form-grid label small {
    line-height: 1.45;
  }

  .wide,
  .form-actions.wide,
  .profile-item-wide {
    grid-column: auto !important;
  }

  .actions,
  .form-actions,
  .quick-actions,
  .usage-actions,
  .compact-actions {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .actions button,
  .form-actions button,
  .quick-actions button,
  .usage-actions button,
  .compact-actions button {
    width: 100%;
  }

  .login-self-service-actions {
    grid-template-columns: 1fr;
  }

  .self-service-dialog {
    align-items: stretch;
    padding: 10px;
  }

  .self-service-card {
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .list-toolbar,
  .pagination-bar,
  .usage-toolbar,
  .table-pagination-toolbar,
  .table-pagination-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 11px 14px;
  }

  .list-toolbar label,
  .table-pagination-toolbar label {
    width: 100%;
    justify-content: space-between;
  }

  .list-toolbar select,
  .table-pagination-toolbar select {
    width: min(160px, 52vw);
  }

  .pagination-bar button,
  .table-pagination-bar button {
    width: 100%;
  }

  .pagination-bar span,
  .table-pagination-bar span {
    width: 100%;
    min-width: 0;
  }

  .table-wrap,
  .table-pagination-frame {
    width: 100%;
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  table {
    width: max-content;
    min-width: 100%;
    font-size: 12px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .stacked-cell small,
  .org-tree-cell small {
    max-width: 220px;
  }

  .docs,
  .profile-grid,
  .detail-summary,
  .output,
  .compact-output {
    padding: 14px;
  }

  .output,
  .docs pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .confirm-backdrop {
    align-items: end;
    padding: 10px;
  }

  .confirm-modal,
  .image-preview-modal {
    width: 100%;
    max-height: 92svh;
    border-radius: 10px;
  }

  .confirm-head {
    padding: 16px 16px 12px;
  }

  .confirm-details {
    padding: 12px 16px;
    max-height: 58svh;
  }

  .confirm-detail-item {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 9px 10px;
  }

  .confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px 16px 16px;
  }

  .image-preview-body {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .image-preview-canvas {
    min-height: 220px;
  }

  .bar-chart {
    grid-template-columns: 44px 1fr;
    gap: 8px;
    padding: 12px;
  }

  .donut-chart {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 430px) {
  .main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar {
    padding-left: 10px;
    padding-right: 10px;
  }

  nav {
    margin-left: -10px;
    margin-right: -10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .table-wrap,
  .table-pagination-frame {
    max-width: calc(100vw - 20px);
  }

  .login-screen {
    padding-left: 10px;
    padding-right: 10px;
  }

  .login-card {
    padding: 16px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .metric .value {
    font-size: 20px;
  }

  .panel-head,
  .form-grid,
  .docs,
  .profile-grid,
  .detail-summary,
  .output,
  .compact-output {
    padding-left: 12px;
    padding-right: 12px;
  }

  .employee-chat-attachment,
  .employee-chat-message-content {
    border-radius: 8px;
  }
}

.overview-dashboard-section {
  display: block;
  margin-top: 24px;
}

.overview-merged-head {
  margin-top: 24px;
}
