:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #eef2f6;
  --ink: #111827;
  --ink-soft: #4b5563;
  --line: #d6dce5;
  --brand: #0f766e;
  --brand-2: #0369a1;
  --warn: #b45309;
  --ok: #166534;
  --error: #991b1b;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-y: scroll;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dff7f3 0%, transparent 60%),
    radial-gradient(1000px 700px at 100% -20%, #dceefa 0%, transparent 55%),
    var(--bg);
  font-family: "Noto Sans SC", "Avenir Next", "Segoe UI", sans-serif;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.title-wrap h1 {
  margin: 0;
  font-size: 26px;
  font-family: "Space Grotesk", "DIN Alternate", sans-serif;
  letter-spacing: 0.2px;
}

.title-wrap p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.mode-switch button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.mode-switch button.active {
  color: white;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
}

.clock-pill {
  min-width: 160px;
  text-align: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font-weight: 700;
  color: #1f2937;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.public-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.public-nav button,
.chip,
.action-btn,
.ghost-btn,
.danger-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
}

.public-nav button.active,
.chip.active,
.action-btn {
  background: linear-gradient(120deg, #0d9488, #0284c7);
  color: #fff;
  border-color: transparent;
}

.ghost-btn {
  background: var(--surface-alt);
}

.danger-btn {
  border-color: #fecaca;
  color: var(--error);
  background: #fff5f5;
}

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

.section {
  padding: 16px;
}

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

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

.inline-tools,
.chips-row,
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.match-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.match-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.meta {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 4px 0;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag.upcoming {
  color: #854d0e;
  background: #fef3c7;
}

.tag.finished {
  color: #14532d;
  background: #dcfce7;
}

.table-wrap {
  overflow: auto;
}

.table-wrap.with-scroll {
  max-height: 660px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.admin-page-fixed {
  min-height: 760px;
  display: flex;
  flex-direction: column;
}

.admin-table-area {
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  font-size: 14px;
}

th {
  color: var(--ink-soft);
  background: #f8fafc;
  position: sticky;
  top: 0;
}

.detail-head {
  padding: 16px;
  background: linear-gradient(110deg, #0f766e, #0369a1);
  color: #fff;
  border-radius: var(--radius);
}

.detail-head h3 {
  margin: 0;
}

.info-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.info-item {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
}

.block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.block h4 {
  margin: 0 0 8px;
}

.block p {
  margin: 0;
  line-height: 1.65;
}

.disclaimer {
  border-left: 4px solid #0f766e;
  background: #f0fdfa;
  padding: 10px 12px;
  font-size: 13px;
  color: #115e59;
  border-radius: 8px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
}

.admin-matches-table {
  min-width: 980px;
}

.operation-cell {
  min-width: 230px;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-stack .ghost-btn {
  white-space: nowrap;
  padding: 8px 12px;
}

.sidebar {
  padding: 12px;
}

.sidebar button {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  cursor: pointer;
}

.sidebar button.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, #0d9488, #0284c7);
}

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

.metric {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 4px;
}

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

label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.login {
  max-width: 420px;
  margin: 40px auto;
  padding: 20px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.pager-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  align-items: center;
}

.pager-size-label {
  font-size: 13px;
  color: var(--ink-soft);
}

.pager-size-menu-wrap {
  position: relative;
}

.pager-size-trigger {
  min-width: 120px;
}

.pager-size-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 40;
  min-width: 84px;
  min-width: 132px;
}

.pager-size-menu .ghost-btn {
  width: 100%;
}

.pager-total-pill {
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: default;
  opacity: 1;
}

.pager-total-pill:disabled {
  color: var(--ink-soft);
  opacity: 1;
}

.log-status-success {
  color: #15803d;
  font-weight: 700;
}

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

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: min(900px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px;
}

@media (max-width: 980px) {
  .match-grid,
  .metric-grid,
  .info-list,
  .form-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-shell {
    padding: 12px;
  }
}
