:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --navy-950: #08111f;
  --navy-900: #0d1829;
  --navy-800: #172338;
  --blue-700: #175cd3;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --slate-950: #111827;
  --slate-700: #344054;
  --slate-600: #475467;
  --slate-500: #667085;
  --slate-400: #98a2b3;
  --slate-300: #d0d5dd;
  --slate-200: #e4e7ec;
  --slate-100: #f2f4f7;
  --slate-50: #f8fafc;
  --white: #fff;
  --green-700: #027a48;
  --green-100: #d1fadf;
  --green-50: #ecfdf3;
  --amber-700: #b54708;
  --amber-100: #fef0c7;
  --amber-50: #fffaeb;
  --red-700: #b42318;
  --red-100: #fee4e2;
  --red-50: #fef3f2;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 40px rgba(16, 24, 40, .15);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: #f5f7fb;
  color: var(--slate-950);
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  background: var(--blue-600);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .3);
}

.brand-mark-large {
  width: 54px;
  height: 54px;
  margin-bottom: 44px;
  border-radius: 16px;
  font-size: 17px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 1.05fr) minmax(440px, .95fr);
  background: var(--white);
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(48px, 7vw, 100px);
  overflow: hidden;
  position: relative;
  background: var(--navy-950);
  color: var(--white);
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
}

.login-brand::before { width: 520px; height: 520px; right: -240px; top: -210px; }
.login-brand::after { width: 330px; height: 330px; right: -40px; bottom: -180px; }

.login-brand h1 {
  max-width: 560px;
  margin: 0 0 24px;
  font-size: clamp(46px, 5vw, 72px);
  line-height: 1.06;
  letter-spacing: -.055em;
}

.login-brand p:last-child {
  max-width: 480px;
  margin: 0;
  color: #aebbcf;
  font-size: 17px;
  line-height: 1.75;
}

.login-brand .eyebrow { color: #79a6ff; }

.login-panel {
  display: grid;
  min-height: 100vh;
  padding: 48px;
  place-items: center;
  background: var(--slate-50);
}

.login-card { width: min(400px, 100%); }
.login-card-heading { margin-bottom: 34px; }
.login-card h2 { margin: 0 0 10px; font-size: 32px; letter-spacing: -.035em; }
.login-card-heading > p:last-child { margin: 0; color: var(--slate-500); line-height: 1.65; }
.mobile-brand { display: none; margin-bottom: 28px; }
.login-card > input { margin-bottom: 16px; }

label {
  display: block;
  margin-bottom: 7px;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 650;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--slate-300);
  border-radius: 9px;
  outline: none;
  background: var(--white);
  color: var(--slate-950);
  padding: 9px 11px;
  transition: border-color .15s, box-shadow .15s;
}

textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: #84adff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .11);
}

.password-field { position: relative; }
.password-field input { padding-right: 58px; }
.text-button {
  position: absolute;
  right: 8px;
  top: 50%;
  border: 0;
  background: transparent;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 700;
  transform: translateY(-50%);
}

.primary-button, .secondary-button, .danger-button {
  min-height: 38px;
  border-radius: 9px;
  padding: 8px 14px;
  font-weight: 700;
  transition: transform .1s, box-shadow .15s, background .15s;
}

.primary-button { border: 1px solid var(--blue-600); background: var(--blue-600); color: var(--white); }
.primary-button:hover { background: #1d4ed8; box-shadow: 0 5px 14px rgba(37, 99, 235, .2); }
.secondary-button { border: 1px solid var(--slate-300); background: var(--white); color: var(--slate-700); }
.secondary-button:hover { background: var(--slate-50); }
.danger-button { border: 1px solid var(--red-700); background: var(--red-700); color: var(--white); }
.login-button { width: 100%; min-height: 46px; margin-top: 18px; }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--red-700); font-size: 13px; }
.login-hint { margin: 22px 0 0; color: var(--slate-400); font-size: 12px; line-height: 1.6; text-align: center; }

.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  background: var(--navy-950);
  color: var(--white);
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 24px; }
.sidebar-brand strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.sidebar-brand span { display: block; margin-top: 2px; color: #7f8da3; font-size: 11px; }
.navigation { flex: 1; overflow-y: auto; }
.nav-group-title { margin: 21px 12px 7px; color: #58677d; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  margin: 3px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #a9b4c5;
  padding: 8px 11px;
  text-align: left;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .055); color: var(--white); }
.nav-item.active { background: #172a4b; color: var(--white); box-shadow: inset 3px 0 0 #4f83ff; }
.nav-icon { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, .06); font-size: 11px; font-weight: 800; }
.nav-item.active .nav-icon { background: var(--blue-600); }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 5px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 17px 7px 0;
}

.sidebar-status strong { display: block; color: #d8dfeb; font-size: 11px; }
.sidebar-status span:last-child { display: block; margin-top: 3px; color: #67758b; font-size: 10px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--amber-700); box-shadow: 0 0 0 4px rgba(181, 71, 8, .16); }
.status-dot.online { background: #12b76a; box-shadow: 0 0 0 4px rgba(18, 183, 106, .14); }
.status-dot.offline { background: #f04438; box-shadow: 0 0 0 4px rgba(240, 68, 56, .14); }

.workspace { min-width: 0; grid-column: 2; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--slate-200);
  background: rgba(255, 255, 255, .95);
  padding: 13px 28px;
  backdrop-filter: blur(12px);
}

.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.topbar p { margin: 3px 0 0; color: var(--slate-500); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.last-updated { color: var(--slate-400); font-size: 11px; }
.avatar-button, .icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-700);
}
.avatar-button { width: 36px; height: 36px; border-radius: 50%; background: var(--navy-900); color: var(--white); font-size: 12px; font-weight: 800; }
.icon-button { width: 34px; height: 34px; border-radius: 9px; font-size: 20px; }
.menu-button { display: none; font-size: 16px; }

.screen { max-width: 1520px; margin: 0 auto; padding: 26px 28px 54px; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-intro h2 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.035em; }
.page-intro p { margin: 0; color: var(--slate-500); line-height: 1.6; }
.page-actions { display: flex; gap: 8px; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card, .panel {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.metric-card { min-height: 128px; padding: 17px; }
.metric-card .metric-label { display: flex; align-items: center; justify-content: space-between; color: var(--slate-500); font-size: 12px; }
.metric-card .metric-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; background: var(--blue-50); color: var(--blue-700); font-size: 11px; font-weight: 800; }
.metric-card strong { display: block; margin: 16px 0 4px; font-size: 29px; letter-spacing: -.045em; }
.metric-card small { color: var(--slate-400); }
.metric-card.attention .metric-icon { background: var(--amber-50); color: var(--amber-700); }
.metric-card.danger .metric-icon { background: var(--red-50); color: var(--red-700); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 16px; }
.panel { min-width: 0; overflow: hidden; }
.panel + .panel { margin-top: 16px; }
.content-grid .panel + .panel { margin-top: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; border-bottom: 1px solid var(--slate-200); padding: 13px 17px; }
.panel-header h3 { margin: 0; font-size: 14px; }
.panel-header p { margin: 3px 0 0; color: var(--slate-500); font-size: 11px; }
.panel-body { padding: 17px; }
.panel-body.flush { padding: 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.search-field { position: relative; width: min(340px, 100%); }
.search-field input { padding-left: 35px; }
.search-field::before { position: absolute; z-index: 1; left: 12px; top: 50%; content: "⌕"; color: var(--slate-400); transform: translateY(-52%); }
.record-count { color: var(--slate-500); font-size: 12px; }

.tabs { display: inline-flex; gap: 3px; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--slate-100); padding: 3px; }
.tab-button { min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--slate-600); padding: 6px 12px; font-size: 12px; font-weight: 700; }
.tab-button.active { background: var(--white); color: var(--slate-950); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }

.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: #fbfcfe; color: var(--slate-500); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
th, td { min-width: 92px; border-bottom: 1px solid var(--slate-200); padding: 11px 13px; text-align: left; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcff; }
td strong { font-weight: 700; }
.cell-main { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { display: block; max-width: 280px; margin-top: 3px; overflow: hidden; color: var(--slate-400); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.cell-time { white-space: nowrap; color: var(--slate-600); }
.cell-actions { display: flex; gap: 6px; }
.table-button { border: 0; background: transparent; color: var(--blue-700); padding: 4px 0; font-size: 11px; font-weight: 750; }
.table-button.danger { color: var(--red-700); }
.empty-cell { height: 150px; color: var(--slate-400); text-align: center; }

.badge { display: inline-flex; align-items: center; min-height: 23px; border-radius: 999px; background: var(--slate-100); color: var(--slate-600); padding: 3px 8px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.success { background: var(--green-50); color: var(--green-700); }
.badge.warning { background: var(--amber-50); color: var(--amber-700); }
.badge.danger { background: var(--red-50); color: var(--red-700); }
.badge.info { background: var(--blue-50); color: var(--blue-700); }

.activity-list { display: grid; gap: 0; }
.activity-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 12px; align-items: start; border-bottom: 1px solid var(--slate-200); padding: 13px 0; }
.activity-item:first-child { padding-top: 0; }
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--blue-600); }
.activity-dot.warning { background: #f79009; }
.activity-dot.danger { background: #f04438; }
.activity-item strong { display: block; margin-bottom: 4px; font-size: 12px; }
.activity-item p { margin: 0; color: var(--slate-500); font-size: 11px; line-height: 1.5; }
.activity-item time { color: var(--slate-400); font-size: 10px; white-space: nowrap; }

.split-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.helper-text { margin: 6px 0 0; color: var(--slate-400); font-size: 10px; line-height: 1.5; }

.security-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.security-filter-actions {
  display: flex;
  gap: 8px;
  grid-column: span 2;
}

.security-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--slate-500);
  font-size: 12px;
}

.evidence-layers { display: grid; gap: 14px; }
.evidence-layer {
  border: 1px solid var(--slate-200);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 14px;
}
.evidence-layer h3 { margin: 0 0 12px; font-size: 13px; }
.evidence-layer.server { border-left-color: var(--green-700); background: var(--green-50); }
.evidence-layer.client { border-left-color: var(--amber-700); background: var(--amber-50); }
.evidence-layer.admin { border-left-color: var(--blue-600); background: var(--blue-50); }
.evidence-layer .detail-field { background: rgba(255, 255, 255, .75); }

.skeleton { position: relative; overflow: hidden; min-height: 90px; border-radius: var(--radius); background: #e9edf4; }
.skeleton::after { position: absolute; inset: 0; content: ""; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent); animation: shimmer 1.2s infinite; transform: translateX(-100%); }
@keyframes shimmer { to { transform: translateX(100%); } }
.loading-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.loading-panel { margin-top: 16px; }
.skeleton-large { min-height: 300px; border-radius: var(--radius); }
.failure-copy { color: var(--slate-500); }

.detail-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 40px));
  border: 0;
  border-radius: 18px;
  background: var(--white);
  padding: 0;
  box-shadow: var(--shadow-lg);
}
.detail-dialog::backdrop { background: rgba(8, 17, 31, .56); backdrop-filter: blur(2px); }
.dialog-header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--slate-200); background: var(--white); padding: 18px 20px; }
.dialog-header h2 { margin: 0; font-size: 18px; }
.dialog-body { padding: 20px; }
.detail-section + .detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 10px; color: var(--slate-700); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-field { min-width: 0; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--slate-50); padding: 11px; }
.detail-field span { display: block; margin-bottom: 5px; color: var(--slate-500); font-size: 10px; }
.detail-field strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.detail-json { max-height: 280px; overflow: auto; border-radius: 10px; background: var(--navy-950); color: #d7e0ef; padding: 14px; font: 11px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }

.toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 44px));
  border-radius: 10px;
  background: var(--navy-900);
  color: var(--white);
  padding: 11px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .18s, transform .18s;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #7a271a; }
.mobile-backdrop { display: none; }

@media (max-width: 1240px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .security-filter-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .workspace { grid-column: 1; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(8, 17, 31, .45); }
  .mobile-backdrop.visible { display: block; }
  .menu-button { display: grid; }
  .split-layout, .content-grid { grid-template-columns: 1fr; }
  .security-filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 760px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: grid; }
  .topbar { min-height: 68px; padding: 10px 16px; }
  .topbar p, .last-updated { display: none; }
  .screen { padding: 20px 16px 42px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 112px; }
  .metric-card strong { margin-top: 12px; font-size: 25px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .tabs { max-width: 100%; overflow-x: auto; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .security-filter-grid { grid-template-columns: 1fr; }
  .security-filter-actions { grid-column: auto; }
  .topbar-actions .secondary-button { padding: 7px 10px; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 16px; }
  .page-intro h2 { font-size: 20px; }
}
