:root {
  --brand: #5e3653;
  --brand-dark: #241f2e;
  --brand-soft: #f6e9e6;
  --ochre: #c0b39f;
  --blush: #f3ded9;
  --bg: #fffcf7;
  --card: #ffffff;
  --text: #241f2e;
  --muted: #8a8194;
  --border: #ece3da;
  --ok: #2e7d32;
  --error: #c0392b;
  --radius: 12px;
}

* { box-sizing: border-box; }

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--brand);
}

body {
  margin: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, .section-title, .card h1, .brand-name {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 700;
}

.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.logo-login {
  display: block;
  height: 110px;
  margin: 0 auto 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(36, 31, 46, 0.06);
  text-align: center;
}

.card h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-weight: 700;
}

.card .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.card form { text-align: left; }

label {
  display: block;
  font-size: 0.85rem;
  margin: 14px 0 6px;
  color: var(--muted);
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  padding: 11px 16px;
  font-family: inherit;
}

button.primary {
  background: var(--brand);
  color: #fff;
  width: 100%;
  margin-top: 18px;
}

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

button.secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.msg {
  margin-top: 12px;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.msg.error { color: var(--error); }
.msg.ok { color: var(--ok); }

/* --- App shell --- */

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  color: var(--brand-dark);
  padding: 8px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.topbar-spacer { display: block; }

.topbar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
}

.topbar .brand-sub {
  font-size: 0.65rem;
  color: var(--ochre);
  font-weight: 600;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.topbar .logo {
  height: 42px;
  display: block;
  flex-shrink: 0;
}

.topbar button {
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 7px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
  justify-self: end;
}

.topbar button:hover { background: var(--border); }

@media (min-width: 640px) {
  .topbar .logo { height: 48px; }
}

@media (max-width: 480px) {
  .topbar { grid-template-columns: auto auto; padding: 12px 16px; }
  .topbar-spacer { display: none; }
  .topbar .logo { height: 40px; }
  .topbar .brand-sub { display: none; }
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--brand-dark);
  padding: 0 16px;
  overflow-x: auto;
}

.tabs a {
  padding: 12px 14px;
  text-decoration: none;
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tabs a:hover { color: #fff; }

.tabs a.active {
  color: #fff;
  border-bottom-color: var(--brand-soft);
}

.content {
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.section-title {
  font-size: 1.25rem;
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-weight: 700;
}

.section-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 16px;
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(36, 31, 46, 0.04);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .content { padding: 16px 12px 60px; }
  .card { padding: 32px 22px; max-width: 100%; }
  .logo-login { height: 80px; }
  .section-title { font-size: 1.1rem; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(36, 31, 46, 0.04);
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  white-space: normal;
  word-break: break-word;
}

th.nowrap, td.nowrap {
  white-space: nowrap;
}

th {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

tr:last-child td { border-bottom: none; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--ochre);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 12px rgba(36, 31, 46, 0.04);
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand);
  margin-top: 4px;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 24px;
  white-space: normal;
}
