/* Edit details drawer (board 5). A right-side glass dialog over the dimmed asset
   detail. Controls use design tokens; photos/video keep square corners, controls
   use --radius. Responsive: the panel is full width on a phone and its inner
   grids collapse to one column. */

.ed-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; justify-content: flex-end;
}
.ed-backdrop {
  position: absolute; inset: 0;
  background: rgba(17, 17, 17, .32);
  animation: ed-fade var(--t-enter) var(--ease-out);
}

.ed-panel {
  position: relative;
  width: min(680px, 100%);
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge), -24px 0 60px -34px rgba(26, 26, 26, .5);
  animation: ed-slide var(--t-enter) var(--ease-out);
}
@keyframes ed-fade { from { opacity: 0; } }
@keyframes ed-slide { from { transform: translateX(24px); opacity: .4; } }

/* ---- Header ----------------------------------------------------------- */
.ed-head {
  display: flex; align-items: center; gap: 16px;
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.ed-thumb { width: 40px; height: 64px; object-fit: cover; flex-shrink: 0; background: var(--surface); }
.ed-thumb--doc { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--text-quiet); }
.ed-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ed-head__title { margin: 0; font-size: 19px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-close { width: 44px; height: 44px; border-radius: 50%; }
.ed-close:hover { background: var(--tone-1); }

/* ---- Body ------------------------------------------------------------- */
.ed-body { flex: 1; overflow: auto; padding: 28px 32px 36px; display: flex; flex-direction: column; gap: 36px; margin: 0; }
.ed-sec { display: flex; flex-direction: column; gap: 20px; }
.ed-sec--ruled { padding-top: 30px; border-top: 1px solid var(--rule); gap: 14px; }

.ed-field { display: flex; flex-direction: column; gap: 6px; }
.ed-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
.ed-lbl--row { display: flex; justify-content: space-between; align-items: baseline; }
.ed-counter { font-weight: 400; font-size: 12px; color: var(--text-quiet); }
.ed-help { font-size: 12px; color: var(--text-quiet); }
.ed-err { font-size: 12px; color: var(--red-text); font-weight: 500; }
.ed-req { color: var(--red-text); }
.ed-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.ed-input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 0; border-radius: var(--radius);
  background: var(--tone-1); color: var(--text); font-size: 14px;
  box-sizing: border-box; transition: background var(--t-hover) var(--ease-out);
}
select.ed-input { padding: 0 10px; }
.ed-input:hover { background: var(--tone-2); }
.ed-input:focus { background: var(--field-active); box-shadow: inset 0 0 0 2px var(--text); outline: 0; }
.ed-input.is-invalid { box-shadow: inset 0 0 0 2px var(--red); }
.ed-textarea { height: auto; min-height: 84px; padding: 12px; line-height: 1.5; resize: vertical; font-family: inherit; }

.ed-fixed {
  height: 44px; padding: 0 12px; border-radius: var(--radius);
  background: var(--tone-2); display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; color: var(--text);
}
.ed-fixed__tag { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-quiet); }
.ed-fixed__tag svg { stroke: currentColor; }

/* ---- Rights segmented control ----------------------------------------- */
.ed-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--tone-1); border-radius: var(--radius); }
.ed-seg__opt { position: relative; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--text); border-radius: var(--radius); cursor: pointer; transition: background var(--t-hover) var(--ease-out); }
.ed-seg__opt:hover { background: var(--tone-1); }
.ed-seg__opt.is-on { background: var(--inverse-bg); color: var(--inverse-text); }
.ed-seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---- Your tags -------------------------------------------------------- */
.ed-tags { min-height: 48px; padding: 7px 8px; background: var(--tone-1); border-radius: var(--radius); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; box-sizing: border-box; }
.ed-tags__chips { display: contents; }
.ed-chip { height: 32px; padding: 0 4px 0 12px; background: var(--field-active); border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 2px; box-shadow: inset 0 0 0 1px var(--rule); }
.ed-chip__x { width: 24px; height: 24px; border: 0; background: transparent; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.ed-chip__x:hover { background: var(--tone-2); }
.ed-tags__input { flex: 1 1 100px; min-width: 100px; height: 32px; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }

/* ---- AI block (read only) --------------------------------------------- */
.ed-ai { display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--tone-1); border-radius: var(--radius); }
.ed-ai__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ed-ai__h { margin: 0; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.ed-ai__h svg { fill: currentColor; }
.ed-ai__desc { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text); }
.ed-ai__tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-aitag { height: 32px; padding: 0 10px 0 12px; border-radius: var(--radius); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.ed-aitag.is-added { opacity: .5; cursor: default; }
.ed-aitag svg { stroke: currentColor; }
.ed-addall { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); text-decoration: underline; text-underline-offset: 3px; margin-left: 4px; }
.ed-addall:hover { color: var(--red-text); }
.ed-ai__tii { display: flex; flex-direction: column; gap: 4px; }
.ed-ai__tiival { font-size: 14px; color: var(--text); }

/* ---- Custom fields ---------------------------------------------------- */
.ed-fields { display: flex; flex-direction: column; gap: 6px; }
.ed-frow { display: grid; grid-template-columns: 170px 1fr 40px; gap: 6px; }
.ed-frow .ed-input { height: 40px; }
.ed-fkey { font-weight: 600; background: var(--tone-2); }
.ed-frow__x { height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.ed-empty { margin: 0; font-size: 13px; color: var(--text-quiet); }
.ed-fields__add { margin-top: 8px; }
.ed-addfield { height: 30px; padding: 0 10px; border-radius: var(--radius); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* ---- Shared tonal / red buttons inside the drawer --------------------- */
.ed-overlay .gbtn { border: 0; background: var(--tone-1); color: var(--text); cursor: pointer; transition: background var(--t-hover) var(--ease-out); }
.ed-overlay .gbtn:hover { background: var(--tone-2); }
.ed-overlay .gbtn svg { stroke: currentColor; }
.ed-overlay .gbtn.ed-aitag svg, .ed-overlay .ed-addfield svg { stroke: currentColor; }
.ed-overlay .red { border: 0; background: var(--red); color: var(--on-red); cursor: pointer; transition: background var(--t-hover) var(--ease-out); }
.ed-overlay .red:hover { background: var(--red-hover); }

/* ---- Footer ----------------------------------------------------------- */
.ed-foot { display: flex; align-items: center; gap: 12px; padding: 18px 32px; border-top: 1px solid var(--rule); flex-shrink: 0; }
.ed-count { flex: 1; min-width: 0; font-size: 13px; color: var(--text-quiet); display: flex; align-items: center; gap: 8px; }
.ed-count.is-dirty { color: var(--text-2); }
.ed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.ed-btn { height: 48px; padding: 0 22px; border-radius: var(--radius); font-size: 15px; font-weight: 600; }
.ed-save:disabled { opacity: .5; cursor: default; }
.ed-banner { margin: 0 32px; padding: 10px 14px; border-radius: var(--radius); background: var(--active-tint); color: var(--active-text); font-size: 13px; }

/* ---- Narrow (phone-width panel) --------------------------------------- */
@media (max-width: 560px) {
  .ed-head, .ed-body, .ed-foot { padding-left: 20px; padding-right: 20px; }
  .ed-banner { margin: 0 20px; }
  .ed-grid2 { grid-template-columns: 1fr; }
  .ed-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-frow { grid-template-columns: 1fr 40px; }
  .ed-frow [data-fval] { grid-column: 1 / -1; }
}

/* A labelled checkbox row (Brand film). */
.ed-check { display: flex; align-items: flex-start; gap: 12px; margin-top: 4px; cursor: pointer; }
.ed-check[hidden] { display: none; }
.ed-check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--red, #c8102e); cursor: pointer; }
.ed-check__text { display: flex; flex-direction: column; gap: 2px; }
