:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #687286;
  --line: #dfe5ef;
  --accent: #116d6e;
  --accent-strong: #0a4f50;
  --danger: #b3261e;
  --shadow: 0 18px 45px rgba(31, 42, 68, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(17, 109, 110, 0.12), transparent 38%),
    var(--bg);
  color: var(--ink);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

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

.panel {
  padding: 28px;
  margin-bottom: 22px;
}

.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
}

.count {
  min-width: 98px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: #f9fbfd;
}

.count span {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-strong);
}

.count small {
  color: var(--muted);
}

.success {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--accent-strong);
  font-weight: 800;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  min-width: 0;
}

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

label span {
  display: block;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  outline: none;
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 109, 110, 0.14);
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.secondary:hover {
  background: #f1f5f9;
}

.table-wrap {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: #34405a;
  background: #eef4f6;
  font-size: 14px;
}

td {
  color: #263149;
}

.empty {
  display: none;
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
}

.empty.show {
  display: block;
}

.error {
  color: var(--danger);
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 20px 0;
  }

  .panel {
    padding: 20px;
  }

  .heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
  }

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

  h1 {
    font-size: 26px;
    line-height: 1.2;
  }

  label {
    gap: 6px;
    font-size: 13px;
  }

  input,
  select,
  button {
    min-height: 48px;
    font-size: 16px;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .count {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 14px;
  }

  tr {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 10px 0;
  }

  td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    align-items: start;
  }

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

  td::before {
    content: attr(data-cell-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

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