:root {
  --bg: #f7f9fd;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --accent: #0ea5e9;
  --accent-2: #22c55e;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(34,197,94,0.14), transparent 35%),
              radial-gradient(circle at 80% 0%, rgba(14,165,233,0.15), transparent 40%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 32px 24px 12px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.5px;
}

.subhead {
  color: var(--muted);
  margin-top: 8px;
  font-size: 15px;
}

.session-indicator {
  align-self: center;
  background: rgba(34, 197, 94, 0.12);
  color: #0f5132;
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  min-width: 180px;
  text-align: center;
}

.session-indicator.offline {
  background: rgba(255, 196, 0, 0.12);
  color: #92400e;
  border-color: rgba(255, 196, 0, 0.4);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 0 4px;
}

.tab-button {
  flex: 1 1 140px;
  min-width: 140px;
  background: #e5e7eb;
  color: #111827;
  border: 1px solid var(--border);
  box-shadow: none;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
  transform: translateY(-1px);
}

.mini-btn {
  width: auto;
  display: inline-block;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;
}
.danger-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.25);
}
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.password-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.password-toggle {
  border: 1px solid var(--border);
  background: #f3f4f6;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  padding: 0;
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: #111827;
  fill: none;
}

main {
  padding: 16px 24px 32px;
  max-width: 1100px;
  margin: 0 auto;
  display: block;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

.panel {
  display: none;
  margin-bottom: 16px;
}

.panel.active {
  display: block;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 4px;
}

input, textarea, select, button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 14px;
}

button {
  margin-top: 12px;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.25);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.status {
  font-size: 13px;
  color: var(--muted);
  min-height: 20px;
  margin-top: 8px;
}

.status.error {
  color: #b91c1c;
  font-weight: 700;
}

pre {
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  overflow: auto;
  font-size: 12px;
  color: #111827;
  max-height: 220px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.table th,
.table td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

.table th.num,
.table td.num {
  text-align: right;
}

.table-scroll {
  overflow-x: auto;
}

.table .sort-btn {
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
  color: var(--text);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.table .sort-btn:hover {
  text-decoration: underline;
}

.table th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 800;
}

.table tfoot td {
  font-weight: 700;
}

.limit-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.limit-control .limit-input {
  width: 90px;
  padding: 6px 8px;
  font-size: 12px;
}

.limit-control .mini-btn {
  margin-top: 0;
  width: auto;
}

.limit-view {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  fill: none;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 640px) {
  .header-top { flex-direction: column; align-items: flex-start; }
  .tabs { padding: 0; }
  .tab-button { flex: 1 1 100%; }
  .split { grid-template-columns: 1fr; }
}
