:root {
  --orange: #f97316;
  --orange-dark: #ea580c;
  --orange-soft: #fff3ea;
  --ink: #1f2430;
  --muted: #7a8494;
  --line: #eceef1;
  --bg: #f7f8fa;
  --white: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20,24,31,.06), 0 8px 24px rgba(20,24,31,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }
a { color: var(--orange-dark); text-decoration: none; cursor: pointer; }

/* Brand */
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.4px; display: flex; align-items: center; gap: 8px; }
.brand em { color: var(--orange); font-style: normal; font-weight: 700; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }

/* Login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  background: var(--white); width: 360px; max-width: 100%; padding: 28px;
  border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.login-card .brand { margin-bottom: 6px; }
.login-card label { display: block; margin: 14px 0 0; font-weight: 600; font-size: 13px; }
.login-card input, .field input, .field select, .field textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; background: var(--white); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
.login-card button { width: 100%; margin-top: 18px; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: 9px 14px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: .12s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: #d9dce1; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f3c9c9; }
.btn.danger:hover { background: #fdecec; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* App layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--white); border-right: 1px solid var(--line); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; flex: 1; }
.sidebar nav a {
  padding: 10px 12px; border-radius: 9px; color: var(--ink); font-weight: 600; font-size: 14px;
}
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { background: var(--orange-soft); color: var(--orange-dark); }
.side-foot { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
main { padding: 28px 32px; max-width: 1100px; }

/* Headings */
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.4px; }
h2 { font-size: 16px; margin: 26px 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.sub { color: var(--muted); margin: 0 0 20px; }

/* Cards / grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-body { padding: 18px; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: #fcfcfd; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.table-scroll { overflow-x: auto; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.b-running   { background: #eef4ff; color: var(--blue); }
.b-queued    { background: var(--orange-soft); color: var(--orange-dark); }
.b-completed { background: #eafaf0; color: var(--green); }
.b-failed    { background: #fdecec; color: var(--red); }
.b-cancelled { background: #f1f2f4; color: var(--muted); }

/* Forms inline */
.field { margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 2px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 180px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,24,31,.45); display: grid; place-items: center; padding: 24px; z-index: 40; }
.modal { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); width: 820px; max-width: 100%; max-height: 88vh; overflow: auto; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--white); }
.modal-body { padding: 20px; }
.x { cursor: pointer; font-size: 20px; color: var(--muted); border: none; background: none; }

/* Docs */
.doc-group { margin-bottom: 26px; }
.doc-ep { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.doc-ep summary { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.doc-ep .m { font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.m-GET { background: #eafaf0; color: var(--green); }
.m-POST { background: var(--orange-soft); color: var(--orange-dark); }
.m-DELETE { background: #fdecec; color: var(--red); }
.m-PUT { background: #eef4ff; color: var(--blue); }
.doc-ep .path { font-family: ui-monospace, monospace; font-size: 13px; }
.doc-ep .lock { margin-left: auto; font-size: 12px; color: var(--muted); }
.doc-body { padding: 0 16px 16px; }
pre { background: #0f1524; color: #e6edf3; padding: 14px 16px; border-radius: 9px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
pre.light { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 60; font-weight: 600; }
.toast.ok { background: var(--green); }
.toast.bad { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--orange-soft); border-top-color: var(--orange); border-radius: 50%; animation: r .7s linear infinite; }
@keyframes r { to { transform: rotate(360deg); } }
