:root {
  --bg: #f4f7fc;
  --bg-accent: #edf3ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #d9e3f2;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --shadow: 0 20px 60px rgba(37, 99, 235, .08);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, .08);
  --radius: 18px;
  --radius-sm: 14px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, .07), transparent 28%), linear-gradient(180deg, var(--bg-accent), var(--bg));
}
.top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(24px, calc((100vw - 1220px) / 2));
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(217, 227, 242, .9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}
.brand { color: var(--text); font-size: 24px; font-weight: 800; text-decoration: none; letter-spacing: -.035em; }
.brand span { color: var(--text); }
.brand img { display: block; width: 156px; height: auto; filter: brightness(0) saturate(100%) invert(19%) sepia(24%) saturate(1210%) hue-rotate(168deg) brightness(94%); }
.top-note { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.wrap { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 52px; flex: 1; min-width: 0; }
.hero { max-width: 680px; margin: min(11vh, 100px) auto 0; text-align: center; }
.eyebrow { color: var(--primary); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { margin: 12px 0; font-size: clamp(42px, 5vw, 64px); line-height: 1.08; letter-spacing: -.05em; }
.hero p { margin: 0 0 28px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--primary);
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn.ghost { background: #eff5ff; color: var(--primary); border-color: rgba(37, 99, 235, .16); box-shadow: none; }
.btn.ghost:hover { background: #e2ecff; }
.btn.small { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); }
.btn:focus-visible, .tabs button:focus-visible, .brand:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }
.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid rgba(217, 227, 242, .95);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.narrow { max-width: 460px; margin: 35px auto; box-shadow: var(--shadow); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h1, .section-head h2, .panel h2 { margin: 0; letter-spacing: -.035em; }
.section-head h1 { font-size: 30px; }
.section-head .admin-section-title { font-size: clamp(20px, 2.4vw, 28px); letter-spacing: .04em; text-transform: uppercase; }
.section-head p { margin: 7px 0 0; color: var(--muted); font-size: 15px; }
h2 { margin: 0 0 14px; font-size: 22px; }
.form { display: grid; gap: 12px; }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form label { display: grid; gap: 6px; min-width: 0; color: var(--text); font-size: 13px; font-weight: 600; }
.form input, .form select, .form textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: rgba(37, 99, 235, .7); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.form input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--primary); }
.form .full { grid-column: 1 / -1; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.notice { margin: 14px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: #eff5ff; color: #1e40af; overflow-wrap: anywhere; }
.notice.error { background: #fff1f2; color: #b91c1c; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 99px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: #94a3b8; }
.status.valid { background: #dcfce7; color: #166534; }
.status.valid::before { background: #16a34a; }
.status.no-data { background: #fef3c7; color: #92400e; }
.status.no-data::before { background: #f59e0b; }
.status.offline { background: #fee2e2; color: #991b1b; }
.status.offline::before { background: #ef4444; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 24px; }
.card { min-width: 0; padding: 17px 19px; border: 1px solid rgba(217, 227, 242, .95); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.card strong { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.04em; overflow-wrap: anywhere; }
.card span { color: var(--muted); font-size: 13px; }
.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 24px; }
.tabs button { min-height: 40px; padding: 9px 15px; border: 1px solid rgba(37, 99, 235, .16); border-radius: var(--radius-sm); background: #fff; color: var(--primary); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.tabs button:hover { background: #eff5ff; }
.tabs button.active { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 10px 24px rgba(37, 99, 235, .18); }
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); box-shadow: var(--shadow-soft); }
table { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f8fbff; color: var(--muted); font-size: 12px; font-weight: 700; }
td { font-size: 13px; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
#base-table { min-width: 0; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.muted { color: var(--muted); }
.secret { padding: 10px; border-radius: 10px; background: #f4f7fc; font-family: ui-monospace, monospace; word-break: break-all; }
.footer { padding: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { padding: 26px; color: var(--muted); text-align: center; }
.loading { opacity: .65; pointer-events: none; }
.form-feedback { min-height: 18px; color: var(--muted); font-size: 13px; }
.form-feedback.error { color: #b91c1c; }
.tcp-total { display: block; margin-top: 4px; color: var(--muted); }
.tcp-error { max-width: 240px; margin-top: 6px; color: #b91c1c; font-size: 12px; white-space: normal; }
.admin-groups { border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; gap: 8px; }
.admin-groups legend { padding: 0 6px; font-weight: 700; }
.admin-group { display: grid !important; grid-template-columns: 20px minmax(0, 1fr) 20px minmax(0, 1fr); align-items: center; gap: 8px !important; }
.admin-group input[type="checkbox"] { min-height: 18px; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
.ui2-crud-layout { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: stretch; gap: 8px; min-width: 0; }
.ui2-crud-rail { position: relative; min-width: 44px; }
.ui2-round { position: absolute; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; font-family: inherit; font-size: 25px; font-weight: 500; line-height: 1; cursor: pointer; }
.ui2-add { color: var(--primary); }
.ui2-minus { color: var(--danger-hover); }
.ui2-round:hover { background: #eaf1ff; }
.ui2-minus:hover { background: #fff0f0; }
.ui2-round:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.ui2-round:disabled { color: var(--muted); opacity: .5; }
.ui2-password-field { display: block; position: relative; }
.ui2-password-field input { width: 100%; padding-right: 50px; }
.ui2-password-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.ui2-password-eye:hover { background: #eaf1ff; color: var(--primary); }
.ui2-password-eye:focus-visible { outline: 3px solid var(--primary); }
.ui2-password-eye svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ui2-table tr[data-ui2-row] { cursor: pointer; }
.ui2-table tr[data-ui2-row]:hover td { background: #f3f8ff; }
.ui2-table tr[data-ui2-row]:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.ui2-table button { white-space: nowrap; }
.ui2-group-members-table { min-width: 0; table-layout: fixed; }
.ui2-group-members-table th:first-child { width: 42%; }
.ui2-group-members-table th:nth-child(2) { width: 19%; }
.password-cell { min-width: 190px; }
.connection-table { width: 100%; min-width: 1180px; table-layout: fixed; }
.connection-table th, .connection-table td { padding: 6px 4px; font-size: 12px; overflow-wrap: anywhere; }
.connection-table th:first-child { width: 2.5%; }
.connection-table th:nth-child(2) { width: 5%; }
.connection-table th:nth-child(3) { width: 7%; }
.connection-table th:nth-child(4), .connection-table th:nth-child(5), .connection-table th:nth-child(6) { width: 8%; }
.connection-table th:nth-child(7), .connection-table th:nth-child(10) { width: 6.5%; }
.connection-table th:nth-child(8) { width: 5%; }
.connection-table th:nth-child(9) { width: 8%; }
.connection-table th:nth-child(11), .connection-table th:nth-child(12) { width: 7%; }
.connection-table th:nth-child(13) { width: 5.5%; }
.connection-table th:nth-child(14) { width: 9%; }
.connection-table th:nth-child(15) { width: 7.5%; }
.rate-pair { display: grid; gap: 3px; white-space: nowrap; }
.gnss-solution { font-weight: 700; }
.revealed-password { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.revealed-password:not(:empty) { display: block; margin: 4px 0; padding: 7px; border-radius: 8px; background: #f4f7fc; }
.port-state { display: inline-block; min-width: 125px; font-weight: 700; white-space: nowrap; }
.port-state.off { color: #64748b; }
.port-state.waiting { color: #dc2626; }
.port-state.on { color: #16a34a; }
.bridges-table { min-width: 0; table-layout: fixed; }
.bridges-table th, .bridges-table td { padding: 8px 5px; font-size: 12px; }
.bridges-table th:first-child, .bridges-table td:first-child { width: 3%; white-space: nowrap; text-align: center; }
.bridges-table th:nth-child(2), .bridges-table th:nth-child(3) { width: 15%; }
.bridges-table th:nth-child(4), .bridges-table th:nth-child(5) { width: 8%; }
.bridges-table th:nth-child(6) { width: 7%; }
.bridges-table th:nth-child(7) { width: 6%; }
.bridges-table th:nth-child(8) { width: 7%; }
.bridges-table th:nth-child(9) { width: 9%; }
.bridges-table th:nth-child(10) { width: 12%; }
.bridges-table th:nth-child(11) { width: 10%; }
.bridges-table .port-state { min-width: 0; flex: none; }
.bridge-endpoint-label { display: inline-flex; align-items: baseline; gap: 5px; max-width: 100%; }
.bridge-endpoint-text { overflow-wrap: anywhere; }
.bridge-endpoint { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; min-width: 0; }
.bridge-endpoint legend { padding: 0 6px; font-weight: 700; }
.bridge-endpoint .bridge-dms .row-actions { display: grid; grid-template-columns: 72px repeat(3, minmax(0, 1fr)) 64px; align-items: center; margin: 8px 0; }
.bridge-endpoint .bridge-dms input, .bridge-endpoint .bridge-dms select { min-width: 0; }
.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(15,23,42,.56); }
.modal-panel { width: min(740px, 100%); max-height: min(88vh, 900px); overflow-y: auto; padding: 24px; border-radius: var(--radius); background: var(--card); box-shadow: 0 28px 80px rgba(15,23,42,.3); }
.modal-panel .section-head { align-items: center; }
.modal-panel .section-head h2 { margin: 0; }
.modal-body { display: grid; gap: 18px; }
.modal-body .panel { box-shadow: none; }
.modal-body .checkbox-label { display: flex; align-items: center; gap: 10px; }
.modal-body .checkbox-label input { width: 18px; }
.modal-body ul { padding-left: 20px; }
.modal-body li { margin: 5px 0; }
.map-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.map-toolbar label { display: grid; gap: 5px; font-weight: 700; font-size: 13px; }
.map-toolbar select { min-width: 200px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.map-frame { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #e8f1f8; }
#ui2-map { width: 100%; height: 450px; }
.map-empty { position: absolute; z-index: 500; left: 50%; top: 50%; width: min(90%, 420px); transform: translate(-50%,-50%); padding: 18px; border-radius: 14px; background: rgba(255,255,255,.96); box-shadow: var(--shadow-soft); text-align: center; font-weight: 700; pointer-events: none; }
.leaflet-container { font-family: inherit; }
@media (max-width: 700px) {
  .top { padding: 12px 18px; }
  .wrap { width: calc(100% - 28px); padding: 22px 0 44px; }
  .hero { margin: 9vh auto 0; }
  .hero p { font-size: 16px; }
  .panel { padding: 18px; }
  .section-head { flex-direction: column; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .form.two { grid-template-columns: minmax(0, 1fr); }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tabs button { flex: none; }
  .modal-backdrop { padding: 10px; }
  .modal-panel { padding: 16px; max-height: 94vh; }
  #ui2-map { height: 350px; }
}
@media (max-width: 390px) {
  .top-note { font-size: 11px; }
  .card { padding: 12px; }
  .card strong { font-size: 24px; }
  .actions .btn { width: 100%; }
}

/* Public homepage only. Other routes retain the existing application layout. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
body.public-home {
  min-height: 100svh;
  background: #304d68 url('/assets/orient-home-poster.webp?v=1') center / cover fixed no-repeat;
  color: #fff;
}
body.public-home::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(17,39,61,.48), rgba(20,42,62,.48) 50%, rgba(17,37,56,.62));
}
body.public-home .top {
  position: relative;
  z-index: 2;
  min-height: 90px;
  padding-top: 12px;
  padding-bottom: 12px;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}
.home-brand-block { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 2px; }
.home-brand { display: block; width: 172px; line-height: 0; }
.home-brand img { display: block; width: 100%; height: auto; }
.home-legal { color: #d6dce4; font-size: 11px; line-height: 1.3; font-weight: 400; }
body.public-home .top-note { align-self: flex-start; margin-top: 12px; color: #e4eaf2; text-align: right; letter-spacing: .06em; }
body.public-home .wrap {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  padding: 40px 24px;
  background: transparent;
}
.home-video { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
body.public-home .hero { width: min(100%, 660px); max-width: none; margin: 0; color: #fff; }
body.public-home .hero p { margin: 0 0 31px; color: #fff; font-size: clamp(21px, 2.5vw, 30px); font-weight: 600; text-shadow: 0 2px 12px rgba(12,37,59,.55); }
body.public-home .actions { gap: 14px; }
body.public-home .actions .btn { min-width: 145px; box-shadow: 0 9px 26px rgba(12,37,59,.32); }
body.public-home .actions .btn.ghost { background: rgba(255,255,255,.95); border-color: rgba(255,255,255,.95); color: #24568c; }
body.public-home .actions .btn.ghost:hover { background: #fff; }
body.public-home .footer { position: relative; z-index: 2; padding: 15px 24px; border-top: 0; background: transparent; color: #f1f5f9; line-height: 1.4; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
body.public-home .home-brand:focus-visible { outline: 3px solid #fff; outline-offset: 5px; border-radius: 4px; }
@media (max-width: 700px) {
  body.public-home .top { gap: 12px; padding: 10px 18px; }
  .home-brand { width: clamp(112px, 37vw, 158px); }
  .home-legal { max-width: 220px; font-size: 10px; }
  body.public-home .top-note { max-width: 40%; margin-top: 9px; font-size: 11px; white-space: normal; line-height: 1.35; }
  body.public-home .wrap { min-height: 0; padding: 42px 20px; }
  body.public-home .hero p { line-height: 1.4; }
}
@media (max-width: 390px) {
  body.public-home .wrap { padding: 34px 18px; }
  body.public-home .actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  body.public-home .home-video { display: none; }
  body.public-home .btn { transition: none; }
}
