:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #172033;
  --muted: #667085;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --danger: #dc2626;
  --green: #16a34a;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #e0ecff 0, transparent 34rem), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

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

h1 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.ok { background: var(--green); }
.dot.error { background: var(--danger); }

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.controls {
  display: grid;
  grid-template-columns: 1.3fr 1.5fr 0.9fr 0.7fr auto;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea,
button {
  border-radius: 12px;
  border: 1px solid #d0d5dd;
  font: inherit;
}

input,
select,
button {
  height: 40px;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 180px;
  padding: 12px;
  line-height: 1.65;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

button {
  align-self: end;
  padding: 0 18px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

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

.hint {
  margin-bottom: 16px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.error {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #991b1b;
  white-space: pre-wrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tab-button {
  align-self: auto;
  height: 38px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  border-color: var(--border);
}

.tab-button.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.tab-panel {
  display: none;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  padding: 16px;
}

.card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.section {
  padding: 16px;
}

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

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pager button {
  align-self: auto;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.usage-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
}

.usage-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.notice-panel {
  margin-bottom: 16px;
}

.notice-form {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-top: 14px;
}

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

.notice-meta,
.notice-status {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  white-space: pre-wrap;
}

.notice-status {
  display: none;
  margin-top: 12px;
}

.notice-status.ok {
  display: block;
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.notice-status.error {
  display: block;
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

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

.notice-actions button {
  align-self: auto;
}

.notice-actions .danger-button {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 600;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: #eef2f7;
  color: #344054;
  word-break: break-all;
}

.empty {
  padding: 24px;
  border: 1px dashed #d0d5dd;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  background: var(--panel-soft);
}

@media (max-width: 900px) {
  .hero,
  .controls,
  .cards,
  .grid,
  .usage-grid,
  .notice-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .notice-actions {
    display: grid;
  }

  button {
    width: 100%;
  }
}
