:root {
  --navy: #08244d;
  --navy-2: #0d3d78;
  --blue: #1f5f9f;
  --blue-light: #d7e8f8;
  --desktop: #6f8fae;
  --panel: #d8d8d0;
  --panel-light: #f5f5ef;
  --panel-dark: #8a8a83;
  --ink: #111111;
  --muted: #4a4a4a;
  --green: #13752a;
  --amber: #8b5a00;
  --red: #9a1f1f;
  --focus: #ffdc4a;
  --shadow: rgba(0, 0, 0, 0.34);
  font-family: Tahoma, Verdana, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--desktop);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.42;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.05)),
    repeating-linear-gradient(135deg, #6e8eac 0, #6e8eac 12px, #7698b8 12px, #7698b8 24px);
}

[hidden] {
  display: none !important;
}

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

button,
.button-link {
  min-height: 28px;
  padding: 4px 12px;
  border: 1px solid #111;
  border-top-color: #fff;
  border-left-color: #fff;
  border-right-color: #555;
  border-bottom-color: #555;
  color: #111;
  background: linear-gradient(#f8f8f3, #c5c5bc);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.65);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: linear-gradient(#ffffff, #d5d5ca);
}

button:active,
.button-link:active {
  border-top-color: #555;
  border-left-color: #555;
  border-right-color: #fff;
  border-bottom-color: #fff;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.35);
  transform: translate(1px, 1px);
}

button:disabled,
fieldset:disabled button {
  color: #777;
  cursor: not-allowed;
  background: #c8c8c0;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.primary-button {
  color: #fff;
  font-weight: 700;
  text-shadow: 1px 1px #082247;
  background: linear-gradient(#2e70ad, #0a3d76);
  border-right-color: #041a35;
  border-bottom-color: #041a35;
}

.primary-button:hover {
  background: linear-gradient(#3f82bf, #104b89);
}

.danger-button {
  color: #fff;
  background: linear-gradient(#b64a4a, #751717);
  text-shadow: 1px 1px #4c0000;
}

input,
select,
textarea {
  min-height: 28px;
  max-width: 100%;
  padding: 4px 6px;
  border: 2px inset #fff;
  border-color: #555 #fff #fff #555;
  color: #111;
  background: #fff;
}

textarea {
  resize: vertical;
}

code,
pre {
  font-family: "Courier New", Courier, monospace;
}

.crt-overlay {
  position: fixed;
  z-index: 9999;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.26) 3px
  );
}

.legacy-banner {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 10px 20px;
  color: #fff;
  border-bottom: 3px ridge #dce9f5;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.11), transparent 32%),
    linear-gradient(#123d71, #061e42);
  box-shadow: 0 3px 8px var(--shadow);
}

.legacy-brand {
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 2px;
  line-height: 1;
  text-shadow: 2px 2px #000;
}

.legacy-subtitle {
  margin-top: 5px;
  color: #bbd8f3;
  font: 11px/1.2 "Courier New", monospace;
  letter-spacing: 1px;
}

.banner-status {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid #6186ac;
  background: #03162f;
  font: 700 11px/1 "Courier New", monospace;
  white-space: nowrap;
}

.status-led {
  width: 10px;
  height: 10px;
  border: 1px solid #001300;
  border-radius: 50%;
  background: #23d44a;
  box-shadow: 0 0 7px #23d44a;
}

.window {
  border: 2px outset #fff;
  border-color: #fff #54544e #54544e #fff;
  background: var(--panel);
  box-shadow: 5px 5px 12px var(--shadow);
}

.window-titlebar,
.mini-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 27px;
  padding: 4px 7px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.25px;
  background: linear-gradient(90deg, #08245a, #2d75a8 68%, #a5c9e3);
  text-shadow: 1px 1px #000;
}

.window-controls {
  padding: 0 3px;
  color: #fff;
  font-family: Arial, sans-serif;
  letter-spacing: 3px;
  white-space: nowrap;
}

.window-body {
  padding: 14px;
}

.window-body.no-padding {
  padding: 0;
}

.window-statusbar,
.desktop-statusbar {
  min-height: 24px;
  padding: 4px 7px;
  border-top: 2px groove #fff;
  color: #333;
  background: #c9c9c1;
  font: 10px/1.3 "Courier New", monospace;
  letter-spacing: 0.25px;
}

.toast {
  position: fixed;
  z-index: 10000;
  top: 82px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  padding: 11px 13px;
  border: 2px outset #fff;
  color: #111;
  background: #fff8c7;
  box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.5);
  font-weight: 700;
}

.toast.success {
  background: #d9f5d9;
}

.toast.error {
  color: #5c0000;
  background: #ffd7d7;
}

.login-shell {
  width: min(780px, calc(100% - 24px));
  margin: 7vh auto 40px;
}

.login-window {
  min-height: 350px;
}

.login-body {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 300px;
  background: linear-gradient(110deg, #e7e7df, #c5d7e7);
}

.login-emblem {
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  margin: auto;
  border: 6px double #d9eafa;
  color: #fff;
  background: radial-gradient(circle, #1f5f9f, #061d3f 72%);
  box-shadow: inset 0 0 20px #000, 5px 5px 10px rgba(0, 0, 0, 0.35);
}

.login-emblem span {
  font: 800 44px/1 "Arial Black", sans-serif;
  letter-spacing: 3px;
}

.login-emblem small {
  margin-top: -38px;
  color: #9ed4ff;
  font: 11px "Courier New", monospace;
  letter-spacing: 2px;
}

.login-content h1,
.setup-window h1 {
  margin: 0 0 8px;
  color: #0b315e;
  font-size: 22px;
}

.login-intro {
  max-width: 520px;
  margin-bottom: 17px;
}

.login-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini-window {
  border: 2px outset #fff;
  background: #d8d8d0;
  box-shadow: 3px 3px 8px var(--shadow);
}

.mini-window p {
  margin: 0;
  padding: 10px;
  font-size: 11px;
}

.legacy-form fieldset,
.setup-window fieldset {
  margin: 12px 0;
  padding: 11px;
  border: 2px groove #fff;
}

.legacy-form legend,
.setup-window legend {
  padding: 0 5px;
  color: #143d69;
  font-weight: 700;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(145px, 34%) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.form-row label {
  font-weight: 700;
}

.form-row.vertical-row {
  grid-template-columns: 1fr;
  gap: 4px;
}

.compact-row {
  grid-template-columns: 100px minmax(0, 1fr);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
}

.message {
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid #666;
  box-shadow: inset 1px 1px #fff;
}

.neutral-message {
  background: #e7edf3;
}

.error-message {
  color: #640000;
  border-color: #9b3535;
  background: #ffd8d8;
}

.success-message {
  color: #054b0f;
  border-color: #38844a;
  background: #daf4dd;
}

.desktop-shell {
  width: min(1460px, calc(100% - 18px));
  margin: 10px auto 28px;
}

.session-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 5px 8px;
  border: 2px outset #fff;
  background: #d6d6ce;
  box-shadow: 3px 3px 8px var(--shadow);
  font: 12px "Courier New", monospace;
}

.separator {
  margin: 0 7px;
  color: #666;
}

.toolbar-button {
  min-height: 24px;
  margin-left: 10px;
  padding: 2px 9px;
  font-size: 11px;
}

.desktop-tabs {
  display: flex;
  gap: 2px;
  align-items: end;
  margin-top: 10px;
  padding-left: 7px;
}

.tab-button {
  min-height: 32px;
  padding: 5px 14px;
  font-weight: 700;
  border-bottom-color: #777;
  border-radius: 4px 4px 0 0;
}

.tab-button.active {
  position: relative;
  z-index: 2;
  color: #fff;
  background: linear-gradient(#2d70aa, #0b376d);
  border-bottom-color: #0b376d;
  text-shadow: 1px 1px #000;
}

.desktop-page {
  min-height: 540px;
  padding: 12px;
  border: 2px outset #fff;
  background: rgba(199, 211, 220, 0.95);
  box-shadow: 5px 5px 14px var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 11px;
}

.stat-box {
  min-height: 74px;
  padding: 8px 10px;
  border: 2px inset #fff;
  background: linear-gradient(#f4f4ee, #d4d4cc);
}

.stat-label {
  display: block;
  margin-bottom: 7px;
  color: #3f5364;
  font: 10px "Courier New", monospace;
  letter-spacing: 0.5px;
}

.stat-box strong {
  color: #0a315f;
  font: 700 22px Tahoma, sans-serif;
}

.desk-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(390px, 1.2fr);
  gap: 11px;
  margin-bottom: 11px;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 128px;
  padding: 15px;
  border: 2px dashed #315a7c;
  color: #173a5c;
  text-align: center;
  background:
    repeating-linear-gradient(45deg, #edf4fa 0, #edf4fa 8px, #e4eef7 8px, #e4eef7 16px);
}

.drop-zone.dragover {
  color: #fff;
  background: #245f91;
}

.drop-zone strong,
.drop-zone span {
  pointer-events: none;
}

.drop-zone strong {
  font: 700 17px "Courier New", monospace;
}

.drop-zone span {
  font-size: 11px;
}

.drop-zone input[type="file"] {
  width: min(100%, 420px);
  margin-top: 8px;
}

.progress-block {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

progress {
  width: 100%;
  height: 18px;
  border: 2px inset #fff;
}

.legacy-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px inset #fff;
  background: #fff;
}

.legacy-table caption {
  padding: 5px 7px;
  color: #fff;
  font-weight: 700;
  text-align: left;
  background: #315f8c;
}

.legacy-table th,
.legacy-table td {
  padding: 6px 7px;
  border: 1px solid #8b8b86;
  vertical-align: top;
  text-align: left;
}

.legacy-table thead th {
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.3px;
  background: linear-gradient(#537aa0, #284e74);
  text-shadow: 1px 1px #111;
}

.legacy-table tbody tr:nth-child(even) {
  background: #edf3f8;
}

.legacy-table tbody tr:hover {
  background: #fff7c8;
}

.allocation-table td,
.allocation-table th {
  white-space: nowrap;
}

.state-unlocked {
  color: var(--green);
  font-weight: 700;
}

.state-locked {
  color: var(--red);
  font-weight: 700;
}

.window-toolbar {
  padding: 6px;
  border-bottom: 2px groove #fff;
  background: #c9c9c1;
}

.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.search-toolbar label {
  font-size: 11px;
  font-weight: 700;
}

.search-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 130px;
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
  background: #fff;
}

.file-table,
.audit-table {
  min-width: 1000px;
  border: 0;
}

.file-name-cell {
  min-width: 190px;
  font-weight: 700;
}

.file-notes-cell {
  max-width: 300px;
  white-space: pre-wrap;
  word-break: break-word;
}

.action-cell {
  min-width: 290px;
}

.action-cell button {
  min-height: 23px;
  margin: 1px;
  padding: 2px 6px;
  font-size: 10px;
}

.zone-chip {
  display: inline-block;
  min-width: 52px;
  padding: 2px 5px;
  color: #fff;
  border: 1px solid #06182c;
  background: #174a7c;
  font: 700 10px "Courier New", monospace;
  text-align: center;
}

.zone-chip.zone-2 {
  background: #795100;
}

.zone-chip.zone-3 {
  background: #861d1d;
}

.hash-fragment {
  color: #555;
  font: 9px "Courier New", monospace;
}

.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pager-bar button {
  min-height: 23px;
  padding: 2px 7px;
  font-size: 10px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.zone-card h2 {
  margin: 10px 0 5px;
  color: #143c65;
  font-size: 17px;
}

.zone-card.zone-three .window-titlebar {
  background: linear-gradient(90deg, #5c0c0c, #a13939 68%, #e1a7a7);
}

.zone-card.zone-two .window-titlebar {
  background: linear-gradient(90deg, #5c3d00, #9a6810 68%, #e1c47f);
}

.zone-badge {
  display: inline-block;
  min-width: 90px;
  padding: 5px 8px;
  border: 2px inset #fff;
  font: 700 12px "Courier New", monospace;
  text-align: center;
}

.zone-badge.unlocked {
  color: #fff;
  background: #1d7c32;
}

.zone-badge.locked {
  color: #fff;
  background: #801e1e;
}

.compact-form .form-actions {
  justify-content: flex-start;
}

.zone-expiry {
  margin-top: 12px;
  padding: 5px;
  border: 1px solid #8a8a84;
  background: #efefe9;
  font: 10px "Courier New", monospace;
}

.system-window,
.critical-window {
  margin-top: 12px;
}

.system-list {
  margin: 0;
}

.system-list div {
  display: grid;
  grid-template-columns: minmax(100px, 37%) minmax(0, 1fr);
  border-bottom: 1px dotted #777;
}

.system-list dt,
.system-list dd {
  margin: 0;
  padding: 5px 3px;
}

.system-list dt {
  font-weight: 700;
}

.two-column-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}

.audit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audit-valid {
  color: var(--green);
}

.audit-invalid {
  color: var(--red);
}

.audit-table td {
  font: 10px/1.35 "Courier New", monospace;
}

.audit-details {
  white-space: pre-wrap;
  word-break: break-word;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.critical-window .window-titlebar {
  background: linear-gradient(90deg, #6d1111, #aa4141 70%, #e3a5a5);
}

.recovery-codes {
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 2px inset #fff;
  color: #102f4c;
  background: #fff;
  font-size: 14px;
  letter-spacing: 1px;
  user-select: all;
}

.desktop-statusbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 2px outset #fff;
  box-shadow: 3px 3px 8px var(--shadow);
}

.noscript-warning {
  margin: 20px;
  padding: 15px;
  border: 3px double #7c0000;
  background: #ffd6d6;
  font-weight: 700;
}

.setup-body {
  padding-bottom: 40px;
}

.setup-shell {
  width: min(900px, calc(100% - 24px));
  margin: 24px auto;
}

.setup-shell .legacy-banner {
  position: static;
  border: 2px outset #fff;
}

.setup-window {
  margin-top: 12px;
}

.wizard-step {
  margin: -4px -4px 14px;
  padding: 7px 9px;
  border: 1px solid #7890a5;
  color: #fff;
  background: #365f84;
  font: 700 11px "Courier New", monospace;
}

.check-table {
  margin: 14px 0;
}

.check-icon {
  width: 62px;
  font: 700 10px "Courier New", monospace;
  text-align: center !important;
}

.check-ok {
  color: #fff;
  background: #17702d;
}

.check-fail {
  color: #fff;
  background: #8c1b1b;
}

.compact-table {
  max-width: 620px;
  margin: 13px 0;
}

.compact-table th {
  width: 210px;
}

.setup-instructions {
  padding-left: 22px;
}

.secret-panel {
  margin: 15px 0;
  padding: 12px;
  border: 3px double #315d85;
  background: #eef6fc;
}

.field-caption {
  display: block;
  margin-bottom: 7px;
  color: #35546d;
  font: 700 10px "Courier New", monospace;
}

.totp-secret {
  display: block;
  overflow-wrap: anywhere;
  color: #072f59;
  font-size: clamp(16px, 3vw, 23px);
  letter-spacing: 2px;
  user-select: all;
}

.details-box {
  margin: 12px 0;
  padding: 8px;
  border: 1px solid #777;
  background: #efefe9;
}

.details-box summary {
  cursor: pointer;
  font-weight: 700;
}

.uri-output {
  width: 100%;
  margin-top: 8px;
  font: 11px "Courier New", monospace;
}

.critical-box {
  margin: 14px 0;
  padding: 12px;
  border: 3px double #8b1b1b;
  background: #fff2d5;
}

.critical-box h2 {
  margin-top: 0;
  color: #731313;
}

.important-note {
  padding: 9px;
  border-left: 5px solid #8b1b1b;
  background: #fff1f1;
}

.small-print {
  color: #4d4d4d;
  font-size: 10px;
}

@media (max-width: 1000px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desk-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .security-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 12px;
  }

  .legacy-banner {
    position: static;
    align-items: flex-start;
    padding: 10px;
  }

  .legacy-subtitle {
    max-width: 230px;
  }

  .banner-status {
    padding: 5px;
    font-size: 9px;
  }

  .login-shell {
    margin-top: 16px;
  }

  .login-body {
    grid-template-columns: 1fr;
  }

  .login-emblem {
    width: 105px;
    height: 105px;
  }

  .login-emblem span {
    font-size: 31px;
  }

  .login-emblem small {
    margin-top: -25px;
  }

  .login-notes,
  .stats-grid,
  .two-column-list {
    grid-template-columns: 1fr;
  }

  .session-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-button {
    float: right;
  }

  .desktop-tabs {
    overflow-x: auto;
    padding-left: 0;
  }

  .tab-button {
    flex: 0 0 auto;
    padding-inline: 9px;
    font-size: 10px;
  }

  .desktop-page {
    padding: 7px;
  }

  .form-row,
  .compact-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button,
  .form-actions .button-link {
    flex: 1 1 auto;
    text-align: center;
  }

  .search-toolbar > * {
    flex: 1 1 130px;
  }

  .search-toolbar label {
    flex: 0 0 auto;
  }

  .pager-bar {
    flex-wrap: wrap;
  }

  .desktop-statusbar {
    flex-direction: column;
  }

  .setup-shell {
    width: min(100% - 12px, 900px);
    margin-top: 6px;
  }

  .check-table,
  .check-table tbody,
  .check-table tr,
  .check-table th,
  .check-table td {
    display: block;
    width: 100%;
  }

  .check-table tr {
    margin-bottom: 8px;
    border: 1px solid #777;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
