:root {
  color-scheme: dark;
  --bg: #0b0e17;
  --surface: #101623;
  --surface-high: #151d2d;
  --line: #273248;
  --text: #f3f5f7;
  --muted: #a4afc2;
  --cyan: #70def2;
  --violet: #a38dff;
  --danger: #ff9aab;
  --green: #7ae5a4;
  --focus: #a3ecff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--text); margin: 0; }
a { color: var(--cyan); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: .625rem .75rem;
  color: var(--text);
  background-color: #0b101c;
  border: 1px solid var(--line);
  border-radius: .375rem;
}
textarea { resize: vertical; }
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 13px) calc(50% + 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.eyebrow { font-size: .875rem; font-weight: 750; color: var(--cyan); letter-spacing: .13em; text-transform: uppercase; }

.login-screen { display: grid; min-height: 100vh; grid-template-columns: 1.1fr .9fr; }
.login-brand {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  gap: 2rem;
  padding: clamp(2rem, 8vw, 8rem);
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: radial-gradient(ellipse at 60% 40%, #281954, #0f1629 60%, var(--bg));
}
.login-brand h1 { font-size: clamp(3rem, 6.4vw, 6.5rem); line-height: .92; letter-spacing: -.07em; margin: .9rem 0 1.25rem; }
.login-brand p:not(.eyebrow) { max-width: 24rem; color: var(--muted); line-height: 1.65; }
.login-art { position: absolute; right: -5%; top: 14%; width: min(60%, 28rem); opacity: .23; z-index: -1; }
.back-link { position: absolute; top: 2rem; left: clamp(2rem, 8vw, 8rem); color: var(--muted); }
.mobile-back { display: none; }
.login-card {
  align-self: center;
  justify-self: center;
  width: min(28rem, calc(100% - 3rem));
  margin: 2rem auto;
  padding: clamp(1.375rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--surface);
  box-shadow: 0 1rem 4rem #0003;
}
.login-heading { display: flex; gap: .875rem; align-items: center; margin-bottom: 1.5rem; }
.login-heading img { width: 3rem; height: 3rem; border-radius: .5rem; }
.login-heading h2 { font-size: 1.5rem; }
#login-form { display: grid; gap: .5rem; }
#login-form label { font-size: .875rem; color: var(--muted); }
#login-form label:not(:first-child) { margin-top: .375rem; }
#login-form .primary-button { margin-top: .625rem; }
.connection-field { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.connection-field p, .login-note { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.connection-field p { flex: 1 1 8rem; }
.login-note { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.feedback { font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.feedback.error, .danger { color: var(--danger); }
.feedback.success { color: var(--green); }
.primary-button, .secondary-button {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .4375rem .75rem;
  font-size: .875rem;
  font-weight: 650;
  border-radius: .375rem;
}
.primary-button { background: linear-gradient(105deg, #7749dc, #455ecc); color: #fff; border: 1px solid #8b76ff; }
.primary-button:hover:not(:disabled) { filter: brightness(1.14); }
.secondary-button { color: var(--text); background: var(--surface-high); border: 1px solid var(--line); }
.secondary-button:hover:not(:disabled) { border-color: var(--violet); }
.secondary-button.danger { color: var(--danger); }

.dashboard { display: grid; min-height: 100vh; grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.25rem .875rem;
  background-color: #0e1320;
  border-right: 1px solid var(--line);
}
.panel-brand { display: flex; align-items: center; gap: .625rem; text-decoration: none; color: var(--text); padding: 0 .375rem; }
.panel-brand img { width: 2.75rem; height: 2.75rem; border-radius: .4rem; }
.panel-brand > span { font-size: 1.15rem; font-weight: 750; line-height: 1.2; }
.panel-brand > span span { display: block; color: var(--muted); font-size: .8125rem; }
.sidebar nav { display: grid; gap: .25rem; }
.side-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 2.75rem;
  padding: .5rem .625rem;
  border: 1px solid transparent;
  border-radius: .375rem;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}
.side-link > span { width: 1rem; text-align: center; font-size: 1rem; }
.side-link:hover, .side-link[aria-current] { background-color: var(--surface-high); border-color: var(--line); color: var(--text); }
.side-link[aria-current] > span { color: var(--violet); }
.account { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding: 1rem .25rem 0; border-top: 1px solid var(--line); }
.account-details { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.account-details strong { display: block; font-size: .875rem; }
.account-details span { display: block; color: var(--muted); font-size: .8125rem; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: #3b3266; font-weight: 750; }
.workspace { min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.125rem max(1.125rem, 2.6vw); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); letter-spacing: -.04em; }
.top-actions, .action-group, .pagination, .dialog-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.connection { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .875rem; }
.connection i { width: .45rem; height: .45rem; border-radius: 50%; background: var(--muted); }
.connection[data-status="online"] i { background: var(--green); }
.connection[data-status="offline"] i { background: var(--danger); }
.content { padding: clamp(1rem, 2.6vw, 2.75rem); max-width: 92rem; margin: auto; }
#view-error { margin-bottom: 1rem; padding: .75rem; background: #231421; border: 1px solid #643944; border-radius: .375rem; }
.view { display: grid; gap: 1rem; }
.stat-grid, .overview-grid, .module-grid { display: grid; gap: 1rem; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.overview-grid { grid-template-columns: repeat(auto-fit, minmax(min(21rem, 100%), 1fr)); }
.module-grid { grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr)); }
.stat-grid article, .panel-card, .table-card { padding: clamp(1rem, 2vw, 1.35rem); border: 1px solid var(--line); background: var(--surface); border-radius: .625rem; }
.stat-grid h2 { font-size: .875rem; color: var(--muted); font-weight: 650; }
.stat-grid strong { display: block; font-size: clamp(1.5rem, 3vw, 2.15rem); margin-top: .625rem; letter-spacing: -.04em; }
.panel-card h2 { font-size: 1.125rem; }
.panel-card h3 { font-size: 1rem; }
.server-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .8rem; margin: 1rem 0 0; }
.server-details dt { color: var(--muted); font-size: .875rem; }
.server-details dd { margin: .375rem 0 0; }
progress { width: 100%; height: .5rem; appearance: none; accent-color: var(--violet); }
.record-list { padding: 0; margin: .5rem 0 0; list-style: none; }
.record {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .75rem 0;
  border-top: 1px solid var(--line);
}
.record:first-child { border-top: 0; }
.record-copy { flex: 1 1 13rem; min-width: 0; overflow-wrap: anywhere; }
.record-copy strong, td strong { display: block; font-size: .95rem; }
.record-copy span, td small { display: block; margin-top: .25rem; color: var(--muted); font-size: .875rem; white-space: pre-wrap; }
.pill { display: inline-block; padding: .2rem .5rem; background: #212b3d; border-radius: .35rem; color: var(--text); font-size: .8125rem; }
.pill.online { background: #19392e; color: var(--green); }
.empty { padding: 1.125rem .5rem; color: var(--muted); overflow-wrap: anywhere; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.filter-bar label, #action-fields label { display: grid; gap: .375rem; font-size: .875rem; }
.filter-bar label:first-child { width: min(100%, 24rem); }
.filter-bar label.checkbox { display: flex; align-items: center; align-self: flex-end; min-height: 2.75rem; gap: .5rem; color: var(--muted); }
input[type="checkbox"] { width: 1.125rem; height: 1.125rem; min-height: auto; accent-color: var(--violet); }
.table-card { padding: 0; overflow: auto; }
table { width: 100%; min-width: 39rem; border-collapse: collapse; }
th, td { text-align: left; padding: .875rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .9rem; }
th { font-size: .875rem; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.pagination { justify-content: flex-end; padding-top: .625rem; color: var(--muted); font-size: .875rem; }
.module-card, .ticket-detail { display: grid; align-content: start; justify-items: start; gap: .625rem; }
.module-card p, .ticket-detail > p { color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.ticket-detail > ul { width: 100%; }
.preserve-lines { white-space: pre-wrap; }

.action-dialog {
  width: min(34rem, calc(100% - 2rem));
  padding: 1.25rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .625rem;
}
.action-dialog::backdrop { background: #05070bbf; }
.action-dialog h2 { font-size: 1.25rem; }
.action-dialog form, #action-fields { display: grid; gap: .875rem; }
.action-dialog p:not(.error) { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.dialog-footer { justify-content: end; }
.toast {
  position: fixed;
  inset: auto 1rem 1rem auto;
  z-index: 2;
  max-width: min(100% - 2rem, 28rem);
  background: var(--surface-high);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: .5rem;
  color: var(--text);
  font-size: .925rem;
  line-height: 1.4;
  padding: .75rem 1rem;
  opacity: 0;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.noscript { margin: 1rem; padding: .75rem; color: var(--danger); }

@media (max-width: 58rem) {
  .login-screen { grid-template-columns: 1fr; background: radial-gradient(ellipse at center, #26194f, var(--bg) 60%); }
  .login-brand { display: none; }
  .mobile-back { display: inline-block; color: var(--muted); margin-bottom: 1rem; font-size: .875rem; }
}
@media (max-width: 46rem) {
  .dashboard { display: block; }
  .sidebar { position: static; height: auto; gap: .75rem; padding: .75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
  .side-link { min-height: 2.5rem; gap: .375rem; padding: .375rem .5rem; }
  .account { margin-top: 0; padding-top: .625rem; }
  .topbar { padding: .75rem; }
  .top-actions { max-width: 100%; }
  .content { padding: .875rem; }
}
