@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url(fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --pine: #123b31;
  --pine-2: #1b4d40;
  --moss: #23705a;
  --mint: #dcebe4;
  --paper: #f0f4f0;
  --panel: #ffffff;
  --ink: #15251f;
  --slate: #566860;
  --line: #d3ddd7;
  --brass: #94690f;
  --brass-soft: #f6ecd2;
  --clay: #ab3527;
  --clay-soft: #f8e4e0;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.55 var(--sans); }
a { color: var(--moss); }
a:hover { color: var(--pine); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; font-weight: 500; }
p { margin: 0 0 .75rem; max-width: 72ch; }
code, .mono { font-family: var(--mono); font-size: .88em; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* Rangka halaman */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--pine); color: #e6efe9; padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 0; height: 100vh; }
.brand { padding: 0 .6rem; font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: #fff; text-decoration: none; display: block; }
.brand small { display: block; font: 400 .78rem var(--sans); color: #a9c4b8; margin-top: .15rem; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: .5rem .6rem; border-radius: 6px; color: #d5e4dc; text-decoration: none; }
.nav a:hover { background: var(--pine-2); color: #fff; }
.nav a.on { background: #fff; color: var(--pine); font-weight: 600; }
.nav .badge { background: var(--clay); color: #fff; border-radius: 9px; font-size: .75rem; padding: 0 .45rem; font-weight: 600; }
.rail-foot { padding: 0 .6rem; font-size: .82rem; color: #a9c4b8; }
.rail-foot a { color: #d5e4dc; }
.rail-foot form { display: inline; }
.rail-foot button { background: none; border: 0; padding: 0; font: inherit; color: #d5e4dc; text-decoration: underline; cursor: pointer; }
.rail-foot .who { display: flex; gap: .75rem; margin-bottom: .25rem; }
main { padding: 1.75rem 2rem 3rem; max-width: 1240px; width: 100%; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem; align-items: flex-end; margin-bottom: 1.25rem; }
.head p { margin: .25rem 0 0; color: var(--slate); }
section { margin-top: 2rem; }
section > h2 { margin-bottom: .75rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.25rem; }
.muted { color: var(--slate); }
.small { font-size: .86rem; }
.stack > * + * { margin-top: .75rem; }

/* Flash dan peringatan */
.flash { border-radius: 6px; padding: .6rem .85rem; margin-bottom: .6rem; border-left: 4px solid var(--moss); background: var(--mint); }
.flash.warn { border-color: var(--brass); background: var(--brass-soft); }
.flash.bad { border-color: var(--clay); background: var(--clay-soft); }
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attention li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; padding: .55rem .85rem; border-radius: 6px; background: var(--brass-soft); border-left: 4px solid var(--brass); }
.attention li.bad { background: var(--clay-soft); border-color: var(--clay); }
.attention a { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* Jalur relay A ke B */
.relay { background: var(--pine); color: #fff; border-radius: 14px; padding: 1.5rem 1.5rem 1.1rem; }
.line { display: grid; grid-template-columns: 1.25fr repeat(5, 1fr) 1.25fr; position: relative; align-items: start; }
.line::before { content: ""; position: absolute; left: 6%; right: 6%; top: 27px; height: 4px; background: #5e9180; border-radius: 2px; }
.stop { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 .25rem; color: inherit; text-decoration: none; }
.stop .dot { width: 58px; height: 58px; border-radius: 50%; background: var(--pine-2); border: 4px solid #5e9180; display: flex; align-items: center; justify-content: center; font: 700 1.3rem var(--display); }
.stop.has .dot { background: #fff; color: var(--pine); border-color: #fff; }
.stop.end .dot { border-radius: 12px; background: var(--brass-soft); color: var(--pine); border-color: var(--brass-soft); font-size: 1.5rem; }
.stop .name { margin-top: .5rem; font-weight: 600; }
.stop .sub { font-size: .8rem; color: #b9d2c7; overflow-wrap: anywhere; }
a.stop:hover .name { text-decoration: underline; }
.branch { grid-column: 4; display: flex; flex-direction: column; align-items: center; position: relative; color: #fff; text-decoration: none; margin-top: .25rem; }
.branch::before { content: ""; width: 4px; height: 20px; background: #5e9180; }
.branch.hot::before { background: #e8917f; }
.branch span { border-radius: 8px; padding: .2rem .7rem; background: var(--pine-2); border: 2px solid #5e9180; white-space: nowrap; }
.branch.hot span { background: var(--clay); border-color: #e8917f; font-weight: 600; }
.relay-foot { display: flex; flex-wrap: wrap; gap: .25rem 2rem; border-top: 1px solid #2e6152; margin-top: 1.1rem; padding-top: .7rem; font-size: .9rem; color: #d5e4dc; }
.relay-foot b { color: #fff; font-family: var(--display); }
.relay-foot meter { width: 110px; vertical-align: middle; }

/* Worker */
.workers { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.worker { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: .35rem 1.25rem; align-items: center; padding: .85rem 1.1rem; }
.worker + .worker { border-top: 1px solid var(--line); }
.worker h3 { font-size: 1.05rem; font-weight: 700; }
.state { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; font-weight: 600; }
.state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--slate); }
.state.running::before, .state.idle::before { background: var(--moss); }
.state.paused::before, .state.waiting_config::before, .state.starting::before { background: var(--brass); }
.state.error::before, .state.offline::before { background: var(--clay); }
.worker progress { width: 100%; max-width: 420px; height: 8px; accent-color: var(--moss); display: block; margin-top: .3rem; }
.worker .err { color: var(--clay); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.actions form { margin: 0; }

/* Tabel */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .55rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 600; color: var(--slate); font-size: .84rem; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; width: 1%; }
td.shrink { width: 1%; white-space: nowrap; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--slate); }

.tag { display: inline-block; border-radius: 4px; padding: .05rem .45rem; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--mint); color: var(--pine); }
.tag.warn, .tag.pull_retry, .tag.push_retry, .tag.detected, .tag.vanished, .tag.unknown, .tag.likely { background: var(--brass-soft); color: #6b4c07; }
.tag.bad, .tag.quarantined, .tag.failed, .tag.quarantine_expired, .tag.plain { background: var(--clay-soft); color: var(--clay); }
.tag.discarded { background: #e8ecea; color: var(--slate); }
.log-level { font-weight: 600; font-size: .82rem; }
.log-level.warn { color: var(--brass); }
.log-level.error { color: var(--clay); }

/* Form */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-bottom: .85rem; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .2rem; }
.field { margin-bottom: .85rem; }
.hint { display: block; font-size: .82rem; color: var(--slate); margin-top: .2rem; font-weight: 400; max-width: 62ch; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid #aebcb5; border-radius: 6px; padding: .4rem .55rem; width: 100%; max-width: 100%;
}
.filters input, .filters select { width: auto; }
textarea.key { font-family: var(--mono); font-size: .8rem; line-height: 1.4; min-height: 7.5rem; background: #f8faf8; word-break: break-all; }
.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; margin-bottom: .6rem; }
.check input { margin-top: .3rem; }
.check b { font-weight: 600; }
button, .button { font: 600 .9rem var(--sans); padding: .42rem .85rem; border-radius: 6px; border: 1px solid var(--moss); background: var(--moss); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { background: var(--pine); border-color: var(--pine); color: #fff; }
.ghost { background: transparent; color: var(--pine); border-color: #9db1a7; }
.ghost:hover { background: var(--mint); color: var(--pine); border-color: var(--moss); }
.danger { background: var(--clay); border-color: var(--clay); }
.danger:hover { background: #8a2a1f; border-color: #8a2a1f; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
[hidden] { display: none !important; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; margin: 0; }
dl.kv dt { color: var(--slate); font-size: .88rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.pages { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .75rem; }
.fp { background: var(--mint); border-radius: 6px; padding: .5rem .7rem; font-family: var(--mono); font-size: .88rem; overflow-wrap: anywhere; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--pine); padding: 1rem; }
.login .panel { width: min(380px, 100%); }
.login h1 { margin-bottom: 1rem; }

@media (max-width: 1100px) {
  .line { grid-template-columns: repeat(7, minmax(62px, 1fr)); }
  .stop .sub { display: none; }
  .stop .name { font-size: .85rem; }
  .stop .dot { width: 50px; height: 50px; font-size: 1.1rem; }
  .line::before { top: 23px; }
}
@media (max-width: 820px) {
  .shell { display: block; }
  .rail { position: static; height: auto; padding: .75rem; gap: .5rem; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { white-space: nowrap; gap: .4rem; }
  .rail-foot { display: flex; justify-content: space-between; }
  main { padding: 1.1rem 1rem 2.5rem; }
  .grid-2, .fields-2 { grid-template-columns: minmax(0, 1fr); }
  .worker { grid-template-columns: minmax(0, 1fr); }
  .line { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
  .line::before { display: none; }
  .stop { flex-direction: row; gap: .75rem; text-align: left; }
  .stop .name { margin-top: 0; font-size: .95rem; }
  .branch { align-items: flex-start; margin-left: 1.4rem; }
  .branch::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none !important; } }
