/* Shared styles for the panel, sign-up and webmail.
   Works from 320px phones up to large desktops; light and dark. */
:root {
  --brand: #1f6feb;
  --brand-fg: #ffffff;
  /* Text links and focus rings: fixed colours with enough contrast on every background we use.
     The brand colour is a reseller's choice, so it is only used for fills, with --brand-fg picked to suit it. */
  --link: #0550ae;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --fg: #1b1f24;
  --muted: #59636e;
  --line: #d1d9e0;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --radius: 10px;
  --nav-w: 232px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1117; --bg-soft: #151b23; --fg: #e6edf3; --muted: #9198a1; --line: #30363d;
          --ok: #3fb950; --warn: #d29922; --bad: #f85149; --link: #58a6ff; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body:not(.signed-in) .nav, body:not(.signed-in) .menu-btn { display: none; }
@media (min-width: 1024px) { body:not(.signed-in) main { margin-left: auto; margin-right: auto; } }
html, body { margin: 0; }
body { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg);
       -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Layout: sidebar on wide screens, top bar + slide-in menu on narrow ones */
.shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
          padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; color: var(--fg); border-bottom: 3px solid var(--brand); text-decoration: none; font-size: 1.1rem; white-space: nowrap;
                 overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.menu-btn { display: inline-flex; }
.nav { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(80vw, 280px); background: var(--bg-soft);
       border-right: 1px solid var(--line); padding: 16px 8px; transform: translateX(-100%); transition: transform .2s;
       overflow-y: auto; }
.nav.open { transform: none; }
.nav a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--fg); text-decoration: none; min-height: 44px; }
.nav a.active { background: var(--brand); color: var(--brand-fg); }
.nav .who { padding: 8px 12px 16px; font-size: .875rem; color: var(--muted); }
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35); display: none; }
.scrim.open { display: block; }
main { padding: 16px; max-width: 1200px; }
@media (min-width: 1024px) {
  .menu-btn { display: none; }
  .nav { transform: none; top: 57px; width: var(--nav-w); }
  .scrim { display: none !important; }
  main { margin-left: var(--nav-w); padding: 24px 32px; }
}

/* Controls */
button, .btn { font: inherit; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line);
               background: var(--bg); color: var(--fg); cursor: pointer; text-decoration: none; display: inline-flex;
               align-items: center; justify-content: center; gap: 6px; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { font: inherit; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 8px;
                          border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
input[type=checkbox] { width: auto; min-height: 0; transform: scale(1.3); margin-right: 8px; }
.check { display: flex; align-items: center; font-weight: 400; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Cards and lists */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card .num { font-size: 1.75rem; font-weight: 700; }
.card .label { color: var(--muted); font-size: .875rem; }
.panel { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }

/* Tables become stacked cards on phones */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
                border-bottom: 1px solid var(--line); padding: 8px; }
table.list td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--bg-soft); }
@media (max-width: 767px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 4px; }
  table.list td { border: 0; padding: 4px 10px; }
  table.list td::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted);
                          text-transform: uppercase; letter-spacing: .03em; }
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.bad { color: var(--bad); border-color: var(--bad); }
.notice { padding: 12px 16px; border-radius: 8px; margin: 12px 0; border: 1px solid var(--line); }
.notice.bad { border-color: var(--bad); color: var(--bad); }
.notice.ok { border-color: var(--ok); color: var(--ok); }
.notice.warn { border-color: var(--warn); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875rem; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px);
         background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 8px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--fg);
         width: min(560px, calc(100% - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 8px 0 12px; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; white-space: nowrap; }
.tabs button.active { border-bottom-color: var(--brand); font-weight: 600; }
.center-box { max-width: 480px; margin: 40px auto; padding: 0 16px; }

.notice .row { margin-top: 8px; }
.meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 8px 0; }
.meter > div { height: 100%; background: var(--ok); }
.meter > div.warn { background: var(--warn); }
.meter > div.bad { background: var(--bad); }

/* Robot trap on the sign-up form: off-screen, not display:none (robots skip those). */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* For screen readers only: on the page, not on the screen. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Long DNS names and values inside a dialog wrap instead of running off a phone screen. */
dialog p, dialog li { overflow-wrap: anywhere; }
