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

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

:root {
  --bg:        #ffffff;
  --surface:   #f9fafb;
  --border:    #e5e7eb;
  --text:      #111827;
  --muted:     #6b7280;
  --subtle:    #9ca3af;
  --accent:    #111827;
  --accent-fg: #ffffff;
  --sidebar-w: 210px;
  --radius:    6px;
  --font:      'Inter', system-ui, sans-serif;
}

body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #fafafa; border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 2px;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto;
}
.sidebar-logo { font-size: 13px; font-weight: 700; letter-spacing: .05em; padding: 0 8px; margin-bottom: 16px; }
.sidebar-section { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); padding: 4px 8px; margin-top: 12px; }
.sidebar-link { display: block; padding: 7px 10px; font-size: 13px; color: var(--muted); border-radius: var(--radius); transition: background .1s, color .1s; }
.sidebar-link:hover { background: var(--border); color: var(--text); }
.sidebar-link.active { background: #f3f4f6; color: var(--text); font-weight: 500; }
.sidebar-user { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.sidebar-user-name { font-size: 13px; font-weight: 500; }
.sidebar-user-role { font-size: 11px; color: var(--subtle); }

.main { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; max-width: 1100px; }

/* ── Page header ────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.page-title { font-size: 18px; font-weight: 600; }
.page-subtitle { font-size: 12px; color: var(--subtle); margin-top: 2px; }

/* ── Buttons ────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; border: none; cursor: pointer; font-family: var(--font); transition: opacity .1s; }
.btn:hover { opacity: .85; }
.btn-primary   { background: var(--accent); color: var(--accent-fg); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-sm        { padding: 4px 10px; font-size: 12px; }

/* ── Badges ─────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-red    { background: #fee2e2; color: #dc2626; }

/* ── Tables ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 1px solid var(--border); }
th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--subtle); }
td { padding: 12px; vertical-align: middle; }
tbody tr { border-bottom: 1px solid #f9fafb; }
tbody tr:hover { background: #f9fafb; }
tbody tr:last-child { border-bottom: none; }
.td-main { font-weight: 500; }
.td-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Tabs ───────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab { padding: 10px 16px; font-size: 13px; color: var(--subtle); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .1s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 500; border-bottom-color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Filter tabs ────────────────────────── */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.filter-tab { padding: 4px 12px; font-size: 12px; border-radius: var(--radius); cursor: pointer; color: var(--muted); }
.filter-tab:hover { background: var(--surface); color: var(--text); }
.filter-tab.active { background: #f3f4f6; color: var(--text); font-weight: 500; }

/* ── Stats row ──────────────────────────── */
.stats-row { display: flex; gap: 32px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--subtle); }
.stat-value { font-size: 18px; font-weight: 600; margin-top: 2px; }
.stat-value.danger { color: #dc2626; }

/* ── Forms ──────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-family: var(--font); color: var(--text); background: var(--bg); transition: border-color .15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: #6b7280; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Modal ──────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg); border-radius: 10px; padding: 28px; width: 100%; max-width: 520px; box-shadow: 0 8px 40px rgba(0,0,0,.12); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Progress bar ───────────────────────── */
.progress-bar { background: #f3f4f6; border-radius: 20px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: #22c55e; border-radius: 20px; transition: width .3s; }

/* ── Misc ───────────────────────────────── */
.action-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.empty-state { text-align: center; padding: 48px 0; color: var(--subtle); font-size: 13px; }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error   { background: #fee2e2; color: #dc2626; }
.alert-success { background: #dcfce7; color: #15803d; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
