/* ============ YALP Asset Library — dark premium theme ============ */
:root {
  --bg: #0a0b0d;
  --surface: #131518;
  --surface-2: #1a1d21;
  --surface-3: #22262b;
  --border: #262b31;
  --border-soft: #1e2226;
  --green: #4fbd97;        /* YALP brand green */
  --green-dim: #3a8f73;
  --green-bg: rgba(79, 189, 151, 0.12);
  --lime: #e9fca5;         /* YALP brand lime */
  --lime-bg: rgba(233, 252, 165, 0.1);
  --text: #e9ebee;
  --text-2: #aab2bc;
  --muted: #6e7681;
  --danger: #e5695e;
  --danger-bg: rgba(229, 105, 94, 0.12);
  --warn: #e0b45c;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(79, 189, 151, 0.07), transparent 65%),
    radial-gradient(700px 500px at -10% 110%, rgba(233, 252, 165, 0.04), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--green); text-decoration: none; }
::selection { background: var(--green-dim); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 60px;
  background: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.logo {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  transition: filter 0.2s;
}
.logo:hover { filter: drop-shadow(0 0 10px rgba(79, 189, 151, 0.45)); }
.logo img { height: 30px; display: block; }
.logo-sub {
  font-size: 10px; font-weight: 600; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--muted);
  border-left: 1px solid var(--border); padding-left: 10px;
}
.searchbox {
  width: 100%; position: relative;
  display: flex; align-items: center;
  margin-bottom: 14px;
}
.searchbox svg { position: absolute; left: 16px; color: var(--muted); pointer-events: none; z-index: 1; }
/* input[type="text"] below has equal specificity — this selector must win */
.searchbox input[type="text"] {
  width: 100%; height: 44px;
  padding: 0 52px 0 46px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text); font-size: 14px; font-family: var(--font);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.searchbox input[type="text"]:focus { border-color: var(--green-dim); box-shadow: 0 0 0 3px var(--green-bg); }
.searchbox input[type="text"]::placeholder { color: var(--muted); }
.searchbox kbd {
  position: absolute; right: 14px;
  font-size: 11px; color: var(--muted);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; font-family: var(--font);
}
#topnav { display: flex; gap: 4px; margin-left: auto; }
#topnav a {
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  padding: 7px 13px; border-radius: 8px; transition: 0.15s;
}
#topnav a:hover { color: var(--text); background: var(--surface-2); }
#topnav a.active { color: var(--green); background: var(--green-bg); }
#usermenu { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; font-size: 13px; color: var(--text-2);
}
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-dim));
  color: #08110d; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.role-badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  padding: 2px 7px; border-radius: 5px; font-weight: 600;
}
.role-admin { background: var(--lime-bg); color: var(--lime); }
.role-editor { background: var(--green-bg); color: var(--green); }
.role-viewer { background: var(--surface-3); color: var(--text-2); }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 13.5px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #333a42; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(160deg, #5ecda6, var(--green) 55%, #3fa985);
  border-color: transparent; color: #07120e; font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(160deg, #6cd9b2, #58c7a0 55%, #46b28d);
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(79, 189, 151, 0.35);
}
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], textarea, select {
  width: 100%; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); color: var(--text);
  font-size: 13.5px; font-family: var(--font); outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--green-dim); }
textarea { resize: vertical; min-height: 70px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.2px;
}
label.field > span .req { color: var(--green); }

/* ---------- Layout ---------- */
#view { max-width: 1600px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 700; }
.page-head .spacer { flex: 1; }
.count-note { color: var(--muted); font-size: 13px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 480px at 68% 18%, rgba(79, 189, 151, 0.1), transparent 70%),
    radial-gradient(560px 400px at 18% 85%, rgba(233, 252, 165, 0.05), transparent 65%),
    var(--bg);
}
.login-card {
  width: 400px; padding: 44px 40px 38px;
  background: linear-gradient(175deg, #16191d, var(--surface) 45%);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow), 0 0 80px rgba(79, 189, 151, 0.07);
}
.login-card .logo { justify-content: center; margin-bottom: 18px; }
.login-card .logo img { height: 74px; }
.login-card .tagline {
  text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 30px;
  text-transform: uppercase; letter-spacing: 2.2px; font-weight: 500;
}
.login-hint {
  text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 20px; line-height: 1.6;
}
.login-error {
  background: var(--danger-bg); color: var(--danger);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- Catalog ---------- */
.catalog { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.filters {
  position: sticky; top: 84px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px;
  max-height: calc(100vh - 108px); overflow-y: auto;
}
.filters h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin: 18px 0 8px;
}
.filters h3:first-child { margin-top: 0; }
.filter-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  color: var(--text-2); font-size: 13px; user-select: none;
}
.filter-item:hover { background: var(--surface-2); color: var(--text); }
.filter-item input { accent-color: var(--green); }
.filter-item .cnt { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.filter-item.on { color: var(--green); }
.tag-filter-search { margin-bottom: 8px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: 0.12s;
}
.tag-chip:hover { border-color: var(--green-dim); color: var(--text); }
.tag-chip.on { background: var(--green-bg); border-color: var(--green-dim); color: var(--green); }
.filters .clear-link { display: inline-block; margin-top: 14px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.filters .clear-link:hover { color: var(--danger); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.quick-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: 0.12s;
}
.chip:hover { color: var(--text); border-color: #333a42; }
.chip.on {
  background: var(--green-bg); border-color: var(--green-dim); color: var(--green);
  box-shadow: 0 0 12px rgba(79, 189, 151, 0.15) inset;
}
.toolbar select { width: auto; padding: 7px 30px 7px 12px; font-size: 13px; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer; position: relative;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 189, 151, 0.35);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(79, 189, 151, 0.12), 0 6px 24px rgba(79, 189, 151, 0.08);
}
.card.selected { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.card-img {
  aspect-ratio: 4 / 3; width: 100%;
  background:
    radial-gradient(300px 200px at 50% 40%, rgba(79, 189, 151, 0.06), transparent),
    var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.25s; }
.card:hover .card-img img { transform: scale(1.04); }
.card-img .noimg { color: var(--muted); font-size: 28px; opacity: 0.5; }
.card-body { padding: 12px 14px 14px; }
.card-title {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.card-meta .proj { color: var(--green); font-weight: 500; }
.card-tags { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.card-tags .t {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
}
.card-check {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  width: 22px; height: 22px; accent-color: var(--green);
  opacity: 0; transition: 0.15s; cursor: pointer;
}
.card:hover .card-check, .card-check:checked, .select-mode .card-check { opacity: 1; }
.card-dl {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(10, 11, 13, 0.72); backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  color: var(--text); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: 0.15s; cursor: pointer;
}
.card:hover .card-dl { opacity: 1; }
.card-dl:hover { background: var(--green); color: #07120e; border-color: var(--green); }
.badge-archived {
  position: absolute; bottom: 84px; left: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  background: var(--danger-bg); color: var(--danger);
  padding: 3px 8px; border-radius: 5px;
}
.load-more-wrap { display: flex; justify-content: center; padding: 28px 0 10px; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state .big { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }

/* ---------- Bulk bar ---------- */
.bulkbar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 16px; box-shadow: var(--shadow);
}
.bulkbar .n { font-weight: 700; color: var(--green); font-size: 14px; margin-right: 4px; }

/* ---------- Asset detail ---------- */
.asset-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); gap: 28px; align-items: start; }
.asset-gallery { position: sticky; top: 84px; }
.asset-hero {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 320px; max-height: 68vh; cursor: zoom-in;
}
.asset-hero img { max-width: 100%; max-height: 68vh; object-fit: contain; }
.asset-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.asset-thumbs .th {
  width: 76px; height: 60px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: var(--surface-2);
  position: relative;
}
.asset-thumbs .th img { width: 100%; height: 100%; object-fit: cover; }
.asset-thumbs .th.on { border-color: var(--green); }
.asset-thumbs .th .rm {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  background: rgba(0,0,0,0.7); color: var(--danger); border-radius: 5px;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.asset-panel h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.asset-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.asset-sub .proj { color: var(--green); font-weight: 600; }
.asset-actions { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.kv {
  display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px;
  font-size: 13px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  margin-bottom: 18px;
}
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); word-break: break-all; }
.asset-desc { color: var(--text-2); font-size: 13.5px; margin-bottom: 18px; white-space: pre-wrap; }
.asset-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.note-box {
  background: var(--lime-bg); border: 1px solid rgba(233, 252, 165, 0.2);
  border-radius: var(--radius-s); padding: 12px 14px; font-size: 13px; color: var(--lime);
  margin-bottom: 18px;
}

/* ---------- Dropzone / upload ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; color: var(--muted);
  transition: 0.15s; cursor: pointer; background: var(--surface);
}
.dropzone:hover, .dropzone.drag { border-color: var(--green-dim); background: var(--green-bg); color: var(--text-2); }
.dropzone .big { font-size: 34px; margin-bottom: 10px; }
.upload-layout { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 24px; align-items: start; }
.filelist { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-s); padding: 10px 14px; font-size: 13px;
}
.file-row .icon { font-size: 18px; }
.file-row .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { color: var(--muted); font-size: 12px; }
.file-row .pair-ok { color: var(--green); font-size: 12px; }
.file-row .pair-no { color: var(--warn); font-size: 12px; }
.file-row .rm { color: var(--muted); cursor: pointer; padding: 4px; }
.file-row .rm:hover { color: var(--danger); }
.side-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 20px;
}
.side-card h3 { font-size: 15px; margin-bottom: 16px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; background: var(--green); width: 0%; transition: width 0.2s; }

/* ---------- Import ---------- */
.import-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 14px 20px; min-width: 130px;
}
.stat-card .v { font-size: 22px; font-weight: 700; color: var(--green); }
.stat-card .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.table-wrap {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: auto; max-height: 60vh;
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 10px 14px; position: sticky; top: 0;
  background: var(--surface-2); color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.8px; z-index: 1;
}
table.data td { padding: 9px 14px; border-top: 1px solid var(--border-soft); }
table.data tr:hover td { background: var(--surface-2); }
table.data input[type="checkbox"] { accent-color: var(--green); width: 15px; height: 15px; }
.pill { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-warn { background: rgba(224, 180, 92, 0.14); color: var(--warn); }
.pill-mut { background: var(--surface-3); color: var(--muted); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Search row (catalog) ---------- */
.search-row { display: flex; align-items: center; gap: 16px; }
.search-row .searchbox { flex: 1; margin-bottom: 0; }
.search-row { margin-bottom: 14px; }
.names-only {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); cursor: pointer;
  user-select: none; white-space: nowrap;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface);
  transition: 0.15s;
}
.names-only:hover { color: var(--text); border-color: #333a42; }
.names-only input { accent-color: var(--green); width: 15px; height: 15px; }
.names-only:has(input:checked) {
  border-color: var(--green-dim); color: var(--green); background: var(--green-bg);
}

/* ---------- Taxonomy chips (admin) ---------- */
.tax-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; flex-wrap: wrap; }
.tax-head .inline-form { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.tax-head h3 { margin-bottom: 0; }
.tax-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tax-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2);
  cursor: grab; user-select: none; transition: border-color 0.12s, background 0.12s, color 0.12s, transform 0.12s;
}
.tax-chip .cnt { color: var(--muted); font-size: 11px; }
.tax-chip:hover { border-color: var(--green-dim); color: var(--text); }
.tax-chip.dragging { opacity: 0.35; cursor: grabbing; }
.tax-chip.drag-over {
  border-color: var(--green); background: var(--green-bg);
  color: var(--green); transform: scale(1.07);
}
.trash-zone {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border: 1.5px dashed var(--border);
  border-radius: 10px; color: var(--muted); font-size: 12px;
  transition: 0.15s;
}
.trash-zone.active {
  border-color: var(--danger); color: var(--danger);
  background: var(--danger-bg); transform: scale(1.04);
}
.tax-hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.tag-admin-tools { display: flex; align-items: center; gap: 10px; margin-left: 6px; flex-wrap: wrap; }
.tag-admin-tools input[type="text"] { width: 180px; padding: 7px 12px; }
.tag-admin-tools .cnt { color: #e2c05f; font-size: 12px; white-space: nowrap; }
.sel-bar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.sel-bar b { color: var(--green); }
.tax-chip.match {
  border-color: #e2c05f; background: rgba(226, 192, 95, 0.16); color: #f0d47c;
}
.tax-chip.selected {
  border-color: var(--green); background: var(--green-bg); color: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}
.tax-chip.selected.match { box-shadow: 0 0 0 1px #e2c05f; }
.marquee {
  position: fixed; z-index: 90; pointer-events: none;
  border: 1px solid var(--green-dim); background: rgba(79, 189, 151, 0.12);
  border-radius: 4px;
}

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border-soft); }
.tabs button {
  background: none; border: none; color: var(--text-2); font-size: 14px; font-weight: 500;
  font-family: var(--font); padding: 10px 18px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--green); border-bottom-color: var(--green); }
.admin-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form label.field { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ---------- Modal / toast ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
  width: 100%; max-width: 460px; padding: 26px;
  max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 720px; }
.modal h2 { font-size: 17px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.asset-overlay {
  align-items: center; padding: 3vh 20px;
  background: rgba(0, 0, 0, 0.82);
}
.asset-modal {
  max-width: 1160px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  padding: 30px; position: relative;
}
.asset-modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: 0.15s;
}
.asset-modal-close:hover { color: var(--text); background: var(--surface-3); }
.asset-modal .asset-gallery { position: sticky; top: 0; }
.asset-modal .asset-detail { grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr); }
@media (max-width: 1000px) {
  .asset-modal .asset-detail { grid-template-columns: 1fr; }
  .asset-modal .asset-gallery { position: static; }
}

.lightbox {
  position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, 0.9);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 94vw; max-height: 94vh; object-fit: contain; }
#toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 10px; padding: 12px 18px; font-size: 13.5px;
  box-shadow: var(--shadow); animation: slidein 0.2s ease;
  max-width: 380px;
}
.toast.error { border-left-color: var(--danger); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--green);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-pad { display: flex; align-items: center; justify-content: center; padding: 60px; gap: 12px; color: var(--muted); }

@media (max-width: 1000px) {
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .asset-detail, .upload-layout, .admin-grid { grid-template-columns: 1fr; }
  .asset-gallery { position: static; }
  .searchbox kbd { display: none; }
}
