/* cupang — paper & ink
   Light paper surface, dark ink rail, serif headings, mono data.
   Deliberately not the usual dark terminal console. */

:root {
  --paper: #f3ece0;
  --paper-2: #fffdf8;
  --paper-3: #ece2d1;
  --ink: #17150f;
  --ink-2: #2b2820;
  --body: #3b362c;
  --muted: #7d7461;
  --line: #ded2bd;
  --line-soft: #ece3d2;
  --moss: #3c6350;
  --moss-2: #e6ede6;
  --rust: #a4501f;
  --rust-2: #f3e2d7;
  --amber: #a3781f;
  --amber-2: #f4e9d2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --r: 4px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(115deg, rgba(23, 21, 15, .016) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, .55), transparent 55%);
  color: var(--body);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--moss); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
code {
  background: var(--paper-3);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: .86em;
}

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 20px 20px;
  background: var(--ink);
  color: #e8e1d2;
  border-right: 1px solid #000;
}

.brand { display: flex; flex-direction: column; gap: 2px; }
.brand-mark {
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1;
  letter-spacing: -.02em;
  color: #fbf6ea;
}
.brand-mark::after {
  content: "";
  display: block;
  width: 30px;
  height: 2px;
  margin-top: 8px;
  background: var(--moss);
}
.brand-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #8d8472;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative;
  padding: 8px 10px 8px 18px;
  border-radius: 3px;
  color: #b9b1a0;
  font-size: 13.5px;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.nav a::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 3px;
  height: 3px;
  translate: 0 -50%;
  background: #5d5648;
  transition: background .12s ease, height .12s ease;
}
.nav a:hover { background: #221f18; color: #f0ead9; }
.nav a.on { background: #262218; color: #fbf6ea; }
.nav a.on::before { height: 14px; background: var(--moss); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid #2c2820; padding-top: 14px; }
.who { font-family: var(--mono); font-size: 11px; color: #8d8472; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; }
.quit { font-size: 12px; color: #b9b1a0; }
.quit:hover { color: var(--rust); }

.main {
  min-width: 0;
  padding: 34px clamp(20px, 4vw, 48px) 64px;
  max-width: 1320px;
}

/* ---------- typography ---------- */

.head { margin-bottom: 26px; }
.head h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.05;
  letter-spacing: -.025em;
  color: var(--ink);
}
.sub { margin: 0; max-width: 68ch; color: var(--muted); font-size: 13.5px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; }

.card-h {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- layout blocks ---------- */

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(23, 21, 15, .045);
}
.card-quiet { background: linear-gradient(180deg, #fffdf8, #fbf6ec); }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }

/* ---------- forms ---------- */

.lbl {
  display: block;
  margin: 14px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.lbl:first-child { margin-top: 0; }

.inp {
  width: 100%;
  padding: 9px 11px;
  background: #fffefb;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.inp:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(60, 99, 80, .12);
}
.inp-mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: .01em; }
.inp-lg { padding: 12px 13px; font-size: 16px; letter-spacing: .18em; }
textarea.inp { resize: vertical; min-height: 76px; line-height: 1.5; }

.hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  background: var(--ink);
  color: #fbf6ea;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .12s ease, transform .06s ease;
}
.btn:hover { background: #2f2a1f; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-full { width: 100%; margin-top: 18px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-3); }
.btn-ghost.danger { color: var(--rust); border-color: #e5c6b4; }

.link { background: none; border: 0; padding: 0; font: inherit; color: var(--moss); cursor: pointer; }
.link:hover { text-decoration: underline; }
.danger { color: var(--rust); }

.err {
  margin: 12px 0 0;
  padding: 8px 11px;
  background: var(--rust-2);
  border-left: 3px solid var(--rust);
  color: #7e3a14;
  font-size: 12.5px;
  border-radius: 2px;
}

.inline-form { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.inline-form .inp { flex: 1 1 140px; }

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.stat { background: var(--paper-2); padding: 13px 14px; display: flex; flex-direction: column; gap: 3px; }
.stat-n { font-family: var(--mono); font-size: 21px; line-height: 1.1; color: var(--ink); letter-spacing: -.02em; }
.stat-l { font-family: var(--mono); font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.stat:nth-child(1) .stat-n { color: var(--moss); }

/* ---------- progress ---------- */

.progress-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; }
.bar { height: 6px; background: var(--paper-3); border-radius: 3px; overflow: hidden; }
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--moss);
  background-image: repeating-linear-gradient(120deg, rgba(255, 255, 255, .22) 0 6px, transparent 6px 12px);
  transition: width .35s ease;
}

/* ---------- feed ---------- */

.feed { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.feed-row { padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.feed-row:last-child { border-bottom: 0; }
.feed-main { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.feed-sub { margin-top: 3px; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.log {
  margin: 0;
  padding: 11px 12px;
  background: #1b1811;
  color: #c7bfae;
  border-radius: 3px;
  font-size: 11.5px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ---------- tables ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  padding: 0 10px 9px;
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:hover { background: #fdf9f1; }
.tbl .num { text-align: right; }
.tbl-tight td, .tbl-tight th { padding-left: 6px; padding-right: 6px; }
.live-n { color: var(--moss); font-weight: 600; }

.pill {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fffefb;
  white-space: nowrap;
}
.pill-live, .pill-done { border-color: #b8ccbc; background: var(--moss-2); color: var(--moss); }
.pill-running, .pill-queued { border-color: #e3cfa4; background: var(--amber-2); color: var(--amber); }
.pill-stopped, .pill-interrupted, .pill-error { border-color: #e2c2ae; background: var(--rust-2); color: var(--rust); }

/* ---------- key/value + lists ---------- */

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; color: var(--ink); }
.kv-4 { grid-template-columns: auto 1fr auto 1fr; }

.steps { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--body); }
.steps li { margin-bottom: 6px; }
.steps li::marker { color: var(--moss); font-family: var(--mono); font-size: 11px; }

.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mini-list li { border-bottom: 1px dashed var(--line-soft); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { display: flex; align-items: center; gap: 8px; padding: 7px 0; color: var(--ink); font-size: 12.5px; text-decoration: none; }
.mini-list a:hover { color: var(--moss); }
.mini-list .muted { margin-left: auto; }

.dl { list-style: none; margin: 0; padding: 0; }
.dl li { border-bottom: 1px dashed var(--line-soft); }
.dl li:last-child { border-bottom: 0; }
.dl a { display: flex; justify-content: space-between; padding: 7px 0; font-size: 12.5px; }

/* ---------- login gate ---------- */

body.gate {
  display: grid;
  place-items: center;
  background-color: #14120c;
  background-image:
    radial-gradient(circle at 30% 20%, rgba(96, 140, 110, .22), transparent 45%),
    radial-gradient(circle at 75% 80%, rgba(164, 80, 31, .16), transparent 50%);
}
.gate-card {
  width: min(400px, calc(100vw - 40px));
  padding: 38px 34px 30px;
  background: var(--paper-2);
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
}
.brand-gate .brand-mark { font-size: 38px; color: var(--ink); }
.brand-gate .brand-mark::after { width: 42px; }
.brand-gate .brand-sub { color: var(--muted); }
.gate-lead { margin: 18px 0 4px; font-size: 13px; color: var(--muted); }
.gate-foot { margin: 24px 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: #b3a894; text-align: center; }

/* ---------- mailbox ---------- */

.conn { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.conn .lbl { margin-top: 0; }
.conn-go .btn { width: 100%; }
.conn-hint { margin-top: 10px; }

.mail-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1.15fr) minmax(0, 1.25fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
/* the author `display: grid` above would otherwise defeat the hidden attribute */
.mail-grid[hidden] { display: none; }
.pane { padding: 16px 16px 14px; }
.pane-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

.folders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.folder {
  width: 100%;
  text-align: left;
  padding: 6px 9px;
  background: transparent;
  border: 0;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--body);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder:hover { background: var(--paper-3); }
.folder.on { background: var(--ink); color: #f7f1e3; }

.msgs { list-style: none; margin: 0; padding: 0; max-height: 62vh; overflow-y: auto; }
.msg { display: flex; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--line-soft); }
.msg-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1px 8px;
  padding: 8px 4px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.msg-from { grid-column: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-date { grid-column: 2; font-size: 10.5px; color: var(--muted); }
.msg-subj { grid-column: 1 / -1; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unread .msg-subj { font-weight: 600; }
.msg.unread .msg-from::before { content: "● "; color: var(--moss); font-size: 8px; vertical-align: 1px; }
.msg-main:hover .msg-subj { color: var(--moss); }
.msg.on { background: var(--paper-3); }
.msg.on .msg-subj, .msg.on .msg-from { color: var(--ink); }
.msg-del { padding: 0 6px; font-size: 10.5px; opacity: 0; }
.msg:hover .msg-del, .msg.on .msg-del { opacity: 1; }

.pager { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

.viewer .body {
  margin: 10px 0 0;
  padding: 12px;
  background: #fffefb;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--body);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 62vh;
  overflow-y: auto;
}
#v-from { font-size: 11.5px; margin: 2px 0 0; }
.viewer .parts { font-size: 10.5px; margin: 2px 0 0; }
.viewer .parts:empty { display: none; }
.viewer.is-loading .body { opacity: .5; }

.vtabs { display: flex; gap: 6px; margin: 8px 0 0; }
.vtabs .btn.on { background: var(--ink); color: #f7f1e3; border-color: var(--ink); }
.head-tools { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.owner-tag { display: inline-block; padding: 1px 7px; border-radius: 3px; background: var(--moss-2); color: var(--moss); font-family: var(--mono); font-size: 10.5px; }
.head-tools .btn { padding: 3px 9px; font-size: 10.5px; }
#auto-btn.on { background: var(--moss); border-color: var(--moss); color: #f7f1e3; }
.viewer .html-body { display: block; width: 100%; min-height: 62vh; height: 62vh; padding: 0; border: 1px solid var(--line-soft); background: #fff; }
.viewer .html-body[hidden] { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mail-grid { grid-template-columns: 1fr; }
  .conn { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 16px; gap: 12px; }
  .brand-mark { font-size: 20px; }
  .brand-sub { display: none; }
  .brand-mark::after { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 6px 8px; font-size: 12px; }
  .nav a::before { display: none; }
  .side-foot { margin: 0; border: 0; padding: 0; }
  .main { padding: 22px 16px 48px; }
  .row-2, .row-3, .conn { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .head h1 { font-size: 26px; }
}

/* ---------- polish pass: type, states, overlays ---------- */

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--moss);
}

.head { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.head-row { align-items: flex-end; }
.small { font-size: 11px; line-height: 1.45; }

::selection { background: #cfe0d4; color: var(--ink); }

a:focus-visible, .btn:focus-visible, .inp:focus-visible,
.folder:focus-visible, .msg-main:focus-visible, .link:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 2px;
}

/* the job page counters ride along while the feed scrolls */
.stats { position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 18px -14px rgba(23, 21, 15, .5); }

/* checkbox row */
.checkline {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 9px 11px;
  background: #fffefb;
  border: 1px dashed var(--line);
  border-radius: 3px;
  font-size: 12.5px;
  color: var(--body);
  cursor: pointer;
}
.checkline input { margin: 2px 0 0; accent-color: var(--moss); }
.checkline:hover { border-color: var(--moss); }

/* copy bar on the live feed */
.copybar { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

/* toast */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}
.toast {
  min-width: 200px;
  max-width: 340px;
  padding: 10px 13px;
  background: var(--ink);
  color: #f7f1e3;
  border-radius: 3px;
  font-size: 12.5px;
  box-shadow: 0 12px 30px -12px rgba(23, 21, 15, .7);
  opacity: 0;
  translate: 0 8px;
  transition: opacity .2s ease, translate .2s ease;
}
.toast.in { opacity: 1; translate: 0 0; }
.toast-err { background: #7d2f12; }

/* modal */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 18, 12, .55);
  opacity: 0;
  transition: opacity .16s ease;
  z-index: 100;
}
.overlay.in { opacity: 1; }
.modal {
  width: min(420px, 100%);
  padding: 22px 22px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--moss);
  border-radius: 3px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .55);
}
.modal-text { margin: 0 0 18px; font-size: 14px; color: var(--ink); line-height: 1.5; }
.modal-bar { display: flex; justify-content: flex-end; gap: 8px; }

/* table niceties */
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td .pill { vertical-align: 0; }

/* small screens: keep the strap sticky counters sane */
@media (max-width: 720px) {
  .stats { position: static; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* --- panel ISP (comcast / rr.com) --- */
.isp-card { margin-top: 22px; border-color: #d9cfbb; background: linear-gradient(180deg, #fffdf8, #fdf7ec); }
.isp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.isp-head .card-h { margin: 0; }
.isp-card .row-2 { margin-top: 14px; }
.isp-card textarea { min-height: 150px; }

/* --- pencarian lintas folder di baca kotak --- */
.search-bar { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; flex-wrap: wrap; }
.search-bar .inp { flex: 1 1 200px; min-width: 140px; padding: 7px 10px; font-size: 12px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.chk input { margin: 0; }
.msg-folder { display: inline-block; padding: 0 5px; margin-right: 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 9.5px; color: var(--muted); vertical-align: 1px; }

/* --- tabel email hasil (get email) --- */
.chk-line { display: flex; align-items: center; gap: 7px; margin: 10px 0 2px; font-size: 12px; color: var(--ink); }
.inp-sm { padding: 5px 9px; font-size: 11.5px; min-width: 180px; }
.hits-wrap { max-height: 62vh; overflow: auto; border-top: 1px solid var(--line-soft); margin-top: 8px; }
.hits { width: 100%; border-collapse: collapse; font-size: 12px; }
.hits th { position: sticky; top: 0; background: var(--paper-2); text-align: left; font-weight: 600;
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  padding: 7px 8px; border-bottom: 1px solid var(--line); }
.hits td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.hits tr:hover td { background: var(--paper-3); }
.hits td:nth-child(1) { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hits td:nth-child(4) { max-width: 240px; }
