:root {
  color-scheme: dark;
  --sec-bg: #030813;
  --sec-bg-deep: #02050c;
  --sec-panel: rgba(10, 22, 43, .78);
  --sec-panel-solid: #0a162b;
  --sec-panel-hover: rgba(18, 40, 73, .78);
  --sec-line: rgba(142, 190, 255, .15);
  --sec-line-strong: rgba(137, 196, 255, .28);
  --sec-blue: #69b7ff;
  --sec-blue-bright: #8bd4ff;
  --sec-indigo: #7c89ff;
  --sec-cyan: #62d7f8;
  --sec-text: #eef7ff;
  --sec-text-soft: #b8c8dc;
  --sec-muted: #7f93ad;
  --sec-success: #53d6ac;
  --sec-warning: #f1bd65;
  --sec-danger: #ff7186;
  --sec-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  --sec-radius-xl: 24px;
  --sec-radius-lg: 18px;
  --sec-radius-md: 13px;
  --sec-sidebar: 260px;
  --sec-topbar: 88px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sec-bg-deep);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--sec-text);
  background:
    radial-gradient(circle at 12% -10%, rgba(44, 101, 201, .24), transparent 34rem),
    radial-gradient(circle at 96% 28%, rgba(25, 134, 198, .13), transparent 35rem),
    linear-gradient(145deg, #050c1a 0%, #020712 48%, #030917 100%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--sec-blue-bright);
}

svg {
  display: block;
  width: 1.2em;
  height: 1.2em;
  fill: currentColor;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: .7rem 1rem;
  color: #05101f;
  background: var(--sec-blue-bright);
  border-radius: 10px;
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform .15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.sec-backdrop {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sec-grid {
  position: absolute;
  inset: 0;
  opacity: .17;
  background-image:
    linear-gradient(rgba(129, 183, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 183, 255, .055) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(circle at 50% 20%, #000 5%, transparent 70%);
  mask-image: radial-gradient(circle at 50% 20%, #000 5%, transparent 70%);
}

.sec-glow {
  position: absolute;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .12;
}

.sec-glow-a {
  top: -22rem;
  left: -12rem;
  background: #377eff;
}

.sec-glow-b {
  right: -23rem;
  bottom: -23rem;
  background: #30b6e5;
}

.glass-panel {
  border: 1px solid var(--sec-line);
  background:
    linear-gradient(145deg, rgba(117, 175, 255, .075), transparent 36%),
    var(--sec-panel);
  box-shadow:
    inset 0 1px rgba(222, 239, 255, .07),
    var(--sec-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
  backdrop-filter: blur(18px) saturate(118%);
}

.eyebrow {
  display: block;
  margin-bottom: .35rem;
  color: var(--sec-blue);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #061222;
  border: 1px solid rgba(231, 248, 255, .6);
  border-radius: 14px;
  background: linear-gradient(145deg, #a2e4ff, #63b2ff 55%, #7785ff);
  box-shadow: 0 9px 28px rgba(67, 145, 255, .24), inset 0 1px rgba(255, 255, 255, .8);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.button,
.icon-button,
.nav-button,
.action-row,
.text-button,
.mobile-menu-button {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .68rem 1rem;
  color: var(--sec-text);
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-weight: 750;
  text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease, opacity .16s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
.nav-button:focus-visible,
.action-row:focus-visible,
.text-button:focus-visible,
.mobile-menu-button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(105, 183, 255, .25);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: .55;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button-primary {
  color: #06101d;
  border-color: rgba(206, 239, 255, .58);
  background: linear-gradient(120deg, #8cdcff, #6bb6ff 48%, #7989ff);
  box-shadow: 0 10px 28px rgba(70, 143, 255, .2), inset 0 1px rgba(255, 255, 255, .65);
}

.button-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 13px 32px rgba(70, 143, 255, .28), inset 0 1px rgba(255, 255, 255, .7);
}

.button-secondary {
  color: #dcecff;
  border-color: var(--sec-line-strong);
  background: rgba(70, 125, 195, .11);
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  border-color: rgba(133, 196, 255, .45);
  background: rgba(77, 141, 220, .18);
}

.button-ghost {
  color: var(--sec-text-soft);
  border-color: var(--sec-line);
  background: rgba(5, 14, 29, .4);
}

.button-danger {
  color: #ffdce2;
  border-color: rgba(255, 113, 134, .34);
  background: rgba(174, 41, 65, .18);
}

.button-danger:hover:not(:disabled) {
  border-color: rgba(255, 113, 134, .56);
  background: rgba(199, 49, 76, .26);
}

.button-danger-soft {
  min-height: 34px;
  color: #ffc5cf;
  border-color: rgba(255, 113, 134, .24);
  background: rgba(255, 113, 134, .08);
}

.button-small {
  min-height: 34px;
  padding: .42rem .72rem;
  font-size: .78rem;
}

.button-wide {
  width: 100%;
}

.icon-button,
.mobile-menu-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--sec-text-soft);
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  background: rgba(15, 31, 56, .72);
}

.icon-button:hover,
.mobile-menu-button:hover {
  color: var(--sec-text);
  border-color: var(--sec-line-strong);
}

.icon-button svg,
.mobile-menu-button svg {
  width: 20px;
  height: 20px;
}

/* Login */
.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px;
  place-items: center;
}

.login-card {
  width: min(100%, 460px);
  padding: clamp(1.35rem, 5vw, 2.25rem);
  border-radius: var(--sec-radius-xl);
}

.login-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--sec-text);
  text-decoration: none;
}

.login-brand > span:last-child,
.sidebar-brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.login-brand strong,
.sidebar-brand strong {
  font-size: 1.18rem;
  font-weight: 850;
  letter-spacing: -.025em;
}

.login-brand small,
.sidebar-brand small {
  color: var(--sec-muted);
  font-size: .69rem;
  letter-spacing: .02em;
}

.login-copy {
  margin: 2.4rem 0 1.55rem;
}

.login-copy h1 {
  margin: 0 0 .55rem;
  font-size: clamp(1.65rem, 7vw, 2.15rem);
  letter-spacing: -.04em;
}

.login-copy p {
  margin: 0;
  color: var(--sec-text-soft);
  font-size: .92rem;
}

.login-form {
  display: grid;
  gap: .8rem;
  margin-top: 1.15rem;
}

.login-form label,
.drawer-form label {
  color: var(--sec-text-soft);
  font-size: .78rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: .7rem .85rem;
  color: var(--sec-text);
  border: 1px solid var(--sec-line);
  border-radius: 11px;
  background: rgba(2, 9, 20, .72);
  outline: none;
}

input::placeholder {
  color: #647993;
}

select {
  cursor: pointer;
}

.secret-field {
  position: relative;
}

.secret-field input {
  padding-right: 3.25rem;
}

.secret-field .icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
}

.login-footnote {
  margin: 1.2rem 0 0;
  color: var(--sec-muted);
  font-size: .74rem;
  text-align: center;
}

.login-footnote a {
  margin-left: .25rem;
  text-decoration: none;
}

.notice,
.global-notice {
  padding: .8rem .95rem;
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  font-size: .82rem;
}

.notice {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.notice-error,
.global-notice.notice-error {
  color: #ffd6dd;
  border-color: rgba(255, 113, 134, .28);
  background: rgba(169, 37, 62, .14);
}

.notice-warning,
.global-notice.notice-warning {
  color: #ffe5b8;
  border-color: rgba(241, 189, 101, .28);
  background: rgba(163, 107, 22, .13);
}

.notice-info,
.global-notice.notice-info {
  color: #d8ecff;
  border-color: rgba(105, 183, 255, .27);
  background: rgba(51, 112, 181, .13);
}

.notice-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

/* Main shell */
.admin-app {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: var(--sec-sidebar) minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  width: var(--sec-sidebar);
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  padding: 22px 18px;
  border-right: 1px solid var(--sec-line);
  background:
    linear-gradient(180deg, rgba(22, 45, 78, .32), transparent 38%),
    rgba(4, 11, 23, .86);
  box-shadow: 18px 0 55px rgba(0, 0, 0, .15);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.sidebar-brand {
  padding: 3px 6px 22px;
}

.admin-nav {
  display: grid;
  gap: 5px;
  padding-top: 16px;
  border-top: 1px solid var(--sec-line);
}

.nav-button {
  display: grid;
  width: 100%;
  min-height: 46px;
  grid-template-columns: 23px minmax(0, 1fr) auto;
  align-items: center;
  gap: .72rem;
  padding: .72rem .8rem;
  color: var(--sec-muted);
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-size: .86rem;
  font-weight: 740;
  text-align: left;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.nav-button:hover {
  color: var(--sec-text-soft);
  background: rgba(91, 151, 228, .08);
}

.nav-button.is-active {
  color: #eaf6ff;
  border-color: rgba(118, 184, 255, .22);
  background: linear-gradient(105deg, rgba(74, 139, 221, .24), rgba(47, 92, 161, .12));
  box-shadow: inset 0 1px rgba(218, 239, 255, .07);
}

.nav-button.is-active svg {
  color: var(--sec-blue-bright);
}

.nav-count {
  min-width: 24px;
  padding: .08rem .35rem;
  color: var(--sec-muted);
  border: 1px solid var(--sec-line);
  border-radius: 999px;
  font-size: .65rem;
  text-align: center;
}

.sidebar-foot {
  display: grid;
  gap: .85rem;
  margin-top: auto;
}

.service-state {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .78rem;
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  background: rgba(7, 18, 36, .58);
}

.service-state > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.service-state strong {
  color: var(--sec-text-soft);
  font-size: .72rem;
}

.service-state small {
  overflow: hidden;
  color: var(--sec-muted);
  font-size: .63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--sec-muted);
  box-shadow: 0 0 0 4px rgba(127, 147, 173, .1);
}

.state-online {
  background: var(--sec-success);
  box-shadow: 0 0 0 4px rgba(83, 214, 172, .11);
}

.state-offline {
  background: var(--sec-danger);
  box-shadow: 0 0 0 4px rgba(255, 113, 134, .1);
}

.state-checking {
  background: var(--sec-blue);
  box-shadow: 0 0 0 4px rgba(105, 183, 255, .1);
}

.admin-workspace {
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: var(--sec-topbar);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 16px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid var(--sec-line);
  background: rgba(3, 10, 22, .73);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  backdrop-filter: blur(20px) saturate(120%);
}

.topbar-title,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.32rem;
  letter-spacing: -.025em;
}

.last-sync {
  color: var(--sec-muted);
  font-size: .72rem;
  white-space: nowrap;
}

.mobile-menu-button {
  display: none;
}

.admin-main {
  width: min(100%, 1530px);
  margin: 0 auto;
  padding: clamp(22px, 3.3vw, 44px);
}

.global-notice {
  margin-bottom: 1rem;
}

.is-hidden {
  display: none !important;
}

.admin-panel {
  min-width: 0;
}

.admin-panel.is-active {
  animation: panel-in .22s ease-out both;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  letter-spacing: -.045em;
}

.section-heading p {
  max-width: 650px;
  margin: .35rem 0 0;
  color: var(--sec-muted);
  font-size: .86rem;
}

.status-badge {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 25px;
  align-items: center;
  gap: .4rem;
  padding: .23rem .53rem;
  border: 1px solid var(--sec-line);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.status-muted {
  color: #aebed2;
  background: rgba(129, 151, 180, .1);
}

.status-success {
  color: #9bf0d2;
  border-color: rgba(83, 214, 172, .23);
  background: rgba(35, 141, 108, .14);
}

.status-processing {
  color: #a9dbff;
  border-color: rgba(105, 183, 255, .26);
  background: rgba(48, 116, 196, .15);
}

.status-warning {
  color: #f8d79c;
  border-color: rgba(241, 189, 101, .25);
  background: rgba(160, 105, 20, .14);
}

.status-danger {
  color: #ffc2cc;
  border-color: rgba(255, 113, 134, .25);
  background: rgba(166, 37, 61, .14);
}

.status-cancelled {
  color: #b8c2d0;
  border-color: rgba(145, 159, 180, .2);
  background: rgba(89, 100, 120, .14);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-width: 0;
  padding: 1rem;
  border-radius: var(--sec-radius-lg);
}

.metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.metric-head span:first-child {
  color: var(--sec-muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric-head span:last-child {
  font-size: 1.32rem;
  font-weight: 850;
  letter-spacing: -.035em;
}

.metric-card small {
  display: block;
  margin-top: .6rem;
  overflow: hidden;
  color: var(--sec-muted);
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter {
  position: relative;
  height: 7px;
  margin-top: .8rem;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(120, 156, 204, .12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .22);
}

.meter > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #609fff, #71d2f5);
  box-shadow: 0 0 15px rgba(87, 173, 255, .35);
  transition: width .28s ease;
}

.meter-slim {
  height: 5px;
  margin-top: .6rem;
}

.overview-grid,
.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.section-card,
.table-card,
.logs-card,
.toolbar {
  border-radius: var(--sec-radius-lg);
}

.section-card {
  min-width: 0;
  margin-top: 16px;
  padding: clamp(1rem, 2vw, 1.25rem);
}

.overview-grid > .section-card,
.system-grid > .section-card {
  margin-top: 0;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-heading h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -.02em;
}

.text-button {
  padding: .3rem;
  color: var(--sec-blue-bright);
  background: none;
  font-size: .75rem;
  font-weight: 750;
}

.text-button:hover {
  text-decoration: underline;
}

.stat-pairs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat-pairs > div {
  min-width: 0;
  padding: .72rem;
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  background: rgba(4, 13, 28, .46);
}

.stat-pairs span,
.quota-box span {
  display: block;
  color: var(--sec-muted);
  font-size: .62rem;
}

.stat-pairs strong,
.quota-box strong {
  display: block;
  margin-top: .25rem;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
}

.quota-box {
  margin-top: .8rem;
  padding: .82rem;
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  background: rgba(4, 13, 28, .46);
}

.quota-box > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.quota-box > div:first-child strong {
  margin: 0;
  font-size: .78rem;
}

.quota-box small {
  display: block;
  margin-top: .55rem;
  color: var(--sec-muted);
  font-size: .64rem;
}

.action-stack {
  display: grid;
  gap: 8px;
}

.action-row {
  display: grid;
  width: 100%;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: .72rem;
  color: var(--sec-text);
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  background: rgba(4, 13, 28, .46);
  text-align: left;
  transition: border-color .16s ease, background-color .16s ease;
}

.action-row:hover {
  border-color: var(--sec-line-strong);
  background: rgba(28, 58, 99, .42);
}

.action-row.action-danger:hover {
  border-color: rgba(255, 113, 134, .32);
  background: rgba(137, 30, 51, .16);
}

.action-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--sec-blue-bright);
  border-radius: 11px;
  background: rgba(75, 144, 225, .13);
}

.action-danger .action-icon {
  color: #ff9bac;
  background: rgba(255, 113, 134, .11);
}

.action-row > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.action-row strong {
  font-size: .78rem;
}

.action-row small {
  color: var(--sec-muted);
  font-size: .65rem;
}

.action-arrow {
  color: var(--sec-muted);
  font-size: 1.2rem;
}

.compact-jobs {
  display: grid;
}

.compact-job-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .72rem 0;
  border-bottom: 1px solid var(--sec-line);
}

.compact-job-row:first-child {
  padding-top: 0;
}

.compact-job-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.compact-job-row > span:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.compact-job-row strong {
  overflow: hidden;
  font-size: .77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-job-row small {
  color: var(--sec-muted);
  font-size: .64rem;
}

/* Toolbars and tables */
.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  padding: .75rem;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select {
  min-height: 40px;
  font-size: .76rem;
}

.search-field {
  position: relative;
}

.search-field svg {
  position: absolute;
  z-index: 1;
  top: 11px;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--sec-muted);
}

.search-field input {
  padding-left: 2.5rem;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  scrollbar-color: rgba(103, 162, 231, .3) transparent;
}

.data-table {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: .82rem 1rem;
  border-bottom: 1px solid var(--sec-line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--sec-muted);
  background: rgba(6, 15, 31, .5);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.data-table td {
  color: var(--sec-text-soft);
  font-size: .75rem;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:not(.placeholder-row):hover {
  background: rgba(63, 119, 189, .055);
}

.data-table .align-right {
  text-align: right;
}

.identity-cell,
.job-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .68rem;
}

.identity-cell > span:last-child,
.job-copy {
  flex-direction: column;
  align-items: flex-start;
  gap: .05rem;
}

.identity-cell strong,
.job-copy strong,
.cell-main {
  display: block;
  overflow: hidden;
  max-width: 260px;
  color: var(--sec-text);
  font-size: .76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-cell small,
.job-copy code,
.cell-sub,
.cell-muted {
  display: block;
  color: var(--sec-muted);
  font-family: inherit;
  font-size: .63rem;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: #dff2ff;
  border: 1px solid rgba(126, 191, 255, .25);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(88, 161, 242, .34), rgba(82, 91, 183, .24));
  font-size: .78rem;
  font-weight: 850;
}

.avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1rem;
}

.progress-cell {
  display: flex;
  min-width: 100px;
  align-items: center;
  gap: .5rem;
}

.progress-cell > span:last-child {
  min-width: 32px;
  color: var(--sec-muted);
  font-size: .64rem;
}

.mini-meter {
  display: block;
  width: 74px;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(118, 155, 204, .14);
}

.mini-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sec-blue), var(--sec-cyan));
}

/* Loading, empty, error and rate-limit states */
.state-box {
  display: flex;
  min-height: 118px;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1.2rem;
  color: var(--sec-muted);
  text-align: center;
}

.state-box strong,
.state-box span:not(.spinner) {
  display: block;
}

.state-box strong {
  color: var(--sec-text-soft);
  font-size: .82rem;
}

.state-box span:not(.spinner) {
  font-size: .7rem;
}

.state-empty,
.state-error,
.state-rate-limit {
  flex-direction: column;
}

.state-error {
  color: #ff9cac;
}

.state-error strong {
  color: #ffd2da;
}

.state-rate-limit {
  color: var(--sec-warning);
}

.state-rate-limit strong {
  color: #ffe1ab;
}

.state-queued {
  color: var(--sec-warning);
}

.state-processing {
  color: var(--sec-blue-bright);
}

.state-success {
  color: var(--sec-success);
}

.spinner {
  display: inline-block;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid rgba(114, 179, 255, .18);
  border-top-color: var(--sec-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.is-loading svg {
  animation: spin .8s linear infinite;
}

/* Logs */
.logs-card {
  min-height: 250px;
  overflow: hidden;
}

.log-row {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr);
  gap: 1rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--sec-line);
}

.log-row:last-child {
  border-bottom: 0;
}

.log-row:hover {
  background: rgba(64, 121, 194, .05);
}

.log-lead,
.log-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.log-lead {
  align-items: flex-start;
  gap: .35rem;
}

.log-lead time {
  color: var(--sec-muted);
  font-size: .62rem;
}

.log-source {
  padding: .18rem .42rem;
  border: 1px solid var(--sec-line);
  border-radius: 999px;
  color: var(--sec-text-soft);
  font-size: .59rem;
  font-weight: 800;
}

.source-security {
  color: #f7ca85;
  border-color: rgba(241, 189, 101, .22);
  background: rgba(167, 108, 18, .11);
}

.source-access {
  color: #a9dbff;
  border-color: rgba(105, 183, 255, .22);
  background: rgba(47, 111, 188, .12);
}

.source-application {
  color: #c3bfff;
  border-color: rgba(124, 137, 255, .22);
  background: rgba(84, 72, 182, .11);
}

.log-content strong {
  overflow-wrap: anywhere;
  font-size: .76rem;
  font-weight: 720;
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .65rem;
  margin-top: .42rem;
}

.log-meta span {
  max-width: 100%;
  overflow: hidden;
  color: var(--sec-muted);
  font-size: .63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-meta b {
  color: #98acc4;
  font-weight: 700;
}

.log-error {
  box-shadow: inset 3px 0 rgba(255, 113, 134, .65);
}

.log-warning {
  box-shadow: inset 3px 0 rgba(241, 189, 101, .65);
}

/* System */
.health-list,
.gpu-list {
  display: grid;
}

.health-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--sec-line);
}

.health-row:first-child {
  padding-top: 0;
}

.health-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.health-row > span:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.health-row strong,
.gpu-row strong {
  color: var(--sec-text);
  font-size: .76rem;
}

.health-row small,
.gpu-row span,
.storage-detail small {
  color: var(--sec-muted);
  font-size: .64rem;
}

.gpu-row {
  padding: .75rem 0;
  border-bottom: 1px solid var(--sec-line);
}

.gpu-row:first-child {
  padding-top: 0;
}

.gpu-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.gpu-row > div:first-child,
.gpu-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gpu-values {
  margin-top: .35rem;
}

.storage-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.storage-values div {
  padding: .65rem;
  color: var(--sec-text-soft);
  border: 1px solid var(--sec-line);
  border-radius: 11px;
  background: rgba(4, 13, 28, .4);
  font-size: .68rem;
  text-align: center;
  white-space: pre-line;
}

.storage-detail small {
  display: block;
  margin-top: .6rem;
}

.config-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.config-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .68rem 0;
  border-bottom: 1px solid var(--sec-line);
}

.config-list > div:first-child {
  padding-top: 0;
}

.config-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.config-list dt {
  color: var(--sec-text-soft);
  font-size: .72rem;
}

.config-list dd {
  margin: 0;
}

/* User drawer */
.drawer-backdrop {
  position: fixed;
  z-index: 70;
  inset: 0;
  background: rgba(0, 4, 12, .66);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.user-drawer {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  width: min(92vw, 400px);
  height: 100vh;
  height: 100dvh;
  padding: 1.25rem;
  overflow-y: auto;
  border-left: 1px solid var(--sec-line-strong);
  background:
    linear-gradient(145deg, rgba(59, 116, 194, .1), transparent 32%),
    #071225;
  box-shadow: -25px 0 70px rgba(0, 0, 0, .35);
  transform: translateX(105%);
  transition: transform .22s ease;
}

.user-drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.drawer-head h2 {
  margin: 0;
  font-size: 1.3rem;
}

.drawer-identity {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem;
  margin-top: 1.3rem;
  border: 1px solid var(--sec-line);
  border-radius: 14px;
  background: rgba(6, 17, 34, .58);
}

.drawer-identity > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.drawer-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-identity small {
  color: var(--sec-muted);
  font-size: .68rem;
}

.drawer-form {
  display: grid;
  gap: .65rem;
  margin-top: 1rem;
}

.drawer-form .button {
  margin-top: .35rem;
}

.drawer-actions {
  display: grid;
  gap: .55rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--sec-line);
}

.drawer-note {
  color: var(--sec-muted);
  font-size: .67rem;
}

/* Toasts */
.toast-region {
  position: fixed;
  z-index: 120;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  width: min(90vw, 360px);
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .8rem .9rem;
  color: var(--sec-text-soft);
  border: 1px solid var(--sec-line-strong);
  border-radius: 12px;
  background: rgba(8, 21, 41, .94);
  box-shadow: var(--sec-shadow);
  font-size: .75rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--sec-blue);
}

.toast-success .toast-dot {
  background: var(--sec-success);
}

.toast-warning .toast-dot {
  background: var(--sec-warning);
}

.toast-error .toast-dot {
  background: var(--sec-danger);
}

/* Error page */
.sec-error-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px;
  place-items: center;
}

.error-shell {
  width: min(100%, 700px);
}

.error-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.4rem, 5vw, 2.5rem);
  border-radius: var(--sec-radius-xl);
}

.error-card::before {
  position: absolute;
  top: -110px;
  right: -90px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(123, 185, 255, .13);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(82, 152, 241, .13), transparent 68%);
  content: "";
  pointer-events: none;
}

.error-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--sec-text);
  text-decoration: none;
}

.error-brand strong {
  font-size: 1rem;
}

.error-code {
  margin-top: 2.8rem;
  color: var(--sec-blue-bright);
  font-size: clamp(3.5rem, 16vw, 7rem);
  font-weight: 900;
  letter-spacing: -.08em;
  line-height: .82;
  text-shadow: 0 12px 40px rgba(60, 137, 231, .22);
}

.error-card h1 {
  margin: 1.2rem 0 .55rem;
  font-size: clamp(1.45rem, 5vw, 2.05rem);
  letter-spacing: -.04em;
}

.error-card > p {
  max-width: 540px;
  margin: 0;
  color: var(--sec-text-soft);
  font-size: .9rem;
}

.error-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .8rem;
  margin-top: 1.3rem;
  border: 1px solid var(--sec-line);
  border-radius: 12px;
  background: rgba(4, 13, 28, .42);
}

.error-meta span {
  color: var(--sec-muted);
  font-size: .67rem;
}

.error-meta code {
  color: var(--sec-text-soft);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1.5rem;
}

.error-note {
  padding-top: 1.1rem;
  margin-top: 1.5rem !important;
  border-top: 1px solid var(--sec-line);
  color: var(--sec-muted) !important;
  font-size: .72rem !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

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

  .stat-pairs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .admin-app {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    width: min(84vw, 290px);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

  .admin-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  .mobile-menu-button {
    display: grid;
  }

  .admin-topbar {
    min-height: 74px;
  }

  .overview-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-main {
    padding: 20px 14px 32px;
  }

  .admin-topbar {
    padding: 12px 14px;
  }

  .topbar-title .eyebrow,
  .last-sync,
  .topbar-actions .button span {
    display: none;
  }

  .topbar-actions .button {
    width: 42px;
    min-height: 42px;
    padding: 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .metric-card {
    padding: .85rem;
  }

  .metric-head {
    display: block;
  }

  .metric-head span:last-child {
    display: block;
    margin-top: .15rem;
  }

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

  .toolbar select {
    width: 100%;
  }

  .log-row {
    grid-template-columns: 1fr;
    gap: .55rem;
  }

  .log-lead {
    flex-direction: row;
    align-items: center;
  }

  .login-shell,
  .sec-error-page {
    padding: 14px;
  }

  .error-actions {
    display: grid;
  }

  .error-actions .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .stat-pairs,
  .storage-values {
    grid-template-columns: 1fr 1fr;
  }

  .storage-values div:last-child {
    grid-column: 1 / -1;
  }

  .login-card,
  .error-card {
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --sec-line: rgba(183, 215, 255, .38);
    --sec-line-strong: rgba(200, 227, 255, .6);
    --sec-text-soft: #d3e1f2;
    --sec-muted: #a8b8cc;
  }
}
