:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #6b7280;
  --line: #e3e6eb;
  --brand: #c8102e;        /* Budget red */
  --brand-ink: #ffffff;
  --primary: #0b5fff;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- nav ---- */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--brand); color: var(--brand-ink);
  padding: 0.75rem 1.25rem;
}
.brand { color: var(--brand-ink); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-link, .nav-right a { color: var(--brand-ink); text-decoration: none; opacity: 0.95; }
.nav-link:hover { text-decoration: underline; }
.nav-user { font-size: 0.9rem; opacity: 0.95; }
.inline-form { display: inline; margin: 0; }
.link-button {
  background: none; border: 1px solid rgba(255,255,255,0.6); color: #fff;
  padding: 0.25rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.link-button:hover { background: rgba(255,255,255,0.15); }

/* ---- layout ---- */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; flex: 1; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin: 0 0 0.25rem; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.lead { font-size: 1.1rem; }

.site-footer { text-align: center; padding: 1rem; color: var(--muted); font-size: 0.85rem; }

/* ---- tiles ---- */
.tile-section { margin-bottom: 2rem; }
.section-title { font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; text-decoration: none; color: var(--ink);
  transition: box-shadow 0.15s, transform 0.15s;
}
.tile:hover { box-shadow: 0 6px 20px rgba(15,23,42,0.10); transform: translateY(-2px); }
.tile-icon { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.tile-icon--letter { display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; font-size: 1.2rem; }
.tile-title { font-weight: 600; }
.tile-desc { font-size: 0.85rem; color: var(--muted); }

/* ---- login ---- */
.login-card, .error-card {
  max-width: 420px; margin: 3rem auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem;
}
.login-card h1 { font-size: 1.3rem; margin-top: 0; }
.btn-block { display: block; width: 100%; text-align: center; }
.breakglass { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.breakglass summary { cursor: pointer; color: var(--muted); }

/* ---- forms ---- */
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.form-wide { max-width: 560px; }
label { display: block; font-weight: 600; font-size: 0.9rem; }
input, select { width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.95rem; margin-top: 0.3rem; font-weight: 400; }
label small { font-weight: 400; display: block; margin-top: 0.25rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }

/* ---- buttons ---- */
.btn { display: inline-block; padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid transparent; text-decoration: none; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #eef1f5; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ---- alerts / badges ---- */
.alert { padding: 0.7rem 0.9rem; border-radius: 8px; margin: 1rem 0; font-size: 0.9rem; }
.alert-error { background: #fdeaea; color: var(--danger); border: 1px solid #f3c0c0; }
.alert-warn { background: #fdf5e6; color: var(--warn); border: 1px solid #f0dcb0; }
.alert-info { background: #eaf1fd; color: var(--primary); border: 1px solid #c2d6f7; }
.badge { background: #eef1f5; border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.75rem; }
.badge-warn { background: var(--warn); color: #fff; border: none; }

/* ---- admin ---- */
.admin-layout { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; }
.admin-side { display: flex; flex-direction: column; gap: 0.4rem; }
.admin-nav { padding: 0.5rem 0.75rem; border-radius: 8px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--card); }
.admin-nav.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.table th { background: #f0f2f5; }
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 0.4rem; align-items: center; }
.stack pre.stack, pre.stack { background: #f0f2f5; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: 0.8rem; }

@media (max-width: 700px) {
  .admin-layout { grid-template-columns: 1fr; }
}
