/* APODEXA — shared styles. Brand: orange #F4581C, navy #101A3C, bg #F7F8FA. */

:root {
  --orange: #F4581C;
  --orange-dark: #d84a12;
  --orange-soft: #FEEDE4;
  --navy: #101A3C;
  --navy-soft: #1c2a55;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --ink: #1A2138;
  --ink-2: #4A5468;
  --ink-3: #7A8397;
  --line: #E7EAF0;
  --line-2: #EEF0F5;
  --green: #16A34A;
  --green-soft: #E6F6EC;
  --amber: #F59E0B;
  --amber-soft: #FDF1DC;
  --red: #E23D3D;
  --red-soft: #FCE8E8;
  --blue-soft: #E9EEFB;
  --shadow-sm: 0 1px 2px rgba(16, 26, 60, 0.04), 0 1px 3px rgba(16, 26, 60, 0.06);
  --shadow: 0 1px 3px rgba(16, 26, 60, 0.05), 0 6px 20px rgba(16, 26, 60, 0.06);
  --shadow-lg: 0 10px 40px rgba(16, 26, 60, 0.12);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 { color: var(--navy); margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 10px 16px; font-size: 14px; font-weight: 600; line-height: 1;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { border-color: #cfd4de; background: #fbfcfd; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.link { color: var(--orange); font-weight: 600; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-head h3 { font-size: 16px; }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 1.4;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-plain::before { display: none; }
.pill-green { background: var(--green-soft); color: #12813b; }
.pill-amber { background: var(--amber-soft); color: #b7791f; }
.pill-red { background: var(--red-soft); color: #c62d2d; }
.pill-navy { background: var(--blue-soft); color: var(--navy); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--ink-2); background: #fff;
}

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 700;
}

/* ---------- Forms ---------- */
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8397' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}

/* ---------- Code blocks ---------- */
.code {
  background: #0F1729; color: #E5E9F0; border-radius: var(--r);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  padding: 16px 18px; overflow-x: auto; white-space: pre; -webkit-overflow-scrolling: touch;
}
.code .k { color: #7FB4FF; }   /* keys */
.code .s { color: #7EE0A6; }   /* strings */
.code .n { color: #FFB37A; }   /* numbers */
.code .c { color: #8792AC; }   /* comments/flags */
.code .p { color: #C7CEDC; }   /* punctuation */

/* ---------- Banner / toast ---------- */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r); font-size: 14px; font-weight: 500;
  border: 1px solid; margin-bottom: 16px;
}
.banner svg { width: 18px; height: 18px; flex: none; }
.banner-warn { background: var(--amber-soft); border-color: #f4d492; color: #92600c; }
.banner-error { background: var(--red-soft); border-color: #f3bcbc; color: #a52222; }
.banner-info { background: var(--blue-soft); border-color: #c6d2f4; color: var(--navy); }
.banner-close { margin-left: auto; background: none; border: none; color: inherit; font-size: 18px; line-height: 1; padding: 2px 4px; opacity: .7; }
.banner-close:hover { opacity: 1; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 40px 24px; color: var(--ink-3);
}
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 12px;
  background: var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--ink-3);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h4 { color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, #eef0f4 25%, #f6f7f9 50%, #eef0f4 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px;
  text-transform: none; padding: 8px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #fafbfc; }
table.data tbody tr:last-child td { border-bottom: none; }
.run-id { font-family: var(--mono); font-size: 12.5px; color: var(--navy); font-weight: 600; }

/* ---------- Login overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 26, 60, 0.42); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 380px; padding: 32px 30px; text-align: center;
}
.login-card img { height: 34px; width: auto; margin: 0 auto 20px; }
.login-card h2 { font-size: 19px; margin-bottom: 6px; }
.login-card p { color: var(--ink-3); font-size: 14px; margin: 0 0 22px; }
.login-card form { text-align: left; }

/* ---------- Drawer ---------- */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 90; background: rgba(16,26,60,.4);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 560px; max-width: 94vw; z-index: 91;
  background: var(--bg); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .25s ease; overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  position: sticky; top: 0; background: var(--bg); z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.drawer-body { padding: 20px 22px 40px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
