:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --text: #17202a;
  --muted: #637083;
  --border: #d8dee8;
  --accent: #1663d8;
  --accent-strong: #0f4dab;
  --success: #0f8b5f;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(20, 31, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 650;
}

.shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.app-view {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar {
  margin-bottom: 22px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  font-size: 20px;
}

.label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: #2d3748;
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 99, 216, 0.13);
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

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

.primary {
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
}

.primary:hover {
  background: var(--accent-strong);
}

.ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
}

.danger {
  background: #fff1f0;
  color: var(--danger);
  padding: 8px 10px;
}

.success {
  background: #e8f7f0;
  color: var(--success);
  padding: 8px 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab {
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.tab-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.pill.active {
  background: #e8f7f0;
  color: var(--success);
}

.pill.pending {
  background: #fff7e6;
  color: #9a5b00;
}

.pill.suspended {
  background: #fff1f0;
  color: var(--danger);
}

.code-area {
  min-height: 420px;
  margin-top: 14px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

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

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

.prompt-area {
  min-height: 150px;
}

.check-row {
  align-content: end;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
}

.check-row input {
  width: auto;
}

.message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--danger);
}

.audit-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.audit-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.audit-meta {
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

@media (max-width: 780px) {
  .app-view {
    width: min(100% - 24px, 1180px);
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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