:root {
  --bg: #f6f3ee;
  --surface: #fffdf8;
  --ink: #1d1b16;
  --muted: #6f6a60;
  --line: #ddd2bf;
  --accent: #0d7a52;
  --accent-2: #d95d39;
  --shadow: 0 20px 40px rgba(27, 23, 17, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(13, 122, 82, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(217, 93, 57, 0.12), transparent 24%),
    var(--bg);
  color: var(--ink);
}

.auth-screen {
  min-height: 100vh;
  display: none;
  padding: 48px 32px;
}

.auth-screen.is-active {
  display: block;
}

.auth-layout {
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 420px);
  align-items: center;
  gap: 36px;
}

.auth-hero {
  padding: 24px 8px;
}

.brand-large {
  margin-bottom: 28px;
}

.auth-title {
  margin: 0 0 14px;
  font-size: 52px;
  line-height: 1.05;
}

.auth-copy {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-screen-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
}

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

.shell.is-active {
  display: grid;
}

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid rgba(29, 27, 22, 0.08);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(8px);
}

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

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #0d7a52, #0b4f6c);
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
}

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

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.nav-item,
.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  font: inherit;
  transition: transform 140ms ease, opacity 140ms ease, background-color 140ms ease;
}

.nav-item {
  padding: 12px 14px;
  text-align: left;
  background: transparent;
  color: var(--ink);
}

.nav-item.is-active {
  background: #efe6d8;
  font-weight: 700;
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  font-weight: 800;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 11px 12px;
  font: inherit;
}

.select-input {
  min-width: 140px;
}

textarea.text-input {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.form-col {
  flex: 1;
  min-width: 0;
}

.primary-button {
  padding: 11px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.danger-button {
  padding: 11px 14px;
  background: var(--accent-2);
  color: white;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  font: inherit;
}

.secondary-button {
  padding: 10px 14px;
  background: #efe6d8;
  color: var(--ink);
  font-weight: 700;
}

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

.base-url-display {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.session-card {
  gap: 12px;
}

.session-user {
  color: var(--muted);
  font-size: 14px;
}

.content {
  padding: 32px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 26px;
}

.content-header h1 {
  margin: 0;
  font-size: 34px;
}

.content-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.request-status {
  background: #efe6d8;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

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

.toolbar.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(221, 210, 191, 0.6);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #fbf7ef;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

td {
  font-size: 14px;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

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

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.pager-text {
  color: var(--muted);
  font-size: 13px;
  min-width: 88px;
  text-align: center;
}

.ghost-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  text-decoration: none;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: rgba(239, 230, 216, 0.52);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.detail-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  max-width: calc(100vw - 24px);
  height: 100vh;
  padding: 18px 18px 18px 0;
  transition: right 180ms ease;
  pointer-events: none;
}

.detail-drawer.is-open {
  right: 0;
  pointer-events: auto;
}

.detail-card {
  height: 100%;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  border-radius: 24px 0 0 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(221, 210, 191, 0.6);
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-kicker {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.detail-title {
  margin: 0;
  font-size: 22px;
}

.detail-body {
  padding: 18px 22px 24px;
  overflow: auto;
}

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

.detail-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.detail-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.detail-value {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.detail-value.is-mono {
  font-family: var(--mono);
  font-size: 12px;
}

.detail-copy {
  flex-shrink: 0;
  padding: 5px 9px;
  font-size: 12px;
}

.empty-detail {
  color: var(--muted);
  font-size: 14px;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.confirm-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.confirm-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 28px 56px rgba(27, 23, 17, 0.18);
  padding: 24px;
}

.confirm-kicker {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.confirm-title {
  margin: 0 0 10px;
  font-size: 26px;
}

.confirm-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-list {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.7;
}

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

@media (max-width: 1120px) {
  .auth-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-title {
    font-size: 40px;
  }

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(29, 27, 22, 0.08);
  }

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

  .detail-backdrop {
    background: rgba(20, 18, 14, 0.34);
  }

  .detail-drawer {
    width: 100%;
    max-width: 100%;
    padding: 12px 0 0;
  }

  .detail-card {
    border-radius: 22px 22px 0 0;
  }
}

@media (max-width: 720px) {
  .auth-screen {
    padding: 20px 16px 28px;
  }

  .auth-title {
    font-size: 34px;
  }

  .auth-copy {
    font-size: 15px;
  }

  .content {
    padding: 20px;
  }

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

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

  .detail-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }
}
