/* Ecount Export Dashboard */

:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f1f3f6; --border: #e3e6eb;
  --text: #15181d; --muted: #5d6573; --faint: #8a93a2;
  --accent: #166534; --accent-hover: #14532d; --accent-soft: #e8f3ec; --on-accent: #ffffff;
  --ok: #15803d; --ok-soft: #e7f5ec; --err: #b42318; --err-soft: #fdecea;
  --warn: #92400e; --warn-soft: #fef3c7; --run: #1d4ed8; --run-soft: #e8eefc;
  --sidebar: #0f2a1b; --sidebar-text: #cfe3d6; --sidebar-active: #1d4a31;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --border: #2a2f3a;
    --text: #e8eaee; --muted: #a2a9b6; --faint: #6f7786;
    --accent: #22a05a; --accent-hover: #2bb567; --accent-soft: #15291d; --on-accent: #06140b;
    --ok: #4ade80; --ok-soft: #13271b; --err: #f87171; --err-soft: #2c1616;
    --warn: #fbbf24; --warn-soft: #2b2210; --run: #7aa2ff; --run-soft: #172040;
    --sidebar: #0b1510; --sidebar-text: #b8cfc0; --sidebar-active: #173524;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--accent); }
h1, h2 { margin: 0; }
h1 { font-size: 18px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 620; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); }
.text-ok { color: var(--ok); } .text-err { color: var(--err); }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 16px; padding: 4px 8px 18px; }
.brand-center { justify-content: center; color: var(--text); padding-bottom: 20px; }
.nav { display: grid; gap: 2px; }
.nav a { color: var(--sidebar-text); text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 550; }
.nav a:hover { background: var(--sidebar-active); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #4ade80; }
.worker-status { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.05); }
.worker-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #f87171; flex: none; }
.worker-status.online .dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .user { margin-left: auto; display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 18px; padding: 2px 10px; cursor: pointer; }
.content { padding: 24px; max-width: 1200px; width: 100%; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: inline-block; }
  .topbar { padding: 12px 16px; }
  .topbar .user span { display: none; }
  .content { padding: 16px; }
}

/* ---------- komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-b { padding: 16px 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--border); }
.card-title { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-icon { background: none; border: 0; color: var(--faint); font-size: 18px; line-height: 1; padding: 0 6px; cursor: pointer; }
.btn-icon:hover { color: var(--err); }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-success { background: var(--ok-soft); color: var(--ok); }
.badge-failed { background: var(--err-soft); color: var(--err); }
.badge-running, .badge-queued { background: var(--run-soft); color: var(--run); }

.msg { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; }
.msg-ok { background: var(--ok-soft); color: var(--ok); }
.msg-err { background: var(--err-soft); color: var(--err); }
.msg-warn { background: var(--warn-soft); color: var(--warn); }
.msg-info { background: var(--surface-2); color: var(--text); }
.msg a { color: inherit; font-weight: 600; }
.msg .token { display: block; margin-top: 8px; padding: 10px; font-size: 13px; color: var(--text); }

/* ---------- form ---------- */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=time], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
input[type=text], input[type=password] { width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 180px; margin-bottom: 0; }
.form-row .field-btn { flex: 0 0 auto; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.times { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.time-row { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; padding-right: 2px; background: var(--surface); }
.time-row input { border: 0; background: none; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; min-width: 46px; text-align: center; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--muted); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.filters { justify-content: flex-start; }
.push-right { margin-left: auto; }

/* ---------- dashboard ---------- */
.hero-b { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-title { font-size: 17px; font-weight: 650; }
.hero-status { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.hero-actions { display: flex; gap: 8px; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { margin: 0; padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-of { font-size: 16px; color: var(--faint); font-weight: 600; }
.stat-sub { color: var(--muted); font-size: 12.5px; }
@media (max-width: 960px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table th, .table td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--surface-2); font-weight: 600; white-space: nowrap; color: var(--muted); }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }

.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager .current { display: inline-block; min-width: 32px; text-align: center; padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; text-decoration: none; }
.pager .current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; margin: 0 0 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
@media (max-width: 600px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: 8px; } }

pre.log { margin: 0; max-height: 520px; overflow: auto; background: var(--surface-2); border-radius: 9px; padding: 12px 14px; font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
img.shot { max-width: 100%; border: 1px solid var(--border); border-radius: 9px; display: block; }
.lead { font-size: 15px; margin-top: 0; }
.notes { padding-left: 18px; color: var(--muted); margin: 0; }
.notes li { margin-bottom: 6px; }
[data-copy] { cursor: copy; }

/* ---------- login / setup ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-box { width: 100%; max-width: 380px; }
