:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #e6eaf0;
  --brand: #0154a7;
  --brand-dark: #003f80;
  --success: #067647;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #e9f2ff, transparent 34%), var(--bg);
}

.app { width: min(1280px, calc(100% - 24px)); margin: 0 auto; padding: 42px 0; }
.hero { margin-bottom: 22px; }
.eyebrow { color: var(--brand); font-weight: 700; margin: 0 0 8px; }
h1 { font-size: clamp(32px, 5vw, 58px); line-height: .98; margin: 0; max-width: 860px; letter-spacing: -.04em; }
.hero p:last-child { color: var(--muted); font-size: 18px; max-width: 620px; }

.panel {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(230,234,240,.9);
  box-shadow: var(--shadow);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(14px);
}

.uploader {
  min-height: 150px;
  border: 1.5px dashed #b9c7d8;
  display: grid;
  place-items: center;
  text-align: center;
  margin-bottom: 18px;
}
.uploader.dragover { border-color: var(--brand); background: #f0f7ff; }
.uploader p { margin: 10px 0 0; color: var(--muted); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 12px 17px;
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(15,23,42,.08); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.settings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
label small { color: var(--muted); font-size: 12px; font-weight: 600; }
label { color: var(--muted); font-size: 14px; font-weight: 800; display: grid; gap: 8px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

.list-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bulk-rename {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.workspace { display: grid; grid-template-columns: 1.08fr .92fr; gap: 16px; align-items: start; }
h2 { margin: 0 0 16px; font-size: 20px; }
.image-wrap {
  min-height: 400px;
  background: #eef2f7;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
}
#cropImage { display: block; max-width: 100%; max-height: 520px; }
#emptyState { color: var(--muted); position: absolute; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.list-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.file-list { display: grid; gap: 8px; max-height: 740px; overflow: auto; padding-right: 4px; }
.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.file-item.active { outline: 2px solid rgba(1,84,167,.25); }
.file-select {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.file-select img { width: 44px; height: 44px; object-fit: cover; border-radius: 12px; background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%); background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; }
.file-name { font-weight: 800; word-break: break-word; font-size: 13px; line-height: 1.2; }
.file-meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.rename-input { margin-top: 6px; padding: 7px 9px; border-radius: 10px; font-size: 13px; }
.status { color: var(--muted); font-weight: 700; font-size: 12px; text-align: right; max-width: 180px; }
.status.success { color: var(--success); }
.status.error { color: var(--danger); }
.file-actions { display: grid; gap: 6px; justify-items: end; }
.mini-btn {
  border: 1px solid #d7dde6;
  background: #ffffff;
  color: #111827;
  border-radius: 999px;
  padding: 7px 11px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.mini-btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.mini-btn.muted, .mini-btn:disabled { cursor: not-allowed; opacity: .55; }

.notice { display: none; color: var(--danger); font-weight: 800; margin: 8px 0 0; }
.notice.show { display: block; }

@media (max-width: 900px) {
  .settings, .workspace, .bulk-rename { grid-template-columns: 1fr; }
  .list-head { align-items: flex-start; flex-direction: column; }
  .image-wrap { min-height: 320px; }
}

@media (max-width: 640px) {
  .file-item { grid-template-columns: 1fr; }
  .file-actions { justify-items: start; }
  .status { text-align: left; }
}
.warning-text { color: var(--danger); font-size: 12px; font-weight: 700; margin-top: 6px; line-height: 1.35; }
.file-select:focus-visible {
  outline: 2px solid rgba(1,84,167,.45);
  outline-offset: 3px;
}


.quick-tools { margin-bottom: 18px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.btn.danger,
.mini-btn.danger {
  color: var(--danger);
  border-color: rgba(180, 35, 24, .25);
  background: #fff;
}

.batch-status {
  display: none;
  margin: 4px 0 10px;
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
}
.batch-status.show { display: block; }

.file-actions {
  min-width: 120px;
}

@media (max-width: 640px) {
  .list-head-actions { width: 100%; }
  .list-head-actions .btn { width: 100%; }
}
