/* ===== VistaFrame UPVC — owner dashboard (uses tokens from style.css) ===== */
body.owner { background: var(--cream-2); min-height: 100vh; padding-bottom: 0; }
:root[data-time="night"] body.owner { background: #08120d; }
.o-wrap { width: min(1280px, 100% - 32px); margin-inline: auto; }
[hidden] { display: none !important; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); }
.hide-xs { }

/* ---- lock screen ---- */
.o-lock { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 80% at 50% 0%, #1a4d3a, var(--g950)); }
.o-lock-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid rgba(255,255,255,.14); color: var(--ink); border-radius: 24px; padding: 34px 28px 26px; text-align: center; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); display: grid; gap: 12px; }
.o-lock-card.shake { animation: shake .4s; }
.o-lock-ic { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 18px; display: grid; place-items: center; background: var(--g900); color: var(--gold); }
.o-lock-ic svg { width: 36px; height: 36px; }
.o-lock-card h1 { font-size: 26px; }
.o-lock-card p { color: var(--muted); font-size: 14.5px; }
.o-lock-card > * { min-width: 0; }
.o-lock-card input { width: 100%; min-width: 0; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); text-align: center; font-size: 20px; letter-spacing: .18em; outline: none; }
.o-lock-card input::placeholder { letter-spacing: .04em; font-size: 16px; color: var(--muted); }
.o-lock-card input:focus { border-color: var(--g500); box-shadow: 0 0 0 4px rgba(47,125,92,.15); }
.o-err { color: #c04545 !important; font-weight: 600; }
.o-err:empty { display: none; }
.o-back { font-size: 14px; color: var(--muted); margin-top: 4px; }
.o-back:hover { color: var(--ink); }

/* ---- top bar ---- */
.o-top { position: sticky; top: 0; z-index: 30; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); color: var(--ink); }
.o-top-in { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.o-top .brand-mark { width: 40px; height: 40px; }
.o-top .brand-mark svg { width: 24px; height: 24px; }
.o-top .brand-text b { font-size: 18px; }
.o-top-act { display: flex; align-items: center; gap: 8px; }
.o-top .time-toggle { background: var(--card); border-color: var(--line); box-shadow: none; backdrop-filter: none; }

.o-main { padding: 30px 0 120px; display: grid; gap: 22px; }
.o-hello h1 { font-size: clamp(28px, 4vw, 40px); }
.o-hello p { color: var(--muted); margin-top: 6px; max-width: 62ch; }
.o-note { background: #fff4d6; color: #6b4e00; border: 1px solid #f0d58a; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; }

/* ---- stats ---- */
.o-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.o-stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.o-stat b { display: block; font-family: var(--head); font-size: 28px; font-weight: 700; line-height: 1.1; }
.o-stat b small { font-size: 14px; color: var(--muted); font-weight: 600; }
.o-stat span { font-size: 13px; color: var(--muted); }

/* ---- upload ---- */
.o-upload { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: center; padding: 22px; border-radius: 20px; border: 2px dashed var(--line-strong); background: var(--card); cursor: pointer; transition: border-color .25s, background .25s, transform .3s var(--ease); outline: none; }
.o-upload:hover, .o-upload:focus-visible { border-color: var(--g500); }
.o-upload.over { border-color: var(--g500); background: rgba(47,125,92,.08); transform: scale(1.01); }
.o-drop-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--solid); color: #fff; }
.o-drop-ic svg { width: 26px; height: 26px; }
.o-upload.over .o-drop-ic { animation: bob .8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.o-drop-txt b { display: block; font-size: 17px; }
.o-drop-txt span { font-size: 13.5px; color: var(--muted); }
.o-link { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.o-drop-opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); cursor: default; }
.o-drop-opts label:not(.o-check) { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.o-drop-opts select, .o-drop-opts input:not([type=checkbox]), .o-toolbar select, .o-add input, .o-pin input {
  padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font-size: 14.5px; outline: none; min-width: 0; }
.o-drop-opts select:focus, .o-drop-opts input:focus, .o-toolbar select:focus, .o-add input:focus, .o-pin input:focus { border-color: var(--g500); }
.o-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; }
.o-check input { width: 18px; height: 18px; accent-color: var(--g700); }

/* upload queue */
.o-queue { display: grid; gap: 8px; }
.o-queue:empty { display: none; }
.o-q { position: relative; display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 8px 14px 8px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 13.5px; overflow: hidden; transition: opacity .4s, transform .4s; }
.o-q.out { opacity: 0; transform: translateX(20px); }
.o-q-th { width: 40px; height: 40px; border-radius: 8px; background: var(--cream-2) center / cover; }
.o-q-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.o-q-st { color: var(--muted); white-space: nowrap; }
.o-q.ok .o-q-st { color: var(--accent-ink); font-weight: 600; }
.o-q.fail .o-q-st { color: #c04545; font-weight: 600; }
.o-q-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--g500), var(--gold)); }
.o-q.busy .o-q-bar { animation: load 1.2s ease-in-out infinite; }
.o-q.ok .o-q-bar { width: 100%; transition: width .4s; }
@keyframes load { 0% { width: 0; margin-left: 0; } 50% { width: 60%; margin-left: 20%; } 100% { width: 0; margin-left: 100%; } }

/* ---- toolbar ---- */
.o-toolbar { position: sticky; top: 66px; z-index: 20; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; margin: 0 -12px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.o-search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper); }
.o-search:focus-within { border-color: var(--g500); }
.o-search svg { width: 17px; height: 17px; color: var(--muted); }
.o-search input { flex: 1; border: 0; background: none; outline: none; padding: 10px 0; font-size: 14.5px; min-width: 0; color: var(--ink); }
.o-seg { display: flex; padding: 3px; border-radius: 10px; background: var(--paper); border: 1.5px solid var(--line); }
.o-seg button { border: 0; background: none; padding: 7px 12px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.o-seg button.on { background: var(--solid); color: #fff; }
.o-selall { margin-left: auto; }
.o-hint { font-size: 13px; color: var(--muted); margin-top: -10px; }

/* ---- grid ---- */
.o-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.o-tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: box-shadow .3s, transform .3s var(--ease), opacity .3s, outline-color .2s; outline: 2px solid transparent; outline-offset: -2px; }
.o-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.o-tile.is-sel { outline-color: var(--g500); }
.o-tile.dragging { opacity: .35; transform: scale(.96); }
.o-tile.is-hidden .o-thumb img { filter: grayscale(1) brightness(.85); opacity: .55; }
.o-thumb { position: relative; aspect-ratio: 4/3; background: var(--cream-2); overflow: hidden; }
.o-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.o-tile:hover .o-thumb img { transform: scale(1.05); }
.o-pick { position: absolute; top: 8px; left: 8px; cursor: pointer; }
.o-pick input { position: absolute; opacity: 0; }
.o-pick i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.9); border: 1.5px solid rgba(0,0,0,.15); color: transparent; transition: all .2s; }
.o-pick i svg { width: 15px; height: 15px; }
.o-pick input:checked + i { background: var(--g500); border-color: var(--g500); color: #fff; }
.o-tile:not(:hover):not(.is-sel) .o-pick { opacity: .0; }
.o-grid.has-sel .o-pick, .o-tile:focus-within .o-pick { opacity: 1 !important; }
.o-badge { position: absolute; right: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: rgba(16,32,26,.8); color: #fff; }
.o-badge.home { background: var(--gold); color: var(--g950); }
.o-badge.home + .o-grip, .o-badge + .o-badge { top: 36px; }
.o-badge svg { width: 12px; height: 12px; }
.o-grip { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.9); color: #333; cursor: grab; opacity: 0; transition: opacity .2s; }
.o-grip svg { width: 16px; height: 16px; }
.o-tile:hover .o-grip { opacity: 1; }
.o-tile-body { padding: 10px 12px 4px; display: grid; gap: 2px; }
.o-tile-body b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-tile-body span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-tile-act { display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px 6px 8px; }
.o-tile-act button { height: 34px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.o-tile-act button:hover { background: var(--cream-2); color: var(--ink); }
.o-tile-act button.on { color: #d99a0b; }
.o-tile-act button.danger:hover { background: rgba(214,90,90,.12); color: #c04545; }
.o-tile-act svg { width: 18px; height: 18px; }
.o-empty { text-align: center; color: var(--muted); padding: 40px 0; }
.o-more { text-align: center; }

/* ---- panels ---- */
.o-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.o-panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: grid; gap: 14px; align-content: start; }
.o-panel h2 { font-size: 20px; }
.o-panel h3 { font-size: 15px; margin-bottom: 8px; }
.o-sub { font-size: 13.5px; color: var(--muted); margin-top: -8px; }
.o-cats { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.o-cats li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; }
.o-cats input { padding: 9px 12px; border-radius: 10px; border: 1.5px solid transparent; background: var(--cream-2); font-weight: 600; font-size: 14.5px; color: var(--ink); outline: none; min-width: 0; }
.o-cats input:focus { border-color: var(--g500); background: var(--paper); }
.o-count { min-width: 30px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.o-cats button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.o-cats button:disabled { opacity: .35; cursor: default; }
.o-cats button.danger:hover { color: #c04545; border-color: rgba(214,90,90,.4); }
.o-cats svg { width: 16px; height: 16px; }
.o-add { display: flex; gap: 8px; }
.o-add input { flex: 1; }
.o-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.o-actions label { cursor: pointer; }
.o-pin { padding-top: 14px; border-top: 1px solid var(--line); }
.o-pin-row { display: flex; flex-wrap: wrap; gap: 8px; }
.o-pin-row input { flex: 1 1 140px; }
.o-danger { justify-self: start; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #c04545; font-weight: 600; font-size: 14px; padding: 6px 0; cursor: pointer; }
.o-danger svg { width: 16px; height: 16px; }
.o-danger:hover { text-decoration: underline; }

/* ---- bulk bar ---- */
.o-bulk { position: fixed; left: 50%; bottom: 20px; translate: -50% 0; z-index: 40; display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 18px; border-radius: 999px; background: var(--g900); color: #fff; box-shadow: 0 20px 50px -15px rgba(0,0,0,.5); animation: up .4s var(--ease); max-width: calc(100% - 24px); }
@keyframes up { from { opacity: 0; translate: -50% 20px; } }
.o-bulk > span { font-weight: 700; font-size: 14px; margin-right: 8px; white-space: nowrap; }
.o-bulk button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255,255,255,.1); color: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background .2s; }
.o-bulk button:hover { background: rgba(255,255,255,.2); }
.o-bulk button.danger:hover { background: #c04545; }
.o-bulk button.ghost { background: none; }
.o-bulk svg { width: 16px; height: 16px; }
.o-bulk select { height: 38px; border-radius: 999px; border: 0; padding: 0 12px; background: rgba(255,255,255,.1); color: #fff; font-weight: 600; font-size: 13.5px; }
.o-bulk select option { color: #111; }

/* ---- edit sheet ---- */
.o-modal { position: fixed; inset: 0; z-index: 60; background: rgba(5,14,10,.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.o-modal.open { opacity: 1; visibility: visible; }
.o-sheet { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); color: var(--ink); border-radius: 22px; display: grid; grid-template-columns: 1fr 1fr; transform: translateY(20px) scale(.98); transition: transform .4s var(--ease); }
.o-modal.open .o-sheet { transform: none; }
.o-sheet-img { position: relative; background: #111; min-height: 260px; }
.o-sheet-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.o-replace { position: absolute; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.92); color: #10201a; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.o-replace svg { width: 15px; height: 15px; }
.o-sheet-body { padding: 22px; display: grid; gap: 14px; align-content: start; }
.o-sheet-head { display: flex; justify-content: space-between; align-items: center; }
.o-sheet-head h2 { font-size: 22px; }
.o-x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.o-x svg { width: 16px; height: 16px; }
.o-toggles { display: grid; gap: 10px; }
.o-switch { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.o-switch input { position: absolute; opacity: 0; }
.o-switch i { position: relative; width: 42px; height: 24px; border-radius: 99px; background: var(--line-strong); transition: background .25s; flex-shrink: 0; }
.o-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .3s var(--ease); }
.o-switch input:checked + i { background: var(--g500); }
.o-switch input:checked + i::after { transform: translateX(18px); }
.o-switch input:focus-visible + i { outline: 2px solid var(--g500); outline-offset: 2px; }
.o-move { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.o-move button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.o-move svg { width: 14px; height: 14px; }
.o-sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---- toast ---- */
.o-toast { position: fixed; left: 50%; bottom: 84px; translate: -50% 30px; z-index: 70; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 14px; background: #10201a; color: #fff; font-size: 14.5px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .3s, translate .4s var(--ease); max-width: calc(100% - 32px); }
.o-toast.show { opacity: 1; translate: -50% 0; pointer-events: auto; }
.o-toast button { border: 0; background: var(--gold); color: var(--g950); font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer; }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .o-stats { grid-template-columns: repeat(3, 1fr); }
  .o-panels { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hide-xs { display: none; }
  .o-main { padding-top: 20px; gap: 18px; }
  .o-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .o-stat { padding: 12px 14px; }
  .o-stat b { font-size: 22px; }
  .o-stat:last-child { grid-column: 1 / -1; }
  .o-upload { grid-template-columns: 1fr; text-align: center; padding: 18px; }
  .o-drop-ic { margin: 0 auto; }
  .o-drop-opts { display: grid; grid-template-columns: 1fr 1fr; text-align: left; }
  .o-drop-opts .o-check { grid-column: 1 / -1; }
  .o-toolbar { top: 66px; margin: 0 -8px; padding: 8px; gap: 8px; }
  .o-search { flex-basis: 100%; }
  .o-toolbar select { flex: 1 1 150px; min-width: 140px; }
  .o-selall { order: 2; padding: 0 4px; }
  .o-seg { order: 3; flex: 1 1 100%; }
  .o-seg button { flex: 1; }
  .o-top .brand-text b { font-size: 16px; white-space: nowrap; }
  .o-top .brand-mark { width: 36px; height: 36px; }
  .o-top-act { gap: 6px; }
  .o-seg button { padding: 7px 9px; }
  .o-selall { margin-left: 0; }
  .o-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .o-pick { opacity: 1 !important; }
  .o-grip { display: none; }
  .o-tile-body b { font-size: 13.5px; }
  .o-tile-act button { height: 32px; }
  .o-sheet { grid-template-columns: 1fr; }
  .o-sheet-img { min-height: 200px; aspect-ratio: 4/3; }
  .o-bulk { left: 8px; right: 8px; translate: none; bottom: 10px; border-radius: 18px; flex-wrap: wrap; justify-content: center; padding: 10px; animation: none; }
  .o-bulk > span { width: 100%; text-align: center; margin: 0 0 4px; }
  .o-bulk button span { display: none; }
  .o-bulk select { max-width: 120px; }
}
:root[data-time="night"] .o-lock-card { background: #15291f; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 40px 80px -30px rgba(0,0,0,.8); }
.o-hint-m { display: none; }
@media (hover: none), (max-width: 640px) { .o-hint-d { display: none; } .o-hint-m { display: inline; } }
