:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --border: #e2e0d8;
  --text: #1a1916;
  --text-muted: #6b6960;
  --accent: #2d6a4f;
  --accent-light: #e8f4ef;
  --accent-hover: #235c43;
  --danger: #c0392b;
  --warning: #e67e22;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --font: 'DM Sans', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- AUTH PAGE ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 28px;
  display: block;
  letter-spacing: -0.5px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-card p.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 12px;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); text-decoration: none; }

.btn-danger {
  background: #fdf0ef;
  color: var(--danger);
  border: 1px solid #f5c6c3;
}
.btn-danger:hover { background: #f9dede; text-decoration: none; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}
.alert-error { background: #fdf0ef; color: var(--danger); border: 1px solid #f5c6c3; }
.alert-success { background: var(--accent-light); color: var(--accent); border: 1px solid #b7dccb; }

/* ---- LAYOUT APP ---- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  padding: 0 8px 20px;
  letter-spacing: -0.5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.nav-link:hover, .nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}

.nav-link .icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -1px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-positive { color: var(--accent); }
.stat-negative { color: var(--danger); }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ---- BADGE ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green { background: var(--accent-light); color: var(--accent); }
.badge-orange { background: #fef3e8; color: var(--warning); }
.badge-red { background: #fdf0ef; color: var(--danger); }
.badge-gray { background: var(--surface-2); color: var(--text-muted); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .app-layout { flex-direction: column; }
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');