:root {
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  color: rgba(0, 0, 0, .87);
  background: #fff;
  font-synthesis: none;
  --blue: #1976d2;
  --line: rgba(0, 0, 0, .12);
  --muted: rgba(0, 0, 0, .6);
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; }
button, a.primary { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, a:focus-visible { outline: 3px solid #90caf9; outline-offset: 3px; }
.topbar {
  min-height: 80px; padding: 16px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 24px; background: #1565c0; color: #fff;
  box-shadow: 0 3px 5px -1px #0003, 0 2px 3px #00000024;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { height: 34px; width: auto; max-width: 208px; object-fit: contain; flex-shrink: 0; }
.brand span { font-size: 24px; font-weight: 700; line-height: 1.35; }
#account { display: flex; align-items: center; gap: 16px; min-width: 0; }
.account-label { font-size: 14px; opacity: .9; overflow-wrap: anywhere; }
.topbar .quiet { color: inherit; border-color: currentColor; padding: 5px 10px; font-size: 13px; }
.topbar .quiet:hover { background: #8080801f; border-color: currentColor; }
main { width: 100%; padding: 24px; min-height: calc(100vh - 134px); }
h1, h2, p { margin-top: 0; }
h1 { font-size: 20px; font-weight: 500; line-height: 1.6; margin-bottom: 4px; }
h2 { font-size: 20px; font-weight: 500; line-height: 1.5; margin-bottom: 8px; }
p { line-height: 1.5; }
.muted, .help { color: var(--muted); font-size: 14px; line-height: 1.5; }
.muted { margin-bottom: 0; }
.help { margin: 16px 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 16px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.heading > div { min-width: 0; }
.heading > button { flex-shrink: 0; }
.compact { align-items: flex-start; margin-bottom: 0; }
.login-layout { min-height: calc(100vh - 182px); display: grid; place-items: center; padding: 24px 0; }
.login-panel { width: 100%; max-width: 420px; padding: 24px; border: 0; box-shadow: 0 2px 1px -1px #0003, 0 1px 3px #00000024; }
.login-panel h1 { font-size: 24px; font-weight: 400; margin-bottom: 12px; }
.login-panel .muted { margin-bottom: 24px; }
.login-panel .primary { width: 100%; margin-top: 24px; text-transform: uppercase; }
.login-panel .help { margin-bottom: 0; }
label { display: block; font-size: 14px; color: var(--muted); margin: 18px 0 8px; }
input { width: 100%; height: 56px; border: 1px solid #0000003b; border-radius: 4px; padding: 16px 14px; background: #fff; color: inherit; outline: none; }
input:hover { border-color: #000000de; }
input:focus { border: 2px solid var(--blue); padding: 15px 13px; }
button, a.primary { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 16px; border: 1px solid transparent; border-radius: 4px; font-size: 14px; font-weight: 500; line-height: 1.5; letter-spacing: .2px; text-decoration: none; }
.primary { color: #fff; background: var(--blue); box-shadow: 0 2px 3px #0003; }
.primary:hover { background: #1565c0; }
.quiet { color: var(--blue); border-color: #1976d280; background: transparent; }
.quiet:hover { border-color: var(--blue); background: #1976d20a; }
.small { padding: 4px 10px; font-size: 13px; min-height: 30px; margin-left: 8px; }
.portal-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; margin-bottom: 16px; }
.check-label { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
.check-label input { width: auto; margin: 0; }
.account-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
select { max-width: 100%; min-height: 40px; padding: 8px; border: 1px solid #0000003b; border-radius: 4px; background: #fff; color: inherit; }
.account-branding { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.branding-preview { display: flex; align-items: center; gap: 16px; padding: 16px; margin: 16px 0; background: #1565c0; color: #fff; border-radius: 4px; overflow: hidden; }
.branding-preview img { max-width: 208px; height: 34px; object-fit: contain; }
#branding-list { margin-bottom: 20px; }
#branding-list > .account-row,
#account-list > .account-row,
#token-list > .account-row {
  display: grid;
  align-items: center;
  gap: 12px;
}
#branding-list > .account-row { grid-template-columns: minmax(0, 1fr) 100px 120px 110px 150px; }
#account-list > .account-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px 280px; }
#token-list > .account-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 90px 120px 110px 130px 160px; }
#branding-list > .account-row > *,
#account-list > .account-row > *,
#token-list > .account-row > * { min-width: 0; }
#branding-list > .account-row > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 16px;
  border: 1px solid #1976d280;
  border-radius: 4px;
  font-size: 14px;
}
#account-list .account-branding { display: grid; grid-template-columns: 1fr; gap: 4px; }
#account-list .account-branding select { width: 100%; min-width: 0; }
.text-colour-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.text-colour-controls input[type="color"] { width: 56px; height: 40px; padding: 4px; cursor: pointer; }
#token-result { margin-bottom: 16px; }
#issued-token { width: 100%; box-sizing: border-box; margin-bottom: 16px; padding: 12px; font: inherit; overflow-wrap: anywhere; }
.add-panel { margin-bottom: 16px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
#site-count { color: #000000de; font-size: 20px; font-weight: 500; }
.site-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.site-filters { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.site-filters > div { min-width: 0; flex: 1 1 180px; }
.site-filters .site-search { flex: 3 1 240px; }
.site-filters input, .site-filters select { width: 100%; height: 48px; margin: 0; padding: 12px 14px; border: 1px solid #0000003b; border-radius: 4px; background: #fff; color: inherit; }
.site-filters input:focus, .site-filters select:focus { outline: 2px solid var(--blue); outline-offset: -2px; }
.site-filters button { min-height: 48px; }
.site-card { border: 3px solid rgba(16, 63, 120, .2); border-radius: 8px; padding: 16px; min-width: 0; display: flex; flex-direction: column; }
.site-card.online { border-color: #2e7d32; background-color: #f8fcf9; }
.site-card.offline { border-color: #c62828; background-color: #fff9f9; }
.site-card.attention { border-color: #ed6c02; background-color: #fffcf6; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.site-symbol { display: grid; place-items: center; width: 44px; height: 44px; background: rgba(13, 71, 161, .12); color: #0d47a1; border-radius: 4px; font-size: 24px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 16px; color: #616161; background: #f0f0f0; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.online { color: #1b5e20; background: #e8f5e9; }
.badge.offline { color: #b71c1c; background: #ffebee; }
.badge.attention { color: #8a3c00; background: #fff3e0; }
.site-card h2 { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.site-id { margin: 0 0 16px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.site-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { min-width: 0; }
.metric dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.metric dd { margin: 0; font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric.fault dd { color: #b71c1c; font-weight: 700; }
.summary-time { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.seen { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.site-card .help { margin: 0 0 16px; }
.card-actions { margin-top: auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.empty { text-align: center; padding: 40px 16px; }
.empty.panel { border: 0; }
.empty p { color: var(--muted); font-size: 14px; }
.empty-icon { display: grid; place-items: center; background: #0d47a11f; color: #0d47a1; width: 48px; height: 48px; border-radius: 4px; font-size: 30px; margin: 0 auto 16px; }
.release-note { font-size: 13px; color: var(--muted); margin: 16px 0 0; }
#notice { border-radius: 4px; background: #fdeded; color: #5f2120; padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }
#notice.success { background: #edf7ed; color: #1e4620; }
footer { padding: 16px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); text-align: center; }
body.dialog-open { overflow: hidden; }
.dialog-backdrop { position: fixed; inset: 0; z-index: 1300; background: #0008; display: grid; place-items: center; padding: 24px; }
.confirmation-dialog { background: #fff; color: #000000de; border-radius: 4px; width: 100%; max-width: 444px; max-height: calc(100dvh - 48px); overflow-y: auto; box-shadow: 0 11px 15px -7px #0003, 0 24px 38px 3px #00000024, 0 9px 46px 8px #0000001f; }
.confirmation-dialog h2 { padding: 16px 24px; margin: 0; font-size: 20px; font-weight: 500; line-height: 1.6; }
.confirmation-dialog p { padding: 0 24px 20px; margin: 0; font-size: 16px; color: var(--muted); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 8px; }
.dialog-actions button { text-transform: uppercase; }
.dialog-cancel { color: var(--blue); background: transparent; }
.dialog-cancel:hover { background: #1976d20a; }
@media (max-width: 1199px) { .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1199px) {
  #account-list > .account-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #account-list > .account-row > button { justify-self: start; }
  #token-list > .account-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #token-list > .account-row > strong,
  #token-list > .account-row > span:nth-child(2) { grid-column: span 2; }
  #token-list > .account-row > span:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 899px) {
  #branding-list > .account-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #branding-list > .account-row > strong { grid-column: span 2; }
}
@media (max-width: 899px) { .topbar { flex-wrap: wrap; gap: 12px; } #account { margin-left: auto; } .fields { grid-template-columns: 1fr; gap: 0; } }
@media (max-width: 599px) {
  #branding-list > .account-row,
  #account-list > .account-row,
  #token-list > .account-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #branding-list > .account-row > strong,
  #branding-list > .account-row > span,
  #account-list > .account-row > strong,
  #account-list > .account-row > span,
  #account-list .account-branding { grid-column: 1 / -1; }
  .topbar { padding: 16px; min-height: 72px; }
  .brand img { height: 28px; max-width: 148px; }
  .brand span { font-size: 20px; }
  #account { width: 100%; justify-content: space-between; }
  main { padding: 16px; }
  .site-grid { grid-template-columns: 1fr; }
  .heading { align-items: flex-start; flex-wrap: wrap; }
  .summary { align-items: flex-start; flex-direction: column; gap: 12px; }
  .summary > span:last-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .small { margin-left: 0; }
  .login-panel { padding: 20px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, a.primary { transition: background-color 120ms ease, box-shadow 120ms ease; }
  .site-card { transition: box-shadow 120ms ease; }
  .site-card:hover { box-shadow: 0 8px 20px #0000001f; }
}
