:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4d;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #5b9fd4;
  --accent-hover: #7ab8e8;
  --danger: #e06c75;
  --danger-hover: #f0808a;
  --success: #7fd99a;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a5f33, transparent);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.header {
  margin-bottom: 2rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.header-links {
  margin: 0.5rem 0 0;
}

.sheet-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.sheet-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-avatar {
  border-radius: 50%;
  width: 28px;
  height: 28px;
  background: var(--surface-hover);
}

.auth-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.auth-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.auth-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-discord {
  background: #5865f2;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.btn-discord:hover {
  background: #6d78f5;
  color: #fff;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  text-decoration: none;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.card h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

.hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hint code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.row-form {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.input-grow {
  flex: 1 1 200px;
  min-width: 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #5b9fd433;
}

input[type="number"] {
  max-width: 6rem;
}

.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #0a0e12;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-remove:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
}

.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.report-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.report-list li:last-child {
  border-bottom: none;
}

.report-list li.empty {
  color: var(--muted);
  font-style: italic;
  border: none;
  padding: 0.5rem 0 0;
}

.report-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  word-break: break-all;
}

.report-link:hover {
  text-decoration: underline;
}

.sync-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
}

.check input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 200px;
}

.field-narrow {
  flex: 0 0 auto;
}

.field span {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-sync {
  margin-top: 0.25rem;
}

.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
}

.status.ok {
  background: #1a3d2a;
  border: 1px solid #2d6b45;
  color: var(--success);
}

.status.err {
  background: #3d1a1f;
  border: 1px solid #6b2d35;
  color: #f0a8b0;
}

.log-box {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: pre-wrap;
}

.preview-wrap {
  margin-top: 1.25rem;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.preview-table th,
.preview-table td {
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.preview-table th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.preview-table tbody tr:last-child td {
  border-bottom: none;
}

.preview-table tbody tr:hover td {
  background: #24304444;
}

.report-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.report-table-wrap {
  margin-top: 0.5rem;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.report-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.td-rows {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.td-synced {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.td-title {
  max-width: 14rem;
}

.td-date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.td-id {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.td-actions {
  text-align: right;
  white-space: nowrap;
}

.report-table tbody tr:hover td {
  background: #24304422;
}

.report-table td.empty {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.select-diff {
  flex: 0 0 auto;
  min-width: 7rem;
}

.select-zone {
  flex: 1 1 280px;
  min-width: 0;
  max-width: 100%;
}

.input-date {
  flex: 0 0 auto;
}

.td-diff {
  text-transform: lowercase;
  white-space: nowrap;
}

.kill-date-form,
.kill-wcl-form {
  align-items: center;
}

.kill-wcl-form {
  margin-bottom: 0.85rem;
}

.kill-toolbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.25rem 0 0.65rem;
}

.kill-select-all {
  margin: 0;
  font-size: 0.88rem;
}

.td-check {
  width: 2rem;
  text-align: center;
}

.td-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
}
