:root {
  --bg: #eef2f5;
  --paper: #fbfcfd;
  --panel: #ffffff;
  --nav: #071015;
  --nav-2: #0d1c24;
  --text: #172026;
  --muted: #63717d;
  --quiet: #8a98a4;
  --line: #cfd8df;
  --line-strong: #aebac4;
  --blue: #0069a8;
  --blue-dark: #003f66;
  --cyan: #00a9df;
  --green: #00a36c;
  --red: #a83a32;
  --shadow: 0 18px 42px rgba(21, 36, 46, .09);
  font-family: Rubik, "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(7, 16, 21, .04) 1px, transparent 1px),
    linear-gradient(rgba(7, 16, 21, .035) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--text);
}

a { color: var(--blue-dark); font-weight: 700; text-decoration: none; }
a:hover { text-decoration: underline; }

button, .button, input, select, textarea { font: inherit; }

button, .button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 700;
}

button:hover, .button:hover, input[type="submit"]:hover { border-color: var(--blue); text-decoration: none; }

.primary, input.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.primary:hover, input.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.danger-button, .danger-link, button.danger, .button.danger, input.blocked {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

input.blocked {
  opacity: 1;
  cursor: not-allowed;
}

.shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

aside {
  background: linear-gradient(180deg, rgba(0, 169, 223, .12), transparent 260px), var(--nav);
  color: #dce8ef;
  padding: 18px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-right: 4px solid var(--cyan);
}

.brand {
  display: block;
  width: fit-content;
  background: #fff;
  border-radius: 4px;
  padding: 9px 10px;
  margin: 2px 4px 28px;
}

.brand img, .login-brand img { display: block; width: 172px; max-width: 100%; height: auto; }

nav {
  display: grid;
  align-content: start;
  gap: 5px;
  border-top: 1px solid rgba(220, 232, 239, .18);
  padding-top: 14px;
}

nav a, .session span {
  color: #dbe8f0;
  padding: 10px 11px;
  border-left: 3px solid transparent;
  font-size: 14px;
}

.nav-section {
  color: #7fb2cb;
  font-size: 11px;
  font-weight: 900;
  margin: 16px 11px 4px;
  text-transform: uppercase;
}

nav a:hover {
  background: var(--nav-2);
  border-left-color: var(--cyan);
  text-decoration: none;
}

.session {
  display: grid;
  gap: 8px;
  color: #9db3c1;
  font-size: 13px;
  border-top: 1px solid rgba(220, 232, 239, .18);
  padding-top: 14px;
}

main { min-width: 0; padding: 34px; max-width: 1280px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  max-width: none;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(0, 105, 168, .22), transparent 40%),
    linear-gradient(315deg, rgba(0, 163, 108, .18), transparent 35%),
    var(--nav);
}

.login-panel {
  width: min(450px, 100%);
  background: var(--paper);
  border: 1px solid #fff;
  border-top: 5px solid var(--cyan);
  border-radius: 4px;
  padding: 30px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

.login-brand {
  display: inline-block;
  background: #fff;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 24px;
}

h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.1; letter-spacing: 0; }
h2 { margin: 0 0 14px; font-size: 18px; line-height: 1.2; }
p { color: var(--muted); }

.alert, .notice {
  background: #fff4f2;
  border: 1px solid #e6b4ad;
  border-left: 4px solid var(--red);
  color: #7f2922;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 0 0 18px;
}

.notice { background: #eefaf4; border-color: #b9dfcd; border-left-color: var(--green); color: #23563d; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  border-bottom: 3px solid var(--text);
  padding-bottom: 18px;
}

.head-actions, .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.stats, .grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: start;
}

.stats div, .stats .stat-link {
  grid-column: span 3;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 4px;
  padding: 15px;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.stats .stat-link.active { border-left-color: var(--red); }

.stats span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.stats strong { display: block; margin-top: 8px; color: var(--text); font-size: 30px; }

.panel, .table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px;
  background: #fbfcfd;
}

.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td span { display: block; color: var(--muted); margin-top: 3px; font-weight: 400; }

dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 18px; margin: 0; }
dt { color: var(--muted); font-weight: 800; }
dd { margin: 0; }

.pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  color: #073b2a;
  background: #dff4ec;
  font-weight: 800;
  font-size: 12px;
}

.pill.success { background: #dff4ec; color: #073b2a; }
.pill.warning { background: #fff3cf; color: #6e4300; }
.hint { font-size: 13px; }

.form { display: grid; gap: 14px; }
.form.one { grid-template-columns: 1fr; }
.form input[type="submit"], .form button { justify-self: start; width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
input:not([type="submit"]), select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  font-weight: 500;
}

textarea { resize: vertical; min-height: 82px; max-height: 180px; }
pre { overflow: auto; white-space: pre-wrap; font-size: 12px; }
.inline-upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-status { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.session a { color: #dbe8f0; padding: 8px 11px; }
.app-version { color: #8fb0c1 !important; font-size: 12px !important; }
.danger-text { color: var(--red); font-weight: 800; }

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 34px;
  background: #fff;
  border-bottom: 4px solid var(--cyan);
}

.public-brand {
  display: inline-flex;
  align-items: center;
  background: #fff;
}

.public-brand img { width: 190px; height: auto; display: block; }

.public-topbar nav {
  display: flex;
  gap: 16px;
  border: 0;
  padding: 0;
}

.public-topbar nav a {
  color: var(--blue-dark);
  border: 0;
  padding: 8px 0;
}

.public-footer, .login-version {
  color: var(--muted);
  font-size: 12px;
  padding: 14px 34px;
}

.login-version {
  position: fixed;
  right: 18px;
  bottom: 12px;
  color: #b5c8d3;
}

.public-page {
  max-width: none;
  padding: 0;
}

.public-hero {
  min-height: 42vh;
  display: grid;
  align-items: center;
  padding: 64px 34px;
  background:
    linear-gradient(120deg, rgba(7, 16, 21, .90), rgba(0, 63, 102, .78)),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  color: #fff;
}

.public-hero.compact { min-height: 30vh; }
.public-hero > div, .public-band > * { max-width: 1120px; width: 100%; margin: 0 auto; }
.public-hero h1 { font-size: 56px; color: #fff; }
.public-hero p { max-width: 720px; color: #dbe8f0; font-size: 19px; }
.eyebrow { color: #85def6 !important; font-weight: 900; text-transform: uppercase; font-size: 13px !important; }
.public-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.public-band {
  padding: 38px 34px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.public-band:nth-of-type(odd) { background: #fff; }
.public-columns, .pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.public-columns > div, .price-card, .public-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.public-section-head { margin-bottom: 18px; }
.public-section-head p { max-width: 780px; }
.price-card h3 { margin: 0 0 10px; font-size: 18px; }
.price-card dl { grid-template-columns: 130px 1fr; }
.public-form { display: grid; gap: 18px; }
.doc-article {
  max-width: none;
  color: var(--ink);
}
.doc-article > * {
  max-width: 920px;
}
.doc-article h2 {
  margin: 34px auto 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 28px;
}
.doc-article h3 {
  margin: 22px auto 8px;
  font-size: 18px;
}
.doc-article p, .doc-article li {
  font-size: 16px;
  line-height: 1.65;
}
.doc-article ol, .doc-article ul {
  padding-left: 24px;
}
.doc-article code {
  background: #f1f4f6;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.public-disclaimer { border-left: 4px solid var(--cyan); padding: 12px 14px; background: #f3f8fb; }
.conditional-group[hidden] { display: none !important; }
.region-notice {
  display: none;
  border-radius: 4px;
  padding: 10px 12px;
  font-weight: 700;
}
.region-notice:not(:empty) { display: block; }
.region-notice.ok {
  background: #eefaf4;
  border: 1px solid #b9dfcd;
  color: #23563d;
}
.region-notice.warning {
  background: #fff7e8;
  border: 1px solid #efc46f;
  color: #6e4300;
}
.portal-credentials {
  display: grid;
  gap: 6px;
  width: min(420px, 100%);
  margin: 20px 0;
  padding: 16px;
  background: rgba(255,255,255,.96);
  color: var(--text);
  border-left: 5px solid var(--green);
  border-radius: 4px;
}
.portal-credentials span { color: var(--muted); }
code {
  display: inline-block;
  background: #f3f6f8;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text);
}
.totp-setup {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.qr-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}
.qr-box svg { display: block; width: 100%; height: auto; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.check-row input { width: auto; margin-top: 4px; }

.ticket-thread {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px;
  margin: 12px 0;
  background: #fff;
}
.ticket-thread-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}
.ticket-thread-head div:first-child {
  display: grid;
  gap: 4px;
}
.ticket-thread-body {
  margin-top: 2px;
}
.ticket-thread-body > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.ticket-articles {
  display: grid;
  gap: 10px;
}
.ticket-article {
  border-left: 4px solid var(--cyan);
  background: #f8fbfd;
  padding: 10px 12px;
}
.ticket-article.staff-only {
  border-left-color: #e6b24b;
  background: #fff9ec;
}
.ticket-article header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ticket-article p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}
.ticket-article pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.quoted-ticket-body {
  margin-top: 8px;
  color: var(--muted);
}
.quoted-ticket-body summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.quoted-ticket-body pre {
  opacity: 0.78;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  aside {
    position: sticky;
    top: 0;
    z-index: 20;
    display: block;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 3px solid var(--cyan);
  }
  .brand {
    display: inline-flex;
    margin: 0 0 8px;
    padding: 6px 8px;
  }
  .brand img { width: 126px; }
  aside nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-top: 1px solid rgba(220, 232, 239, .18);
    padding: 8px 0 4px;
    scrollbar-width: thin;
  }
  aside nav a {
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 7px 9px;
    font-size: 13px;
    white-space: nowrap;
  }
  aside nav a:hover { border-left-color: transparent; border-bottom-color: var(--cyan); }
  aside .nav-section { display: none; }
  .session {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-top: 0;
    padding-top: 4px;
    align-items: center;
  }
  .session span, .session a, .session button {
    flex: 0 0 auto;
    font-size: 12px;
    padding: 5px 7px;
  }
  .session .app-version { display: none; }
  main { padding: 20px; }
  .page-head { display: grid; }
  .section-heading { display: grid; }
  .stats div, .span-5, .span-7 { grid-column: 1 / -1; }
  .form-grid, dl { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .public-topbar { display: grid; padding: 14px 20px; }
  .public-topbar nav { flex-wrap: wrap; }
  .public-hero { padding: 48px 20px; }
  .public-hero h1 { font-size: 40px; }
  .public-band { padding: 28px 20px; }
  .public-columns, .pricing-grid { grid-template-columns: 1fr; }
  .totp-setup { grid-template-columns: 1fr; }
}
