/* ==========================================================================
   News Card Generator — Newsroom Design System
   Aesthetic: Bengali press room · warm amber ink · dark studio
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* ── Core palette ── */
  --bg:          #07090e;
  --bg2:         #0a0d14;
  --surface:     #0e1119;
  --surface2:    #131720;
  --surface3:    #181c27;
  --ink:         #e8ecf4;
  --ink2:        #a8b0c2;
  --ink3:        #616878;
  --amber:       #f0a500;
  --amber-dim:   #c07f00;
  --amber-glow:  rgba(240,165,0,.12);
  --amber-glow2: rgba(240,165,0,.06);
  --cyan:        #38bdf8;
  --cyan-dim:    #0ea5e9;
  --green:       #34d399;
  --red:         #f87171;
  --purple:      #a78bfa;

  /* ── Border ── */
  --line:        rgba(255,255,255,.06);
  --line2:       rgba(255,255,255,.10);
  --line-amber:  rgba(240,165,0,.25);

  /* ── Typography ── */
  --font-ui:   'Inter', system-ui, sans-serif;
  --font-bn:   'Hind Siliguri', 'Inter', sans-serif;

  /* ── Geometry ── */
  --r:    12px;
  --r-sm: 8px;
  --r-xs: 6px;

  /* ── Motion ── */
  --ease:   cubic-bezier(.16,1,.3,1);
  --ease-s: cubic-bezier(.4,0,.2,1);

  /* ── Shadows ── */
  --shadow:    0 1px 3px rgba(0,0,0,.5), 0 8px 32px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 8px rgba(0,0,0,.6), 0 20px 60px rgba(0,0,0,.5);
  --glow:      0 0 0 1px var(--amber), 0 0 20px var(--amber-glow), 0 0 40px var(--amber-glow2);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 900px 500px at 10% -5%,  rgba(240,165,0,.04) 0%, transparent 60%),
    radial-gradient(ellipse 700px 400px at 95% 10%, rgba(56,189,248,.03) 0%, transparent 55%);
  background-attachment: fixed;
}

::selection { background: rgba(240,165,0,.25); color: var(--ink) }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 8px }
::-webkit-scrollbar-thumb:hover { background: var(--line2) }

h1,h2,h3,h4 { font-weight: 600; line-height: 1.3; letter-spacing: -.2px }
a { color: inherit; text-decoration: none }
code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .875em;
  background: var(--surface3);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--amber);
}

/* ════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 20px;
  padding: 0 clamp(16px,4vw,32px);
  height: 58px;
  background: rgba(7,9,14,.85);
  backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex; align-items: center; gap: 10px;
}
.topbar-logo {
  width: 30px; height: 30px;
  background: var(--amber);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(240,165,0,.35);
  flex-shrink: 0;
}
.topbar h1 {
  font-size: 15px; font-weight: 600;
  color: var(--ink); letter-spacing: .1px;
}
.topbar-sub {
  font-size: 11px; color: var(--ink3);
  font-weight: 400; margin-top: 1px;
}

.topbar-nav { display: flex; align-items: center; gap: 6px }

.adminlink {
  font-size: 13px; color: var(--ink3); font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-sm);
  transition: color .15s, background .15s;
}
.adminlink:hover { color: var(--ink); background: var(--surface3) }

/* ════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════ */
.wrap {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  padding: clamp(16px,3vw,28px);
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 900px) { .wrap { grid-template-columns: 1fr } }
@media (max-width: 560px) { .wrap { padding: 12px; gap: 14px } }

/* ════════════════════════════════════════════════════════════
   CARD / SURFACE
   ════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(18px,3vw,24px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.02) 0%, transparent 60%);
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   SECTION LABELS
   ════════════════════════════════════════════════════════════ */
.section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--ink3);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after {
  content: ''; flex: 1;
  height: 1px; background: var(--line);
}

/* ════════════════════════════════════════════════════════════
   FORM CONTROLS
   ════════════════════════════════════════════════════════════ */
label {
  display: block; margin-bottom: 14px;
  font-size: 12px; font-weight: 500;
  color: var(--ink3);
  font-family: var(--font-ui);
}
label span.lbl-text { display: block; margin-bottom: 7px; letter-spacing: .3px }

label input, label select, label textarea,
.field-row input, .field-row select, .field-row textarea {
  display: block; width: 100%;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-bn);
  line-height: 1.5;
  transition: border-color .18s var(--ease-s), box-shadow .18s var(--ease-s), background .18s;
}

label input:hover, label select:hover, label textarea:hover,
.field-row input:hover, .field-row select:hover, .field-row textarea:hover {
  border-color: rgba(255,255,255,.15);
}

label input:focus, label select:focus, label textarea:focus,
.field-row input:focus, .field-row select:focus, .field-row textarea:focus {
  outline: none;
  border-color: var(--amber);
  background: rgba(7,9,14,.9);
  box-shadow: 0 0 0 3px var(--amber-glow), 0 0 0 1px var(--amber);
}

textarea, .field-row textarea { resize: vertical; min-height: 68px }

label input[type="file"],
.field-row input[type="file"] {
  padding: 9px 12px;
  cursor: pointer;
  color: var(--ink2);
  font-size: 13px;
}
label input[type="file"]::file-selector-button {
  background: var(--surface3);
  border: 1px solid var(--line2);
  color: var(--ink2);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 10px;
  transition: border-color .15s, background .15s;
}
label input[type="file"]::file-selector-button:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-glow);
}

select option { background: var(--surface2) }

/* ── Template select with thumb preview ── */
#template-select {
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line2);
  background: var(--surface2);
  color: var(--ink2);
  font-size: 13px; font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform .12s var(--ease),
    border-color .15s,
    background .15s,
    color .15s,
    box-shadow .15s;
}
.btn:hover {
  border-color: rgba(255,255,255,.2);
  background: var(--surface3);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.btn:active { transform: translateY(0); box-shadow: none }

.btn.primary {
  background: linear-gradient(160deg, rgba(240,165,0,.15) 0%, rgba(200,130,0,.1) 100%);
  border-color: var(--amber-dim);
  color: var(--amber);
  font-weight: 600;
  box-shadow: 0 0 0 0 var(--amber-glow);
}
.btn.primary:hover {
  background: linear-gradient(160deg, rgba(240,165,0,.22) 0%, rgba(200,130,0,.16) 100%);
  border-color: var(--amber);
  color: #ffc740;
  box-shadow: 0 0 20px rgba(240,165,0,.2);
}
.btn.primary:disabled {
  opacity: .45; cursor: wait;
  transform: none; box-shadow: none;
}

.btn.primary.generating {
  animation: pulse-amber 1.4s ease-in-out infinite;
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,165,0,.3) }
  50%       { box-shadow: 0 0 0 6px rgba(240,165,0,0) }
}

.btn.danger { color: var(--red); border-color: rgba(248,113,113,.2) }
.btn.danger:hover { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.4); color: #fca5a5 }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  border-radius: var(--r-xs);
  font-size: 13px;
}

.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap }

/* ════════════════════════════════════════════════════════════
   MSG / TOAST
   ════════════════════════════════════════════════════════════ */
.msg {
  font-size: 12.5px; color: var(--ink3);
  min-height: 20px; margin-top: 10px;
  transition: color .2s;
}
.msg.err { color: var(--red) }
.msg.ok  { color: var(--green) }

/* Toast notification */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  background: var(--surface2);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  max-width: 320px;
  transform: translateY(8px); opacity: 0;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
  pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; pointer-events: auto }
#toast.toast-ok   { border-color: rgba(52,211,153,.3); color: var(--green) }
#toast.toast-err  { border-color: rgba(248,113,113,.3); color: var(--red) }
#toast.toast-info { border-color: var(--line-amber); color: var(--amber) }
.toast-icon { font-size: 16px }

/* ════════════════════════════════════════════════════════════
   PREVIEW
   ════════════════════════════════════════════════════════════ */
.preview { display: flex; flex-direction: column }

.preview-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--ink3); margin-bottom: 12px;
}

.preview-box {
  position: relative;
  aspect-ratio: 1080 / 1350;
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--line);
  transition: border-color .3s;
}
.preview-box::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 24px 24px;
}
.preview-box.has-image { border-color: var(--amber-dim) }
.preview-box.loading   { border-color: rgba(240,165,0,.3) }

.preview-empty {
  position: absolute; z-index: 1;
  text-align: center; color: var(--ink3);
  pointer-events: none;
  transition: opacity .3s;
}
.preview-empty .icon { font-size: 32px; margin-bottom: 10px; opacity: .4 }
.preview-empty p { font-size: 12px; line-height: 1.6; opacity: .5 }
.preview-box.has-image .preview-empty { opacity: 0 }

#preview {
  max-width: 100%; max-height: 100%;
  display: block; position: relative; z-index: 2;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
#preview.loaded { opacity: 1 }

/* skeleton shimmer */
.preview-skeleton {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg,
    var(--surface) 0%,
    var(--surface2) 50%,
    var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.preview-box.loading .preview-skeleton { opacity: 1 }
@keyframes shimmer {
  0%   { background-position: -200% 0 }
  100% { background-position:  200% 0 }
}

/* ════════════════════════════════════════════════════════════
   FIELD ROWS (dynamic form)
   ════════════════════════════════════════════════════════════ */
.field-row { display: block; margin-bottom: 14px; font-size: 12px; color: var(--ink3) }
.field-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500; color: var(--ink3);
  margin-bottom: 7px; letter-spacing: .2px;
}

.badge-dynamic {
  display: inline-block; padding: 2px 8px;
  border-radius: 20px; font-size: 9px; font-weight: 700;
  background: var(--amber-glow); color: var(--amber);
  border: 1px solid var(--line-amber); letter-spacing: .5px;
  text-transform: uppercase;
}
.badge-static {
  display: inline-block; padding: 2px 8px;
  border-radius: 20px; font-size: 9px; font-weight: 700;
  background: rgba(168,176,194,.08); color: var(--ink3);
  border: 1px solid var(--line); letter-spacing: .5px;
  text-transform: uppercase;
}

.static-layer-info {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px; margin-bottom: 10px;
  background: var(--bg2);
  border: 1px dashed var(--line2);
  border-radius: var(--r-sm);
  flex-wrap: wrap;
}
.static-name { font-size: 12px; color: var(--ink3) }
.static-val  { font-size: 12px; color: var(--ink3); font-style: italic; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

/* ════════════════════════════════════════════════════════════
   TEMPLATE THUMBNAIL STRIP
   ════════════════════════════════════════════════════════════ */
.tpl-picker {
  display: flex; gap: 10px; overflow-x: auto;
  padding-bottom: 4px; margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.tpl-thumb {
  flex: 0 0 70px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--line);
  transition: border-color .18s, transform .15s var(--ease), box-shadow .18s;
  position: relative;
  aspect-ratio: 3/4;
  background: var(--bg2);
}
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block }
.tpl-thumb .tpl-lbl {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
  color: #fff; font-size: 8px; font-weight: 600;
  padding: 12px 4px 4px; text-align: center;
  line-height: 1.2; letter-spacing: .2px;
  opacity: 0; transition: opacity .2s;
}
.tpl-thumb:hover .tpl-lbl { opacity: 1 }
.tpl-thumb:hover { border-color: rgba(240,165,0,.5); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.4) }
.tpl-thumb.active {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber), 0 0 16px var(--amber-glow);
  transform: translateY(-2px);
}
.tpl-thumb.active .tpl-lbl { opacity: 1 }

/* ════════════════════════════════════════════════════════════
   PROGRESS BAR
   ════════════════════════════════════════════════════════════ */
.prog-wrap {
  height: 2px; background: var(--line); border-radius: 2px;
  overflow: hidden; margin-top: 14px; opacity: 0;
  transition: opacity .2s;
}
.prog-wrap.active { opacity: 1 }
.prog-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber), var(--cyan));
  border-radius: 2px;
  width: 0%;
  transition: width .4s var(--ease-s);
}

/* ════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; font-size: 13px }
th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line2);
  text-align: left;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--ink3);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink2);
}
tr:last-child td { border-bottom: none }
tr:hover td { background: rgba(255,255,255,.02) }

/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .3px; white-space: nowrap;
}
.badge.ok     { background: rgba(52,211,153,.1);  color: var(--green);  border: 1px solid rgba(52,211,153,.25) }
.badge.fail   { background: rgba(248,113,113,.1); color: var(--red);    border: 1px solid rgba(248,113,113,.25) }
.badge.api    { background: rgba(56,189,248,.1);  color: var(--cyan);   border: 1px solid rgba(56,189,248,.25) }
.badge.web    { background: rgba(167,139,250,.1); color: var(--purple); border: 1px solid rgba(167,139,250,.25) }
.badge.amber  { background: var(--amber-glow);    color: var(--amber);  border: 1px solid var(--line-amber) }

/* ════════════════════════════════════════════════════════════
   STAT CARDS
   ════════════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 16px;
  text-align: center;
  transition: border-color .2s, transform .2s var(--ease);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
}
.stat-card:hover { border-color: var(--line2); transform: translateY(-2px) }
.stat-card .num {
  font-size: 2rem; font-weight: 700;
  color: var(--amber); line-height: 1.1;
  margin-bottom: 5px;
}
.stat-card .num.green  { color: var(--green) }
.stat-card .num.red    { color: var(--red) }
.stat-card .num.blue   { color: var(--cyan) }
.stat-card .num.purple { color: var(--purple) }
.stat-card .lbl {
  font-size: 11px; color: var(--ink3); font-weight: 500;
  text-transform: uppercase; letter-spacing: .5px;
}

/* ════════════════════════════════════════════════════════════
   PROGRESS BAR (inline)
   ════════════════════════════════════════════════════════════ */
.progress-bar {
  height: 3px; background: var(--line);
  border-radius: 3px; overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: 3px;
}

/* ════════════════════════════════════════════════════════════
   QUICK NAV GRID (dashboard)
   ════════════════════════════════════════════════════════════ */
.quick-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 12px; margin-bottom: 20px;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 16px;
  text-decoration: none; color: var(--ink);
  transition: border-color .2s, transform .2s var(--ease), background .2s;
  position: relative; overflow: hidden;
}
.nav-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.02) 0%, transparent 100%);
}
.nav-btn:hover {
  border-color: var(--amber-dim);
  background: var(--surface2);
  transform: translateY(-2px);
}
.nav-btn .icon { font-size: 22px; margin-bottom: 6px }
.nav-btn .title { font-size: 14px; font-weight: 600; color: var(--ink) }
.nav-btn .label { font-size: 11px; color: var(--ink3) }

/* ════════════════════════════════════════════════════════════
   API KEY BOX
   ════════════════════════════════════════════════════════════ */
.apikey-box {
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  word-break: break-all;
  color: var(--ink2);
  line-height: 1.7;
}

.alert-new {
  background: rgba(52,211,153,.06);
  border: 1px solid rgba(52,211,153,.2);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.alert-new code {
  background: rgba(52,211,153,.1);
  color: var(--green);
  padding: 3px 8px;
  border-radius: 5px;
  word-break: break-all;
  font-size: 12px;
}

.code-block {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-family: ui-monospace, monospace;
  font-size: 12px; line-height: 1.7;
  color: var(--cyan);
  overflow-x: auto; white-space: pre;
  margin: 10px 0;
}

/* ════════════════════════════════════════════════════════════
   SECTION HEADER
   ════════════════════════════════════════════════════════════ */
.section-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.section-header h2 {
  font-size: 14px; font-weight: 600;
  color: var(--ink); letter-spacing: .1px;
}

/* ════════════════════════════════════════════════════════════
   GALLERY
   ════════════════════════════════════════════════════════════ */
.gallery-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 20px;
  flex-wrap: wrap; gap: 12px;
}
.stats-row { display: flex; gap: 20px; font-size: 13px; color: var(--ink3); align-items: center }
.stats-row strong { color: var(--ink) }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap: 14px;
}
.img-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.img-card:hover { border-color: var(--amber-dim); transform: translateY(-3px); box-shadow: var(--shadow-lg) }
.img-card.selected { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber), 0 0 16px var(--amber-glow) }
.img-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--bg2) }
.img-meta { padding: 10px 12px }
.img-name { font-size: 10px; color: var(--ink3); word-break: break-all; margin-bottom: 4px; font-family: monospace }
.img-size { font-size: 10px; color: var(--ink3); opacity: .6; margin-bottom: 4px }
.img-date { font-size: 10px; color: var(--ink3); opacity: .5; margin-bottom: 8px }
.img-actions { display: flex; gap: 6px }
.img-actions a, .img-actions button {
  flex: 1; padding: 6px 0; font-size: 11px;
  text-align: center; border-radius: var(--r-xs);
  border: 1px solid var(--line2);
  background: var(--bg2); color: var(--ink2);
  cursor: pointer; text-decoration: none;
  font-family: var(--font-ui);
  transition: border-color .15s, background .15s, color .15s;
}
.img-actions a:hover { border-color: var(--amber-dim); color: var(--amber) }
.img-actions .del-btn { color: var(--red); border-color: rgba(248,113,113,.2) }
.img-actions .del-btn:hover { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.4) }
.checkbox-wrap { position: absolute; top: 8px; left: 8px; z-index: 2 }
.checkbox-wrap input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--amber) }

.bulk-bar {
  background: var(--surface2);
  border: 1px solid var(--line-amber);
  border-radius: var(--r-sm);
  padding: 12px 16px; margin-bottom: 16px;
  display: none; align-items: center; gap: 12px;
  font-size: 13px; color: var(--amber);
}
.bulk-bar.active { display: flex }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink3) }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: .4 }
.empty-state p { font-size: 13px; margin-bottom: 16px }

.search-box {
  padding: 8px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line2);
  background: var(--bg2); color: var(--ink);
  font-size: 13px; width: 220px;
  transition: border-color .18s, box-shadow .18s;
}
.search-box:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-glow) }

/* ════════════════════════════════════════════════════════════
   TEMPLATE EDITOR
   ════════════════════════════════════════════════════════════ */
.editor-shell { max-width: 1440px; margin: 0 auto; padding: clamp(14px,3vw,24px) }
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 16px; align-items: start;
}
.canvas-wrap {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
  display: flex; justify-content: center;
  min-height: 420px;
}
#editor-canvas {
  max-width: 100%; height: auto;
  touch-action: none;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.layer-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px; max-height: 720px; overflow: auto;
}
.layer-panel h3 { font-size: 12px; color: var(--ink3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 12px }
.layer-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 10px 12px; margin: 5px 0;
  background: var(--bg2); color: var(--ink2);
  border: 1px solid var(--line); border-radius: var(--r-xs);
  cursor: pointer; font-size: 12px;
  font-family: var(--font-ui);
  transition: border-color .15s, background .15s, color .15s;
}
.layer-item:hover { border-color: var(--line2); background: var(--surface2); color: var(--ink) }
.layer-item.active { border-color: var(--amber); color: var(--amber); background: var(--amber-glow) }
.layer-item .meta { font-size: 10px; color: var(--ink3); margin-left: auto }
.props { margin-top: 14px }
.props h3 { font-size: 11px; color: var(--amber); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px }
.props label { display: block; margin-bottom: 9px; font-size: 11px; color: var(--ink3) }
.props label input, .props label select {
  display: block; width: 100%; margin-top: 4px;
  padding: 7px 9px; border-radius: 6px;
  border: 1px solid var(--line2); background: var(--bg2);
  color: var(--ink); font-size: 12px; font-family: var(--font-ui);
}
.props label input[type=color] { padding: 2px 4px; height: 30px; cursor: pointer }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 10px }
.grid label { margin: 0 }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 10px 0 }
legend { padding: 0 6px; color: var(--amber); font-size: 11px; font-weight: 600 }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.row .btn { padding: 7px 12px; font-size: 12px }

@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr }
  .layer-panel { max-height: none }
  .canvas-wrap { min-height: 0 }
}

/* ════════════════════════════════════════════════════════════
   LOGS
   ════════════════════════════════════════════════════════════ */
.filter-bar { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; align-items: center }
.filter-bar a {
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface2);
  color: var(--ink3); font-size: 12px; font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
}
.filter-bar a:hover { border-color: var(--line2); color: var(--ink) }
.filter-bar a.active { background: var(--amber-glow); color: var(--amber); border-color: var(--line-amber) }
.filter-bar a.success-f.active { background: rgba(52,211,153,.1); color: var(--green); border-color: rgba(52,211,153,.3) }
.filter-bar a.fail-f.active { background: rgba(248,113,113,.1); color: var(--red); border-color: rgba(248,113,113,.3) }

.headline-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink) }
.err-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--red); font-size: 11px; cursor: pointer }
.out-link { color: var(--amber); font-size: 11px; font-family: monospace }
.out-link:hover { text-decoration: underline }
.time-cell { color: var(--ink3); font-size: 11px; white-space: nowrap }

/* ════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 700px 500px at 50% 40%, rgba(240,165,0,.05) 0%, transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 28px; gap: 10px;
}
.login-logo-mark {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--amber-dim), var(--amber));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 24px rgba(240,165,0,.3);
}
.login-logo h1 { font-size: 18px; color: var(--ink); font-weight: 700 }
.login-logo p { font-size: 12px; color: var(--ink3) }

/* ════════════════════════════════════════════════════════════
   DIVIDER
   ════════════════════════════════════════════════════════════ */
.divider {
  height: 1px; background: var(--line);
  margin: 16px 0;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .topbar { padding: 0 14px }
  .topbar h1 { font-size: 14px }
  .btn { padding: 9px 14px; font-size: 12.5px }
  .card { border-radius: 10px; padding: 16px }
  .stat-card .num { font-size: 1.6rem }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important }
}

/* ════════════════════════════════════════════════════════════
   MINI LOG TABLE
   ════════════════════════════════════════════════════════════ */
.mini-log { font-size: 12px }
.mini-log td { padding: 8px 10px; border-bottom: 1px solid var(--line) }
.mini-log tr:last-child td { border-bottom: none }

/* ════════════════════════════════════════════════════════════
   UTILITY
   ════════════════════════════════════════════════════════════ */
.text-muted   { color: var(--ink3) }
.text-amber   { color: var(--amber) }
.text-green   { color: var(--green) }
.text-red     { color: var(--red) }
.text-cyan    { color: var(--cyan) }
.mt-0 { margin-top: 0 }
.mb-0 { margin-bottom: 0 }
.danger { color: var(--red) }
