:root {
  --ink: #1b2630;
  --muted: #5f6f7d;
  --line: #d9e2e8;
  --panel: #fff;
  --page: #f2f6f7;
  --teal: #147c80;
  --teal-dark: #0c5e62;
  --red: #b13b38;
  --green: #2f7a48;
  --gold: #94680e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}
a { color: var(--teal-dark); font-weight: 700; }
.shell { width: min(1380px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0; }
.narrow { width: min(760px, calc(100% - 32px)); }
.login-shell { width: min(1040px, calc(100% - 32px)); }
.security-banner {
  padding: 9px 16px;
  background: #0b1f28;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 8px;
  background: #12313b;
  color: #fff;
}
.official-topbar { margin-bottom: 20px; }
.topbar p { color: #d2e4e8; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 4vw, 2.7rem); }
h2 { font-size: 1.08rem; }
h3 { margin-bottom: 6px; font-size: .95rem; }
.brand-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}
.brand-logo {
  flex: 0 0 auto;
  max-width: 132px;
  max-height: 72px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,.12);
}
.panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.login-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.login-card {
  border-top: 4px solid var(--teal);
}
.login-card-header {
  margin-bottom: 16px;
}
.login-fields {
  display: grid;
  gap: 14px;
}
.official-stack {
  display: grid;
  gap: 18px;
}
.backend-notice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.notice-panel {
  border-left: 4px solid var(--teal);
}
.notice-panel p {
  margin-bottom: 0;
  color: #41525f;
  line-height: 1.55;
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
label { display: grid; gap: 7px; font-size: .9rem; font-weight: 700; }
input, select, textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid #bdcbd2;
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
}
textarea { resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}
.button.secondary, button.secondary { border: 1px solid #b8c8cf; background: #fff; color: var(--ink); }
.button.danger, button.danger { border: 1px solid #e1b8b7; background: #fff; color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.compact-actions { margin-top: 0; }
.branding-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.logo-preview-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.logo-preview {
  max-width: 180px;
  max-height: 96px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  width: auto;
  gap: 8px;
}
.inline-check input {
  min-height: auto;
  width: auto;
}
.inline-edit {
  display: grid;
  min-width: 220px;
  gap: 8px;
}
.inline-edit textarea {
  min-height: 74px;
}
.inline-edit button {
  justify-self: start;
}
.account-notes {
  min-width: 320px;
}
.section-heading {
  margin-bottom: 12px;
}
.section-heading p {
  margin-bottom: 0;
}
.accounts-list {
  display: grid;
  gap: 14px;
}
.account-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) auto;
  align-items: end;
  gap: 14px;
}
.account-picker .actions {
  margin-top: 0;
}
.account-results {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.account-results-scroll {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.result-summary {
  color: var(--muted);
  font-size: .9rem;
}
.account-directory {
  min-width: 860px;
}
.account-directory th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbfc;
}
.account-directory tr.selected-row td {
  background: #eefafa;
}
.account-directory td:last-child,
.account-directory th:last-child {
  width: 110px;
  text-align: right;
}
.account-empty-state {
  margin-bottom: 0;
}
.account-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.account-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.account-card-header h3 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}
.account-card-header p {
  margin-bottom: 0;
  color: var(--muted);
}
.account-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.account-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8fbfc;
  color: #41525f;
  font-size: .82rem;
  font-weight: 700;
}
.account-card-body {
  display: grid;
  grid-template-columns: minmax(360px, 1.35fr) minmax(300px, .85fr);
  gap: 18px;
  padding: 20px;
}
.account-section {
  min-width: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.account-section:first-child {
  grid-row: span 2;
}
.account-section h4 {
  margin: 0 0 12px;
  color: #41525f;
  font-size: .82rem;
  text-transform: uppercase;
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.account-actions form {
  display: inline-flex;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 24, 31, .58);
}
.modal-backdrop[hidden] {
  display: none;
}
.modal {
  width: min(460px, 100%);
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 22px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .24);
}
.modal p {
  line-height: 1.45;
}
.message { margin: 0 0 14px; padding: 12px; border-radius: 8px; background: #fff8e8; color: var(--gold); font-weight: 700; }
.message.success { background: #eaf7ee; color: var(--green); }
.message.error { background: #fff1f1; color: var(--red); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
table.owner-table { min-width: 620px; }
.table-wrap { overflow-x: auto; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 9px; text-align: left; vertical-align: top; }
th { color: #41525f; font-size: .78rem; text-transform: uppercase; }
.status { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: .82rem; font-weight: 700; }
.status.current { background: #e4f5ea; color: var(--green); }
.status.soon { background: #fff4d8; color: var(--gold); }
.status.expired { background: #ffe8e7; color: var(--red); }
.muted { color: var(--muted); }
.wide { grid-column: 1 / -1; }
.log-view {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #111c22;
  color: #d7edf0;
  font-size: .86rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
code {
  font-family: Consolas, Monaco, monospace;
}
@media (max-width: 820px) {
  .grid, .admin-grid, .login-layout, .backend-notice-grid, .account-card-body, .account-picker { grid-template-columns: 1fr; }
  .account-card-header { flex-direction: column; }
  .account-meta { justify-content: flex-start; }
  .topbar { align-items: stretch; flex-direction: column; }
  .brand-heading { align-items: flex-start; flex-direction: column; }
}
