:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #66736b;
  --line: #d9dfdc;
  --panel: #ffffff;
  --leaf: #2d7455;
  --leaf-dark: #1f573f;
  --coral: #c85f48;
  --gold: #bb8c22;
  --blue: #386f91;
  --danger: #982b18;
  --shadow: 0 18px 50px rgba(23, 33, 28, 0.1);
  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;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, rgba(200, 95, 72, 0.14), transparent 25rem),
    radial-gradient(circle at 88% 10%, rgba(56, 111, 145, 0.14), transparent 23rem),
    linear-gradient(135deg, #fbfaf6 0%, #edf5f0 54%, #f7eee7 100%);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
}

.login-brand,
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.login-brand {
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--leaf), var(--coral));
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(45, 116, 85, 0.22);
}

.login-brand p,
.brand-lockup span,
.panel-header p,
.help-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-brand h1 {
  margin: 2px 0 0;
  font-size: clamp(2.2rem, 8vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.panel,
.login-card,
.stat-card {
  border: 1px solid rgba(217, 223, 220, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 15px;
  padding: 24px;
}

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

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

.brand-lockup strong {
  display: block;
  font-size: clamp(1.18rem, 2.5vw, 1.85rem);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid rgba(187, 140, 34, 0.3);
  border-radius: 8px;
  color: #755511;
  background: #fff8e5;
  font-weight: 900;
  white-space: nowrap;
}

label span,
.label-text {
  display: block;
  margin-bottom: 7px;
  color: #344139;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

textarea {
  min-height: 86px;
  padding-top: 10px;
  resize: vertical;
}

input[readonly] {
  color: #3d4c43;
  background: #f5f7f4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(45, 116, 85, 0.13);
}

.primary-btn,
.secondary-btn,
.quiet-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
  text-decoration: none;
}

.primary-btn {
  color: #ffffff;
  background: var(--leaf);
}

.secondary-btn {
  color: var(--leaf-dark);
  border-color: rgba(45, 116, 85, 0.28);
  background: #ffffff;
}

.quiet-btn {
  color: var(--blue);
  border-color: rgba(56, 111, 145, 0.24);
  background: #f4f9fc;
}

.danger-btn {
  color: #ffffff;
  background: var(--coral);
}

.message {
  border-radius: 8px;
  padding: 12px 13px;
  line-height: 1.45;
  font-weight: 800;
}

.message.error {
  color: var(--danger);
  background: #fde9e3;
  border: 1px solid #f4c7ba;
}

.message.success {
  color: #1d6047;
  background: #e7f4ed;
  border: 1px solid #b9dfcc;
}

.grid-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.full-panel {
  grid-column: 1 / -1;
}

#rekap-order {
  order: -1;
}

.member-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  overflow: hidden;
}

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

.panel-header h2,
.form-section h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0;
}

.panel-body {
  padding: 22px;
}

.stack {
  display: grid;
  gap: 13px;
}

.inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.inline-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-section {
  display: grid;
  gap: 12px;
  padding: 0 0 21px;
  margin-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

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

.section-title small {
  color: var(--muted);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.choice-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice {
  position: relative;
  display: block;
}

.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-card {
  display: block;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  line-height: 1.4;
}

.choice input:checked + .choice-card {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(45, 116, 85, 0.12);
}

.choice input:disabled + .choice-card {
  cursor: not-allowed;
  opacity: 0.52;
}

.choice-card b {
  display: block;
  font-size: 0.94rem;
}

.choice-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

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

.stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.cost-box,
.stat-card {
  border-radius: 8px;
  padding: 13px;
  background: #fffaf0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.94);
}

.cost-box span,
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cost-box strong,
.stat-card strong {
  display: block;
  margin-top: 7px;
  font-size: 1.2rem;
}

.stat-card strong {
  font-size: 1.65rem;
}

.form-actions,
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.filter-form {
  align-items: end;
}

.compact-actions {
  justify-content: flex-start;
  margin-bottom: 7px;
}

.compact-actions:last-child {
  margin-bottom: 0;
}

.compact-actions select,
.compact-actions input {
  width: auto;
  min-width: 132px;
  min-height: 34px;
}

.compact-actions button {
  min-height: 34px;
  padding: 0 10px;
}

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

.history-item,
.empty-state,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.history-item strong,
.mini-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.history-item span,
.empty-state,
.mini-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td input,
td select {
  min-height: 36px;
}

.menu-admin {
  display: grid;
  gap: 14px;
}

.section-admin {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf9;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 80px 95px auto;
  gap: 8px;
  align-items: end;
  margin-top: 9px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 18px;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(45, 116, 85, 0.24);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--leaf-dark);
  background: rgba(255, 255, 255, 0.84);
  font-weight: 900;
  text-decoration: none;
}

.tabs a.active {
  color: #ffffff;
  background: var(--leaf);
}

@media (max-width: 1050px) {
  .grid-user,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .login-page {
    padding: 14px;
  }

  .app-shell {
    width: min(100% - 24px, 620px);
    padding-top: 16px;
  }

  .login-card,
  .panel-body,
  .panel-header {
    padding: 18px;
  }

  .topbar,
  .top-actions,
  .panel-header,
  .section-title,
  .form-actions,
  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn,
  .quiet-btn,
  .danger-btn,
  .pill {
    width: 100%;
  }

  .inline-grid,
  .inline-grid.three,
  .choice-grid,
  .choice-grid.compact,
  .cost-summary,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .option-row {
    grid-template-columns: 1fr;
  }
}
