:root {
  --bg: #f6f7f3;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #647067;
  --line: #dfe4dc;
  --accent: #1f7a5a;
  --accent-dark: #12563e;
  --warn: #b84a21;
  --soft: #eef5ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #ffffff 0%, #eef5ef 100%);
}

h1,
h2,
p {
  margin: 0;
}

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

.topbar p,
.section-title span {
  color: var(--muted);
}

.topbar p {
  margin-top: 8px;
}

.clock {
  min-width: 120px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.sync-status {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 22px clamp(14px, 4vw, 48px) 42px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 20px;
}

.rental-form,
.dialog-form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

button {
  padding: 11px 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

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

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

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.inline-form button {
  min-width: 112px;
}

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

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.rental-card,
.vehicle-row {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.rental-card strong,
.vehicle-row strong {
  font-size: 18px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 14px;
}

.price {
  color: var(--warn);
  font-weight: 800;
}

.vehicle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, .38);
}

.dialog-form {
  padding: 20px;
}

.summary {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

  .status-stack {
    justify-items: start;
  }
}

@media (max-width: 560px) {
  .inline-form,
  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 15px;
  }
}
