:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #18212b;
  --muted: #657485;
  --line: #dce3ea;
  --primary: #175cd3;
  --ok: #0f766e;
  --warn: #b45309;
  --shadow: 0 16px 40px rgba(24, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.topbar {
  align-items: flex-end;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 28px min(5vw, 56px) 18px;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

.topbar p,
.hero p,
.empty {
  color: var(--muted);
}

.shell {
  margin: 24px auto 48px;
  width: min(1180px, calc(100vw - 32px));
}

.hero,
.panel,
.auth-card,
.metrics article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero,
.panel,
.auth-card {
  padding: 18px;
}

.hero {
  margin-bottom: 18px;
}

.metrics {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metrics article {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics strong {
  font-size: 28px;
}

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

.actions-panel {
  margin-bottom: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

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

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.message {
  border-radius: 8px;
  border: 1px solid var(--line);
  font-weight: 700;
  padding: 12px 14px;
}

.message.success {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.25);
  color: var(--ok);
}

.message.error {
  background: rgba(180, 83, 9, 0.08);
  border-color: rgba(180, 83, 9, 0.25);
  color: var(--warn);
}

.message.warning {
  background: rgba(180, 83, 9, 0.08);
  border-color: rgba(180, 83, 9, 0.25);
  color: var(--warn);
}

.message.info {
  background: rgba(23, 92, 211, 0.08);
  border-color: rgba(23, 92, 211, 0.2);
  color: var(--primary);
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
}

th {
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.status.ok {
  background: rgba(15, 118, 110, 0.08);
  color: var(--ok);
}

.status.warn {
  background: rgba(180, 83, 9, 0.08);
  color: var(--warn);
}

.status.caution {
  background: rgba(23, 92, 211, 0.08);
  color: var(--primary);
}

.button {
  align-items: center;
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
}

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

.button.danger {
  background: #fff;
  border-color: rgba(180, 83, 9, 0.45);
  color: var(--warn);
}

.small-button {
  align-items: center;
  background: #fff;
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  min-height: 32px;
  padding: 5px 9px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

input {
  border: 1px solid #cbd5df;
  border-radius: 6px;
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

select,
input[type="file"],
textarea {
  border: 1px solid #cbd5df;
  border-radius: 6px;
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.message-draft {
  background: #f8fafc;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.55;
}

.row-checkbox {
  min-height: 18px;
  width: 18px;
}

label {
  color: #334155;
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 6px;
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.errorlist {
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 820px) {
  .topbar,
  .topbar nav {
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .metrics,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
