/* KASKOW Alat Gambar — tambahan tampilan di atas pdf-studio.css (img-tools.js). */
.pds.img { --pds-acc: #d946ef; --pds-acc2: #8b5cf6; }
.pds.img .pds-hint a { color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.pds-strip .chip img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex: none; }

/* ---------- kolom isian kecil ---------- */
.ikb { display: flex; align-items: center; gap: 8px; }
.ikb .pds-input { flex: 1; }
.ikb span { font-weight: 800; color: var(--muted); }
.iest { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, #10b981 10%, transparent); border: 1px solid color-mix(in srgb, #10b981 30%, transparent); font-size: .82rem; }
.iest:empty { display: none; }
.iest span { width: 100%; color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.iest b { font-size: .98rem; }
.iest em { font-style: normal; font-weight: 800; color: #059669; }
[data-theme="dark"] .iest em { color: #34d399; }
.iwh { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.iwh label, .i4 label { display: flex; flex-direction: column; gap: 4px; }
.iwh small, .i4 small { font-size: .72rem; font-weight: 700; color: var(--muted); }
.i4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ilock { display: grid; place-items: center; width: 40px; height: 42px; border-radius: 12px; border: 1px solid var(--pds-line); background: transparent; color: var(--muted); cursor: pointer; transition: all .15s; }
.ilock.on { color: #fff; border-color: transparent; background: linear-gradient(145deg, var(--pds-acc2), var(--pds-acc)); box-shadow: 0 10px 20px -12px var(--pds-acc); }
.icolor { width: 46px; height: 38px; padding: 3px; border-radius: 10px; border: 1px solid var(--pds-line); background: var(--pds-card); cursor: pointer; }
.icolor-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.isw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--pds-card); background: var(--c); box-shadow: 0 0 0 1px var(--pds-line); cursor: pointer; transition: transform .12s; }
.isw:hover { transform: scale(1.12); }

/* ---------- pilihan format (Ubah format) ---------- */
.ifmt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ifmt button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 11px 12px; border-radius: 14px; border: 1px solid var(--pds-line); background: transparent; color: var(--text); cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.ifmt button:hover { border-color: color-mix(in srgb, var(--pds-acc) 50%, transparent); transform: translateY(-1px); }
.ifmt button.on { border-color: var(--pds-acc); background: color-mix(in srgb, var(--pds-acc) 9%, transparent); box-shadow: inset 0 0 0 1px var(--pds-acc); }
.ifmt b { font-size: 1rem; font-weight: 800; }
.ifmt small { font-size: .72rem; color: var(--muted); line-height: 1.3; }

/* ---------- pratinjau langsung ---------- */
.ilv { display: grid; place-items: center; padding: 16px; border-radius: 16px; background: repeating-conic-gradient(color-mix(in srgb, var(--text) 6%, transparent) 0% 25%, transparent 0% 50%) 50% / 20px 20px; min-height: 260px; }
.ilv-in { position: relative; line-height: 0; }
.ilv canvas { display: block; max-width: 100%; max-height: 68vh; width: auto; height: auto; border-radius: 6px; box-shadow: 0 20px 44px -24px rgba(0,0,0,.6); }
.ilv.icol canvas { max-height: 56vh; }
.ilv-tag { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(15,23,42,.78); color: #fff; font-size: .74rem; font-weight: 800; line-height: 1.4; }
.ilv-spin, .ipaper-wrap .ilv-spin { position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--pds-acc) 25%, transparent); border-top-color: var(--pds-acc); animation: pdsSpin .8s linear infinite; }
[data-hold] { user-select: none; -webkit-user-select: none; touch-action: none; }
.ihint { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; text-align: center; }
.ihint svg { color: var(--pds-acc); flex: none; }

/* ---------- kotak potong / area ---------- */
.ipaper-wrap { display: flex; justify-content: center; padding: 6px 0; }
.ipaper { background: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 50% / 18px 18px; }
.ibx-layer { position: absolute; inset: 0; touch-action: none; }
.ibx-layer.create { cursor: crosshair; }
.ibx { position: absolute; border: 2px solid #fff; outline: 1px solid rgba(0,0,0,.35); cursor: move; touch-action: none; }
.ibx-layer.shade { overflow: hidden; }
.ibx-layer.shade .ibx { box-shadow: 0 0 0 9999px rgba(8,12,20,.55); }
.ibx-layer:not(.shade) .ibx { background: color-mix(in srgb, var(--pds-acc) 14%, transparent); border-style: dashed; }
.ibx-layer:not(.shade) .ibx.on { border-style: solid; border-color: var(--pds-acc); background: transparent; }
.ibx .g { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .15s;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.ibx-layer.dragging .ibx .g, .ibx:hover .g { opacity: 1; }
.ibx .h { position: absolute; width: 14px; height: 14px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.3); }
.ibx-layer:not(.shade) .ibx:not(.on) .h { display: none; }
.ibx .h.nw { left: -8px; top: -8px; cursor: nwse-resize; }
.ibx .h.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.ibx .h.se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.ibx .h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.ibx .h.n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; }
.ibx .h.s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.ibx .h.e { right: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.ibx .h.w { left: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.ibx .x { position: absolute; top: -13px; right: -13px; display: none; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: #ef4444; color: #fff; font-size: 17px; line-height: 1; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.ibx.on .x { display: grid; }
@media (pointer: coarse) {
  .ibx .h { width: 22px; height: 22px; border-radius: 6px; }
  .ibx .h.nw { left: -12px; top: -12px; } .ibx .h.ne { right: -12px; top: -12px; } .ibx .h.se { right: -12px; bottom: -12px; } .ibx .h.sw { left: -12px; bottom: -12px; }
  .ibx .h.n { left: calc(50% - 11px); top: -12px; } .ibx .h.s { left: calc(50% - 11px); bottom: -12px; } .ibx .h.e { right: -12px; top: calc(50% - 11px); } .ibx .h.w { left: -12px; top: calc(50% - 11px); }
}
.iacount { display: flex; align-items: baseline; gap: 6px; padding: 10px 14px; border-radius: 12px; background: var(--pds-soft); font-size: .85rem; }
.iacount b { font-size: 1.3rem; color: var(--pds-acc); }

/* ---------- putar ---------- */
.irot-all { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 16px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.irot-all b { font-size: .8rem; color: var(--muted); margin-right: 4px; }

/* ---------- tanda air ---------- */
.ilogo { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px; border-radius: 12px; border: 1px solid var(--pds-line); font-size: .8rem; }
.ilogo img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 50% / 10px 10px; }
.ilogo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- edit & filter ---------- */
.ifil { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ifil button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--text); font-size: .7rem; font-weight: 700; cursor: pointer; }
.ifil canvas { width: 100%; aspect-ratio: 1; border-radius: 12px; background: color-mix(in srgb, var(--text) 8%, transparent); box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s, transform .15s; }
.ifil button:hover canvas { transform: translateY(-2px); }
.ifil button.on canvas { box-shadow: 0 0 0 2px var(--pds-card), 0 0 0 4px var(--pds-acc); }
.ifil button.on { color: var(--pds-acc); }
.iadj { display: flex; flex-direction: column; gap: 2px; }
.iadj + .iadj { margin-top: 6px; }
.iadj label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; }
.iadj output { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.iadj input[type="range"] { width: 100%; accent-color: var(--pds-acc); }

/* ---------- pas foto ---------- */
.ipas { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.ipas-prev { flex: none; width: 92px; min-height: 60px; line-height: 0; }
.ipas-prev canvas { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 10px 24px -14px rgba(0,0,0,.6); }
.ipas b { display: block; font-size: 1.15rem; font-weight: 800; }
.ipas small { color: var(--muted); font-size: .76rem; }
.ibgs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ibgs button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px; border-radius: 12px; border: 1px solid var(--pds-line); background: transparent; color: var(--text); font-size: .7rem; font-weight: 700; cursor: pointer; }
.ibgs button.on { border-color: var(--pds-acc); box-shadow: inset 0 0 0 1px var(--pds-acc); }
.ibgs i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px var(--pds-line); }
.ibgs button:last-child i { background: repeating-conic-gradient(#d1d5db 0% 25%, #fff 0% 50%) 50% / 8px 8px; }

/* ---------- metadata & warna ---------- */
.iinfo { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.iinfo-data { display: flex; flex-direction: column; gap: 12px; }
.ipick canvas { cursor: crosshair; }
.iloupe { position: absolute; width: 34px; height: 34px; margin: -44px 0 0 10px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.4); pointer-events: none; }
.icard { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--pds-line); background: color-mix(in srgb, var(--text) 2%, transparent); }
.icard h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.icard .r { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: .84rem; border-bottom: 1px dashed color-mix(in srgb, var(--text) 10%, transparent); }
.icard .r:last-of-type { border-bottom: 0; }
.icard .r span { color: var(--muted); }
.icard .r b { text-align: right; word-break: break-word; }
.icard.warn { border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.08); }
.icard.warn h3 { color: #b45309; }
[data-theme="dark"] .icard.warn h3 { color: #fbbf24; }
.icard.warn p { margin: 0 0 6px; font-size: .82rem; line-height: 1.5; }
.icard.warn .pds-btn { margin-top: 8px; color: var(--text); text-decoration: none; }
.ipal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ipal button { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 64px; padding: 6px 8px; border: 0; border-radius: 12px; background: var(--c); color: #fff; text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s; }
.ipal button:hover { transform: translateY(-2px); }
.ipal button span, .ipal button small { font-size: .68rem; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.ipal button small { font-weight: 600; opacity: .9; }
.ipal.small { grid-template-columns: repeat(8, 1fr); margin-top: 8px; }
.ipal.small button { height: 28px; padding: 0; border-radius: 8px; }
.ipicked { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--pds-line); }
.ipicked .sw { width: 44px; height: 44px; border-radius: 12px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.ipicked div { flex: 1; min-width: 90px; }
.ipicked b { display: block; font-size: 1.02rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ipicked small { color: var(--muted); font-size: .76rem; }

/* ---------- OCR ---------- */
.iai-note { display: flex; gap: 8px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, #6366f1 9%, transparent); border: 1px solid color-mix(in srgb, #6366f1 28%, transparent); font-size: .78rem; line-height: 1.5; }
.iai-note svg { flex: none; color: #6366f1; margin-top: 2px; }
.iocr { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 16px; }
.iocr-bar { display: flex; align-items: center; gap: 10px; }
.iocr-bar b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iocr-bar .grow { flex: 1; }
.iocr-body { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 14px; min-height: 420px; }
.iocr-body:has(> textarea:only-child) { grid-template-columns: 1fr; }
.iocr-img { display: grid; place-items: center; padding: 10px; border-radius: 14px; background: color-mix(in srgb, var(--text) 5%, transparent); overflow: hidden; }
.iocr-img img { max-width: 100%; max-height: 520px; border-radius: 6px; cursor: zoom-in; }
.iocr textarea { width: 100%; min-height: 420px; padding: 14px 16px; resize: vertical; font: 500 .92rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }

@media (max-width: 900px) {
  .iinfo, .iocr-body { grid-template-columns: 1fr; }
  .iocr-img img { max-height: 260px; }
  .iocr textarea { min-height: 300px; }
}
@media (max-width: 560px) {
  .ifil { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .ipal { grid-template-columns: repeat(4, 1fr); }
  .ilv { padding: 10px; min-height: 200px; }
  .irot-all .pds-btn { padding: 7px 9px; font-size: .78rem; }
}
