:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17211d;
  background: #f4f6f5;
  font-size: 16px;
  --line: #d9e1de;
  --muted: #5a6d65;
  --ink: #17211d;
  --accent: #176348;
  --accent-dark: #114b38;
  --panel: #ffffff;
  --sidebar: #13221d;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, .button-link {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 0.45rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .button-link:hover { background: var(--accent-dark); }
.secondary, .secondary-link { background: #fff; color: var(--accent); }
.secondary:hover, .secondary-link:hover { background: #eef4f1; }
:focus-visible { outline: 3px solid #b77a22; outline-offset: 3px; }
.skip { position: fixed; top: -6rem; left: 1rem; background: white; padding: 0.7rem; z-index: 20; }
.skip:focus { top: 0.5rem; }
.brand { font-weight: 800; color: inherit; text-decoration: none; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand span { font-size: 0.8rem; font-weight: 550; opacity: 0.7; margin-left: 0.35rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); }
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  padding: 1.5rem 1.1rem;
  background: var(--sidebar);
  color: #eef6f2;
}
.side-nav { display: grid; gap: 0.25rem; }
.side-nav a { color: #dbe8e2; text-decoration: none; padding: 0.72rem 0.8rem; border-radius: 0.45rem; font-weight: 600; }
.side-nav a:hover, .side-nav a:focus-visible { background: #203b32; color: #fff; }
.sidebar-footer { margin-top: auto; display: grid; gap: 0.8rem; color: #9fb5ac; font-size: 0.82rem; }
.sidebar-footer form, .row-actions form { margin: 0; }
.sidebar-footer button { width: 100%; background: transparent; color: #e8f1ed; border-color: #526d62; }
.app-main { min-width: 0; width: 100%; padding: clamp(1.25rem, 3vw, 2.5rem); }
.public-header { padding: 1rem clamp(1rem, 4vw, 3rem); background: white; border-bottom: 1px solid var(--line); }
.public-main { max-width: 74rem; margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); }
.auth { max-width: 29rem; margin: 2rem auto; background: white; padding: clamp(1.25rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: 0.75rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-size: 0.72rem; font-weight: 800; margin: 0 0 0.55rem; }
h1 { font-size: clamp(1.75rem, 3vw, 2.3rem); line-height: 1.15; margin: 0 0 0.55rem; letter-spacing: -0.025em; }
h2 { font-size: 1.1rem; margin: 0 0 0.85rem; }
.muted { color: var(--muted); line-height: 1.55; margin: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.85rem; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 0.65rem; padding: 1rem; display: grid; gap: 0.45rem; }
.metric span { color: var(--muted); font-size: 0.82rem; }
.metric strong { font-size: 1.7rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 0.7rem; padding: 1.35rem; margin-top: 1.25rem; }
.form-card { max-width: 42rem; }
.field { margin: 1rem 0; }
label { display: block; font-weight: 650; font-size: 0.9rem; }
input, select, textarea { width: 100%; min-width: 0; margin-top: 0.4rem; padding: 0.68rem 0.75rem; border: 1px solid #879a92; border-radius: 0.42rem; background: #fff; color: inherit; }
textarea { resize: vertical; }
.filter-bar { display: grid; grid-template-columns: minmax(14rem, 2fr) minmax(10rem, 1fr) minmax(10rem, 1fr) auto; align-items: end; gap: 0.75rem; background: #fff; border: 1px solid var(--line); border-radius: 0.65rem; padding: 1rem; margin-bottom: 1rem; }
.filter-bar button { min-height: 2.7rem; }
.action-row, .row-actions { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.row-actions button { padding: 0.45rem 0.65rem; font-size: 0.82rem; white-space: nowrap; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 0.65rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; vertical-align: top; padding: 0.8rem; border-bottom: 1px solid #e5ebe8; overflow-wrap: anywhere; }
th { background: #edf2ef; color: #344940; white-space: nowrap; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: 0; }
code { font-size: 0.8rem; }
.status { display: inline-flex; border-radius: 999px; padding: 0.2rem 0.48rem; background: #e9efec; font-size: 0.75rem; font-weight: 750; white-space: nowrap; }
.status-ready { background: #e1f3e9; color: #185a3d; }
.status-failed { background: #fde8e5; color: #8b2e22; }
.status-suspended { background: #f2ece3; color: #694b22; }
.tenant-table { min-width: 74rem; }
.tenant-table td:nth-child(1), .tenant-table td:nth-child(2) { min-width: 11rem; }
.tenant-table td:nth-child(3), .tenant-table td:nth-child(4) { min-width: 13rem; }
.tenant-table code { white-space: normal; overflow-wrap: anywhere; }
.tenant-table td:last-child { min-width: 10rem; }
.newsletter-table { min-width: 59rem; }
.newsletter-table td:nth-child(1) { min-width: 13rem; }
.newsletter-table td:nth-child(2) { min-width: 16rem; }
.newsletter-table td:nth-child(2), .newsletter-table td:nth-child(4), .newsletter-table td:last-child { white-space: nowrap; }
.newsletter-table button { white-space: nowrap; }
.messages { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.message { margin: 0; padding: 0.7rem 0.9rem; border-radius: 0.45rem; background: #edf3f0; }
.errorlist { list-style: none; background: #fff1ef; border-left: 3px solid #b43c2c; color: #87281e; padding: 0.7rem 1rem; line-height: 1.5; }
@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .app-sidebar { position: static; height: auto; padding: 0.9rem 1rem; gap: 0.8rem; }
  .side-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; }
  .side-nav a { white-space: nowrap; padding: 0.55rem 0.65rem; }
  .sidebar-footer { display: flex; justify-content: space-between; align-items: center; }
  .sidebar-footer button { width: auto; }
  .app-main { padding: 1rem; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head > .button-link { align-self: flex-start; }
  .filter-bar { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .auth { margin: 1rem auto; }
}
