:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

* { 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);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; width: 100%; }

main.wrap { flex: 1; padding-top: 24px; padding-bottom: 48px; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 16px; }
.brand { font-weight: 800; font-size: 18px; color: var(--brand); text-decoration: none; letter-spacing: .2px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.nav a:hover { background: var(--bg); }
.nav a.active { color: var(--brand); font-weight: 600; background: #eef2ff; }
.nav a.muted { color: var(--muted); }
.nav .who { color: var(--muted); font-size: 13px; margin-left: 6px; }

.foot { color: var(--muted); font-size: 13px; padding-bottom: 24px; }
.foot p { margin: 0; }

h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 4px; }

.hero { padding: 32px 0 8px; text-align: center; }
.hero h1 { font-size: 34px; margin: 0 0 8px; }
.tagline { color: var(--muted); margin: 0 0 24px; }
.tagline code { color: var(--brand); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}
.card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.card-danger { border-color: #fecaca; background: #fff7f7; }

form label { display: block; margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--ink); }
label .opt { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="datetime-local"], input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 400;
  background: #fff;
}
input:focus { outline: 2px solid #c7d2fe; border-color: var(--brand); }
small { color: var(--muted); font-weight: 400; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row label { margin-bottom: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.4;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn-danger:hover { background: #fef2f2; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-file { margin: 0; }
.btn-file input[type="file"] { display: none; }

.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; margin: 0; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--ok); }
.flash-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--bad); }

.dashboard-top { display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 24px; }
.quota { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 280px; }
.quota-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 4px 0; }
.bar { background: #eef0f3; border-radius: 99px; height: 8px; overflow: hidden; margin-bottom: 10px; }
.bar-fill { background: var(--brand); height: 100%; border-radius: 99px; }

.project-list { display: flex; flex-direction: column; gap: 16px; }
.project-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.project-info { flex: 1; min-width: 240px; }
.project-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.project-actions form { margin: 0; }
.replace { display: inline-flex; }
.url { background: var(--bg); padding: 3px 8px; border-radius: 6px; font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stat-num { display: block; font-size: 26px; font-weight: 800; color: var(--brand); }
.stat-label { color: var(--muted); font-size: 14px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table .over { color: var(--bad); font-weight: 700; }
.table .admin-row { background: #f8f9ff; }

.pill { display: inline-block; background: #eef2ff; color: var(--brand); font-size: 11px; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.pill-muted { background: var(--bg); color: var(--muted); }
.pill-bad { background: #fef2f2; color: var(--bad); }

.inline-form { margin-bottom: 16px; }
.inline-form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.inline-form .btn { margin-top: 8px; }

hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.code-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.code-actions { display: flex; gap: 8px; margin-top: 12px; }
.code-actions form { margin: 0; }

details summary { cursor: pointer; color: var(--brand); font-size: 14px; margin-top: 10px; }
.edit-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

.center { text-align: center; }
.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
