:root {
  --blue-900: #1e3a5f;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --slate-900: #1e293b;
  --slate-600: #475569;
  --slate-400: #94a3b8;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--slate-50);
  color: var(--slate-900);
}

/* ─── Topbar ─────────────────────────────────────── */
.topbar {
  background: linear-gradient(90deg, var(--blue-900), var(--blue-600));
  color: white;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand-title { font-size: 17px; font-weight: 700; }
.brand-sub { font-size: 12px; opacity: 0.75; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.user-pill {
  background: rgba(255,255,255,0.12);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
}
.btn-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13px;
}
.btn-link:hover { color: white; text-decoration: underline; }

/* ─── Tabs ───────────────────────────────────────── */
.tabs { background: white; border-bottom: 1px solid var(--border); }
.tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
}
.tab {
  padding: 12px 20px;
  text-decoration: none;
  color: var(--slate-600);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--blue-600); }
.tab.active { color: var(--blue-600); border-bottom-color: var(--blue-500); }

/* ─── Container ──────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ─── Flash messages ─────────────────────────────── */
.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* ─── Page header ────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 20px; margin: 0; }

/* ─── Buttons ────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--blue-500); color: white; }
.btn-primary:hover { background: var(--blue-600); }
.btn-secondary { background: var(--slate-100); color: var(--slate-900); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ─── Cards / stat grid ──────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-card .label { font-size: 13px; color: var(--slate-600); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--slate-400); margin-top: 4px; }

/* ─── Tables ─────────────────────────────────────── */
.table-wrap { background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 16px; background: var(--slate-50); font-weight: 600; color: var(--slate-600); border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--slate-50); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.actions-cell { display: flex; gap: 8px; }

/* ─── Forms ──────────────────────────────────────── */
form { display: flex; flex-direction: column; gap: 4px; }
.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 700px;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 200px; }
label { font-size: 13px; font-weight: 600; color: var(--slate-600); margin-top: 12px; margin-bottom: 4px; }
input, select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
textarea { resize: vertical; min-height: 80px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* ─── Filters bar ────────────────────────────────── */
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 160px; }

/* ─── Login page ─────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-600));
}
.login-box {
  background: white;
  padding: 36px 32px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { font-size: 18px; margin: 8px 0 4px; }
.login-header p { font-size: 12px; color: var(--slate-400); margin: 0; }

/* ─── File list ──────────────────────────────────── */
.file-list { list-style: none; padding: 0; margin: 8px 0; }
.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--slate-50);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

/* ─── Empty state ────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--slate-400); }

/* ─── Inline forms (delete confirm) ──────────────── */
.inline-form { display: inline; }
