/* ============================================================
   Lamar — gaya aplikasi editor (orisinal)
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
  background: #eef1f4;
  color: #1c2430;
  font-size: 14px;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #1b2a41; color: #fff;
  padding: 10px 16px;
}
.brand { font-weight: 800; font-size: 18px; letter-spacing: 0.5px; margin-right: 6px; }
.brand a { color: #fff; text-decoration: none; }
.brand small { font-weight: 400; font-size: 11px; opacity: 0.7; display: block; line-height: 1; }
.tb-group { display: flex; align-items: center; gap: 6px; }
.tb-label { font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }
.tb-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.2); }
.btn {
  background: #0f766e; color: #fff; border: none;
  padding: 7px 13px; border-radius: 6px; font-size: 13px; font-weight: 600;
}
.btn:hover { background: #0d665f; }
.btn.ghost { background: rgba(255,255,255,0.12); }
.btn.ghost:hover { background: rgba(255,255,255,0.22); }
.btn.warn-ghost { background: rgba(255,255,255,0.08); }
.btn.danger-text { background: none; color: #c0392b; padding: 4px 0; font-weight: 600; }
.seg { display: flex; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; overflow: hidden; }
.seg button {
  background: transparent; color: #fff; border: none;
  padding: 6px 12px; font-size: 13px; font-weight: 700;
}
.seg button.active { background: #0f766e; }
.switch-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* dropdown ekspor */
.dd { position: relative; }
.menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; color: #1c2430; border: 1px solid #d5dbe3; border-radius: 8px;
  min-width: 210px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 60; overflow: hidden;
}
.menu.show { display: block; }
.menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 10px 14px; font-size: 13px;
}
.menu button:hover { background: #f0f4f7; }
.menu button small { display: block; color: #6b7686; font-size: 11px; }

/* ---------- layout ---------- */
.editor-layout {
  display: grid; grid-template-columns: minmax(380px, 460px) 1fr;
  gap: 0; height: calc(100vh - 52px);
}
.form-panel { overflow-y: auto; padding: 16px; background: #eef1f4; }
.preview-panel {
  overflow-y: hidden; display: flex; flex-direction: column;
  background: #dfe4ea; border-left: 1px solid #cfd6df;
}
.preview-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid #dfe4ea;
}
.preview-toolbar .tb-label { color: #6b7686; opacity: 1; }
.pill {
  border: 1px solid #c7d0db; background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; color: #33404f;
}
.pill:hover { border-color: #0f766e; color: #0f766e; }
.pill.active { background: #0f766e; border-color: #0f766e; color: #fff; }
.preview-scroll { overflow-y: auto; padding: 20px; flex: 1; }
.preview-scroll .resume { box-shadow: 0 2px 14px rgba(0,0,0,0.12); }

/* ---------- kartu form ---------- */
.sec-card {
  background: #fff; border: 1px solid #dbe1e8; border-radius: 10px;
  padding: 14px; margin-bottom: 14px;
}
.sec-card.off { opacity: 0.55; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sec-title { font-weight: 700; font-size: 15px; flex: 1; }
.sec-note { font-size: 11px; color: #6b7686; }
.sec-move { display: flex; gap: 2px; }
.sec-move button, .item-tools button {
  border: 1px solid #d5dbe3; background: #fff; border-radius: 5px;
  width: 26px; height: 26px; line-height: 1; font-size: 13px; color: #445060;
}
.sec-move button:hover:not(:disabled), .item-tools button:hover:not(:disabled) { border-color: #0f766e; color: #0f766e; }
.sec-move button:disabled, .item-tools button:disabled { opacity: 0.35; cursor: default; }
.item-tools button.danger, .sec-head button.danger { color: #c0392b; font-size: 16px; }
.sec-rename { margin-bottom: 10px; }

.fld { display: block; margin-bottom: 10px; }
.fld > span:first-child { display: block; font-size: 12px; font-weight: 600; color: #445060; margin-bottom: 4px; }
.fld input[type="text"], .fld input[type="email"], .fld input[type="tel"], .fld textarea {
  width: 100%; border: 1px solid #c7d0db; border-radius: 6px; padding: 8px 10px; font-size: 13px;
}
.fld input:focus, .fld textarea:focus { outline: 2px solid #0f766e55; border-color: #0f766e; }
.fld textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.chkrow { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; }
.chk input { width: auto; }

.item-card {
  border: 1px dashed #c7d0db; border-radius: 8px; padding: 12px;
  margin-bottom: 10px; background: #fafbfc; position: relative;
}
.item-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 3px; }
.item-card .grid2, .item-card .grid3, .item-card .grid4 { margin-right: 76px; }

.btn-add {
  width: 100%; border: 1.5px dashed #9fb3c8; background: none; color: #0f766e;
  border-radius: 8px; padding: 9px; font-weight: 700; font-size: 13px; margin-top: 2px;
}
.btn-add:hover { border-color: #0f766e; background: #0f766e0d; }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.switch input { display: none; }
.switch .sl {
  width: 34px; height: 19px; border-radius: 999px; background: #c7d0db;
  position: relative; transition: background 0.15s;
}
.switch .sl::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; transition: left 0.15s;
}
.switch input:checked + .sl { background: #0f766e; }
.switch input:checked + .sl::after { left: 17px; }

.photo-row { display: flex; gap: 14px; align-items: flex-start; }
.photo-thumb { width: 90px; height: 112px; object-fit: cover; border: 1px solid #c7d0db; border-radius: 6px; }
.photo-empty {
  width: 90px; height: 112px; border: 1px dashed #9fb3c8; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #6b7686; text-align: center; padding: 6px;
}
.photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hint { font-size: 11px; color: #6b7686; margin: 0; }

/* ---------- kartu ATS ---------- */
.ats-card {
  background: #fff; border: 1px solid #dbe1e8; border-radius: 10px;
  padding: 14px; margin: 0 20px 20px;
}
.ats-card h3 { margin: 0 0 4px; font-size: 14px; }
.ats-card h3 .score {
  float: right; background: #0f766e; color: #fff; border-radius: 999px;
  font-size: 12px; padding: 2px 10px;
}
.ats-sub { font-size: 11px; color: #6b7686; margin: 0 0 10px; }
#atsList { list-style: none; margin: 0; padding: 0; }
#atsList li { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid #eef1f4; font-size: 13px; }
#atsList .badge {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; margin-top: 1px;
}
#atsList li.ok .badge { background: #0f766e; }
#atsList li.warn .badge { background: #d97706; }
.chk-label { font-weight: 600; }
#atsList li.warn .chk-label { color: #92400e; }
.chk-hint { font-size: 12px; color: #6b7686; }

/* ---------- tampilan parser ---------- */
.parser-view {
  background: #fff; border: 1px solid #dbe1e8; border-radius: 4px;
  padding: 24px 28px; margin: 0 20px 20px;
  font-family: 'Courier New', Courier, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-word; color: #111;
  box-shadow: 0 2px 14px rgba(0,0,0,0.12);
  max-width: 820px;
}

/* ---------- modal & toast ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(20,30,45,0.55); align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 22px; max-width: 440px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.modal p { margin: 0 0 18px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .btn.ghost { background: #eef1f4; color: #1c2430; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1b2a41; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 120;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- tab mobile ---------- */
.mobile-tabs { display: none; }

/* ---------- responsif ---------- */
@media (max-width: 960px) {
  .editor-layout { display: block; height: auto; }
  .mobile-tabs {
    display: flex; position: sticky; top: 52px; z-index: 40;
    background: #fff; border-bottom: 1px solid #dbe1e8;
  }
  .mobile-tabs button {
    flex: 1; background: none; border: none; padding: 12px;
    font-weight: 700; font-size: 14px; color: #6b7686;
    border-bottom: 3px solid transparent;
  }
  .mobile-tabs button.active { color: #0f766e; border-bottom-color: #0f766e; }
  .form-panel, .preview-panel { border: none; }
  .preview-panel { display: none; }
  body.m-preview .preview-panel { display: flex; }
  body.m-preview .form-panel { display: none; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .toolbar { padding: 8px 10px; gap: 6px; }
  .tb-label, .tb-sep { display: none; }
}
@media (max-width: 560px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .item-card .grid2, .item-card .grid3, .item-card .grid4 { margin-right: 0; }
  .item-tools { position: static; margin-bottom: 8px; justify-content: flex-end; }
}
