:root {
  --page-max: 1100px;

  --brand: #0a84ff;
  --brand-2: #0077cc;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #111;
  --muted: #666;
  --border: #dadde1;

  --radius: 14px;
  --radius-sm: 10px;

  --shadow: 0 4px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.12);

  --col-grid: 180px minmax(220px, .6fr) 110px 110px 80px 76px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Arial, "Noto Sans TC", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  max-width: var(--page-max);
  margin: 56px auto;
  padding: 0 24px;
}
.card {
  background: var(--surface);
  padding: 28px 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-title {
  margin: 0 0 16px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
}
label {
  display: block;
  margin: 12px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 52px;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  appearance: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input::placeholder { color: #9aa0a6; }

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10,132,255,.15);
  background: #fff;
}

select.select-like {
  width: 100%;
  height: 52px;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  appearance: none;
}

.name-grid {
  display: grid;
  grid-template-columns: var(--col-grid);
  column-gap: var(--gap);
  justify-items: center;
  margin-bottom: 14px;
}
.name-grid > label {
  grid-column: 1 / 2;
  align-self: end;
  margin: 0 0 6px;
  text-align: center;
  color: var(--muted);
}
.name-grid > #customer {
  grid-column: 1 / 2;
  justify-self: center;
  width: min(100%, 360px);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 16px;
  margin-top: 14px;
}
table thead tr,
table tbody tr {
  display: grid;
  grid-template-columns: var(--col-grid);
  column-gap: var(--gap);
  align-items: center;
}
table thead th {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}
table thead th:first-child {
  justify-content: center;
  text-align: center;
  justify-self: center;
  width: min(100%, 360px);
}
table thead th:last-child { justify-content: flex-end; }

td > input,
td > select { width: 100%; }

td:nth-child(4) input { text-align: center; }

td:first-child { justify-self: center; }

td:first-child > input { width: min(100%, 360px); }

td:last-child {
  display: flex;
  justify-content: flex-end;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
button,
.back-home {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease, color .2s ease;
}
button:active,
.back-home:active { transform: translateY(1px); }

.add {
  background: #eef1f5;
  color: #111;
}
.add:hover { background: #e3e7ed; }

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px rgba(10,132,255,.25);
}
.primary:hover {
  filter: saturate(1.05);
  box-shadow: var(--shadow-lg);
}

.del {
  padding: 8px 12px;
  background: #f2f3f5;
  color: #333;
}
.del:hover { background: #e6e8eb; }

.back-home {
  display: inline-block;
  text-decoration: none;
  background: #e9ebef;
  color: #111;
}
.back-home:hover { background: #dde1e7; }

.hidden { display: none !important; }
.hint {
  margin: 6px 0 12px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .wrap { padding: 0 16px; margin: 32px auto; }

  input,
  select,
  select.select-like { height: 48px; font-size: 15px; }

  table thead { display: none; }

  table tbody tr {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
  }

  td:last-child { grid-column: 2 / 3; justify-content: end; }

  .name-grid { grid-template-columns: 1fr 1fr; }
  .name-grid > label {
    grid-column: 1 / -1;
    text-align: center;
  }
  .name-grid > #customer {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (min-width: 1280px) {
  .wrap { max-width: 1200px; }
  .card { padding: 32px 36px; }
  input,
  select,
  select.select-like { height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
