/* Refero: Modal — phosphorescent terminal / server room after dark
   https://styles.refero.design/style/68c15685-5db9-4869-b71d-27240568c9d8
   Presentation only — routes, forms, JS unchanged. */

:root {
  --void: #000000;
  --ground: #181818;
  --carbon: #212525;
  --circuit: #485346;
  --border-soft: #1f2a33;
  --lime: #7fee64;
  --phosphor: #ddffdc;
  --sage: #8cab87;
  --sage-40: #677d64;
  --moss: #9cbf93;
  --moss-80: #aed2a4;
  --fern: #859984;
  --deep-fern: #697368;
  --warn: #e6c35c;
  --danger: #e07a7a;
  --radius: 10px;
  --radius-lg: 14px;
  --font: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--phosphor);
  background: var(--void);
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(127, 238, 100, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 100%, rgba(127, 238, 100, 0.04) 0%, transparent 50%);
}

a { color: var(--moss); text-decoration: none; }
a:hover { color: var(--lime); text-decoration: underline; text-underline-offset: 3px; }
code {
  font-family: var(--mono);
  font-size: 0.84em;
  color: var(--moss-80);
  background: rgba(127, 238, 100, 0.06);
  border: 1px solid var(--circuit);
  padding: 0.1em 0.38em;
  border-radius: 4px;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
  color: var(--phosphor);
}
.muted { color: var(--sage); }
.tiny {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--deep-fern);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mt { margin-top: 1.25rem; }

/* —— Login —— */
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-panel {
  width: min(400px, 100%);
  background: var(--ground);
  border: 1px solid var(--circuit);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.65rem 1.85rem;
  position: relative;
}
.login-panel::before {
  content: "";
  display: block;
  width: 42px;
  height: 8px;
  margin-bottom: 1.15rem;
  background:
    radial-gradient(circle at 4px 4px, #ff5f57 3.2px, transparent 3.4px),
    radial-gradient(circle at 18px 4px, #febc2e 3.2px, transparent 3.4px),
    radial-gradient(circle at 32px 4px, #28c840 3.2px, transparent 3.4px);
}
.login-panel .brand {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.login-panel .brand::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 0 0 14px rgba(127, 238, 100, 0.75);
}
.login-panel h1 {
  margin: 0.7rem 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--phosphor);
}
.login-panel > .muted {
  margin: 0 0 0.4rem;
  color: var(--moss-80);
  font-size: 0.95rem;
}

/* —— Shell —— */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--carbon) 92%, transparent);
  backdrop-filter: blur(12px);
  padding: 1.15rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: grid;
  gap: 0.25rem;
  padding: 0.4rem 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.15rem;
}
.sidebar-brand .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-brand .brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--lime);
  box-shadow: 0 0 12px rgba(127, 238, 100, 0.55);
}
.sidebar nav { display: grid; gap: 0.15rem; }
.sidebar nav a {
  color: var(--fern);
  padding: 0.58rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar nav a:hover {
  background: rgba(127, 238, 100, 0.06);
  color: var(--phosphor);
  text-decoration: none;
}
.sidebar nav a.active {
  background: rgba(127, 238, 100, 0.1);
  color: var(--phosphor);
  box-shadow: inset 3px 0 0 var(--lime);
  border-radius: 0 8px 8px 0;
  padding-left: calc(0.75rem - 3px);
}
.logout-form { margin-top: auto; padding: 0 0.25rem 0.25rem; }
.logout-form .btn { width: 100%; }

.content {
  padding: 1.85rem 2.1rem 3.5rem;
  max-width: 1080px;
  width: 100%;
}
.page-head h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--phosphor);
}
.page-head p {
  margin: 0.45rem 0 0;
  max-width: 60ch;
  color: var(--sage);
  font-size: 0.95rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.panel {
  background: var(--ground);
  border: 1px solid var(--circuit);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.2rem 1.3rem;
}
.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--phosphor);
}
.panel > .muted {
  font-size: 0.88rem;
  margin: 0 0 0.2rem;
  color: var(--sage);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.panel-head h2 { margin: 0; }

.kv { margin: 0; display: grid; gap: 0.8rem; }
.kv dt {
  font-family: var(--mono);
  color: var(--moss);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kv dd {
  margin: 0.22rem 0 0;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--phosphor);
}

.status-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.2rem 0 1rem;
}
.chip {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--carbon);
  border: 1px solid var(--circuit);
  border-radius: 999px;
  padding: 0.32rem 0.8rem 0.32rem 0.85rem;
  font-size: 0.86rem;
}
.chip span {
  font-family: var(--mono);
  color: var(--deep-fern);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chip strong code { font-size: 0.88em; }

.tabs {
  display: inline-flex;
  gap: 0.2rem;
  margin-bottom: 1.05rem;
  flex-wrap: wrap;
  padding: 0.28rem;
  background: var(--ground);
  border: 1px solid var(--circuit);
  border-radius: 999px;
}
.tab {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--fern);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.tab:hover { color: var(--phosphor); }
.tab.active {
  color: #121412;
  background: var(--lime);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panel-in 0.16s ease; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.stack { display: grid; gap: 0.85rem; margin-top: 1rem; }
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--moss);
  font-weight: 500;
  letter-spacing: 0.01em;
}
label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--phosphor);
  font-weight: 450;
}
input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  font: inherit;
  color: var(--phosphor);
  background: var(--void);
  border: 1px solid var(--circuit);
  border-radius: 8px;
  padding: 0.62rem 0.75rem;
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(127, 238, 100, 0.18);
}
textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--moss-80);
}

.btn {
  font: inherit;
  font-weight: 550;
  font-size: 0.9rem;
  border: 1px solid var(--circuit);
  border-radius: 999px;
  padding: 0.58rem 1.05rem;
  cursor: pointer;
  background: var(--carbon);
  color: var(--phosphor);
  transition: filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn-primary {
  background: var(--lime);
  border-color: color-mix(in srgb, var(--lime) 70%, #000);
  color: #121412;
  font-weight: 650;
  box-shadow: 0 0 24px rgba(127, 238, 100, 0.22);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-secondary {
  background: var(--ground);
  border-color: var(--circuit);
  color: var(--phosphor);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fern);
  border-radius: 8px;
}
.btn-ghost:hover {
  background: rgba(127, 238, 100, 0.06);
  color: var(--phosphor);
  filter: none;
}
.btn-small {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 550;
}

.alert {
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin: 1rem 0;
  border: 1px solid;
  font-size: 0.9rem;
}
.alert-error {
  background: rgba(224, 122, 122, 0.1);
  border-color: rgba(224, 122, 122, 0.35);
  color: #f0b4b4;
}
.alert-warn {
  background: rgba(230, 195, 92, 0.1);
  border-color: rgba(230, 195, 92, 0.35);
  color: #f0e0a8;
}
.form-msg.ok { color: var(--lime); }
.form-msg.err { color: #f0b4b4; }

.upload-progress { display: grid; gap: 0.35rem; }
.upload-progress-track {
  height: 5px;
  border-radius: 999px;
  background: var(--void);
  border: 1px solid var(--circuit);
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(127, 238, 100, 0.55);
  transition: width 0.12s linear;
}
.upload-progress.indeterminate .upload-progress-bar {
  width: 40%;
  animation: upload-indeterminate 1.1s ease-in-out infinite;
}
.upload-progress-label { margin: 0; color: var(--sage-40); }
@keyframes upload-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid var(--circuit);
  border-radius: var(--radius);
  background: var(--void);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
th, td {
  text-align: left;
  padding: 0.58rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
th {
  font-family: var(--mono);
  color: var(--moss);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--ground);
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(127, 238, 100, 0.03); }
tr.empty td {
  color: var(--sage-40);
  text-align: center;
  padding: 1.25rem;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 1.15rem 1.1rem 2.5rem; }
  .tabs { width: 100%; }
}
