/* Shared styles for the dashboard, portal and checkout. The colours, background,
   type and buttons follow the marketing site (site/style.css), so the app reads
   as the same product. System fonts, no dependencies. */

:root {
  --bg: #0e1116;
  --bg-alt: #151a22;
  --card: #1a212c;
  --card-hover: #202836;
  --text: #e8ecf1;
  --muted: #9aa4b2;
  --accent: #4cc38a;
  --accent-2: #38bdf8;
  --accent-dim: rgba(76, 195, 138, 0.14);
  --border: #262e3b;
  --warn: #e5a54b;
  --bad: #e5604f;
  --radius: 10px;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* grid and flex rules below would otherwise override it */

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(76, 195, 138, 0.12), transparent 60%),
    radial-gradient(700px 460px at 100% 0%, rgba(56, 189, 248, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(76, 195, 138, 0.28); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }

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

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 900px; }
.wrap.tight { max-width: 580px; }

/* minmax(0, 1fr): a wide table then scrolls inside its panel instead of
   stretching the column past the screen. */
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* Header: logo and page name, a link to the other page, and the session. */

.app-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 17, 22, 0.92);
  backdrop-filter: blur(8px);
}
.app-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 22px; width: auto; }
.wordmark { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.brand-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(76, 195, 138, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
}

.nav-link { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.nav-link:hover { color: var(--text); text-decoration: none; }

.session { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-family: var(--mono); font-size: 13px; white-space: nowrap; }

/* Phones: two deliberate rows instead of a ragged wrap. Logo and page link on
   the first, who is signed in and the sign-in button on the second. */
@media (max-width: 640px) {
  .app-header { position: static; }
  .app-header .wrap { flex-wrap: wrap; gap: 10px 16px; padding-top: 12px; padding-bottom: 12px; }
  .session { width: 100%; justify-content: space-between; }
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 20px; }
}

/* Every non-mainnet deployment says so under the header (network.js). */
.testnet-bar {
  background: rgba(229, 165, 75, 0.1);
  border-bottom: 1px solid rgba(229, 165, 75, 0.45);
  color: var(--warn);
  font-size: 13px;
  text-align: center;
  padding: 7px 16px;
}
.testnet-bar a { color: inherit; text-decoration: underline; white-space: nowrap; }

.app-footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: 13px; color: var(--muted); }
.app-footer .wrap { display: flex; gap: 8px 16px; flex-wrap: wrap; justify-content: space-between; }
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--text); }

/* Buttons: primary as on the site, ghost and danger for secondary actions. */

button, .button {
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: linear-gradient(135deg, #4cc38a 0%, #3db87a 100%);
  color: #0b0e12;
  box-shadow: 0 8px 24px -10px rgba(76, 195, 138, 0.6);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.25s ease, border-color 0.15s ease;
}
button:hover:not(:disabled), .button:hover {
  background: linear-gradient(135deg, #5fd29a 0%, #4cc38a 100%);
  transform: translateY(-1px);
  text-decoration: none;
}
button.ghost, .button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
  font-weight: 600;
}
button.ghost:hover:not(:disabled), .button.ghost:hover { background: var(--accent-dim); border-color: var(--accent); }
button.danger, button.ghost.danger { background: transparent; color: var(--bad); border-color: rgba(229, 96, 79, 0.6); box-shadow: none; font-weight: 600; }
button.danger:hover:not(:disabled) { background: rgba(229, 96, 79, 0.12); border-color: var(--bad); }
button.small, .button.small { padding: 7px 14px; font-size: 14px; }
button:disabled { opacity: 0.45; cursor: default; transform: none; }

input[type=text], input[type=url], input[type=number], select {
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  transition: border-color 0.15s ease;
}
input:focus { border-color: var(--accent); }

/* Panels and tiles */

.panel, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.panel h2, .card h2 {
  font-size: 16px;
  margin: 0 0 14px;
  position: relative;
  padding-left: 14px;
  letter-spacing: -0.01em;
}
.panel h2::before, .card h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }

/* Tables */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
tbody tr:last-child td { border-bottom: 0; }
.addr, td.addr { font-family: var(--mono); font-size: 13px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.active, .pill.trial, .pill.sent { background: rgba(76, 195, 138, 0.15); color: var(--accent); }
.pill.past_due, .pill.failed, .pill.pending { background: rgba(229, 165, 75, 0.15); color: var(--warn); }
.pill.paused, .pill.cancelled, .pill.dead { background: rgba(229, 96, 79, 0.15); color: var(--bad); }

/* Text */

.muted { color: var(--muted); }
.warn-text { color: var(--warn); }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.note { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.banner { background: rgba(229, 165, 75, 0.08); border: 1px solid rgba(229, 165, 75, 0.6); border-radius: 12px; padding: 14px 18px; display: grid; gap: 10px; }
.banner button { justify-self: start; }
.banner h2 { font-size: 16px; margin: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Loading: a spinner before text that is waiting, and shimmering placeholders. */

.loading::before, .busy::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading { color: var(--muted); margin: 0; padding: 12px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--card) 0%, var(--card-hover) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skeleton-line { height: 14px; margin: 12px 0; }
.skeleton-line.short { width: 40%; }
