:root {
  --emerald: #059669;
  --emerald-dark: #047857;
  --emerald-light: #d1fae5;
  --emerald-50: #ecfdf5;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #f1f5f3;
  --text: #14201b;
  --text-soft: #5b6b63;
  --border: #e3e9e6;
  --danger: #dc2626;
  --warn: #d97706;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(6,95,70,.06);
  --radius: 14px;
}
[data-theme="dark"] {
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-light: #064e3b;
  --emerald-50: #0c2a22;
  --bg: #0d1411;
  --surface: #15201b;
  --surface-2: #1c2a23;
  --text: #e7f0ec;
  --text-soft: #9db3a8;
  --border: #25342c;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 256px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.brand-logo { font-size: 28px; background: var(--emerald-50); width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; font-weight: 800; }
.brand-text span { font-size: 12px; color: var(--emerald); font-weight: 600; }
.nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 3px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 10px;
  color: var(--text-soft); cursor: pointer; font-weight: 600; font-size: 13.5px; user-select: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--emerald); color: #fff; box-shadow: 0 4px 12px rgba(6,95,70,.25); }
.nav-item .ic { font-size: 17px; }
.nav-sec { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); padding: 12px 14px 4px; opacity: .75; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.mode-badge { font-size: 11.5px; font-weight: 700; color: var(--emerald-dark); background: var(--emerald-50); padding: 6px 10px; border-radius: 8px; text-align: center; }
.acct { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; }
.acct-av { width: 32px; height: 32px; border-radius: 50%; background: var(--emerald); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.acct-info { flex: 1; line-height: 1.2; min-width: 0; }
.acct-info b { font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-info small { font-size: 10.5px; color: var(--text-soft); }

/* ===== Main ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-size: 18px; font-weight: 800; flex: 1; }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.key-status { font-size: 11px; padding: 5px 10px; border-radius: 20px; font-weight: 700; }
.key-status.ok { color: var(--emerald-dark); background: var(--emerald-50); }
.key-status.bad { color: var(--danger); background: #fee2e2; }
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ===== Cards & layout ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 17px; font-weight: 800; }
.muted { color: var(--text-soft); font-size: 13px; }
.spacer { flex: 1; }

/* ===== Steps ===== */
.step { border-left: 3px solid var(--emerald); padding-left: 14px; margin-bottom: 18px; }
.step-title { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.step-num { background: var(--emerald); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; }

/* ===== Forms ===== */
label.field { display: block; font-weight: 700; font-size: 12.5px; margin-bottom: 6px; color: var(--text); }
.help { font-weight: 500; color: var(--text-soft); font-size: 11.5px; margin-left: 4px; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; outline: none;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-50); }
textarea { resize: vertical; min-height: 70px; }
.form-group { margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px;
  background: var(--emerald); color: #fff; border: none; border-radius: 10px; font-weight: 700;
  font-family: inherit; font-size: 13.5px; cursor: pointer; transition: background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--emerald-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; color: var(--emerald-dark); border: 1.5px solid var(--emerald); }
.btn-outline:hover { background: var(--emerald-50); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 9px 14px; border-radius: 9px; font-weight: 600; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }

/* ===== Drop zone ===== */
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 28px; text-align: center;
  cursor: pointer; color: var(--text-soft); transition: border .15s, background .15s; background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--emerald); background: var(--emerald-50); color: var(--emerald-dark); }
.dropzone .big { font-size: 30px; margin-bottom: 6px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; cursor: pointer; font-size: 12px; border: none; }

/* ===== Chips / option pills ===== */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 8px 13px; border: 1.5px solid var(--border); border-radius: 20px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--text-soft); user-select: none; transition: all .12s; background: var(--surface);
}
.pill:hover { border-color: var(--emerald); }
.pill.active { background: var(--emerald); border-color: var(--emerald); color: #fff; }

/* ===== Segmented control (pemilih model) ===== */
.seg { display: flex; gap: 8px; background: var(--surface-2); padding: 6px; border-radius: 14px; flex-wrap: wrap; }
.seg-btn {
  flex: 1; min-width: 150px; display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid transparent; background: transparent; cursor: pointer; font-family: inherit; text-align: left; transition: all .15s; color: var(--text);
}
.seg-btn:hover { background: var(--surface); }
.seg-btn.active { background: var(--surface); border-color: var(--emerald); box-shadow: 0 2px 10px rgba(6,95,70,.12); }
.seg-ic { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--emerald-50); border-radius: 10px; flex-shrink: 0; }
.seg-btn.active .seg-ic { background: var(--emerald); }
.seg-txt { display: flex; flex-direction: column; line-height: 1.3; }
.seg-txt b { font-size: 13.5px; font-weight: 700; }
.seg-txt small { font-size: 11px; color: var(--text-soft); }
.mp-body { margin-top: 14px; }
.model-hint { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px; padding: 16px; color: var(--text-soft); font-size: 13px; text-align: center; }

/* ===== Character cards ===== */
.char-grid, .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.char-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.char-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.char-card .ph { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.char-card .body { padding: 11px 13px; }
.char-card .body h4 { font-size: 14px; font-weight: 700; }
.char-card .body p { font-size: 11.5px; color: var(--text-soft); }
.char-card .actions { display: flex; gap: 6px; padding: 0 13px 13px; }
.select-char-card { cursor: pointer; border: 2px solid var(--border); }
.select-char-card.sel { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-50); }

/* ===== Gallery ===== */
.gallery-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.gallery-card img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: pointer; background: var(--surface-2); }
.gallery-card .meta { padding: 9px 11px; font-size: 11px; color: var(--text-soft); }
.gallery-card .meta b { color: var(--text); display: block; font-size: 12.5px; }
.gallery-card .bar { display: flex; gap: 5px; padding: 0 11px 11px; flex-wrap: wrap; }

/* ===== Prompt Studio: hasil terakhir & bandingkan ===== */
.recent-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.recent-thumb { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; flex-shrink: 0; transition: border-color .12s, transform .12s; }
.recent-thumb:hover { border-color: var(--emerald); transform: translateY(-2px); }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cmp-col img { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }

/* ===== Video Maker ===== */
.vm-stage { width: 100%; background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; max-height: 60vh; }
.vm-stage canvas { max-width: 100%; max-height: 60vh; display: block; }
.vm-scene { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.vm-scene > img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; flex-shrink: 0; border: 1px solid var(--border); }
.vm-scene input[type=text] { font-size: 12px; padding: 6px 9px; }
.vm-scene-btns { display: flex; flex-direction: column; gap: 3px; }
.vm-scene-btns button { padding: 2px 8px; min-width: 30px; }

/* ===== Ide Kreatif ===== */
.idea-list { display: flex; flex-direction: column; gap: 8px; }
.idea-item { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.idea-item span { flex: 1; }

/* ===== Sebelum/Sesudah (Edit Foto) ===== */
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ba-col { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.ba-col img { width: 100%; display: block; aspect-ratio: 1; object-fit: contain; background: var(--surface-2); }
.ba-lbl { font-size: 11px; font-weight: 700; text-align: center; padding: 5px; color: var(--text-soft); background: var(--surface); }
.ba-col:last-child .ba-lbl { color: var(--emerald-dark); }

/* ===== Result area ===== */
.result-img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.candidates { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.candidate { border: 2px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; }
.candidate.sel { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-50); }
.candidate img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.candidate .tag { position: absolute; top: 6px; left: 6px; background: var(--emerald); color: #fff; font-size: 10px; padding: 3px 8px; border-radius: 6px; font-weight: 700; }

/* ===== Badges / tags ===== */
.tag-pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-soft); }
.score { font-weight: 800; }
.score.good { color: var(--emerald-dark); }
.score.bad { color: var(--danger); }

/* ===== Progress ===== */
.progress { height: 12px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--emerald); width: 0; transition: width .3s; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.queue-item .st { font-size: 16px; }
.queue-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.queue-item.clickable { cursor: zoom-in; border-radius: 8px; transition: background .12s; padding-left: 6px; padding-right: 6px; }
.queue-item.clickable:hover { background: var(--emerald-50); }

/* ===== Caption output ===== */
.caption-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.caption-box .lbl { font-weight: 800; font-size: 12px; color: var(--emerald-dark); margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }
.caption-box .txt { font-size: 13px; white-space: pre-wrap; }

/* ===== Tooltip ===== */
.tip { position: relative; display: inline-flex; align-items: center; cursor: help; color: var(--text-soft); }
.tip .q { width: 15px; height: 15px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 10px; font-weight: 700; margin-left: 5px; }
.tip:hover::after {
  content: attr(data-tip); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: #14201b; color: #fff; padding: 8px 11px; border-radius: 8px; font-size: 11.5px; font-weight: 500;
  width: max-content; max-width: 260px; z-index: 100; line-height: 1.4; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* ===== Toast ===== */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--emerald);
  padding: 13px 16px; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.15); min-width: 260px; max-width: 360px;
  font-size: 13px; font-weight: 500; animation: slidein .25s; color: var(--text);
}
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 900; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 16px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal img.preview { width: 100%; border-radius: 10px; }

/* ===== Lightbox (perbesar) ===== */
.lb-img-wrap { width: 100%; max-height: 62vh; overflow: hidden; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; position: relative; }
.lb-img { max-width: 100%; max-height: 62vh; object-fit: contain; cursor: zoom-in; transition: transform .1s ease-out; display: block; will-change: transform; user-select: none; -webkit-user-drag: none; }
.lb-img.grabbable { cursor: grab; }
.lb-img.grabbing { cursor: grabbing; transition: none; }

/* Toolbar zoom (perbesar/perkecil/reset) */
.lb-zoom { position: absolute; bottom: 10px; right: 10px; display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,.62); border-radius: 22px; padding: 5px 8px; z-index: 4; backdrop-filter: blur(3px); }
.lb-zoom button { width: 28px; height: 28px; border: none; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; display: grid; place-items: center; }
.lb-zoom button:hover { background: var(--emerald); }
.lb-zoom span { color: #fff; font-size: 11.5px; font-weight: 700; min-width: 42px; text-align: center; }
.lb-prompt { white-space: pre-wrap; font-size: 11px; line-height: 1.5; background: var(--surface-2); padding: 11px; border-radius: 8px; margin: 8px 0; max-height: 220px; overflow: auto; font-family: ui-monospace, 'Cascadia Code', monospace; }
.modal { max-width: 640px; }
.lb-img-wrap { position: relative; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; display: grid; place-items: center; z-index: 2; }
.lb-nav:hover { background: var(--emerald); }
.lb-nav:disabled { opacity: .3; cursor: not-allowed; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lb-counter { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; z-index: 2; }
.lb-meta { width: 100%; font-size: 12px; line-height: 1.9; margin-top: 8px; }
.lb-meta td:first-child { color: var(--text-soft); width: 120px; }

/* Tools overlay pada kandidat & kartu gambar */
.candidate { }
.cand-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 5px; opacity: 0; transition: opacity .15s; }
.candidate:hover .cand-tools { opacity: 1; }
.cand-tools button { width: 28px; height: 28px; border-radius: 8px; border: none; background: rgba(0,0,0,.62); color: #fff; cursor: pointer; font-size: 13px; display: grid; place-items: center; backdrop-filter: blur(2px); }
.cand-tools button:hover { background: var(--emerald); }
.candidate .pick-hint { position: absolute; bottom: 6px; left: 6px; right: 6px; text-align: center; font-size: 10.5px; font-weight: 700; color: #fff; background: rgba(0,0,0,.5); border-radius: 6px; padding: 3px; opacity: 0; transition: opacity .15s; }
.candidate:hover .pick-hint { opacity: 1; }
.candidate.sel .pick-hint { opacity: 1; background: var(--emerald); }

/* ===== Spinner ===== */
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spinner.dark { border-color: var(--border); border-top-color: var(--emerald); }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px; color: var(--text-soft); }

/* ===== Stat cards ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat .v { font-size: 26px; font-weight: 800; color: var(--emerald-dark); }
.stat .l { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-row .name { width: 120px; flex-shrink: 0; font-weight: 600; }
.bar-row .track { flex: 1; height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.bar-row .track > i { display: block; height: 100%; background: var(--emerald); }

.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--emerald); display: inline-block; box-shadow: 0 0 0 0 rgba(16,185,129,.6); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); } 70% { box-shadow: 0 0 0 7px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

.empty { text-align: center; padding: 50px 20px; color: var(--text-soft); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ===== Responsive ===== */
/* ===== Beranda / Hero ===== */
.hero {
  display: flex; align-items: center; gap: 20px; padding: 30px 32px; border-radius: 20px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  color: #fff; box-shadow: 0 12px 36px rgba(6,95,70,.28); margin-bottom: 18px; position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; background: rgba(255,255,255,.08); border-radius: 50%; }
.hero-text { flex: 1; z-index: 1; }
.hero-text h1 { font-size: 26px; font-weight: 800; line-height: 1.25; margin-bottom: 8px; }
.hero-text h1 span { color: #d1fae5; }
.hero-text p { font-size: 14px; opacity: .92; max-width: 560px; margin-bottom: 18px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { background: #fff; color: var(--emerald-dark); }
.hero-actions .btn:hover { background: #ecfdf5; }
.hero-actions .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.hero-actions .btn-outline:hover { background: rgba(255,255,255,.12); }
.hero-badge { font-size: 80px; z-index: 1; filter: drop-shadow(0 8px 16px rgba(0,0,0,.2)); }

.setup-card { display: flex; align-items: center; gap: 16px; border-left: 4px solid var(--warn); }
.setup-card.ok { border-left-color: var(--emerald); }
.setup-card h3 { font-size: 15px; font-weight: 800; margin-bottom: 3px; }
.setup-step-num { width: 38px; height: 38px; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.setup-step-num.ok { background: var(--emerald); }

/* ===== Quick action cards ===== */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.quick-card {
  display: flex; align-items: center; gap: 13px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: transform .14s, box-shadow .14s, border-color .14s;
}
.quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--emerald); }
.quick-ic { font-size: 28px; width: 50px; height: 50px; background: var(--emerald-50); border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.quick-card h4 { font-size: 14px; font-weight: 700; }
.quick-card p { font-size: 12px; color: var(--text-soft); }
.quick-arrow { margin-left: auto; color: var(--emerald); font-weight: 800; font-size: 18px; opacity: 0; transition: opacity .14s, transform .14s; }
.quick-card:hover .quick-arrow { opacity: 1; transform: translateX(3px); }

/* ===== Panduan ===== */
.guide { display: grid; gap: 14px; }
.guide-step { display: flex; gap: 13px; align-items: flex-start; }
.g-num { width: 28px; height: 28px; border-radius: 50%; background: var(--emerald); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.guide-step b { font-size: 13.5px; }

.switch-row { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.switch-row input { width: auto; }

/* ===== Setup banner ===== */
.setup-banner {
  display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 13px;
}
[data-theme="dark"] .setup-banner { background: #2a1c0c; border-color: #5c3a14; color: #fbbf24; }

/* ===== Login overlay ===== */
.login-overlay {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
}
.login-card {
  background: var(--surface); border-radius: 20px; padding: 36px 32px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
.login-logo { font-size: 52px; margin-bottom: 8px; }
.login-card h2 { font-size: 20px; font-weight: 800; }
.login-card > p.muted { margin-bottom: 18px; color: var(--emerald); font-weight: 600; }
.login-msg { font-size: 13px; color: var(--text-soft); margin-bottom: 16px; }
.login-card input { margin-bottom: 12px; text-align: center; font-size: 15px; padding: 13px; }
.login-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 16px; }

/* ===== Halus: scrollbar & seleksi ===== */
::selection { background: var(--emerald-light); color: var(--emerald-dark); }
.nav::-webkit-scrollbar, .content::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }
.brand-logo { box-shadow: inset 0 0 0 1px var(--border); }
.nav-item { position: relative; }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 20%; height: 60%; width: 3px; background: #fff; border-radius: 3px; }

/* ===== Responsive ===== */
@media (max-width: 880px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .hamburger { display: block; }
  .grid-2, .grid-3, .field-grid { grid-template-columns: 1fr; }
  .candidates { grid-template-columns: 1fr 1fr; }
  .content { padding: 16px; }
  .hero { flex-direction: column; text-align: center; padding: 24px 20px; }
  .hero-badge { font-size: 56px; }
  .hero-text h1 { font-size: 21px; }
  .hero-actions { justify-content: center; }
  .topbar-title { font-size: 16px; }
}

/* ===== Konveksi: aksi desain baju & kalkulator harga ===== */
.apparel-actions { margin-top: 4px; }
.konv-row { display: grid; grid-template-columns: 1.4fr 0.9fr 0.7fr 1fr auto auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.konv-row select, .konv-row input { padding: 7px 8px; font-size: 12.5px; }
.konv-row .chk { display: flex; align-items: center; gap: 3px; font-size: 11px; white-space: nowrap; }
.konv-row .x { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 14px; }
@media (max-width: 720px) { .konv-row { grid-template-columns: 1fr 1fr; } }

.nota { background: #fff; color: #1a1a1a; border: 1px solid #e5e5e5; border-radius: 10px; padding: 18px; font-size: 13px; }
.nota-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1e6f5c; padding-bottom: 10px; margin-bottom: 10px; }
.nota-shop { font-size: 17px; font-weight: 800; color: #1e6f5c; }
.nota-cust { margin-bottom: 10px; }
.nota-tbl { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.nota-tbl th { text-align: left; font-size: 11px; color: #555; border-bottom: 1px solid #ddd; padding: 6px 4px; }
.nota-tbl td { padding: 7px 4px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.nota-sum { margin-left: auto; width: 62%; }
.nota-sum > div { display: flex; justify-content: space-between; padding: 3px 0; }
.nota-sum .tot { font-weight: 800; font-size: 15px; border-top: 1px solid #ddd; margin-top: 3px; padding-top: 6px; color: #1e6f5c; }
.nota-note { margin-top: 12px; background: #f6faf8; border-left: 3px solid #1e6f5c; padding: 8px 10px; font-size: 12px; border-radius: 4px; }
.nota-foot { margin-top: 14px; text-align: center; font-size: 11px; color: #777; }
.nota-tbl td small.muted { color: #999; }

/* Saat mencetak: tampilkan hanya area cetak (nota / size chart) */
@media print {
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .nota { border: none; }
  .no-print, .sidebar, .topbar, .toast-wrap { display: none !important; }
}

/* ===== Papan Pesanan (Kanban) ===== */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.board-col { background: var(--surface-2); border-radius: 12px; padding: 8px; }
.board-head { font-weight: 800; font-size: 13px; padding: 8px 6px; display: flex; justify-content: space-between; align-items: center; }
.board-head .cnt { background: var(--surface); border-radius: 20px; padding: 1px 9px; font-size: 12px; }
.board-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.board-empty { text-align: center; color: var(--muted); padding: 14px 0; font-size: 12px; }
.ord-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.ord-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.ord-menu .i { background: transparent; border: none; cursor: pointer; font-size: 12px; padding: 0 2px; }
.ord-items { font-size: 12px; color: var(--text); margin: 5px 0; }
.ord-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; margin-top: 4px; }
.ord-meta span { background: var(--surface-2); border-radius: 6px; padding: 2px 6px; }
.ord-meta .warn { background: #fef3c7; color: #92400e; }
.ord-meta .ok { background: #dcfce7; color: #166534; }
.ord-meta .late { background: #fee2e2; color: #991b1b; }
.ord-wa { display: inline-block; margin-top: 7px; font-size: 11.5px; color: #16a34a; font-weight: 700; text-decoration: none; }
.ord-move { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.ord-move .mv { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 2px 10px; font-weight: 700; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }

/* ===== Katalog: pilihan gambar ===== */
.kat-pick { position: relative; border: 2px solid transparent; }
.kat-pick.sel { border-color: var(--emerald); }
.kat-check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--emerald); color: #fff; display: none; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.kat-pick.sel .kat-check { display: flex; }

/* ===== Template Pola Konveksi ===== */
.tpl-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px 6px 7px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text); transition: border-color .15s, transform .1s; }
.tpl-chip:hover { border-color: var(--emerald); transform: translateY(-1px); }
.tpl-chip.sel { border-color: var(--emerald); background: var(--emerald-soft, rgba(16,111,92,.1)); }
.tpl-sw { display: inline-flex; }
.tpl-sw i { width: 13px; height: 13px; border-radius: 50%; display: inline-block; border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.tpl-sw i + i { margin-left: -5px; }
.tpl-wrap { display: inline-flex; align-items: center; position: relative; }
.tpl-chip.custom { border-style: dashed; border-color: var(--emerald); }
.tpl-del { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 12px; padding: 2px 4px; margin-left: -4px; }

/* ===== Analisa AI ===== */
.analysis-box { margin-top: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.an-head { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.an-score { background: #e5e7eb; color: #374151; border-radius: 20px; padding: 2px 12px; font-size: 13px; }
.an-score.good { background: #dcfce7; color: #166534; }
.an-score.bad { background: #fee2e2; color: #991b1b; }
.an-verdict { margin: 8px 0; font-size: 13px; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 8px 0; }
.an-grid > div { background: var(--surface); border-radius: 8px; padding: 8px; font-size: 11.5px; }
.an-grid b { display: block; margin-bottom: 2px; color: var(--emerald); }
.an-list { margin-top: 8px; font-size: 12.5px; }
.an-list ul { margin: 4px 0 0; padding-left: 18px; }
.an-list li { margin-bottom: 3px; }
.an-list.ok b { color: #16a34a; }
@media (max-width: 640px) { .an-grid { grid-template-columns: 1fr; } }
