:root {
  --ink: #202123;
  --muted: #6b6b70;
  --subtle: #9b9ba1;
  --paper: #f7f7f8;
  --card: #ffffff;
  --line: #e4e4e7;
  --line-light: #f0f0f1;
  --accent: #202123;
  --accent-strong: #0d0d0d;
  --accent-soft: #ececee;
  --sidebar: #f7f7f8;
  --sidebar-line: #e4e4e7;
  
  --zinc-950: #09090b;
  --zinc-900: #18181b;
  --zinc-800: #27272a;
  --zinc-700: #3f3f46;
  --zinc-600: #52525b;
  --zinc-500: #71717a;
  --zinc-400: #a1a1aa;
  --zinc-300: #d4d4d8;
  --zinc-200: #e4e4e7;
  --zinc-100: #f4f4f5;
  --zinc-50: #fafafa;
  
  --mint-badge-bg: #f1f1f2;
  --mint-badge-text: #3f3f46;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-bg: #fef2f2;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.035), 0 6px 20px rgba(0, 0, 0, 0.025);
  --shadow-md: 0 12px 32px -10px rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 24px 54px -14px rgba(0, 0, 0, 0.2);
  --shadow-glass: 0 20px 48px rgba(0, 0, 0, 0.12);
  
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Import previews keep business data and corrective actions together. */
.import-toolbar { display: flex; align-items: end; gap: 20px; padding: 0 24px 20px; }
.import-toolbar label { display: grid; gap: 8px; flex: 1; max-width: 520px; font-size: 13px; }
.import-toolbar input { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 11px 12px; color: var(--ink); min-width: 0; }
.import-empty { padding: 24px; color: var(--muted); }
.import-tour-picker { display: grid; gap: 14px; grid-column: 1 / -1; }
.import-tour-picker .hint { margin: 0; }
#detail-dialog.import-dialog { width: min(1320px, calc(100vw - 32px)); max-width: none; }
.import-dialog .dialog-card { width: 100%; max-width: none; }
.import-dialog .detail-grid { display: block; }
.import-overview { min-width: 0; }
.import-tour-summary { max-width: 340px; white-space: normal; overflow-wrap: anywhere; }
.import-overview .import-tour-summary { max-width: none; }
.import-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 12px; }
.import-counts > div { display: grid; gap: 8px; background: var(--paper); padding: 16px; border-radius: 8px; }
.import-counts span { font-size: 13px; color: var(--muted); }
.import-counts strong { font-size: 26px; }
.import-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.import-dialog .import-preview-head label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.import-dialog .import-preview-head input { width: auto; }
.import-travelers { margin-top: 8px; font-size: 13px; }
.import-travelers summary { cursor: pointer; }
.import-preview-table { min-width: 880px; }
.import-preview-table td { vertical-align: top; white-space: normal; min-width: 90px; max-width: 300px; overflow-wrap: anywhere; }
.import-preview-table .hint { margin: 6px 0 0; }
.import-payment-details { min-width: 210px; margin: 12px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }
.import-payment-details > div { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 4px; margin: 4px 0; }
.import-payment-details dt, .import-payment-details dd { margin: 0; }
.import-payment-details dt { color: var(--muted); white-space: nowrap; }
.import-payment-details dd { min-width: 0; overflow-wrap: anywhere; }
.import-payment-details > div:nth-child(2) dd { white-space: nowrap; }
.import-registration-remark { margin: 12px 0 0; white-space: pre-wrap; }
.import-issue-list, .import-sheet-list { padding-left: 18px; line-height: 1.7; }
.import-issue-list { font-size: 13px; }
.import-warning { padding: 14px 18px; margin: 16px 0; background: #fff8e6; border: 1px solid #e9d9a5; border-radius: 8px; color: #69501a; }
#import-confirm-dialog { width: min(560px, calc(100vw - 32px)); }
.import-confirm-summary { white-space: pre-line; overflow-wrap: anywhere; padding: 16px; border-radius: 8px; background: var(--paper); line-height: 1.8; }
@media (max-width: 640px) {
  .import-toolbar { align-items: stretch; flex-direction: column; }
  .import-counts { grid-template-columns: repeat(2, 1fr); }
  .import-preview-head { align-items: start; flex-direction: column; }
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(9, 9, 11, 0.2) transparent;
}

/* ==================== CUSTOM SCROLLBARS ==================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(9, 9, 11, 0.15);
  border-radius: 99px;
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(9, 9, 11, 0.35);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 78% -10%, rgba(0, 0, 0, 0.025), transparent 30%),
    var(--paper);
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(32, 33, 35, 0.14);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* Typography & Badges */
.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--zinc-600);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 16px 6px 16px 6px;
  background: var(--zinc-950);
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 32px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-mark:hover {
  transform: scale(1.05) rotate(-2deg);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 10px 4px 10px 4px;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==================== LOGIN SCREEN ==================== */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(440px, 1.25fr) minmax(420px, 0.75fr);
  background: #f4f4f5;
}

.login-brand {
  padding: 8vw 7vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--zinc-950);
  position: relative;
  overflow: hidden;
  background: 
    radial-gradient(circle at 10% 20%, rgba(0, 0, 0, 0.03), transparent 35%),
    linear-gradient(145deg, #ffffff 0%, #f4f4f5 100%);
  border-right: 1px solid var(--line);
}

.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(1px 1px at 24px 24px, rgba(9, 9, 11, 0.04), transparent);
  background-size: 32px 32px;
  pointer-events: none;
}

.login-brand .eyebrow {
  margin-top: 36px;
  color: var(--zinc-500);
  letter-spacing: 0.22em;
}

.login-brand h1 {
  max-width: 640px;
  margin: 12px 0 22px;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(38px, 4.8vw, 68px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--zinc-950);
}

.login-brand > p:not(.eyebrow) {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 520px;
}

.brand-stat {
  margin-top: 60px;
  padding: 20px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 440px;
  box-shadow: var(--shadow-sm);
}

.brand-stat strong {
  color: var(--zinc-950);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.login-panel {
  display: grid;
  place-items: center;
  padding: 48px;
  background: var(--paper);
}

.login-card {
  width: min(420px, 100%);
  padding: 48px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px 36px 16px 36px;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  margin: 0 0 32px;
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--zinc-950);
}

.login-card label, .dialog-card label {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--zinc-700);
}

.login-card input, .dialog-card input, .dialog-card textarea, .dialog-card select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.login-card input:focus, .dialog-card input:focus, .dialog-card textarea:focus, .dialog-card select:focus {
  border-color: var(--zinc-950);
  box-shadow: 0 0 0 3.5px rgba(9, 9, 11, 0.08);
}

.login-card .primary {
  width: 100%;
  margin-top: 16px;
  padding: 15px;
  font-size: 15px;
}

.hint {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 22px 0 0;
  text-align: center;
}

/* ==================== BUTTONS ==================== */
button.primary, button.secondary, .danger-button {
  border: 0;
  border-radius: 10px;
  padding: 11px 20px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button.primary {
  background: var(--zinc-950);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(9, 9, 11, 0.15);
}

button.primary:hover {
  background: var(--zinc-800);
  box-shadow: 0 4px 14px rgba(9, 9, 11, 0.22);
  transform: translateY(-1px);
}

button.primary:active {
  transform: translateY(0) scale(0.98);
}

button.secondary {
  background: #ffffff;
  color: var(--zinc-900);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: var(--zinc-100);
  border-color: var(--zinc-300);
  color: var(--zinc-950);
}

button.secondary:active {
  transform: scale(0.98);
}

.danger-button {
  background: var(--danger);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.danger-button:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.text-button {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--zinc-900);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  transition: color 0.2s ease;
}

.text-button:hover {
  color: var(--muted);
}

.icon-button {
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background: var(--zinc-100);
  color: var(--ink);
}

/* ==================== APP LAYOUT & SIDEBAR ==================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  background: #ffffff;
  color: var(--zinc-950);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  z-index: 30;
}

.logo {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 4px 8px 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.logo div {
  display: grid;
}

.logo b {
  font-family: 'Outfit', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--zinc-950);
}

.logo small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar nav {
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding-right: 4px;
}

.nav-group {
  margin: 20px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--subtle);
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--zinc-700);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
  background: var(--zinc-100);
  color: var(--zinc-950);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--zinc-100);
  color: var(--zinc-950);
  font-weight: 600;
  box-shadow: inset 3.5px 0 var(--zinc-950);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 15px;
  opacity: 0.75;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 12px 4px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

#user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--zinc-950);
}

#user-role {
  color: var(--muted);
  font-size: 12px;
}

/* ==================== WORKSPACE & TOPBAR ==================== */
.workspace {
  min-width: 0;
}

.topbar {
  height: 88px;
  padding: 18px 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--zinc-950);
  margin: 0;
  letter-spacing: -0.01em;
}

.topbar .eyebrow {
  margin-bottom: 2px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.env-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--zinc-950);
  box-shadow: 0 0 0 4px rgba(9, 9, 11, 0.12);
  animation: pulse-env 2s infinite ease-in-out;
}

@keyframes pulse-env {
  0%, 100% { box-shadow: 0 0 0 4px rgba(9, 9, 11, 0.12); }
  50% { box-shadow: 0 0 0 8px rgba(9, 9, 11, 0.03); }
}

.topbar #menu {
  display: none;
}

.content {
  padding: 32px 36px 64px;
  max-width: 1600px;
  margin: auto;
}

/* ==================== DASHBOARD & METRICS ==================== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.metric {
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--zinc-950);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--zinc-300);
}

.metric:hover::after {
  opacity: 1;
}

.metric span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 32px;
  color: var(--zinc-950);
  font-variant-numeric: tabular-nums;
}

/* ==================== PANELS & TABLES ==================== */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-head {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.panel-head h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--zinc-950);
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease;
}

.search:focus {
  border-color: var(--zinc-950);
  box-shadow: 0 0 0 3px rgba(9, 9, 11, 0.08);
}

.table-wrap {
  overflow-x: auto;
  min-height: 360px;
}

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

th {
  position: sticky;
  top: 0;
  background: var(--zinc-100);
  color: var(--zinc-700);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  user-select: none;
  z-index: 2;
}

th, td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-light);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--zinc-50);
}

.detail-row {
  cursor: pointer;
}

td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  background: var(--zinc-100);
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--zinc-800);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--zinc-100);
  color: var(--zinc-900);
  border: 1px solid var(--zinc-200);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.muted {
  color: var(--subtle);
}

.masked {
  color: var(--subtle);
  font-style: italic;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

.empty strong {
  display: block;
  color: var(--zinc-950);
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line-light);
  background: #ffffff;
}

.pager button {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 600;
  color: var(--zinc-800);
  transition: all 0.2s ease;
}

.pager button:hover:not(:disabled) {
  background: var(--zinc-100);
  border-color: var(--zinc-300);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
  position: fixed;
  right: 28px;
  top: 24px;
  z-index: 100;
  max-width: 440px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--zinc-950);
  color: #ffffff;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-glass);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-16px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.toast.error {
  background: #dc2626;
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==================== DIALOGS & MODALS ==================== */
dialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  background: #ffffff;
}

dialog::backdrop {
  background: rgba(9, 9, 11, 0.4);
  backdrop-filter: blur(6px);
}

.dialog-card {
  padding: 32px;
  overflow-y: auto;
  max-height: calc(100vh - 40px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-light);
}

.dialog-head h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--zinc-950);
}

.dialog-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.form-grid label.wide, .form-grid .checkbox-field {
  grid-column: 1 / -1;
}

.dialog-card label small {
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

.checkbox-field {
  display: flex !important;
  grid-template-columns: auto 1fr !important;
  align-items: center;
  gap: 10px !important;
  margin: 8px 0;
}

.checkbox-field input {
  width: 18px !important;
  height: 18px;
  accent-color: var(--zinc-950);
  cursor: pointer;
}

.form-error {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--danger-bg);
  border: 1px solid #fca5a5;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
}

.detail-item {
  padding: 16px;
  background: var(--card);
  min-width: 0;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.detail-item strong {
  display: block;
  font-size: 14px;
  color: var(--zinc-950);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-item code {
  white-space: pre-wrap;
  font-size: 11px;
  background: var(--zinc-100);
  padding: 4px 8px;
  border-radius: 6px;
  display: block;
}

.tag-list {
  padding: 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line-light);
  flex-wrap: wrap;
}

/* ==================== SKELETON LOADERS ==================== */
.skeleton {
  height: 16px;
  margin: 18px 24px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f4f4f5 0%, #ffffff 50%, #f4f4f5 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite ease-in-out;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ==================== OPERATIONS CONSOLE REFRESH ==================== */
button svg,
.text-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

button.primary {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

button.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
}

button.secondary {
  border-color: var(--line);
  color: #3f3f46;
}

button.secondary:hover {
  border-color: #d4d4d8;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  font-size: inherit;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.brand-mark {
  border-radius: 17px;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.brand-mark.small {
  border-radius: 11px;
  box-shadow: none;
}

.login-shell {
  background: var(--paper);
}

.login-brand {
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 0, 0, 0.04), transparent 34%),
    linear-gradient(145deg, #ffffff 0%, #f2f2f3 100%);
  border-color: var(--line);
}

.login-card {
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}

.login-card input:focus,
.dialog-card input:focus,
.dialog-card textarea:focus,
.dialog-card select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(32, 33, 35, 0.1);
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 14px;
  border-right: 1px solid var(--sidebar-line);
  background: var(--sidebar);
  color: #202123;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.025);
}

.logo {
  margin-bottom: 10px;
  padding: 2px 8px 20px;
  border-color: var(--sidebar-line);
}

.sidebar .brand-mark {
  background: #202123;
  color: #ffffff;
}

.logo b,
#user-name {
  color: #202123;
}

.logo small,
#user-role {
  color: #71717a;
}

.sidebar nav {
  gap: 2px;
  padding-right: 2px;
  scrollbar-color: rgba(39, 39, 42, 0.18) transparent;
}

.nav-group {
  margin: 18px 10px 6px;
  color: #a1a1aa;
  font-size: 10px;
  letter-spacing: 0.14em;
}

.nav-item {
  gap: 11px;
  min-height: 40px;
  padding: 9px 11px;
  color: #52525b;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
}

.nav-item:hover {
  transform: none;
  background: #ececee;
  color: #18181b;
}

.nav-item.active {
  background: #e7e7e9;
  border-color: #dedee1;
  color: #18181b;
  box-shadow: none;
}

.nav-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  opacity: 0.72;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
}

.nav-item.active .nav-icon {
  color: #202123;
  opacity: 1;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot {
  border-color: var(--sidebar-line);
  padding: 16px 10px 2px;
}

.sidebar .text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #71717a;
}

.sidebar .text-button:hover {
  color: #18181b;
}

.workspace {
  background: transparent;
}

.topbar {
  height: 78px;
  padding: 14px 32px;
  border-color: rgba(228, 228, 231, 0.86);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(140%);
}

.topbar h1 {
  color: var(--ink);
  font-size: 23px;
}

.topbar .eyebrow {
  color: #71717a;
}

.top-actions {
  gap: 9px;
}

.top-actions button {
  padding: 9px 13px;
}

.env-dot {
  background: #71717a;
  box-shadow: 0 0 0 4px rgba(113, 113, 122, 0.12);
}

@keyframes pulse-env {
  0%, 100% { box-shadow: 0 0 0 4px rgba(113, 113, 122, 0.12); }
  50% { box-shadow: 0 0 0 7px rgba(113, 113, 122, 0.035); }
}

.content {
  max-width: 1720px;
  padding: 28px 32px 56px;
}

.panel,
.metric {
  border-color: var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  min-height: 78px;
  padding: 18px 22px;
  border-color: var(--line-light);
}

.panel-head h2 {
  color: var(--ink);
  font-size: 19px;
}

.metric::after {
  background: var(--accent);
}

.metric strong {
  color: var(--ink);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 238px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #8b8b91;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(32, 33, 35, 0.08);
  color: var(--accent);
}

.search-field > svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-field .search {
  min-width: 0;
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.search-field .search:focus {
  box-shadow: none;
}

th {
  background: #f4f4f5;
  color: #52525b;
  letter-spacing: 0.015em;
}

tbody tr:hover {
  background: #fafafa;
}

.status {
  border-color: #dcdce0;
  background: var(--accent-soft);
  color: #3f3f46;
}

.pager button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pager button svg {
  width: 14px;
  height: 14px;
}

.empty {
  gap: 14px;
}

.empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto;
  place-items: center;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon svg {
  width: 23px;
  height: 23px;
}

.empty-icon.error-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

dialog {
  border-color: var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(24, 24, 27, 0.42);
}

.checkbox-field input {
  accent-color: var(--accent);
}

.skeleton {
  background: linear-gradient(90deg, #ededee 0%, #fafafa 50%, #ededee 100%);
  background-size: 200% 100%;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-brand {
    display: none;
  }
  .login-panel {
    min-height: 100vh;
    padding: 24px 16px;
  }
  .login-card {
    padding: 36px 24px;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 40;
    width: 270px;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  }
  .app-shell.menu-open .sidebar {
    transform: translateX(0);
  }
  .topbar {
    padding: 16px 20px;
    height: 76px;
  }
  .topbar #menu {
    display: block;
  }
  .top-actions span:not(.env-dot) {
    display: none;
  }
  #change-password {
    display: none;
  }
  .content {
    padding: 20px 16px 50px;
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .search {
    min-width: 0;
    width: 140px;
  }
  .search-field {
    min-width: 0;
    width: min(100%, 220px);
  }
  .panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .panel-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .form-grid, .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-grid label.wide, .form-grid .checkbox-field {
    grid-column: auto;
  }
  dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }
  .dialog-card {
    padding: 20px;
  }
}
