:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #61706b;
  --line: #dfe8e3;
  --paper: #f5f7f3;
  --white: #ffffff;
  --green: #2f7359;
  --green-deep: #183f32;
  --teal: #158c8a;
  --blue: #2c629c;
  --amber: #b47d2c;
  --red: #b95043;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 250px;
  padding: 22px;
  color: var(--white);
  background: var(--green-deep);
}

.back-link,
.ghost-button,
.primary-button,
.danger-button,
.quick-slots button,
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 850;
}

.back-link {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
}

.product-name {
  margin: 34px 0;
}

.product-name strong {
  display: block;
  font-size: 1.45rem;
}

.product-name span {
  color: rgba(255, 255, 255, 0.62);
}

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

.app-sidebar nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
}

.app-sidebar nav a.active,
.app-sidebar nav a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
}

.app-shell {
  min-height: 100svh;
  margin-left: 250px;
  padding: 28px clamp(18px, 4vw, 46px) 46px;
}

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

.topbar-actions,
.filter-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1.1;
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 60px rgba(23, 33, 31, 0.08);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 6px 0;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 16px;
}

.workspace.secondary {
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 0.75fr);
  margin-top: 16px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-head.single {
  display: block;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

input {
  padding: 0 13px;
}

select {
  padding: 0 12px;
}

.filter-row input {
  width: min(280px, 100%);
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.82rem;
}

td strong {
  display: block;
}

td small {
  color: var(--muted);
}

.status {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.status-booked {
  color: var(--blue);
  background: #e6eff8;
}

.status-arrived {
  color: var(--amber);
  background: #f8f0df;
}

.status-done {
  color: var(--green);
  background: #e4f2ec;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-action,
.ghost-button,
.quick-slots button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--white);
}

.primary-button {
  border: 0;
  color: var(--white);
  background: var(--green);
}

.danger-button {
  border: 1px solid #f0d5d0;
  color: var(--red);
  background: #fff5f3;
}

.form-panel form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

label input,
label select {
  width: 100%;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-slots {
  padding: 0 22px 22px;
}

.quick-slots strong {
  display: block;
  margin-bottom: 10px;
}

.quick-slots div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.empty-state {
  margin: 0;
  padding: 28px;
  color: var(--muted);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  align-items: end;
  height: 260px;
  padding: 22px;
}

.bar {
  display: grid;
  align-content: end;
  gap: 8px;
  height: 100%;
}

.bar b {
  display: block;
  min-height: 8px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, var(--teal), var(--green));
}

.bar span {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.timeline-list {
  display: grid;
  gap: 10px;
  padding: 22px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.timeline-item time {
  color: var(--green);
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  color: var(--white);
  background: var(--green-deep);
  box-shadow: 0 18px 50px rgba(23, 33, 31, 0.22);
}

@media (max-width: 1280px) {
  .workspace,
  .workspace.secondary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .app-sidebar {
    position: static;
    width: auto;
  }

  .app-sidebar nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app-shell {
    margin-left: 0;
  }

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

@media (max-width: 680px) {
  .topbar,
  .panel-head {
    display: block;
  }

  .topbar-actions,
  .filter-row {
    margin-top: 16px;
  }

  .app-sidebar nav,
  .two-col,
  .quick-slots div {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
