:root {
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-strong: #eef4ec;
  --text: #14201a;
  --muted: #647067;
  --line: #d9e1d7;
  --primary: #146c43;
  --primary-dark: #0d4d30;
  --accent: #c2532f;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(20, 32, 26, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
  min-width: 0;
  padding: 0 16px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
  white-space: normal;
  overflow-wrap: anywhere;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.topbar {
  align-items: center;
  background: #18382a;
  color: white;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(16px, 4vw, 48px);
}

.topbar h1,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 760;
}

.eyebrow {
  color: #6b7d70;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #b7cabe;
}

.top-actions,
.admin-actions,
.report-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 22px clamp(14px, 4vw, 32px) 48px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  flex: 0 0 auto;
}

.tab.active {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 750;
}

.toolbar,
.report-panel,
.admin-panel,
.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding: 18px;
}

.toolbar h2,
.report-head h2,
.admin-panel h2 {
  font-size: 22px;
}

.toolbar p {
  color: var(--muted);
  margin-top: 4px;
}

.machine-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  margin-top: 16px;
}

.machine-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  align-self: stretch;
  min-height: 190px;
  padding: 18px;
  width: 100%;
}

.machine-title {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.machine-title h3 {
  font-size: 20px;
  margin: 0;
  overflow-wrap: anywhere;
}

.status {
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 760;
  padding: 6px 10px;
}

.status.running {
  background: #e7f4ee;
  color: var(--primary-dark);
}

.status.down {
  background: #fff0e9;
  color: var(--accent);
}

.status.unavailable {
  background: #edf0f2;
  color: #536069;
}

.timer {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: 22px 0;
}

.nominal-hours {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.machine-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.machine-admin {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  margin-top: 12px;
  width: 100%;
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-dark);
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: inherit;
}

main .ghost,
.machine-admin .ghost,
.report-controls .ghost {
  border-color: var(--line);
  color: var(--text);
}

.danger {
  background: #fff1f0;
  color: var(--danger);
}

.stop {
  background: #c2532f;
  color: white;
}

.start {
  background: #e7f4ee;
  color: var(--primary-dark);
}

.availability {
  background: #edf0f2;
  color: #38434a;
  grid-column: 1 / -1;
}

.availability.available {
  background: #dfeeed;
  color: #0d4d30;
}

.report-panel,
.admin-panel,
.empty {
  margin-top: 22px;
  padding: 18px;
}

.report-head,
.admin-panel {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.report-controls input,
.report-controls select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 12px;
}

.report-summary {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 14px 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 820px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

td {
  font-variant-numeric: tabular-nums;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.empty h2 {
  color: var(--text);
  margin-bottom: 6px;
}

.toast {
  background: #17241d;
  border-radius: 8px;
  bottom: 18px;
  box-shadow: var(--shadow);
  color: white;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 10;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .topbar,
  .toolbar,
  .report-head,
  .admin-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .admin-actions,
  .report-controls {
    justify-content: stretch;
  }

  .top-actions button,
  .admin-actions button,
  .report-controls button,
  .report-controls input,
  .report-controls select {
    flex: 1 1 140px;
  }

  .machine-grid {
    grid-template-columns: 1fr;
  }
}
