:root {
  --ink: #19212a;
  --muted: #65717d;
  --line: #d9e0e7;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --blue: #145f7c;
  --green: #13795b;
  --red: #b42318;
  --amber: #b7791f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: #162631;
  color: white;
}
.admin-brand {
  color: white;
  font-size: 1.05rem;
  font-weight: 850;
  text-decoration: none;
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar a {
  color: #d8e7ee;
  border-radius: 6px;
  padding: 10px 12px;
  text-decoration: none;
  font-weight: 700;
}
.sidebar a:hover,
.sidebar a.current { background: rgba(255,255,255,.14); color: white; }
.public-link {
  border-top: 1px solid rgba(255,255,255,.14);
  color: #f3d59d;
}
.logout {
  margin-top: auto;
  width: 100%;
  background: rgba(255,255,255,.1);
  color: white;
  border: 1px solid rgba(255,255,255,.2);
}

.admin-main {
  margin-left: 244px;
  padding: 28px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 22px;
}
.page-header h1 { margin: 0; font-size: 2rem; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.metric span { color: var(--muted); font-weight: 750; }
.metric strong { display: block; margin-top: 8px; font-size: 2rem; }
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: .92rem;
}
th {
  color: var(--muted);
  background: #fbfcfd;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}
.empty { color: var(--muted); text-align: center; padding: 28px; }
.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: .78rem;
  font-weight: 850;
  background: #e9eef3;
  color: var(--muted);
}
.online,
.active,
.completed { background: #e3f4ed; color: var(--green); }
.offline,
.expired,
.failed { background: #fde7e5; color: var(--red); }
.pending,
.sent,
.new { background: #fff3d8; color: var(--amber); }

.toolbar-form,
.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  margin-bottom: 18px;
}
.inline-form {
  grid-template-columns: repeat(6, minmax(110px, 1fr)) auto auto;
  margin: 0;
}
input,
select,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}
.button-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-weight: 800;
}
.secondary-link {
  background: #eef3f6;
  color: var(--blue);
}
.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.muted { color: var(--muted); }
.error-text { color: var(--red); font-weight: 800; }
.wide-table {
  min-width: 1240px;
}
button {
  border: 0;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-weight: 800;
}
.danger-button {
  background: var(--red);
}
.check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.check input { min-height: auto; width: auto; }
.field-with-help {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-weight: 750;
}
.field-with-help small {
  color: var(--muted);
  font-weight: 650;
}
.edit-row td { background: #fbfcfd; }
.mini-form {
  display: grid;
  gap: 8px;
  min-width: 180px;
}
.mini-form textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.login-panel h1 { margin: 0 0 8px; }
.login-panel p { color: var(--muted); line-height: 1.5; }
.login-panel label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: var(--muted);
  font-weight: 750;
}
.login-panel button { width: 100%; margin-top: 8px; }
.alert {
  background: #fde7e5;
  color: var(--red);
  border-radius: 6px;
  padding: 10px;
  font-weight: 750;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }
  .admin-main { margin-left: 0; padding: 18px; }
  .metric-grid,
  .two-column,
  .toolbar-form,
  .inline-form { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}
