:root {
  --ink: #17211b;
  --muted: #68766d;
  --paper: #f4f1e8;
  --card: #fffdf8;
  --line: #ddd9cd;
  --green: #2e704c;
  --green-dark: #1d5337;
  --lime: #dbe9aa;
  --red: #a83c31;
  --shadow: 0 18px 50px rgba(31, 49, 39, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.25rem, 5vw, 4.7rem); font-weight: 500; line-height: .98; letter-spacing: -.045em; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.9rem; font-weight: 500; letter-spacing: -.025em; }

.topbar { height: 76px; max-width: 1240px; margin: auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 10px; align-items: center; font-weight: 760; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50% 50% 45% 55%; color: #fff; background: var(--green-dark); font-family: Georgia, serif; }
.page-shell { max-width: 1240px; margin: auto; padding: 64px 28px 72px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); gap: 48px; align-items: end; margin-bottom: 48px; }
.hero h1 { max-width: 760px; margin-bottom: 18px; }
.eyebrow { margin-bottom: 12px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.monitor-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.monitor-card small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.4; }
.status-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #aaa; box-shadow: 0 0 0 6px rgba(120,120,120,.1); }
.status-live { background: #49a46d; box-shadow: 0 0 0 6px rgba(73,164,109,.12); }
.status-error { background: var(--red); box-shadow: 0 0 0 6px rgba(168,60,49,.12); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 24px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(255,255,255,.35); }
.stats article { padding: 22px 24px; border-right: 1px solid var(--line); }
.stats article:last-child { border: 0; }
.stats span { color: var(--muted); display: block; }
.stats span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stats strong { display: block; margin: 8px 0 2px; font-family: Georgia, serif; font-size: 2.1rem; font-weight: 500; }
.dashboard-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 24px; align-items: start; }
.panel { padding: 30px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.blacklist-panel { background: var(--green-dark); color: white; border: 0; }
.blacklist-panel .eyebrow { color: var(--lime); }
.blacklist-panel .muted { color: rgba(255,255,255,.7); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.panel-heading h2 { margin-bottom: 15px; }
.muted { color: var(--muted); line-height: 1.65; }
.count-pill { flex: none; padding: 7px 11px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: rgba(255,255,255,.82); font-size: .75rem; }
.inline-form { display: flex; gap: 10px; margin: 28px 0 18px; }
input { width: 100%; border: 1px solid #ccc9bd; border-radius: 11px; padding: 12px 14px; color: var(--ink); background: #fff; outline: 0; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: #72a688; box-shadow: 0 0 0 3px rgba(73,126,91,.13); }
.blacklist-panel input { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; }
.blacklist-panel input::placeholder { color: rgba(255,255,255,.5); }
.button { border: 0; border-radius: 11px; padding: 12px 17px; font-weight: 750; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-dark { background: var(--lime); color: #172719; }
.text-button { padding: 0; border: 0; color: var(--muted); background: none; cursor: pointer; font-weight: 650; text-decoration: none; }
.text-button:hover { color: var(--ink); }
.danger:hover { color: var(--red); }
.partner-form { display: grid; grid-template-columns: .75fr 1.25fr auto; gap: 10px; align-items: end; margin: 12px 0 28px; }
label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.field-help { display: block; margin-top: 7px; color: var(--muted); line-height: 1.45; }
.partner-list { border-top: 1px solid var(--line); }
.partner-row { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.avatar { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #e3ebdf; color: var(--green-dark); font-weight: 800; }
.partner-details { min-width: 0; flex: 1; }
.partner-details strong, .partner-details small { display: block; overflow: hidden; text-overflow: ellipsis; }
.partner-details small { margin-top: 3px; color: var(--muted); }
.row-actions { display: flex; gap: 12px; align-items: center; }
.empty-state { padding: 28px 8px 8px; color: var(--muted); text-align: center; line-height: 1.5; }
.notice { margin: 0 0 22px; padding: 13px 15px; border-radius: 11px; background: #e4ede5; color: #255438; font-size: .9rem; }
.notice-error { background: #f7e1dd; color: #843128; }
.notice-warning { background: #f3e8c8; color: #66531d; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 80% 15%, #dce7bc 0, transparent 30%), var(--paper); }
.auth-card { width: min(100%, 470px); padding: 36px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.auth-copy { margin: 48px 0 30px; }
.auth-copy h1 { font-size: 3rem; }
.auth-copy > p:last-child { color: var(--muted); line-height: 1.65; }
.stack { display: grid; gap: 17px; }
.stack .button { margin-top: 3px; }
.reset-signout { margin-top: 22px; text-align: center; }
.narrow-shell { width: min(100% - 40px, 580px); margin: 60px auto; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--muted); text-decoration: none; }
.edit-card h1 { font-size: 3rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 850px) {
  .hero, .dashboard-grid { grid-template-columns: 1fr; }
  .hero { gap: 24px; }
  .partner-form { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stats article { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats article:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 18px; }
  .page-shell { padding: 42px 18px 52px; }
  .panel, .auth-card { padding: 23px; }
  .inline-form { flex-direction: column; }
  .partner-row { align-items: start; }
  .row-actions { flex-direction: column; align-items: end; }
}
