/* Modern light theme */
:root{
  --bg:#f7f9fc; --panel:#ffffff; --muted:#64748b; --border:#e5e7eb; --accent:#2563eb;
  --text:#0f172a; --shadow:0 10px 30px rgba(15,23,42,.06);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif}
.app-header{position:sticky;top:0;background:rgba(255,255,255,.8);backdrop-filter:saturate(180%) blur(10px);border-bottom:1px solid var(--border);z-index:20}
.app-header .logo{font-weight:700;padding:12px 16px}
.nav{display:flex;gap:8px;align-items:center;padding:8px 16px}
.nav a{padding:8px 12px;border-radius:10px;text-decoration:none;color:var(--muted);border:1px solid transparent}
.nav a.active{background:#eef2ff;color:#1e40af;border-color:#c7d2fe}
.nav a.diag{margin-left:auto;color:#0ea5e9}

.container{max-width:1100px;margin:24px auto;padding:0 16px}
.card{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:16px 16px 12px;box-shadow:var(--shadow);margin-bottom:16px}
h2{margin:6px 0 14px;font-size:20px}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.col .row, .col .row-2{display:flex;gap:10px;align-items:center;margin:10px 0}
.col .row label{width:140px;color:var(--muted)}
.col .row-2>div{flex:1}
label.switch{display:inline-flex;gap:8px;align-items:center;font-size:14px;color:var(--muted)}
.actions{display:flex;gap:12px;align-items:center;margin-top:14px}
button{border:0;border-radius:12px;padding:10px 14px;cursor:pointer}
button.primary{background:var(--accent);color:#fff}
button.secondary{background:#e2e8f0;color:#0f172a}
.status{color:var(--muted);font-size:14px}

input[type="number"], input[type="text"], select, input[type="color"]{
  width:100%;padding:10px;border:1px solid var(--border);border-radius:10px;background: #fff; color: var(--text);
}

.filedrop{display:flex;align-items:center;justify-content:center;border:2px dashed #cbd5e1;border-radius:16px;padding:28px;height:160px;color:var(--muted);background:#fafafa}
.filedrop input{display:none}
.thumbs{display:grid;grid-template-columns:1fr;gap:8px;margin-top:8px}
.thumb{padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:#fff;color:#0f172a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.preview{width:100%;border-radius:12px;border:1px solid var(--border);box-shadow:var(--shadow)}

.result .done{display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:flex-start}
.result img{max-width:100%;border:1px solid var(--border);border-radius:12px}

.details summary{cursor:pointer;margin:6px 0 8px;color:#0f172a;font-weight:600}
.details{border:1px dashed #e5e7eb;border-radius:12px;padding:6px 10px}

.toast{position:fixed;bottom:16px;left:50%;transform:translateX(-50%);background:#111827;color:#fff;padding:12px 14px;border-radius:12px;box-shadow:var(--shadow)}

.tab{display:none}
.tab.active{display:block}

.gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.gitem{background:#fff;border:1px solid var(--border);border-radius:12px;padding:8px;box-shadow:var(--shadow)}
.gitem img{width:100%;border-radius:10px;display:block}
.gitem .meta{display:flex;justify-content:space-between;align-items:center;margin-top:6px}
.gitem .dl{font-size:14px;color:#0ea5e9;text-decoration:none}
@media (max-width: 820px){
  .grid{grid-template-columns:1fr}
  .col .row label{width:110px}
}

/* Mini previews */
.thumbs.thumb-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:10px}
.thumb-item{position:relative;border:1px solid var(--border);border-radius:10px;overflow:hidden;background:#fff}
.thumb-item img{display:block;width:100%;height:88px;object-fit:cover}
.thumb-item .remove{position:absolute;top:6px;right:6px;border:0;border-radius:999px;background:#000000cc;color:#fff;width:22px;height:22px;line-height:22px;text-align:center;font-size:12px;cursor:pointer}
.thumb-item[draggable="true"]{cursor:grab}
.file-chip{display:inline-flex;align-items:center;gap:8px;background:#eef2ff;color:#1e3a8a;border:1px solid #c7d2fe;border-radius:999px;padding:6px 10px;font-size:13px;margin-top:8px}
.file-chip .dot{width:8px;height:8px;border-radius:999px;background:#6366f1}
.filedrop.dragover{border-color:#60a5fa;background:#eff6ff}
