/* ============================================================
   Reframe — professional design system (slate + blue)
   ============================================================ */
:root {
  --bg: #f6f8fb;
  --bg-soft: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-dim: #5b6b81;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.1);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 4px 8px rgba(15, 23, 42, 0.06), 0 12px 28px -6px rgba(15, 23, 42, 0.14);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --nav-h: 60px;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-soft: #101a2c;
  --surface: #111c30;
  --surface-2: #16233a;
  --border: #1e2c47;
  --border-strong: #2c3d5e;
  --text: #e8eef7;
  --text-dim: #8fa1bd;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.4), 0 12px 28px -6px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
code { background: var(--bg-soft); padding: 0.15em 0.4em; border-radius: 5px; font-size: 0.9em; font-family: "SF Mono", "JetBrains Mono", Consolas, monospace; }
::selection { background: var(--accent-soft); }

/* ---------- layout ---------- */
.container { max-width: 1440px; margin: 0 auto; padding: 0 28px; }
.container.wide { max-width: none; }
.narrow { max-width: 440px; margin: 0 auto; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 4px; }
.page-sub { color: var(--text-dim); margin: 0 0 22px; font-size: 0.95rem; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
}
.brand-mark svg { width: 15px; height: 15px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  color: var(--text-dim); font-weight: 500; font-size: 0.88rem; padding: 8px 12px;
  border-radius: 7px; transition: 0.12s; white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 2px; }
.card-sub { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 18px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 5px; color: var(--text-dim); }
.field .input, input[type=text], input[type=password], input[type=number], input[type=search], input:not([type]) {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.92rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field .input:focus, input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.92rem; cursor: pointer;
}
select.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap; text-decoration: none !important;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); box-shadow: 0 2px 6px -1px var(--accent-soft); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.05); }
.btn-sm { padding: 6px 11px; font-size: 0.8rem; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.gray { background: var(--bg-soft); color: var(--text-dim); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px; }
.stat .l { font-size: 0.78rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- toasts ---------- */
.toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 16px; box-shadow: var(--shadow-lg);
  font-size: 0.88rem; font-weight: 500; animation: toastin 0.18s ease;
}
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: grid; place-items: center; z-index: 150;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 22px; max-width: 440px; width: calc(100vw - 40px); box-shadow: var(--shadow-lg);
  transform: translateY(6px); transition: transform 0.15s;
}
.modal-overlay.open .modal { transform: none; }
.modal h3 { font-size: 1rem; margin-bottom: 6px; }
.modal p.input-desc { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 14px; }
.modal input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.modal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 44px 22px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: border-color 0.15s, background 0.15s;
  margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-ico { margin-bottom: 8px; color: var(--text-dim); }
.dropzone .dz-ico svg { width: 30px; height: 30px; }
.dropzone p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.dropzone strong { color: var(--text); }
.dropzone .dz-file { display: none; margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 13px; align-items: center; gap: 10px; }
.dropzone.has-file .dz-file { display: flex; }
.dropzone.has-file .dz-ico, .dropzone.has-file p { display: none; }

/* ---------- tools ---------- */
.tools-layout { display: grid; grid-template-columns: minmax(min(480px, 55%), 1fr) minmax(min(420px, 45%), 1fr); gap: 18px; align-items: start; }
.mode-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.mode-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; transition: 0.12s;
}
.mode-card:hover { border-color: var(--border-strong); }
.mode-card input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.mode-card .t { font-weight: 600; font-size: 0.9rem; }
.mode-card .d { font-size: 0.8rem; color: var(--text-dim); margin-top: 1px; }
.mode-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.mode-card.selected .t { color: var(--accent); }
.section-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin: 20px 0 8px; }
.check-row { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.check-row label { font-size: 0.88rem; font-weight: 500; cursor: pointer; }

/* ---------- banners ---------- */
.banner {
  padding: 11px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 500;
  display: flex; align-items: center; gap: 9px; margin-bottom: 16px;
}
.banner.ok { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); }
.banner.warn { background: var(--warning-soft); color: var(--warning); border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); }
.banner.days { background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---------- misc ---------- */
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.wrap { flex-wrap: wrap; }
.small { font-size: 0.8rem; }
.muted { color: var(--text-dim); }
.mono { font-family: "SF Mono", "JetBrains Mono", Consolas, monospace; font-size: 0.9em; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
.job-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.job-status { flex: 1; min-width: 0; }
.job-status .jname { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-error { color: var(--danger); font-size: 0.8rem; margin-top: 3px; }

/* ---------- multi-file list ---------- */
.file-list { display: flex; flex-direction: column; gap: 7px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.file-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 500; }
.file-row-x { color: var(--text-dim); cursor: pointer; padding: 2px 7px; border-radius: 5px; font-size: 0.85rem; }
.file-row-x:hover { background: var(--danger-soft); color: var(--danger); }
/* folder grouping in the staged list (before remaking) */
.folder-head {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}
.folder-prev { color: var(--accent); display: grid; place-items: center; }
.file-row.in-folder { margin-left: 22px; border-left: 2px solid color-mix(in srgb, var(--accent) 40%, var(--border)); }

/* admin users: agency → subs dropdown */
.subs-drop { position: relative; }
.subs-drop summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.82rem; font-weight: 600; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 6px; padding: 3px 9px; user-select: none;
}
.subs-drop summary::-webkit-details-marker { display: none; }
.subs-drop summary .caret { font-size: 0.7rem; transition: transform 0.15s; }
.subs-drop[open] summary .caret { transform: rotate(180deg); }
.subs-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.subs-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 9px; border-radius: 6px; font-size: 0.82rem;
  background: var(--bg-soft);
}
.subs-item.off { opacity: 0.55; }

/* ---------- address search ---------- */
.loc-results {
  margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden; max-height: 220px; overflow-y: auto; box-shadow: var(--shadow);
}
.loc-item {
  display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px;
  cursor: pointer; font-size: 0.86rem; border-bottom: 1px solid var(--border);
}
.loc-item:last-child { border-bottom: none; }
.loc-item:hover { background: var(--accent-soft); }
.loc-none { padding: 11px; color: var(--text-dim); font-size: 0.86rem; }
.loc-chosen {
  display: flex; align-items: center; gap: 9px; margin-top: 6px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 0.86rem;
}
.loc-chosen > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.tbl th { text-align: left; padding: 9px 12px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); border-bottom: 1px solid var(--border); font-weight: 600; }
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border); margin-top: 80px; padding: 28px 0 36px;
  color: var(--text-dim); font-size: 0.82rem; text-align: center;
}

/* ---------- auth page ---------- */
.auth-card { max-width: 400px; margin: 56px auto 90px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 4px; }

/* ---------- landing / hero ---------- */
.hero { padding: 88px 0 64px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 16px; line-height: 1.12; }
.accent-text { color: var(--accent); }
.hero .sub { font-size: 1.02rem; color: var(--text-dim); max-width: 560px; margin: 0 auto 28px; line-height: 1.55; }
.hero .cta-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; padding-bottom: 56px;
}
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px;
  box-shadow: var(--shadow-sm);
}
.feature .ico {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 14px;
}
.feature .ico svg { width: 21px; height: 21px; }
.feature h3 { font-size: 1.02rem; font-weight: 650; margin-bottom: 7px; letter-spacing: -0.01em; }
.feature p { font-size: 0.9rem; color: var(--text-dim); line-height: 1.55; margin: 0; }

.how { padding-bottom: 72px; }
.how-title { text-align: center; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 34px; }
.how-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 18px;
}
.step .num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.85rem;
  display: grid; place-items: center;
}
.step h4 { font-size: 0.95rem; font-weight: 650; margin: 2px 0 4px; }
.step p { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; margin: 0; }

/* ---------- theme toggle ---------- */
.theme-toggle {
  width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); cursor: pointer; font-size: 14px;
  display: grid; place-items: center; transition: 0.12s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; }

/* ---------- gallery ---------- */
.gallery-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 28px 0 16px; flex-wrap: wrap; }
.queue-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 99px;
  padding: 6px 14px; font-size: 0.8rem; color: var(--text-dim); font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.gallery-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 9px 16px; border: none; border-bottom: 2px solid transparent;
  background: none; color: var(--text-dim); font: inherit; font-weight: 500; font-size: 0.88rem;
  cursor: pointer; transition: 0.12s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.gallery-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; padding-bottom: 56px;
}
.media-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow 0.14s ease, border-color 0.14s ease;
  display: flex; flex-direction: column;
}
.media-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.media-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.media-thumb { position: relative; aspect-ratio: 4/3; background: var(--bg-soft); overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-ic { position: absolute; top: 8px; right: 8px; font-size: 15px; background: rgba(15, 23, 42, 0.6); color: #fff; border-radius: 5px; padding: 2px 6px; }
.media-info { padding: 11px 13px 3px; }
.media-name { font-weight: 600; font-size: 0.87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.media-actions { display: flex; gap: 6px; padding: 9px 13px 12px; }
.media-actions .btn { flex: 1; }

/* checkmark on selection (corner of thumbnail) */
.media-check {
  position: absolute; top: 8px; left: 8px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(15, 23, 42, 0.55); border: 2px solid rgba(255, 255, 255, 0.75);
  display: none; place-items: center; font-size: 12px; color: #fff; font-weight: 700; line-height: 1;
}
.media-card.selected .media-check {
  display: grid; background: var(--accent); border-color: var(--accent);
}
.media-card.selected .media-check::after { content: "✓"; }

/* folder cards */
.folder-card { cursor: pointer; background: var(--bg-soft); }
.folder-thumb {
  display: grid; place-items: center; color: var(--accent);
  background: var(--accent-soft); border-bottom: 1px solid var(--border);
}
.folder-card .media-name { color: var(--text); }

/* breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.crumb { border: none; background: none; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--accent); cursor: pointer; padding: 2px 4px; }
.crumb:hover { text-decoration: underline; }
.crumb.current { color: var(--text); cursor: default; }
.crumb.current:hover { text-decoration: none; }
.crumb-sep { color: var(--text-dim); font-size: 0.9rem; }

/* wide modal (add-from-gallery picker) */
.modal-wide { max-width: 860px !important; width: 92vw; }
.gp-breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* gallery picker grid (studio add-from-gallery) */
.gallery-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
  max-height: 55vh; overflow-y: auto; padding: 4px;
}
.gp-item {
  display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); padding-bottom: 6px; position: relative;
  transition: border-color 0.12s ease;
}
.gp-item:hover { border-color: var(--border-strong); }
.gp-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gp-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.gp-item span {
  font-size: 0.72rem; font-weight: 500; color: var(--text); padding: 0 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gp-item input { display: none; }
/* corner checkmark on picked media */
.gp-checkmark {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(15, 23, 42, 0.55); border: 2px solid rgba(255,255,255,0.75);
  display: none; place-items: center; font-size: 11px; color: #fff; font-weight: 700; line-height: 1;
}
.gp-item .gp-checkmark { padding: 0; }
.gp-item.on .gp-checkmark { display: grid; background: var(--accent); border-color: var(--accent); }
.gp-folder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  aspect-ratio: 4/3; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent); cursor: pointer; text-align: center;
  padding: 8px; position: relative;
}
.gp-folder span { font-size: 0.75rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gp-folder:hover { border-color: var(--accent); }
.gp-folder.has-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gp-folder .gp-fcount {
  position: absolute; top: 6px; right: 6px;
  background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 700;
  border-radius: 99px; padding: 2px 8px; line-height: 1.4;
}

/* folder-pick list (move-to modal) */
.folder-pick { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.fp-item {
  text-align: left; padding: 10px 12px; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); font: inherit; font-size: 0.88rem; cursor: pointer;
}
.fp-item:hover { border-color: var(--accent); background: var(--accent-soft); }

/* zip-or-folder download choice */
.dl-choice { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.dl-card {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px 16px;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  font: inherit; cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease;
}
.dl-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.dl-card strong { font-size: 0.92rem; color: var(--text); }

/* folder job cards in the studio */
.folder-job .jname { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.folder-job .jname svg { flex: 0 0 auto; }
.fg-meta { margin-top: 6px; font-size: 0.78rem; }
.fg-toggle { cursor: pointer; font-size: 0.8rem; user-select: none; color: var(--text-dim); }
.fg-toggle:hover { color: var(--accent); }
.fg-badge { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.fg-files {
  margin-top: 10px; padding: 8px 10px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto;
}
.fg-file { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.fg-file-status { flex: 0 0 16px; color: var(--text-dim); }
.fg-file-status.ok { color: var(--success, #16a34a); }
.fg-file-status.err { color: var(--danger); }
.fg-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* picker toolbar inside the folder ("Select entire folder") */
.gp-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px; padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}

/* "Select all" on folder tiles in the studio picker */
.gp-folder { position: relative; }
.gp-folder-all {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  font: inherit; font-size: 0.7rem; font-weight: 700; padding: 4px 10px; cursor: pointer;
  white-space: nowrap; box-shadow: var(--shadow);
}
.gp-folder-all:hover { filter: brightness(1.08); }

.gallery-empty {
  grid-column: 1 / -1; text-align: center; color: var(--text-dim);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 56px 20px;
}
.file-prev { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; flex: 0 0 42px; background: var(--bg-soft); display: grid; place-items: center; }

/* ---------- gallery bulk bar + context menu ---------- */
.gallery-bulk {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
  position: sticky; top: calc(var(--nav-h) + 8px); z-index: 40;
}
.media-folder { font-size: 0.72rem; color: var(--accent); font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-menu {
  position: absolute; z-index: 120; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; overflow: hidden;
}
.mm-name { font-weight: 600; font-size: 0.82rem; padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.mm-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none;
  font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--text); border-radius: 6px; cursor: pointer;
}
.mm-item:hover { background: var(--bg-soft); }
.mm-item.danger { color: var(--danger); }
.mm-item.danger:hover { background: var(--danger-soft); }

/* ---------- responsive / mobile ---------- */
@media (max-width: 980px) {
  .tools-layout { grid-template-columns: 1fr; }
  .container { padding: 0 18px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 11px; }
}
@media (max-width: 640px) {
  .nav-links { gap: 2px; }
  .nav-link { padding: 7px 9px; font-size: 0.84rem; }
  .brand span:last-child { display: none; }
  .hero { padding: 52px 0 38px; }
  .grid-2 { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .media-actions { flex-direction: column; }
  .stats { grid-template-columns: 1fr 1fr; }
  .modal { max-width: calc(100vw - 28px); }
  .queue-pill { font-size: 0.76rem; padding: 5px 11px; }
  .card { padding: 18px; }
  .btn { padding: 10px 14px; }
  .footer { margin-top: 56px; }
}
@media (max-width: 400px) {
  .gallery-grid { grid-template-columns: 1fr 1fr; }
}
