:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef5f3;
  --text: #182331;
  --muted: #667085;
  --line: #d9e2e7;
  --navy: #214966;
  --teal: #248978;
  --blue: #2f80ed;
  --amber: #d79a3d;
  --coral: #d8604b;
  --shadow: 0 18px 45px rgba(22, 41, 64, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #102b3c;
  color: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: grid;
  gap: 14px;
}

.brand img {
  width: 100%;
  max-height: 118px;
  border-radius: 8px;
  object-fit: cover;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand p,
.sidebar .storage-note span {
  color: rgba(248, 251, 255, 0.74);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fbff;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: #f8fbff;
  color: #102b3c;
}

.storage-note {
  margin-top: auto;
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.main {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 26px;
}

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

.topbar h2 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: 0;
}

.top-actions,
.toolbar,
.data-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-pill {
  min-height: 34px;
  border: 1px solid #b9d7d0;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--teal);
  background: #eef8f5;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-pill.warning {
  color: var(--amber);
  border-color: #ecd3a3;
  background: #fff8e8;
}

.sync-pill.error {
  color: var(--coral);
  border-color: #f0c1b8;
  background: #fff4f1;
}

.primary-button,
.ghost-button,
.danger-button,
.file-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

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

.ghost-button,
.file-button,
.icon-button {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}

.danger-button {
  background: #fff;
  color: var(--coral);
  border-color: #f0c1b8;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.4fr);
  gap: 18px;
  margin-bottom: 18px;
  min-width: 0;
}

.summary-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.visual-panel {
  min-height: 180px;
  padding: 20px;
  background-image:
    linear-gradient(120deg, rgba(16, 43, 60, 0.78), rgba(36, 137, 120, 0.7)),
    url("./assets/tennis-court.svg");
  background-size: cover;
  background-position: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.visual-panel .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.visual-panel h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.visual-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.visual-stat span {
  font-size: 48px;
  font-weight: 800;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0;
  overflow: hidden;
}

.metric {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  color: var(--navy);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  min-width: 0;
}

.panel {
  padding: 18px;
  min-width: 0;
}

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

.panel h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

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

.form-grid label,
.file-button {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.13);
}

input[readonly] {
  color: var(--muted);
  background: #f3f6f8;
}

textarea {
  resize: vertical;
}

.field-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.status-line {
  min-height: 20px;
  margin: -2px 0 0;
  color: var(--teal);
  font-size: 13px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.record-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.record-card h4 {
  margin: 0;
  font-size: 15px;
}

.record-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef5f3;
  color: var(--teal);
  font-size: 12px;
}

.delete-small {
  border: 0;
  background: transparent;
  color: var(--coral);
  padding: 0;
}

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

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

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

th {
  background: #eef5f3;
  color: var(--navy);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #edf0f3;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.file-button input {
  display: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    grid-template-columns: 118px 1fr;
    align-items: center;
  }

  .nav-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .storage-note {
    display: none;
  }

  .dashboard-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

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

  .top-actions,
  .toolbar {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-actions > *,
  .toolbar > * {
    flex: 1 1 0;
    min-width: 0;
  }

  .brand {
    grid-template-columns: 1fr;
  }

  .brand img {
    max-height: 92px;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-bottom: 1px solid var(--line);
  }

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

  .rating-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .top-actions {
    grid-template-columns: 1fr;
  }

  .sync-pill,
  .top-actions > * {
    width: 100%;
  }

  .nav-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
