/* app.css — UPVOTE.NET orange theme tokens (ported from demo) + app-shell layout.
   Pure CSS, no build step. Shared by login.html and the app shell (index.html). */
:root {
  --page: #f9fafb;
  --surface: #fff;
  --surface-soft: #fff7ed;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --orange: #f97316;
  --orange-dark: #ea580c;
  --orange-soft: rgba(249, 115, 22, 0.08);
  --green: #047857;
  --red: #b91c1c;
  --code-bg: #0f172a;
  --shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--orange-dark); }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
.section { font-size: 16px; }
.muted { color: var(--muted); }
.green { color: var(--green); }
.red { color: var(--red); }
[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--orange); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.brand-title { font-weight: 800; letter-spacing: .3px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.header-spacer { flex: 1; }

nav.app-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
nav.app-nav a {
  padding: 12px 14px; text-decoration: none;
  color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent;
}
nav.app-nav a.active { color: var(--orange-dark); border-bottom-color: var(--orange); }
nav.app-nav a:hover { color: var(--text); }

main.app-view { max-width: 920px; margin: 0 auto; padding: 24px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-soft { background: var(--surface-soft); border-color: #fed7aa; }
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Data picker (Advanced) ---------- */
.entity-card { padding: 14px; }
.entity-card > label.field:first-child { margin-bottom: 10px; }
.entity-fields { gap: 6px 14px; }
.entity-fields label.field { margin-bottom: 4px; font-weight: 400; }
.entity-fields label.field > span { display: inline; font-weight: 400; }
.entity-fields[hidden] { display: none; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 24px; font-weight: 800; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange-soft); border-color: var(--orange); }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- Buttons ---------- */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--orange); background: var(--orange); color: #fff;
}
button:hover, .btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--page); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13px;
}
.chip.active { background: var(--orange-soft); border-color: var(--orange); color: var(--orange-dark); }
.chip:disabled, .chip[aria-disabled=true] { opacity: .45; cursor: not-allowed; }

/* ---------- Subtabs ---------- */
.subtabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.subtab {
  padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted);
  border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0;
}
.subtab.active { color: var(--orange-dark); border-bottom-color: var(--orange); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-queued { background: #fef3c7; color: #92400e; }
.badge-running { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: var(--green); }
.badge-failed { background: #fee2e2; color: var(--red); }
.badge-revoked { background: #f3f4f6; color: var(--muted); }
.badge-active { background: #d1fae5; color: var(--green); }

/* ---------- Code ---------- */
pre, code { font-family: 'SF Mono', Menlo, Consolas, monospace; }
pre.code {
  background: var(--code-bg); color: #e2e8f0;
  padding: 14px; border-radius: 10px; overflow-x: auto; font-size: 12.5px;
}
code.inline { background: var(--page); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: grid; place-items: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--surface); border-radius: 14px; padding: 22px;
  max-width: 460px; width: 100%; box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: 10px;
  box-shadow: var(--shadow); z-index: 60; max-width: 90vw;
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
