/* PDHC Design System — aligned with sso.pdhc.se */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --code-bg: #f1f5f9;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 12px;
}

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

/* Navbar */
nav {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  color: white;
}
.brand:hover { color: white; text-decoration: none; }
.nav-links { display: flex; gap: 0.75rem; align-items: center; list-style: none; }
.nav-links a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.92em;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.15); text-decoration: none; }
.nav-links a.active { background: rgba(255,255,255,0.2); }
.nav-separator { width: 1px; height: 1rem; background: rgba(255,255,255,0.3); }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 1.25rem 1.25rem 2.5rem; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1.25rem 2.5rem; }

/* Headings */
h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text); }
h1 + .lead { color: var(--text-muted); font-size: 1em; margin-bottom: 1rem; }
h2 { font-size: 1.1rem; font-weight: 700; margin-top: 0.2rem; margin-bottom: 0.5rem; color: var(--text); }
h3 { font-size: 1rem; font-weight: 600; margin-top: 0; margin-bottom: 0.4rem; color: var(--text); }

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card h2 { margin-top: 0; }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.9rem;
  border: none;
  border-radius: 5px;
  font-size: 0.92em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
  line-height: 1.4;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; text-decoration: none; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; text-decoration: none; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; text-decoration: none; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; color: white; text-decoration: none; }
.btn-sm { padding: 0.2rem 0.6rem; font-size: 0.85em; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 1em; }
th {
  background: var(--code-bg);
  font-weight: 600;
  font-size: 0.92em;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
tr:hover { background: var(--bg); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.85em;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }

/* Forms */
.form-group { margin-bottom: 0.75rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.15rem;
  font-size: 0.92em;
}
.form-control {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 1em;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
select.form-control { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Flash messages */
.flash { padding: 0.5rem 0.75rem; border-radius: 5px; margin-bottom: 0.75rem; font-size: 1em; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Dashboard cards grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem;
}
.dash-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.dash-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37,99,235,0.1);
  text-decoration: none;
  color: inherit;
}
.dash-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.dash-card .count { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: 0.2rem; }
.dash-card p { font-size: 0.92em; color: var(--text-muted); line-height: 1.4; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Pagination */
.pagination {
  display: flex; gap: 0.2rem; list-style: none;
  margin-top: 1rem; justify-content: center;
}
.pagination a, .pagination span {
  padding: 0.2rem 0.6rem; border-radius: 5px;
  font-size: 0.92em; border: 1px solid var(--border);
  color: var(--text-muted); text-decoration: none;
}
.pagination a:hover { background: var(--code-bg); border-color: var(--primary); text-decoration: none; }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* Detail view */
.detail-grid { display: grid; grid-template-columns: 8rem 1fr; gap: 0.3rem 0.75rem; font-size: 1em; }
.detail-label { font-weight: 600; color: var(--text-muted); }
.detail-value { color: var(--text); }

/* Empty state */
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.empty-state p { margin-bottom: 0.75rem; }

/* Section divider */
hr.section-break { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* Utility: typography */
.section-heading { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.monospace { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.9em; }
.text-muted { color: var(--text-muted); }
.lead { color: var(--text-muted); font-size: 1em; }
.text-center { text-align: center; }
code {
  background: var(--code-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Utility: spacing */
.mt-1 { margin-top: 0.4rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-4 { margin-top: 0.75rem; }
.mt-6 { margin-top: 1.25rem; }
.mt-8 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.4rem; }
.mb-2 { margin-bottom: 0.75rem; }

/* Utility: layout */
.button-group { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.button-group-sm { display: flex; gap: 0.4rem; }
.inline-form { display: flex; gap: 0.4rem; align-items: end; margin-top: 0.75rem; }
.inline-form .form-group { flex: 1; margin-bottom: 0; }
.section-divider { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

/* Icons (Lucide) */
i[data-lucide] { width: 1rem; height: 1rem; stroke-width: 1.5; }
.btn i[data-lucide] { width: 0.85rem; height: 0.85rem; }
.dash-card i[data-lucide] { width: 1.5rem; height: 1.5rem; color: var(--primary); margin-bottom: 0.4rem; }

/* Sort order input in tables */
td .form-control { width: 4rem; padding: 0.2rem 0.4rem; font-size: 0.92em; }

/* Responsive */
@media (max-width: 768px) {
  .form-row, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  nav { flex-direction: column; gap: 0.4rem; }
  .container, .container-wide { padding: 0.75rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
