:root {
  --bg: #f3efe6;
  --panel: rgba(255, 252, 245, 0.94);
  --panel-strong: #fffdf9;
  --line: rgba(92, 67, 43, 0.12);
  --text: #24180d;
  --muted: #705b46;
  --accent: #b45a2f;
  --accent-deep: #8f3e17;
  --shadow: 0 24px 60px rgba(70, 38, 17, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 200, 130, 0.45), transparent 28%),
    radial-gradient(circle at bottom right, rgba(188, 227, 214, 0.6), transparent 26%),
    linear-gradient(135deg, #f7f0e4 0%, #ecf4f1 100%);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel {
  max-width: 520px;
  margin: 6vh auto 0;
  padding: 36px;
}

.panel-copy h1,
.toolbar h2,
.card h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted,
.api-tip {
  color: var(--muted);
  line-height: 1.6;
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid rgba(120, 90, 66, 0.2);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

select {
  width: 100%;
  border: 1px solid rgba(120, 90, 66, 0.2);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

input:focus {
  border-color: rgba(180, 90, 47, 0.55);
  box-shadow: 0 0 0 4px rgba(180, 90, 47, 0.1);
  transform: translateY(-1px);
}

select:focus {
  border-color: rgba(180, 90, 47, 0.55);
  box-shadow: 0 0 0 4px rgba(180, 90, 47, 0.1);
  transform: translateY(-1px);
}

button {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #d57d49 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: 0 14px 30px rgba(180, 90, 47, 0.22);
}

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

button.secondary {
  background: #fff;
  color: var(--accent-deep);
  border: 1px solid rgba(180, 90, 47, 0.24);
  box-shadow: none;
}

button.danger {
  background: linear-gradient(135deg, #c84c36 0%, #de7650 100%);
  box-shadow: 0 14px 30px rgba(200, 76, 54, 0.2);
}

.hidden {
  display: none;
}

.dashboard {
  padding: 28px;
}

.toolbar,
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.card {
  padding: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.secret-card {
  margin-top: 24px;
}

.secret-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(244, 238, 225, 0.9);
  overflow-x: auto;
}

.table-card {
  margin-top: 20px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(120, 90, 66, 0.14);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.query-result {
  margin-top: 16px;
  padding: 14px 16px;
  min-height: 58px;
  border-radius: 16px;
  background: rgba(244, 238, 225, 0.85);
  color: var(--text);
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(36, 24, 13, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
}

code {
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(180, 90, 47, 0.08);
  color: var(--accent-deep);
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.small-action {
  padding: 9px 14px;
  font-size: 13px;
}

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

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 24, 13, 0.38);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(420px, calc(100% - 24px));
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .auth-panel,
  .dashboard {
    padding: 20px;
  }

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

  .toolbar,
  .table-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
