:root {
  --primary: #C75B2B;
  --primary-dark: #A04520;
  --primary-light: #F4E4D8;
  --accent: #D4A853;
  --bg: #FAF7F4;
  --surface: #FFFFFF;
  --surface-2: #F5F0EB;
  --text: #1C1410;
  --text-muted: #7A6A5A;
  --border: #E8DDD4;
  --success: #2D7A4F;
  --warning: #B5870A;
  --danger: #C0392B;
  --info: #1A6B8A;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 24px rgba(28,20,16,0.08);
  --shadow-lg: 0 16px 40px rgba(28,20,16,0.12);
  --radius: 16px;
  --radius-sm: 8px;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-heading); color: var(--text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.page-title { font-family: var(--font-heading); font-size: 1.6rem; margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }

.card { background: var(--surface); border: 1px solid rgba(232, 221, 212, 0.6); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(232, 221, 212, 0.5); }
.card-title { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 600; }
.card + .card { margin-top: 24px; }
.stat-card { display: flex; align-items: center; gap: 16px; }
.stat-card .stat-icon { width: 52px; height: 52px; border-radius: var(--radius-sm); background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 600; line-height: 1; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 100px; font-size: 0.88rem; font-weight: 600; font-family: var(--font-body); border: 1px solid transparent; cursor: pointer; transition: all 0.25s ease; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 12px rgba(199, 91, 43, 0.2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(199, 91, 43, 0.3); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.btn-secondary:hover { background: var(--surface-2); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn-ghost:hover { background: var(--primary-light); }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.95rem; background: rgba(255,255,255,0.8); color: var(--text); transition: all 0.2s ease; box-shadow: inset 0 1px 2px rgba(0,0,0,0.01); }
.form-control:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(199, 91, 43, 0.1); }
textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237A6A5A' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section-title { font-family: var(--font-heading); font-size: 1rem; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 16px; margin-top: 8px; }

.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.table thead tr { background: rgba(245, 240, 235, 0.6); backdrop-filter: blur(4px); }
.table th { padding: 14px 16px; text-align: left; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background 0.2s; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(245, 240, 235, 0.4); }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 500; }
.badge-success { background: #D4EDDA; color: var(--success); }
.badge-warning { background: #FFF3CD; color: var(--warning); }
.badge-danger { background: #FDDEDE; color: var(--danger); }
.badge-info { background: #D1ECF1; color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }

.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.88rem; border-left: 4px solid; position: relative; }
.alert-success { background: #D4EDDA; border-color: var(--success); color: #1a5c35; }
.alert-danger { background: #FDDEDE; border-color: var(--danger); color: #7a1515; }
.alert-warning { background: #FFF3CD; border-color: var(--warning); color: #6b4e00; }
.alert-info { background: #D1ECF1; border-color: var(--info); color: #0d3f52; }
.alert-close { position: absolute; right: 12px; top: 12px; background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.6; line-height: 1; }
.alert-close:hover { opacity: 1; }

.pagination-wrapper { display: flex; justify-content: center; padding: 20px 0; }
.pagination { display: flex; gap: 4px; list-style: none; align-items: center; }
.pagination li a, .pagination li span { display: flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 0.85rem; color: var(--text); background: var(--surface); }
.pagination li.active a, .pagination li.active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination li a:hover { background: var(--primary-light); border-color: var(--primary); text-decoration: none; }

.notif-bell { position: relative; cursor: pointer; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 0.65rem; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 10px); width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 1000; display: none; }
.notif-dropdown.open { display: block; }
.notif-dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 0.9rem; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.83rem; display: flex; gap: 10px; }
.notif-item.unread { background: var(--primary-light); border-left: 3px solid var(--primary); }
.notif-item:last-child { border-bottom: none; }
.notif-dropdown-footer { padding: 10px 16px; text-align: center; font-size: 0.82rem; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--primary); font-size: 0.9rem; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { font-family: var(--font-heading); font-size: 1.5rem; color: var(--primary); }
.auth-logo p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.auth-title { font-family: var(--font-heading); font-size: 1.25rem; margin-bottom: 4px; }
.auth-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 24px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state p { margin-top: 8px; font-size: 0.88rem; }

.app-wrapper { display: flex; min-height: 100vh; }
.sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-width); height: 100vh; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; z-index: 100; display: flex; flex-direction: column; }
.sidebar-logo { padding: 20px 24px; font-family: var(--font-heading); font-size: 1.25rem; color: var(--primary); font-weight: 600; border-bottom: 1px solid var(--border); }
.sidebar-nav { list-style: none; padding: 16px 12px; flex-grow: 1; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: var(--radius-sm); color: var(--text); transition: all 0.15s; }
.sidebar-nav a:hover { background: var(--primary-light); text-decoration: none; }
.sidebar-nav a.active { background: var(--primary-light); color: var(--primary); border-left: 3px solid var(--primary); font-weight: 500; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.main-content { margin-left: var(--sidebar-width); flex-grow: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; height: var(--topbar-height); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 24px; z-index: 90; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.page-content { padding: 28px 24px; flex-grow: 1; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }
  .main-content { margin-left: 0; }
  .topbar { display: flex; }
  .hamburger { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-content { padding: 16px; }
  .notif-dropdown { width: 280px; right: -60px; }
  .auth-card { padding: 28px 20px; }
  .table th, .table td { padding: 10px 12px; }
}
@media (min-width: 769px) {
  .hamburger { display: none; }
  .topbar { display: flex; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .btn { padding: 8px 14px; }
}
