:root {
  --bg: #f6f5ef;
  --surface: #ffffff;
  --ink: #17251c;
  --muted: #66736b;
  --line: #e3e0d5;
  --green: #0f5f3b;
  --green-soft: #e7f1ea;
  --red: #8b1f2f;
  --shadow: 0 12px 28px rgba(23, 37, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Tahoma, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar,
.toolbar,
.workspace,
.stats-grid {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 40px);
}

.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 11px 14px;
  min-height: 44px;
  transition: 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.button.ghost {
  background: transparent;
}

.button.danger {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stats-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stats-grid span {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.stats-grid strong {
  display: block;
  font-size: 30px;
}

.toolbar {
  display: grid;
  grid-template-columns: 220px 220px minmax(240px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

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

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
}

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

.table-wrap {
  overflow: auto;
}

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

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

th {
  background: #faf9f4;
  color: var(--muted);
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  font-size: 14px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  white-space: nowrap;
}

.badge.waiting {
  background: #fff3cf;
  color: #805c00;
}

.badge.paid {
  background: #e3f6e8;
  color: #0b6f32;
}

.badge.cancelled {
  background: #f8e5e8;
  color: var(--red);
}

.details-panel {
  padding: 18px;
  position: sticky;
  top: 16px;
}

.panel-empty {
  min-height: 280px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.detail-head {
  border-bottom: 1px solid var(--line);
  margin: -2px 0 14px;
  padding-bottom: 12px;
}

.detail-head h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
}

.detail-list strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

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

.form-grid .wide,
.action-row {
  grid-column: 1 / -1;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.message-box {
  margin: 14px 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.toast {
  position: fixed;
  bottom: 18px;
  left: 18px;
  max-width: min(420px, calc(100% - 36px));
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .details-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

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

  .stats-grid,
  .toolbar,
  .form-grid,
  .action-row {
    grid-template-columns: 1fr;
  }
}
