:root {
  --bg: #f4f1e8;
  --surface: #fffdf6;
  --surface-2: #f8f2df;
  --text: #2a2118;
  --muted: #756a5c;
  --primary: #6b3f1f;
  --primary-dark: #432512;
  --accent: #1f7a4d;
  --danger: #c2410c;
  --warning: #b7791f;
  --border: #e2d5bd;
  --shadow: 0 18px 45px rgba(67, 37, 18, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #efe1bd 0, transparent 32%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

aside {
  background: linear-gradient(180deg, #3c2415 0%, #21130b 100%);
  color: #fff8eb;
  padding: 28px 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand-logo {
  width: 130px;
  height: 130px;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f6d365, #1f7a4d);
  display: grid;
  place-items: center;
  color: #241308;
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.15;
}

.brand small {
  color: #d8c8ae;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #efe5d2;
  text-decoration: none;
  padding: 13px 14px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateX(3px);
}

.sidebar-card {
  margin-top: 28px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-card p {
  color: #dccab2;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
}

main {
  padding: 28px;
  overflow: hidden;
}

/* Alerts */
.alert {
  padding: 13px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
}

.alert-success {
  background: #ddf7ea;
  color: #166534;
  border: 1px solid #bbf0d2;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background: #fff3cd;
  color: #92400e;
  border: 1px solid #fde68a;
}

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

.topbar h2 {
  font-size: clamp(24px, 3.5vw, 38px);
  letter-spacing: -1.2px;
  color: var(--primary-dark);
}

.topbar p {
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}

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

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 25px rgba(107, 63, 31, 0.25);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-light {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-light:hover {
  background: var(--surface-2);
}

.grid {
  display: grid;
  gap: 20px;
}

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

.card {
  background: rgba(255, 253, 246, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 213, 189, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 130px;
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  right: -34px;
  bottom: -38px;
  background: rgba(31, 122, 77, 0.1);
}

.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  margin-top: 12px;
  font-size: 28px;
  font-weight: 900;
  color: var(--primary-dark);
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

.content-grid {
  grid-template-columns: 1.35fr 0.65fr;
  align-items: start;
}

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

.section-title h3 {
  font-size: 18px;
  color: var(--primary-dark);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 800;
  font-size: 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}

td strong {
  color: var(--primary-dark);
}

.status {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.paid {
  background: #ddf7ea;
  color: #166534;
}

.cash {
  background: #e8f1ff;
  color: #1d4ed8;
}

.credit {
  background: #fff3cd;
  color: #92400e;
}

.danger {
  background: #fee2e2;
  color: #991b1b;
}

.form-card {
  display: grid;
  gap: 0;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fffaf0;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  outline: none;
  font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(107, 63, 31, 0.1);
}

input[readonly] {
  background: var(--surface-2);
  cursor: default;
}

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

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

.mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mini-item strong {
  color: var(--primary-dark);
}

.mini-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.cash-closing {
  grid-template-columns: 0.8fr 1.2fr;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}

.summary-row span:first-child {
  color: var(--muted);
}

.summary-row:last-child {
  border-bottom: 0;
}

.difference {
  font-size: 22px;
  font-weight: 900;
}

footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 1120px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .cash-closing {
    grid-template-columns: 1fr;
  }
}

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

  aside {
    position: relative;
    height: auto;
    padding: 18px 16px;
  }

  .brand {
    margin-bottom: 18px;
  }

  nav {
    gap: 6px;
  }

  .nav-link {
    padding: 11px 12px;
    min-height: 44px;
    border-radius: 12px;
  }

  .sidebar-card {
    margin-top: 16px;
    padding: 14px;
  }

  main {
    padding: 16px;
  }

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

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .top-actions .btn {
    min-height: 42px;
  }

  .card {
    padding: 16px;
  }

  .section-title {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .value {
    font-size: 24px;
  }

  .stats,
  .two-col {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 520px;
  }
}

@media (max-width: 560px) {
  aside {
    padding: 14px 12px;
  }

  .brand-logo,
  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .nav-link {
    font-size: 13px;
    gap: 10px;
  }

  main {
    padding: 12px;
  }

  .topbar h2 {
    font-size: 28px;
    letter-spacing: -0.8px;
  }

  .top-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .pill {
    font-size: 11px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 12px;
  }

  table {
    min-width: 460px;
  }

  .inline-form {
    flex-wrap: wrap;
  }
}