/* admin.css — only what the management table needs.
 *
 * The portal's style.css is loaded first and does the rest: the tokens, the
 * ground, and every .login-* rule behind the sign-in card. That is the whole
 * reason the panel moved in here alongside the portal — backend/admin/ had to
 * keep a hand-copied duplicate of those tokens, because it lived on the far
 * side of a separate deploy and could not reach this file.
 */
:root {
  /* Named for the role the table uses them in; values from the portal's own
     palette so nothing drifts. */
  --border:        rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --accent:        var(--champagne);
  --danger:        #e2716a;
  --ok:            #6fbf8b;

  /* The metal, for the one line that says which door this is. */
  --silver: linear-gradient(100deg,
    #8f98a4 0%, #ffffff 20%, #d6dde6 36%,
    #949daa 52%, #ffffff 70%, #b9c2cd 100%);
}

/* .login-shell sets display:grid, which would otherwise beat the UA
   stylesheet's [hidden]{display:none} and leave the form over the panel. */
[hidden] { display: none !important; }

/* ── The one difference from the portal's login ──────────────── */
.login-section {
  margin: clamp(14px, 1.6vw, 20px) 0 0;
  text-align: center;
  font-size: clamp(11px, 1.05vw, 13.5px);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;          /* the tracking would push it off-centre */
  text-transform: uppercase;
  background: var(--silver);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Less than the portal's first field: .login-section already sits in that gap. */
.login-card .login-field:first-of-type { margin-top: clamp(18px, 2.4vw, 28px); }

/* ── The panel's ground ─────────────────────────────────────── */
/* Only under the panel. Over the sign-in card the portal's own scene is
   running, and these would be a second, worse version of the same light. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-viewer);
  pointer-events: none;
  overflow: hidden;
  display: none;
}
body.view-panel .backdrop { display: block; }

/* Shafts of light entering on the diagonal — the same axis the sand falls along
   in the portal, so the two rooms are lit from the same window. Three of them,
   gathered to the right at uneven spacings: evenly spaced they read as a
   measured pattern, which is the one thing light never looks like. */
.beams {
  position: absolute;
  top: -6%;
  left: 0;
  right: 0;
  /* A third of the window, not all of it. Run the full height and they stop
     being light coming in and become rules drawn across the screen. */
  height: 46%;
  background:
    linear-gradient(107deg,
      transparent 50%,
      rgba(203, 164, 104, 0.085) 53%,
      rgba(203, 164, 104, 0.02) 55.5%,
      transparent 58%),
    linear-gradient(107deg,
      transparent 59.5%,
      rgba(226, 236, 248, 0.10) 62%,
      rgba(236, 244, 252, 0.21) 63.5%,
      rgba(226, 236, 248, 0.07) 65.5%,
      transparent 68%),
    linear-gradient(107deg,
      transparent 71%,
      rgba(226, 236, 248, 0.095) 73%,
      rgba(226, 236, 248, 0.025) 75.5%,
      transparent 78%);
  filter: blur(4px);
  /* Fades out well before the bottom of its own box, so each shaft ends in air
     rather than being cut off by an edge. */
  -webkit-mask-image: linear-gradient(to bottom,
    #000 0%, rgba(0, 0, 0, 0.92) 26%, rgba(0, 0, 0, 0.5) 58%, transparent 100%);
  mask-image: linear-gradient(to bottom,
    #000 0%, rgba(0, 0, 0, 0.92) 26%, rgba(0, 0, 0, 0.5) 58%, transparent 100%);
}

/* A pool of light where the card sits, so it has something to sit in rather
   than floating on flat black. */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 55% at 50% 42%,
    rgba(214, 226, 240, 0.055) 0%, transparent 70%);
}

/* ── The corner mark ────────────────────────────────────────── */
/* Only on the panel. On the gate the mark sits on the card itself, and a second
   copy in the corner would be the same artwork twice on one screen. */
.corner-mark { display: none; }
body.view-panel .corner-mark {
  display: block;
  position: fixed;
  top: clamp(16px, 2vw, 26px);
  left: clamp(18px, 2.4vw, 34px);
  z-index: var(--z-chrome);
  width: clamp(52px, 5.6vw, 76px);
  aspect-ratio: 1 / 1;
  background: url(../assets/logos/group-mark-chrome.png) no-repeat center / contain;
  opacity: 0.95;
  pointer-events: none;
}

/* ── Panel layout ───────────────────────────────────────────── */
main {
  position: relative;
  z-index: var(--z-panels);
  /* Wide enough that the whole row fits without a horizontal scrollbar, which
     otherwise appears on an ordinary desktop just to reach the delete button. */
  max-width: min(1520px, 95vw);
  margin: 0 auto;
  padding: clamp(28px, 3.4vw, 46px) clamp(18px, 2.2vw, 28px) 64px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(20px, 2.4vw, 30px);
  padding-left: clamp(58px, 6.6vw, 104px);   /* clears the fixed corner mark */
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

h1 { font-size: clamp(19px, 1.7vw, 23px); margin: 0; letter-spacing: 0.02em; }
h2 { font-size: 15px; margin: 0; letter-spacing: 0.02em; }
.muted  { color: var(--text-dim); margin: 2px 0 0; }
.center { text-align: center; }
.status { min-height: 18px; font-size: 12px; color: var(--text-dim); margin: 14px 0 0; }
.status.ok  { color: var(--ok); }
.status.bad { color: var(--danger); }

.card {
  background: rgba(18, 15, 12, 0.86);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: clamp(22px, 2.4vw, 32px) clamp(20px, 2.4vw, 34px) clamp(20px, 2.2vw, 28px);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* The rules that matter most are the ones most easily skipped, so they get
   room and a line down the side rather than being wedged between the buttons
   and the table. */
.note {
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 78ch;
  margin: clamp(14px, 1.6vw, 20px) 0 0;
  padding: 12px 15px;
  border-left: 2px solid rgba(203, 164, 104, 0.45);
  background: rgba(203, 164, 104, 0.05);
  border-radius: 0 4px 4px 0;
  color: var(--text-dim);
}
/* Where the save goes is a property of the install, not of the rules, so it
   reads as a different kind of remark. */
.note-mode {
  border-left-color: rgba(226, 236, 248, 0.35);
  background: rgba(226, 236, 248, 0.04);
  margin-top: 10px;
}

/* ── Controls ───────────────────────────────────────────────── */
input[type="text"], input[type="password"], input:not([type]) {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  min-width: 0;
}
input:disabled { opacity: 0.6; cursor: not-allowed; }
input:focus-visible, button:focus-visible, [type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input::placeholder { color: rgba(242, 242, 240, 0.3); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

button {
  font: inherit;
  border-radius: 3px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #1a1206;
  font-weight: 600;
}
.primary:hover:not(:disabled) { background: #d9b57e; }

.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); }

.link-danger {
  background: none;
  border: none;
  color: var(--danger);
  padding: 4px 6px;
  font-size: 12px;
}
.link-danger:hover { text-decoration: underline; }

/* ── Table ──────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin-top: clamp(16px, 1.8vw, 22px); padding-bottom: 2px; }

table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}
td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

/* A row with unsaved edits is marked. It matters more here than it did on the
   server version: nothing is written until Salva, so an unmarked row is the
   only signal that a change actually landed. */
tbody tr.dirty { background: rgba(203, 164, 104, 0.09); }
tbody tr.dirty td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

td input[type="text"], td input[type="password"] { width: 140px; }
th:nth-child(3), td:nth-child(3) { width: 1%; }
td.center { text-align: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .link-danger { white-space: nowrap; }

/* ── Scrollbars ─────────────────────────────────────────────── */
/* The platform default is a grey slab across the glass. Same thin champagne bar
   the portal's brand cards use for their link lists. */
.table-scroll, body {
  scrollbar-width: thin;
  scrollbar-color: rgba(203, 164, 104, 0.38) transparent;
}
.table-scroll::-webkit-scrollbar, body::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-track, body::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb {
  background: rgba(203, 164, 104, 0.34);
  border-radius: 4px;
}
.table-scroll::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover { background: rgba(203, 164, 104, 0.6); }
.table-scroll::-webkit-scrollbar-corner { background: transparent; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .topbar { padding-left: clamp(52px, 8vw, 78px); }
  td input[type="text"], td input[type="password"] { width: 124px; }
}

@media (max-width: 720px) {
  main { padding: 20px 14px 48px; max-width: 100%; }
  .card { padding: 18px 16px; }
  .topbar {
    flex-direction: column;
    gap: 14px;
    padding-left: 0;
    padding-top: clamp(34px, 9vw, 48px);   /* under the corner mark, not beside it */
  }
  .topbar-right { width: 100%; justify-content: space-between; }
  .actions { width: 100%; }
  .actions button { flex: 1 1 auto; }
  .note { font-size: 13px; padding: 11px 13px; }
}
