:root {
  color-scheme: light;
  --bg-page: #f3efe7;
  --bg-shell: rgba(255, 252, 247, 0.78);
  --bg-panel: #fffdfa;
  --bg-panel-muted: #f7f2ea;
  --bg-strong: #111111;
  --bg-soft: #f0e8dc;
  --bg-success: #ecf8ef;
  --bg-error: #fff0ed;
  --bg-warning: #fff6dd;
  --border-soft: rgba(72, 55, 36, 0.12);
  --border-strong: rgba(72, 55, 36, 0.22);
  --text-title: #181411;
  --text-primary: #352c24;
  --text-secondary: #746657;
  --text-muted: #9d907f;
  --accent: #22543d;
  --accent-hover: #183f2e;
  --accent-soft: rgba(34, 84, 61, 0.1);
  --danger: #b64c35;
  --warning: #b7791f;
  --success: #2f855a;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(24, 20, 17, 0.04);
  --shadow-md: 0 14px 40px rgba(24, 20, 17, 0.08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --font-body: "Be Vietnam Pro", "PingFang SC", sans-serif;
  --font-display: "Newsreader", "Noto Serif SC", serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-page);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(34, 84, 61, 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(183, 121, 31, 0.08), transparent 24%),
    linear-gradient(180deg, #f8f4ee 0%, #f3efe7 100%);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  border: 0;
  background: transparent;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-8) var(--space-6);
  background: var(--bg-shell);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.brand {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(160deg, #1f1a16, #3a3028);
  box-shadow: 0 14px 24px rgba(24, 20, 17, 0.15);
}

.brand-mark::after {
  content: "C";
  color: #fff7ee;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
}

.brand-mark span {
  display: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.brand-info h1 {
  font-family: var(--font-display);
  font-size: 31px;
  line-height: 1.05;
  color: var(--text-title);
  font-weight: 600;
}

.brand-info p:last-child {
  color: var(--text-secondary);
  font-size: 14px;
}

.nav {
  display: grid;
  gap: var(--space-2);
}

.nav a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 var(--space-4);
  border-radius: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-title);
  transform: translateX(2px);
}

.nav a.active {
  background: var(--bg-panel);
  color: var(--text-title);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-12);
}

.page-chrome {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.chrome-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(34, 84, 61, 0.08);
}

.chrome-label {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
}

.alert {
  margin-bottom: var(--space-6);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.alert.success {
  background: var(--bg-success);
  color: var(--success);
  border-color: rgba(47, 133, 90, 0.2);
}

.alert.error {
  background: var(--bg-error);
  color: var(--danger);
  border-color: rgba(182, 76, 53, 0.18);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.page-header-main {
  display: grid;
  gap: var(--space-3);
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text-title);
  font-weight: 600;
}

.page-header p {
  max-width: 700px;
  color: var(--text-secondary);
  font-size: 15px;
}

.page-actions,
.actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  color: var(--text-secondary);
  font-size: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-pill.success {
  background: var(--bg-success);
  color: var(--success);
}

.status-pill.warning {
  background: var(--bg-warning);
  color: var(--warning);
}

.status-pill.danger {
  background: var(--bg-error);
  color: var(--danger);
}

.panel {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
}

.panel-muted {
  background: var(--bg-panel-muted);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.section-header h3,
.panel h3 {
  font-size: 24px;
  line-height: 1.1;
  color: var(--text-title);
  font-weight: 700;
}

.section-header p,
.panel-copy,
.panel-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: var(--space-6);
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: var(--space-8);
}

.two-col {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
}

.stat-card {
  display: grid;
  gap: var(--space-5);
  min-height: 172px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(34, 84, 61, 0.08), transparent 45%),
    linear-gradient(0deg, rgba(17, 17, 17, 0.02), rgba(17, 17, 17, 0.02));
}

.stat-card > * {
  position: relative;
}

.stat-card span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  font-family: var(--font-display);
  font-size: clamp(42px, 5vw, 62px);
  line-height: 0.92;
  color: var(--text-title);
  font-weight: 600;
}

.stat-card small {
  color: var(--text-secondary);
  font-size: 13px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.toolbar form {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
}

.button.primary,
button.primary {
  background: var(--bg-strong);
  color: #fffdf9;
  box-shadow: 0 12px 28px rgba(17, 17, 17, 0.16);
}

.button.primary:hover,
button.primary:hover {
  background: #1d1d1d;
}

.button.secondary,
button.secondary {
  background: var(--bg-panel);
  border-color: var(--border-soft);
  color: var(--text-primary);
}

.button.secondary:hover,
button.secondary:hover {
  border-color: var(--border-strong);
  background: #fff9f2;
}

.button.ghost,
button.ghost {
  background: transparent;
  color: var(--text-secondary);
}

.button.ghost:hover,
button.ghost:hover {
  background: rgba(17, 17, 17, 0.04);
  color: var(--text-title);
}

form {
  display: grid;
  gap: var(--space-5);
}

label {
  display: grid;
  gap: var(--space-2);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

label .field-hint,
.field-hint {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="time"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: #fffdfa;
  color: var(--text-title);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

textarea {
  min-height: 120px;
  padding: 14px 16px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(34, 84, 61, 0.35);
  box-shadow: 0 0 0 4px rgba(34, 84, 61, 0.08);
}

.feature-field {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-6);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 242, 234, 0.95)),
    var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
}

.feature-field-secondary {
  background:
    linear-gradient(180deg, rgba(250, 246, 240, 0.96), rgba(243, 236, 225, 0.9)),
    var(--bg-panel-muted);
}

.feature-field-label {
  display: block;
  color: var(--text-title);
  font-size: 16px;
  font-weight: 800;
}

.feature-field-hint {
  color: var(--text-secondary);
  font-size: 13px;
}

.feature-field-input {
  min-height: 58px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 600;
}

.feature-field-input-time {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
}

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

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

th,
td {
  text-align: left;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

th {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  color: var(--text-primary);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 249, 242, 0.7);
}

.table-card {
  overflow: hidden;
}

.table-link {
  color: var(--text-title);
  font-weight: 700;
}

.table-link:hover {
  color: var(--accent);
}

.table-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.inline-code,
.log-box {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: #171411;
  color: #f6f1eb;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-box {
  min-height: 440px;
  overflow: auto;
}

.stack {
  display: grid;
  gap: var(--space-4);
}

.surface-note {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--bg-panel-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state {
  display: grid;
  gap: var(--space-3);
  place-items: start;
  min-height: 220px;
  padding: var(--space-8);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(247, 242, 234, 0.9), rgba(255, 252, 247, 0.92));
  border: 1px dashed var(--border-strong);
}

.empty-state strong {
  font-size: 18px;
  color: var(--text-title);
}

.empty-state p {
  max-width: 520px;
  color: var(--text-secondary);
}

.split-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.metric-list {
  display: grid;
  gap: var(--space-4);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-soft);
}

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

.metric-row span:first-child {
  color: var(--text-secondary);
}

.metric-row strong {
  color: var(--text-title);
}

.danger-zone {
  border-color: rgba(182, 76, 53, 0.18);
  background: linear-gradient(180deg, rgba(255, 244, 240, 0.9), rgba(255, 250, 247, 0.98));
}

.danger-zone h3,
.danger-zone h2 {
  color: var(--danger);
}

.mono {
  font-family: var(--font-mono);
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .content {
    padding-top: var(--space-6);
  }

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

@media (max-width: 760px) {
  .content {
    padding: var(--space-5);
  }

  .panel {
    padding: var(--space-6);
  }

  .page-header,
  .section-header,
  .toolbar,
  .split-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-header h2 {
    font-size: 36px;
  }

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

  th,
  td {
    padding-left: 10px;
    padding-right: 10px;
  }

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