/* Subnetix portal — design system.
   Matches the marketing site: square corners, hairline borders, mono microlabels,
   one orange accent used sparingly so it still means something. */

:root {
  --bg: #0a0c10;
  --surface: #12151c;
  --surface-2: #161a22;
  --line: #1e222c;
  --line-bright: #2a2f3b;

  --text: #f0f2f5;
  --text-2: #a8afbc;
  --text-3: #6b7280;

  --accent: #ff7a2f;
  --accent-dim: rgba(255, 122, 47, 0.12);
  --accent-line: rgba(255, 122, 47, 0.35);

  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---------- ambient background ------------------------------------------ */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient::before {
  /* Hairline grid, echoing the logo mark. */
  content: '';
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
}
.ambient::after {
  content: '';
  position: absolute;
  top: -30vh;
  left: 50%;
  width: 90vw;
  max-width: 900px;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 122, 47, 0.09), transparent 62%);
  filter: blur(30px);
}

/* ---------- type -------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 0;
}
h1 {
  font-size: 28px;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 15px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 10px;
}
.eyebrow--accent {
  color: var(--accent);
}

.muted {
  color: var(--text-2);
}
.dim {
  color: var(--text-3);
}
.mono {
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- logo -------------------------------------------------------- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}
.logo svg {
  display: block;
}
.logo-word {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}
.logo-cell {
  fill: var(--accent);
  animation: cell 4.5s var(--ease) infinite;
}
@keyframes cell {
  0%,
  70%,
  100% {
    opacity: 1;
  }
  82% {
    opacity: 0.35;
  }
}

/* ---------- auth shell -------------------------------------------------- */

.auth {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.auth-card {
  width: 100%;
  max-width: 408px;
  animation: rise 0.6s var(--ease) both;
}
.auth-head {
  margin-bottom: 26px;
}
.auth-head .logo {
  margin-bottom: 30px;
}
.auth-head p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 14px;
}
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 28px;
}
.auth-foot {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ---------- form -------------------------------------------------------- */

.field {
  margin-bottom: 18px;
}
.field:last-of-type {
  margin-bottom: 22px;
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
}
.input {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--body);
  font-size: 14.5px;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
.input::placeholder {
  color: #4b5563;
}
.input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input[aria-invalid='true'] {
  border-color: var(--bad);
}
.hint {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

textarea.input {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
  font-family: var(--body);
}

input[type='file'].input {
  padding: 9px 11px;
  font-size: 13.5px;
  cursor: pointer;
}
input[type='file'].input::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-bright);
  color: var(--text);
  font-family: var(--body);
  font-size: 13px;
  cursor: pointer;
}
input[type='file'].input::file-selector-button:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

input[type='date'].input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

@media (max-width: 520px) {
  .sx-two {
    grid-template-columns: 1fr !important;
  }
}

select.input {
  appearance: none;
  /* Chevron drawn inline so the control needs no image request and stays
     correct under the strict CSP. */
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% + 1px),
    calc(100% - 12px) calc(50% + 1px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
  cursor: pointer;
}

/* ---------- ticket thread ----------------------------------------------- */

.thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-bright);
  padding: 16px 18px;
}
.msg--staff {
  border-left-color: var(--accent);
}
.msg--internal {
  /* Visually unmistakable: an internal note shown to the wrong person is the
     one failure this feature really cannot afford. */
  background: repeating-linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.045),
    rgba(251, 191, 36, 0.045) 10px,
    transparent 10px,
    transparent 20px
  );
  border-left-color: var(--warn);
  border-style: dashed;
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.msg-head strong {
  font-weight: 500;
  color: var(--text);
}
.msg-head time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
}

.msg-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 11px 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #12151c;
  font-family: var(--body);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.14s var(--ease),
    box-shadow 0.2s,
    filter 0.16s;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 5px 22px rgba(255, 122, 47, 0.24);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn--ghost {
  width: auto;
  background: transparent;
  color: var(--text-2);
  border-color: var(--line-bright);
}
.btn--ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-3);
  box-shadow: none;
  filter: none;
}
.btn--sm {
  width: auto;
  padding: 7px 13px;
  font-size: 13px;
}

/* Destructive actions read as destructive before they are clicked, not after. */
.btn--danger {
  background: transparent;
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.4);
}
.btn--danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--bad);
  box-shadow: none;
  filter: none;
}
.btn--danger:focus-visible {
  outline-color: var(--bad);
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- alert ------------------------------------------------------- */

.alert {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--text-3);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text-2);
  animation: rise 0.3s var(--ease) both;
}
.alert--bad {
  border-left-color: var(--bad);
  color: #fecaca;
}
.alert--ok {
  border-left-color: var(--ok);
  color: #a7f3d0;
}
.alert[hidden] {
  display: none;
}

/* ---------- app shell --------------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.side {
  border-right: 1px solid var(--line);
  background: rgba(18, 21, 28, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  gap: 30px;
}
.side .logo {
  padding-left: 4px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 4px;
  margin: 16px 0 7px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-2);
  font-size: 14px;
  border-left: 2px solid transparent;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav a[aria-current='page'] {
  color: var(--text);
  background: var(--surface-2);
  border-left-color: var(--accent);
}
.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.who {
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.who strong {
  display: block;
  font-weight: 500;
}
.who span {
  color: var(--text-3);
  font-size: 12px;
}

.main {
  padding: 34px 38px 60px;
  max-width: 1180px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 14px;
  max-width: 62ch;
}

/* ---------- cards / tiles ----------------------------------------------- */

.grid {
  display: grid;
  gap: 14px;
}
.grid--tiles {
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 17px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.tile:hover {
  border-color: var(--line-bright);
}
.tile-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}
.tile-value {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.1;
}
.tile-sub {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-3);
}
.tile--accent .tile-value {
  color: var(--accent);
}

/* ---------- table ------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 520px;
}
th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 400;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr {
  transition: background 0.13s;
}
tbody tr:hover {
  background: var(--surface-2);
}
td strong {
  color: var(--text);
  font-weight: 500;
}

/* ---------- pill -------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--line-bright);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.pill--ok {
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--ok);
}
.pill--warn {
  border-color: rgba(251, 191, 36, 0.4);
  color: var(--warn);
}
.pill--bad {
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--bad);
}
.pill--accent {
  border-color: var(--accent-line);
  color: var(--accent);
}

/* ---------- empty / skeleton -------------------------------------------- */

.empty {
  border: 1px dashed var(--line-bright);
  background: rgba(18, 21, 28, 0.4);
  padding: 44px 28px;
  text-align: center;
}
.empty h3 {
  margin-bottom: 7px;
}
.empty p {
  margin: 0 auto 20px;
  color: var(--text-2);
  font-size: 14px;
  max-width: 46ch;
}

.skel {
  height: 13px;
  background: linear-gradient(90deg, var(--surface-2) 25%, #1d2029 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- token reveal ------------------------------------------------ */

.token-box {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 12px;
}
.token-box input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ---------- toast ------------------------------------------------------- */

.toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 44px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line-bright);
  border-left: 2px solid var(--accent);
  padding: 12px 15px;
  font-size: 13.5px;
  color: var(--text);
  animation: slidein 0.32s var(--ease) both;
}
.toast--bad {
  border-left-color: var(--bad);
}
.toast--ok {
  border-left-color: var(--ok);
}
@keyframes slidein {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ---------- dialog ------------------------------------------------------ */

dialog {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
}
dialog::backdrop {
  background: rgba(6, 8, 11, 0.72);
  backdrop-filter: blur(2px);
}
.dialog-body {
  padding: 24px;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
.dialog-actions .btn {
  width: auto;
}

/* ---------- responsive -------------------------------------------------- */

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    flex-wrap: wrap;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-label {
    display: none;
  }
  .nav a {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 6px 10px;
  }
  .nav a[aria-current='page'] {
    border-left: none;
    border-bottom-color: var(--accent);
  }
  .side-foot {
    margin: 0 0 0 auto;
    border-top: none;
    padding-top: 0;
  }
  .who {
    margin-bottom: 0;
    text-align: right;
  }
  .main {
    padding: 24px 18px 48px;
  }
}

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