* {
  box-sizing: border-box;
}

:root {
  --bg: #5c6338;
  --bg-deep: #4b5230;
  --card: #f5f2e7;
  --card-soft: #ece8d8;
  --border: #c7c3ac;
  --text: #2f331f;
  --muted: #6f7353;
  --primary: #6a7240;
  --primary-dark: #4b5230;
  --secondary: #d8d4c1;
  --danger: #a3564c;
  --success: #6b7d49;
  --warning: #a78449;
  --shadow: 0 16px 36px rgba(70, 76, 46, 0.16);
  --radius: 20px;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eeebdd 0%, #e4dfcb 100%);
}

body {
  min-height: 100vh;
}

h1, h2, h3, p {
  margin-top: 0;
}

button, input, select, textarea {
  font: inherit;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 480px);
}

.auth-card,
.card,
.metric-card,
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 32px;
  background: linear-gradient(180deg, #f6f3e8 0%, #efebdc 100%);
}

.brand-block h1,
.logo-box h1 {
  margin-bottom: 8px;
  color: var(--primary-dark);
}

.brand-kicker,
.muted {
  color: var(--muted);
}

.stack-gap {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #faf7ee;
  padding: 12px 14px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(106, 114, 64, 0.14);
}

.field-full {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 26px;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: 0.2s ease;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #f7f4eb;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--primary-dark);
}

.btn-danger {
  background: #ead6d0;
  color: #6d3028;
}

.w-full {
  width: 100%;
}

.chip,
.text-button,
.menu-item,
.icon-button {
  cursor: pointer;
  border: 0;
  background: none;
}

.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: #e8e4d5;
  color: var(--primary-dark);
  font-weight: 600;
}

.demo-block {
  margin-top: 24px;
}

.demo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #e6e0cc;
  color: #4b5230;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: #f5f2e7;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 8px 0 24px rgba(47, 51, 31, 0.14);
}

.logo-box {
  padding: 10px 8px;
}

.logo-box .brand-kicker {
  color: #d8d4c1;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu-item {
  text-align: left;
  color: #ece8d8;
  border-radius: 14px;
  padding: 12px 14px;
}

.menu-item.active,
.menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.user-badge {
  background: rgba(245,242,231,0.12);
  border: 1px solid rgba(245,242,231,0.12);
  border-radius: 14px;
  padding: 14px;
  font-size: 0.95rem;
}

.content {
  padding: 24px;
  display: grid;
  gap: 20px;
  background:
    radial-gradient(circle at top right, rgba(216, 212, 193, 0.35), transparent 28%),
    linear-gradient(180deg, #eeebdd 0%, #e5e0cd 100%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 20px;
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, #f7f4eb 0%, #efebdc 100%);
}

.metric-card strong {
  font-size: 1.9rem;
}

.layout-two {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.card {
  padding: 18px;
  background: linear-gradient(180deg, #f7f4eb 0%, #efebdc 100%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.88rem;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item,
.transaction-box {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #eee8d7 0%, #e8e3d0 100%);
  border: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-completed { background: #dbeafe; color: #1d4ed8; }

.panel-section {
  display: none;
}

.panel-section.active {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(47, 51, 31, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 30;
}

.modal-card {
  width: min(100%, 720px);
  padding: 24px;
  background: linear-gradient(180deg, #f7f4eb 0%, #efebdc 100%);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.icon-button {
  font-size: 1.6rem;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.hint {
  color: var(--muted);
  margin: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #4b5230;
  color: #f5f2e7;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.text-button {
  color: var(--primary-dark);
  font-weight: 700;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}



.topbar-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-button {
  display: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #faf7ee;
  color: var(--text);
  width: 46px;
  height: 46px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.sidebar-overlay {
  display: none;
}

.table-wrap table {
  min-width: 700px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 320px);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    padding-bottom: 32px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(47, 51, 31, 0.42);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    display: block;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .content {
    padding: 18px;
    width: 100%;
  }

  .layout-two,
  .card-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-heading {
    width: 100%;
    align-items: flex-start;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1 1 220px;
  }

  .card,
  .metric-card,
  .auth-card,
  .modal-card {
    border-radius: 18px;
  }

  .table-wrap {
    overflow: visible;
  }

  .table-wrap table {
    min-width: 0;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap tr {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #f1edde 0%, #ebe5d4 100%);
  }

  .table-wrap td {
    border: 0;
    padding: 8px 0;
    text-align: left;
  }

  .table-wrap td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row .btn {
    width: 100%;
  }

  .modal {
    align-items: end;
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    max-height: min(92dvh, 760px);
    overflow-y: auto;
    padding: 18px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .modal-header {
    position: sticky;
    top: 0;
    background: var(--card);
    padding-bottom: 12px;
    z-index: 2;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .checkbox-field {
    align-items: flex-start;
    padding-top: 0;
  }
}

@media (max-width: 680px) {
  .auth-page {
    padding: 16px;
  }

  .auth-card {
    padding: 22px;
  }

  .btn,
  .chip {
    width: 100%;
  }

  .demo-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .content {
    padding: 14px;
    gap: 16px;
  }

  .metric-card strong {
    font-size: 1.55rem;
  }

  .card {
    padding: 14px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }
}
