:root {
  color-scheme: dark;
  --bg: #15181d;
  --panel: #20242a;
  --row: #1b1f24;
  --line: #373d46;
  --text: #f4f6fa;
  --muted: #a3adbb;
  --accent: #7dc9ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
.app-shell { min-height: 100vh; }
.site-header { border-bottom: 1px solid #2d333b; background: #191d22; }
.header-inner { max-width: 1060px; margin: auto; padding: 14px 24px; display: flex; align-items: center; gap: 38px; }
.brand { display: inline-flex; align-items: center; gap: 12px; flex: none; font-weight: 750; font-size: 16px; line-height: 1.13; letter-spacing: -.025em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: .01em; }
.brand-mark, .login-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #263e50; color: var(--accent); font-weight: 800; font-size: 19px; }
.site-header nav { font-size: 13px; color: var(--muted); }
.nav-active { color: var(--text); font-weight: 600; }
.header-account { margin-left: auto; display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 13px; }
.header-account form { margin: 0; }
.logout { border: 1px solid var(--line); border-radius: 8px; background: transparent; color: #d5dce6; padding: 7px 11px; font-size: 12px; white-space: nowrap; }
.logout:hover { background: #293039; }
.content { max-width: 1060px; margin: 0 auto; padding: 44px 24px 60px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.eyebrow { margin-bottom: 9px; color: var(--accent); font-size: 11px; letter-spacing: .16em; font-weight: 750; }
.page-heading h1 { margin: 0 0 7px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.04em; line-height: 1.18; }
.page-heading p, .form-card > p { margin: 0; color: var(--muted); font-size: 14px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 15px; white-space: nowrap; font-size: 13px; font-weight: 650; }
.button.primary { border-color: #80cdfc; background: #83cbf8; color: #10202c; }
.button.primary:hover { background: #a5ddff; }
.button.secondary { background: #262b32; color: #e9eff6; }
.button.secondary:hover { background: #303840; }
.button.small { padding: 7px 11px; font-size: 12px; }
.button.full { width: 100%; }
.filters { display: flex; gap: 10px; margin-bottom: 24px; }
.search-field { display: flex; flex: 1; min-width: 0; align-items: center; gap: 12px; padding: 0 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; color: #a8b4c3; }
.search-field:focus-within { border-color: var(--accent); }
.search-field svg { flex: none; }
.search-field input { border: 0; padding: 12px 0; width: 100%; min-width: 0; background: transparent; outline: 0; }
input, select, textarea { max-width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: #8994a3; }
.filters select { min-width: 170px; font-size: 13px; }
.system-list { display: grid; gap: 15px; }
.system-card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.system-main { padding: 21px 23px 10px; }
.system-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 8px; min-width: 0; }
.system-identity { display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px; min-width: 0; }
.system-heading h2 { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -.025em; overflow-wrap: anywhere; }
.system-name { color: var(--muted); font-size: 12px; }
.badge { flex: none; border: 1px solid #35546b; border-radius: 99px; background: #203747; color: #9ad6ff; padding: 3px 9px; font-size: 11px; font-weight: 650; }
.badge-staging { border-color: #6a5640; background: #3a3027; color: #f2c98d; }
.badge-production { border-color: #714452; background: #402b34; color: #f4b7c7; }
.system-url { display: inline-block; max-width: 100%; color: var(--accent); font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.system-url:hover { text-decoration: underline; }
.notes { margin: 12px 0 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.system-actions { display: flex; gap: 3px; margin-left: auto; }
.system-actions form, .account-links form { display: inline-flex; margin: 0; }
.icon-button, .credential-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); flex: none; }
.icon-button:hover, .credential-icon:hover { background: #323943; color: #fff; }
.icon-button.danger:hover { color: #ff9ca8; }
.access-details { padding-bottom: 19px; }
.access-details summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 23px 11px; list-style: none; cursor: pointer; font-size: 12px; color: var(--muted); }
.access-details summary::-webkit-details-marker { display: none; }
.detail-toggle { color: var(--accent); font-weight: 600; }
.access-details[open] .detail-toggle span { display: inline-block; transform: rotate(180deg); }
.account-area { padding: 0 23px; }
.account-area-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.account-area-header h3 { margin: 0; font-size: 13px; font-weight: 650; color: #dce4ed; }
.account-card + .account-card { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.account-top { display: flex; justify-content: space-between; align-items: center; min-height: 28px; margin-bottom: 8px; }
.account-top strong { font-size: 12px; font-weight: 600; color: var(--muted); }
.account-links { display: flex; gap: 3px; }
.credential-list { display: grid; gap: 8px; }
.credential-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 51px; padding: 5px 12px; border: 1px solid #343a43; border-radius: 9px; background: var(--row); }
.credential-label { color: var(--muted); font-size: 13px; }
.credential-value { min-width: 0; color: #f3f6fb; font: 14px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.credential-actions { display: flex; align-items: center; gap: 2px; }
.credential-icon { width: 35px; height: 35px; }
.restricted-note { margin: 4px 23px 20px; color: var(--muted); font-size: 12px; }
.muted, .footer-note, .hint { color: var(--muted); font-size: 13px; }
.footer-note { margin: 19px 0 0; }
.empty { border: 1px dashed var(--line); background: var(--panel); border-radius: 14px; padding: 55px 25px; text-align: center; }
.empty-icon { margin: 0 auto 14px; color: var(--accent); font-size: 32px; }
.empty h2 { margin-bottom: 5px; }
.empty p { color: var(--muted); }
.empty .button { margin-top: 10px; }
.alert { margin-bottom: 16px; padding: 11px 14px; border: 1px solid; border-radius: 9px; font-size: 13px; }
.alert.success { border-color: #426858; background: #20372e; color: #b6f0cd; }
.alert.error { border-color: #85515b; background: #452b32; color: #ffd6dc; }
.pagination { margin-top: 20px; }
.pagination a, .pagination span { color: var(--text); }
.back-link { display: inline-block; margin-bottom: 24px; color: var(--accent); font-size: 13px; font-weight: 600; }
.form-card, .login-card { max-width: 620px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); padding: clamp(22px, 4vw, 36px); }
.form-card h1, .login-card h1 { margin-bottom: 6px; font-size: 29px; letter-spacing: -.035em; }
.form-card form, .login-card form { margin-top: 28px; }
.form-card label, .login-card label { display: block; margin-bottom: 19px; font-size: 13px; font-weight: 600; }
.form-card label input, .form-card label select, .form-card label textarea, .login-card label input { display: block; width: 100%; margin-top: 8px; font-weight: 400; background: var(--row); }
.form-card label.check { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.form-card label.check input { width: auto; margin: 0; }
.hint { margin: 0 0 18px; }
.field-error { display: block; margin-top: 5px; color: #ffb3bd; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(100%, 430px); }
.login-mark { margin-bottom: 23px; }
.login-card p { color: var(--muted); font-size: 14px; }
@media (max-width: 700px) {
  .header-inner { gap: 16px; padding: 12px 18px; }
  .site-header nav { display: none; }
  .header-account > span { display: none; }
  .content { padding: 30px 18px 45px; }
  .filters { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .filters select { min-width: 0; flex: 1; }
}
@media (max-width: 480px) {
  .brand small { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .system-main { padding: 18px 16px 10px; }
  .system-heading { flex-wrap: wrap; }
  .system-actions { margin-left: auto; }
  .access-details summary { padding-left: 16px; padding-right: 16px; }
  .account-area { padding: 0 16px; }
  .credential-row { grid-template-columns: 39px minmax(0, 1fr) auto; gap: 7px; padding: 5px 7px; }
  .credential-icon { width: 30px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
}

/* Compact directory layout */
.site-header { background: var(--bg); border-bottom: 0; }
.header-inner { max-width: 998px; padding: 19px 24px 9px; align-items: flex-start; }
.brand { font-size: 26px; line-height: 1.15; letter-spacing: -.04em; }
.brand small { margin-top: 6px; font-size: 16px; color: #aab8cf; letter-spacing: 0; }
.header-account { margin-top: 0; }
.header-account .logout { padding: 10px 17px; font-size: 14px; font-weight: 650; }
.admin-badge { border: 1px solid #675539; border-radius: 99px; padding: 5px 20px; background: #30291f; color: #f5bb74; font-weight: 700; }
.content { max-width: 998px; padding: 16px 24px 60px; }
.directory-tools { display: flex; gap: 13px; align-items: stretch; margin: 0 0 15px; }
.filters { margin: 0; flex: 1; min-width: 0; }
.search-field { width: 100%; min-height: 48px; }
.search-field button { display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #a6b1c1; }
.search-field button:hover { color: white; }
.search-field input { font-size: 16px; }
.add-system { padding: 10px 19px; font-size: 15px; }
.system-list { gap: 15px; }
.system-card { padding: 16px 22px 20px; }
.system-main { padding: 0 0 7px; }
.system-heading { margin-bottom: 9px; gap: 10px; }
.system-heading h2 { font-size: 19px; }
.badge { border: 0; background: #263e35; color: #72d4a4; padding: 3px 11px; }
.badge-development { background: #233849; color: #83cfff; }
.badge-production { background: #452d38; color: #ffb7ca; }
.system-url { margin: 0; font-size: 13px; }
.account-area { padding: 0; }
.account-card + .account-card { margin-top: 14px; padding-top: 14px; }
.account-top { min-height: 25px; margin-bottom: 6px; }
.account-top strong { color: #9eacbf; }
.credential-row { min-height: 51px; }
.add-account { display: inline-block; margin-top: 13px; color: var(--accent); font-size: 12px; }
.add-account:hover { text-decoration: underline; }
.restricted-note { margin: 5px 0 0; }
.footer-note { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 19px; line-height: 1.6; }
.admin-dialog { width: min(475px, calc(100% - 28px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 0; border-radius: 17px; background: transparent; color: var(--text); }
.admin-dialog::backdrop { background: rgb(0 0 0 / 68%); }
.admin-dialog .login-card { width: 100%; padding: 27px; }
.admin-dialog h2 { margin-bottom: 19px; font-size: 20px; }
.admin-dialog .login-card form { margin: 0; }
.admin-dialog label { color: #aab8cf; }
.admin-dialog input { height: 45px; }
.admin-dialog .form-actions { margin-top: 18px; }
.form-card { max-width: 620px; }
.form-section-heading { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 32px 0 13px; }
.form-section-heading h2 { margin: 0; font-size: 16px; }
.form-section-heading span { font-size: 12px; color: var(--muted); }
.account-form-row { padding: 18px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--row); }
.account-row-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; color: #dce5ee; font-size: 13px; }
.account-form-row label { margin-bottom: 12px; }
.account-form-row label:last-of-type { margin-bottom: 0; }
.account-form-row input { background: var(--panel) !important; }
.account-form-row .hint { margin: 9px 0 0; }
.remove-account { padding: 3px 6px; border: 0; background: transparent; color: #ffb4c0; font-size: 12px; }
.remove-account:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .header-inner { padding: 17px 18px 7px; }
  .content { padding: 16px 18px 48px; }
  .brand { font-size: 22px; }
  .brand small { font-size: 12px; }
  .directory-tools { flex-wrap: wrap; }
  .directory-tools .filters { flex-basis: 100%; }
  .directory-tools .add-system { width: 100%; }
}
@media (max-width: 480px) {
  .header-account .logout { font-size: 12px; padding: 8px 10px; }
  .brand small { display: block; }
  .system-card { padding: 16px 14px 18px; }
  .system-main { padding: 0 0 7px; }
  .credential-row { grid-template-columns: 39px minmax(0, 1fr) auto; }
}

/* Environment filter and compact account accordions */
.filters select { flex: none; min-width: 187px; padding-right: 30px; background: var(--panel); color: var(--text); font-size: 13px; }
.account-card { border-top: 1px solid var(--line); }
.account-card + .account-card { margin: 0; padding: 0; border-top: 1px solid var(--line); }
.account-toggle { display: flex; justify-content: space-between; align-items: center; gap: 14px; list-style: none; padding: 11px 0; color: #e2ebf5; font-size: 13px; font-weight: 650; cursor: pointer; }
.account-toggle::-webkit-details-marker { display: none; }
.account-toggle:hover { color: var(--accent); }
.account-toggle-hint { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.account-toggle-hint span { display: inline-block; margin-left: 3px; transition: transform .15s; }
.account-card[open] .account-toggle-hint span { transform: rotate(180deg); }
.account-content { padding: 2px 0 12px; }
.account-content .account-links { justify-content: flex-end; margin: 0 0 5px; }
.account-area > .muted { margin: 6px 0 0; }
@media (max-width: 700px) {
  .filters select { width: 100%; min-height: 44px; }
}
