:root {
  --primary: #128C7E;
  --primary-dark: #075E54;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #667085;
  --border: #e4e7eb;
  --danger: #e5484d;
  --success: #12b76a;
  --warning: #f79009;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--card);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  width: 340px;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p { color: var(--muted); font-size: 13px; margin-top: 0; }
input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  background: #fff;
}
button.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
button.btn:hover { background: var(--primary-dark); }
button.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
button.btn.danger { background: var(--danger); }
.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 8px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--primary-dark);
  color: #fff;
  padding: 20px 0;
  flex-shrink: 0;
}
.sidebar h2 { padding: 0 20px; font-size: 16px; margin-bottom: 24px; }
.sidebar a {
  display: block;
  padding: 12px 20px;
  color: #d7f3ee;
  text-decoration: none;
  font-size: 14px;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.main { flex: 1; padding: 28px 32px; }
.main h1 { margin-top: 0; font-size: 22px; }

.cards-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border-radius: 10px;
  padding: 18px 20px;
  min-width: 180px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: #fafafa; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; }
tr:last-child td { border-bottom: none; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.paid, .badge.completed { background: #d1fadf; color: #067647; }
.badge.draft, .badge.waiting_payment { background: #fef0c7; color: #b54708; }
.badge.cash_pending { background: #e0e7ff; color: #3730a3; }
.badge.cancelled, .badge.expired { background: #fee4e2; color: #b42318; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { margin-bottom: 0; width: auto; min-width: 160px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: 12px; padding: 24px; width: 420px; max-width: 92vw;
  max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.hidden { display: none !important; }
.top-right { margin-left: auto; }
.small-muted { color: var(--muted); font-size: 12px; }
