/* BRUSH Studio — dashboard privata (vedi js/studio.js). Tema scuro, superfici in vetro. */
.st-fab {
  position: fixed; z-index: 60; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  min-height: 44px; padding: 0 18px 0 38px; border-radius: 999px; font: 600 14px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter Tight", system-ui, sans-serif; color: #fff;
  background: rgba(28, 28, 30, .78); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12); cursor: pointer;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.st-fab:hover { transform: scale(1.04); }
.st-fab::before { content: ""; position: absolute; left: 16px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #0a84ff; box-shadow: 0 0 10px rgba(10, 132, 255, .8); }
.st-fab.is-dirty::before { background: #ff9f0a; box-shadow: 0 0 10px rgba(255, 159, 10, .8); }

#studio {
  --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c; --line: rgba(255, 255, 255, .09);
  --fg: #f5f5f7; --mut: #98989f; --blue: #0a84ff; --red: #ff453a; --green: #30d158; --orange: #ff9f0a;
  --ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed; inset: 0; z-index: 200; overflow: auto; color-scheme: dark;
  background: radial-gradient(900px 500px at 85% -10%, rgba(10, 132, 255, .12), transparent 70%), var(--bg);
  color: var(--fg); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter Tight", system-ui, sans-serif; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
.st { display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100%; }
:where(.st) button, :where(.st) input, :where(.st) select, :where(.st) textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:where(.st) button { cursor: pointer; }
.st :focus-visible { outline: 3px solid rgba(10, 132, 255, .6); outline-offset: 2px; }

/* barra in alto, vetro */
.st-top {
  grid-column: 1 / -1; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; min-height: 60px; padding-block: 10px;
  padding-left: max(22px, env(safe-area-inset-left, 0px)); padding-right: max(22px, env(safe-area-inset-right, 0px));
  background: rgba(22, 22, 24, .72); -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); border-bottom: 1px solid var(--line);
}
.st-logo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.st-logo i { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(145deg, #3a3a3c, #1c1c1e); border: 1px solid rgba(255, 255, 255, .14); position: relative; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
.st-logo i::after { content: ""; position: absolute; left: 10px; top: 7px; border: 5px solid transparent; border-left: 8px solid #fff; border-right: 0; }
.st-status { margin-left: auto; font-size: 13px; color: var(--mut); text-align: right; }
.st-status.is-dirty { color: var(--orange); }

.st-btn { min-height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--surface-2); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .2s, transform .2s var(--ease), opacity .2s; }
.st-btn:hover { background: var(--surface-3); }
.st-btn:active { transform: scale(.96); }
.st-btn--dark, .st-btn--red { background: var(--blue); color: #fff; font-weight: 600; }
.st-btn--dark:hover, .st-btn--red:hover { background: #2b95ff; }
.st-btn:disabled { opacity: .35; cursor: default; transform: none; }
.st-link { padding: 6px 0; border: 0; background: none; color: var(--blue); font-weight: 500; text-align: left; }
.st-link:hover { text-decoration: underline; }
.st-x { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--mut); font-size: 12px; }
.st-x:hover { background: var(--surface-3); color: var(--fg); }

/* barra laterale */
.st-side { display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--line); background: rgba(22, 22, 24, .5); }
.st-side button { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 500; color: #d1d1d6; transition: background-color .2s; }
.st-side button:hover { background: rgba(255, 255, 255, .06); }
.st-side button[aria-current] { background: var(--blue); color: #fff; }
.st-side b { font-weight: 500; font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; }
.st-side button[aria-current] b { color: rgba(255, 255, 255, .8); }

.st-body { min-width: 0; padding: 32px clamp(16px, 3vw, 40px) 70px; }
.st-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.st-head ~ .st-head { margin-top: 44px; }
.st-head h2 { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.st-head p { margin-top: 6px; color: var(--mut); font-size: 14px; }

/* elenco video: lista raggruppata */
.st-row { display: grid; grid-template-columns: 128px minmax(160px, 2fr) minmax(0, 1.6fr) 150px 236px; gap: 14px; align-items: center; }
.st-cols { padding: 0 16px 10px; font-size: 12px; font-weight: 500; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.st-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.st-row { padding: 12px 16px; border-top: 1px solid var(--line); transition: background-color .2s; }
.st-row:first-child { border-top: 0; }
.st-row:hover { background: rgba(255, 255, 255, .035); }
.st-thumb { display: grid; place-items: center; width: 128px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: var(--surface-2) center / cover; font-size: 11px; line-height: 1.25; color: #6e6e73; text-align: center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.st-main { min-width: 0; display: grid; gap: 3px; }
.st-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-main span { color: var(--mut); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-cell { min-width: 0; font-size: 14px; color: #d1d1d6; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.st-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); font-style: normal; font-size: 12px; color: var(--fg); white-space: nowrap; }
.st-state { display: inline-flex; align-items: center; gap: 6px; font-style: normal; font-size: 13px; color: var(--orange); }
.st-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-state.is-ok { color: var(--green); }
.st-acts { display: flex; gap: 4px; justify-content: flex-end; }
.st-acts button { min-width: 34px; min-height: 34px; padding: 0 11px; border-radius: 999px; border: 0; background: none; font-size: 13px; font-weight: 500; color: var(--blue); transition: background-color .2s; }
.st-acts button[data-act="up"], .st-acts button[data-act="down"] { color: var(--mut); }
.st-acts button:hover:not(:disabled) { background: var(--surface-2); }
.st-acts button:disabled { opacity: .25; cursor: default; }
.st-acts .st-danger { color: var(--red); }
.st-row > .st-av { justify-self: center; width: 60px; height: 60px; }
.st-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.st-btn--file { display: inline-flex; align-items: center; cursor: pointer; position: relative; overflow: hidden; }
.st-btn--file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.st-btn--file:focus-within { outline: 3px solid rgba(10, 132, 255, .6); outline-offset: 2px; }
.st-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--mut); }
.st .st-bulk select { width: auto; min-height: 36px; padding: 6px 12px; background: var(--surface); }
.st-body > .st-err { padding: 0; margin-bottom: 8px; color: var(--green); }
.st-body > .st-err:empty { display: none; }
.st-group { padding: 14px 14px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6e6e73; }
.st-group:first-child { padding-top: 2px; }
.st-empty { padding: 48px 16px; text-align: center; color: var(--mut); }

/* moduli */
.st-card { max-width: 860px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.st-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.st-f { display: grid; gap: 7px; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.st-f--wide { grid-column: 1 / -1; }
.st-f > span, .st-f > label, .st-f > legend { padding: 0; font-size: 13px; font-weight: 500; color: var(--mut); }
.st-f > legend { margin-bottom: 7px; }
.st-f small { font-size: 12px; color: #7c7c82; }
.st input[type="text"], .st input[type="email"], .st input:not([type]), .st select, .st textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid transparent; border-radius: 12px; background: var(--surface-2); transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.st-drawer input[type="text"], .st-drawer input:not([type]), .st-drawer select, .st-drawer textarea, .st-card input, .st-card textarea { background: var(--surface-2); }
.st ::placeholder { color: #6e6e73; }
.st textarea { resize: vertical; line-height: 1.5; }
.st input:focus, .st select:focus, .st textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(10, 132, 255, .25); }
.st-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.st-checks label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }
.st-checks input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); }
.st-checks input[type="text"] { flex: 1 1 180px; width: auto; }
.st-cover { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.st-cover > div { display: grid; gap: 5px; min-width: 0; flex: 1 1 200px; }
.st-cover input[type="file"] { max-width: 100%; font-size: 13px; color: var(--mut); }
.st-cover input[type="file"]::file-selector-button { margin-right: 10px; min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--surface-3); color: var(--fg); font: inherit; font-weight: 500; cursor: pointer; }
.st-av { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2) center / cover; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.st-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); }
.st .st-inline input { width: 72px; min-height: 36px; padding: 6px 10px; text-align: center; }
.st-ok { font-weight: 500; font-size: 13px; color: var(--green); }
.st-ok:empty { display: none; }
.st-facts { display: grid; gap: 8px; }
.st-facts > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.st textarea.st-export { max-width: 860px; font: 12px/1.55 "JetBrains Mono", ui-monospace, "SF Mono", monospace; letter-spacing: 0; background: var(--surface); border-color: var(--line); border-radius: 18px; color: #c7c7cc; }
.st-err { min-height: 20px; padding: 0 24px; font-size: 13px; color: var(--red); }

/* pannello di modifica: foglio in vetro */
.st--login { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 100%; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.st-login { display: grid; gap: 16px; width: min(460px, 100%); padding: 28px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 40px 100px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08); }
.st-login h2 { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.st-login p { color: var(--mut); font-size: 14px; }
.st-login small { color: #7c7c82; font-size: 12px; line-height: 1.5; }
.st-login .st-err { padding: 0; min-height: 0; }
.st-login .st-err:empty { display: none; }
.st input[type="password"] { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid transparent; border-radius: 12px; background: var(--surface-2); }
.st-shade { position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: st-fade .3s; }
.st-drawer {
  position: fixed; z-index: 9; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100% - 24px)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 24px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(28, 28, 30, .97);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .1); animation: st-in .45s var(--ease);
}
@keyframes st-in { from { transform: translateX(40px) scale(.98); opacity: 0; } }
@keyframes st-fade { from { opacity: 0; } }
.st-drawer > header, .st-drawer > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 24px; }
.st-drawer > header { border-bottom: 1px solid var(--line); }
.st-drawer > header h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.st-drawer > footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.st-drawer > footer .st-btn { min-height: 40px; padding: 0 20px; }
.st-drawer .st-fields { flex: 1; overflow: auto; align-content: start; padding: 22px 24px; }

@media (max-width: 1100px) {
  .st-row { grid-template-columns: 128px minmax(0, 1fr); }
  .st-row .st-cell { display: none; }
  .st-row .st-cell:has(.st-state) { display: block; grid-column: 1; }
  .st-acts { grid-column: 2; }
}
@media (max-width: 760px) {
  .st { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .st-top { flex-wrap: wrap; }
  .st-status { order: 5; flex: 1 1 100%; margin: 0; text-align: left; }
  .st-logo { margin-right: auto; }
  .st-side { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .st-side button { flex: none; white-space: nowrap; border-radius: 999px; }
  .st-group { display: none; }
  .st-head h2 { font-size: 26px; }
  .st-row { grid-template-columns: 96px minmax(0, 1fr); }
  .st-fields { grid-template-columns: minmax(0, 1fr); }
  .st-facts > div { grid-template-columns: minmax(0, 1fr) auto; }
  .st-facts > div input:first-child { grid-column: 1 / -1; }
  .st-drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: calc(100% - 40px); }
  @keyframes st-in { from { transform: translateY(60px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .st-drawer, .st-shade { animation: none; } .st-btn, .st-fab { transition: none; } }
