:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-soft: #f3ece4;
  --line: #e6ddd3;
  --text: #451a03;
  --muted: #7c5a43;
  --primary: #b45309;
  --primary-deep: #92400e;
  --accent: #059669;
  --warning: #b91c1c;
  --shadow: 0 10px 30px rgba(91, 55, 22, 0.06);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
}

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(180, 83, 9, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf7f2 0%, #f5eee6 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  background: #f7efe5;
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-block h1,
.page-header h2,
.panel-head h3,
.auth-intro h1 {
  margin: 0;
}

.brand-kicker,
.page-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.brand-copy,
.panel-head p,
.stat-card small,
.empty-state p,
.action-card span,
.info-list p,
.table-title small,
.detail-number,
.sidebar-note span,
.user-chip small,
.auth-intro p:last-child {
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: var(--surface);
  border-color: var(--line);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
}

.sidebar-note strong {
  display: block;
  margin-top: 6px;
}

.main-content {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.page-header {
  padding-bottom: 8px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.stats-grid,
.content-grid,
.form-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

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

.content-grid,
.form-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
}

.detail-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.detail-main,
.detail-side {
  display: grid;
  gap: 18px;
}

.panel,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.stat-card {
  padding: 20px;
  display: grid;
  gap: 8px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.94rem;
}

.stat-card strong {
  font-size: 1.8rem;
  line-height: 1.1;
}

.stat-card.emphasis {
  border-color: rgba(5, 150, 105, 0.22);
}

.stat-card.warning {
  border-color: rgba(185, 28, 28, 0.18);
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.stacked-mobile {
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
  background: var(--surface);
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-deep);
}

.button.secondary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.button.secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.subtle {
  background: var(--surface-soft);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
}

.text-link {
  color: var(--primary);
  font-weight: 700;
}

.text-link:hover {
  text-decoration: underline;
}

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

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

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

thead th {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-title {
  display: grid;
  gap: 4px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-badge.open {
  background: #fff2e2;
  color: var(--primary-deep);
  border-color: #f2d3b0;
}

.status-badge.partial {
  background: #fef3c7;
  color: #854d0e;
  border-color: #f5d481;
}

.status-badge.paid {
  background: #dcfce7;
  color: #166534;
  border-color: #a7f3c0;
}

.status-badge.large {
  min-height: 42px;
  padding-inline: 14px;
}

.action-list,
.info-list {
  display: grid;
  gap: 12px;
}

.action-card,
.info-list > div,
.description-box,
.summary-strip > div {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.action-card {
  display: grid;
  gap: 6px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fcfaf7;
  display: grid;
  gap: 8px;
  justify-items: start;
}

.empty-state.slim {
  padding: 22px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-stack label {
  display: grid;
  gap: 8px;
}

.form-stack span {
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d8cabd;
  background: white;
  border-radius: 10px;
  padding: 12px 13px;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(180, 83, 9, 0.18);
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.split-fields,
.summary-strip,
.filter-row,
.form-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.split-fields label {
  flex: 1 1 220px;
}

.filter-chip {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-weight: 700;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.alert.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--warning);
}

.alert.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.summary-strip {
  margin-top: 18px;
}

.summary-strip > div {
  flex: 1 1 160px;
}

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

.summary-strip strong {
  font-size: 1.2rem;
}

.description-box {
  line-height: 1.6;
  white-space: pre-wrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.user-chip strong,
.user-chip small {
  display: block;
}

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

.auth-panel {
  width: min(100%, 440px);
  padding: 28px;
  border-radius: 18px;
  border: 1px solid rgba(140, 103, 72, 0.18);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 60px rgba(86, 52, 24, 0.08);
}

.auth-panel.wide {
  width: min(100%, 720px);
}

.auth-intro {
  margin-bottom: 20px;
}

.auth-submit {
  width: 100%;
}

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

  .content-grid,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    gap: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-content {
    padding: 20px 16px 28px;
  }

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

  .stacked-mobile,
  .panel-head,
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

