/* Velmio dashboard: shell, overview, library, projects, history, brand kit and settings. */
.page-app { background: var(--bg); }
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: fixed; z-index: 45; top: 0; bottom: 0; inset-inline-start: 0; display: flex; flex-direction: column; width: 256px; padding: 14px 12px; background: var(--sidebar); border-inline-end: 1px solid var(--glass-line); transform: translateX(-105%); transition: transform .2s ease, width .2s ease; overflow-y: auto; }
[dir="rtl"] .side { transform: translateX(105%); }
.shell.is-open .side, [dir="rtl"] .shell.is-open .side { transform: none; }
.side-brand { display: flex; align-items: center; min-height: 44px; padding: 0 8px; margin-bottom: 10px; text-decoration: none; }
.side nav { display: grid; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 500 .9rem/1.2 var(--body); text-align: start; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.side-link:hover { background: rgba(var(--accent-rgb), .08); color: var(--ivory); }
.side-link[aria-current="page"] { background: var(--bg-2); color: var(--ivory); font-weight: 600; box-shadow: var(--sm-shadow); }
.side-link[aria-current="page"] .ic { color: var(--lavender); }
.side-bottom { display: grid; gap: 2px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--glass-line); }
.shell-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(10, 8, 30, .45); }
.shell-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 var(--gutter); border-bottom: 1px solid var(--glass-line); background: var(--bg-2); }
.topbar-end { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.topbar .theme-toggle { background: transparent; }
.topbar .theme-toggle:hover { background: var(--glass); }
.icon-btn-plain { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: var(--ivory); cursor: pointer; }
.icon-btn-plain:hover { background: var(--glass); }
.page { width: min(1180px, 100%); margin-inline: auto; padding: 24px var(--gutter) 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); font-weight: 650; line-height: 1.18; letter-spacing: -.028em; }
.page-head p { margin-top: 4px; color: var(--muted); }
.note-line { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: .85rem; line-height: 1.4; }

.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 28px; }
.stat { padding: 16px 18px; border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--card); box-shadow: var(--sm-shadow); }
.stat span { display: block; color: var(--muted); font-size: .84rem; font-weight: 500; }
.stat strong { display: block; margin-top: 4px; font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat small { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-head h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.012em; line-height: 1.3; }
.sec-head a { color: var(--lavender); font-size: .875rem; font-weight: 500; }

/* Video and project cards */
.video-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.vcard { position: relative; border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--card); box-shadow: var(--sm-shadow); transition: box-shadow .18s ease, transform .18s ease; }
.vcard:hover { box-shadow: var(--md-shadow); transform: translateY(-1px); }
.vthumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0; border-radius: 13px 13px 0 0; background: var(--soft); overflow: hidden; cursor: pointer; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; }
.vthumb::after { content: ""; position: absolute; inset: 0; background: rgba(23, 21, 43, .28); opacity: 0; transition: opacity .18s ease; }
.vthumb:hover::after, .vthumb:focus-visible::after { opacity: 1; }
.vplay { position: absolute; z-index: 1; left: 50%; top: 50%; display: grid; place-items: center; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%; background: rgba(23, 21, 43, .68); color: #fff; }
.vbody { display: flex; align-items: flex-start; gap: 6px; padding: 10px 6px 10px 14px; }
[dir="rtl"] .vbody { padding: 10px 14px 10px 6px; }
.vtext { flex: 1; min-width: 0; }
.vtext strong { display: block; overflow: hidden; font-size: .92rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.vmeta { margin-top: 2px; color: var(--muted); font-size: .78rem; line-height: 1.4; overflow-wrap: anywhere; }
.status { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; color: var(--muted); font-size: .76rem; font-weight: 500; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--purple); }
.status.is-draft::before { background: var(--muted); }
.status.is-failed { color: var(--error); }
.status.is-failed::before { background: var(--error); }
.vmenu { position: relative; flex: none; }
.video-grid.is-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.is-list .vcard { display: flex; align-items: center; }
.is-list .vthumb { flex: none; width: 104px; aspect-ratio: 4 / 3; border-radius: 13px 0 0 13px; }
[dir="rtl"] .is-list .vthumb { border-radius: 0 13px 13px 0; }
.is-list .vbody { flex: 1; min-width: 0; align-items: center; }
.is-list .vplay { width: 32px; height: 32px; margin: -16px 0 0 -16px; }
.pcard .vthumb { aspect-ratio: 16 / 9; }
.pcard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 14px 14px; }
.pcard-actions .ui-btn { min-height: 44px; }
.pcard-tag { position: absolute; z-index: 2; top: 10px; inset-inline-start: 10px; padding: 3px 9px; border-radius: 7px; background: rgba(23, 21, 43, .72); color: #fff; font-size: .72rem; font-weight: 600; }

/* Tools */
.tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
.search { position: relative; }
.search .ic { position: absolute; top: 14px; inset-inline-start: 12px; color: var(--muted); }
.search input, .tool-select, .form-grid input, .form-grid select, .form-grid textarea { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--ivory); font: 400 16px var(--body); }
.search input { padding-inline-start: 38px; }
.form-grid textarea { height: auto; padding: 11px 12px; resize: vertical; }
.search input:focus, .tool-select:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--lavender); outline: 3px solid rgba(var(--accent-rgb), .18); outline-offset: 0; }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-row .tool-select { flex: 1 1 130px; width: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--glass); }
.seg button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--bg-2); color: var(--ivory); box-shadow: var(--sm-shadow); }

/* States */
.empty { display: grid; justify-items: center; gap: 6px; padding: 44px 20px; border: 1px dashed var(--glass-line); border-radius: var(--r); text-align: center; }
.empty svg.art { width: 150px; height: 104px; margin-bottom: 6px; }
.empty strong { font-size: 1.1rem; font-weight: 600; letter-spacing: -.012em; }
.empty p { max-width: 400px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.empty .ui-btn { margin-top: 10px; }
.skel { border-radius: var(--r); background: var(--glass); min-height: 200px; }
.motion .skel { animation: skel 1.3s ease-in-out infinite; }
@keyframes skel { 50% { opacity: .55; } }

/* History */
.feed { border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--card); }
.feed li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--glass-line); }
.feed li:last-child { border-bottom: 0; }
.feed-ic { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--soft); color: var(--lavender); }
.feed-text { flex: 1; min-width: 0; }
.feed-text strong { display: block; font-size: .92rem; font-weight: 600; }
.feed-text span { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.feed time { flex: none; color: var(--muted); font-size: .78rem; text-align: end; }

/* Forms and settings */
.panel-card { padding: 18px; border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--card); box-shadow: var(--sm-shadow); }
.panel-card + .panel-card { margin-top: 12px; }
.panel-card h2 { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; font-weight: 600; letter-spacing: -.012em; line-height: 1.3; }
.panel-card > p { margin-top: 4px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.form-grid { display: grid; gap: 12px; margin-top: 14px; }
.form-grid label { display: block; margin-bottom: 5px; font-size: .84rem; font-weight: 500; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.form-actions p { color: var(--muted); font-size: .85rem; }
.row-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--glass-line); font-size: .92rem; }
.row-line:last-child { border-bottom: 0; }
.row-line > span:first-child { min-width: 0; }
.row-line small { display: block; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.row-line a { color: var(--lavender); font-weight: 500; white-space: nowrap; }
.settings { display: grid; gap: 14px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 500 .875rem/1.2 var(--body); white-space: nowrap; text-align: start; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--bg-2); color: var(--ivory); font-weight: 600; box-shadow: var(--sm-shadow); }
.motion .tab-panel:not([hidden]) { animation: tab-in .16s ease-out; }
@keyframes tab-in { from { opacity: 0; transform: translateY(3px); } }
.avatar.is-large { width: 64px; height: 64px; font-size: 1.3rem; }
.brand-layout { display: grid; gap: 14px; }
.brand-preview { position: relative; display: grid; align-content: end; gap: 8px; min-height: 280px; padding: 22px; border-radius: var(--r); color: #fff; overflow: hidden; }
.brand-preview strong { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.brand-preview span { justify-self: start; padding: 7px 16px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: #17152B; font-size: .85rem; font-weight: 600; overflow-wrap: anywhere; }
.brand-note { display: flex; gap: 8px; margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; background: var(--glass); color: var(--muted); font-size: .875rem; line-height: 1.45; }
.color-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid input[type="color"] { padding: 4px; cursor: pointer; }
.player-dialog { width: min(760px, calc(100vw - 24px)); padding: 16px; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--bg-2); color: var(--ivory); box-shadow: var(--shadow); }
.player-dialog::backdrop { background: rgba(10, 8, 30, .6); }
.player-dialog video { display: block; width: auto; max-width: 100%; max-height: 62vh; margin-inline: auto; border-radius: 12px; background: #000; }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.player-head strong { min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.player-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.player-foot p { color: var(--muted); font-size: .85rem; }

.page-app .chat-launch { background: var(--brand); color: var(--on-brand); box-shadow: var(--md-shadow); }
.page-app .chat-launch:hover { background: var(--brand-hover); }
.page-app .chat-user, .page-app .chat-send { background: var(--brand); color: var(--on-brand); }
.page-app .chat-bot { background: var(--glass); }

@media (min-width: 480px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat strong { font-size: 1.6rem; }
  .form-grid.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 640px) {
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tools { grid-template-columns: minmax(200px, 1fr) auto; align-items: center; }
  .tool-row .tool-select { flex: 0 1 170px; }
}
@media (min-width: 768px) {
  .shell { grid-template-columns: 68px minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 35; align-self: start; width: 68px; height: 100dvh; padding-inline: 10px; transform: none; }
  [dir="rtl"] .side { transform: none; }
  .side .label { display: none; }
  .side-brand .logo-word { display: none; }
  .side-link { justify-content: center; padding: 0; }
  .shell.is-open .side { position: fixed; width: 256px; box-shadow: var(--shadow); }
  .shell.is-open .side .label { display: inline; }
  .shell.is-open .side-brand .logo-word { display: inline; }
  .shell.is-open .side-link { justify-content: flex-start; padding: 0 10px; }
  .page { padding-top: 32px; }
  .settings { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
  .tabs { flex-direction: column; overflow: visible; }
  .tabs button { width: 100%; }
  .brand-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .brand-preview { position: sticky; top: 84px; }
}
@media (min-width: 1100px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr); }
  .shell .side, .shell.is-open .side { position: sticky; width: 240px; box-shadow: none; }
  .side .label { display: inline; }
  .side-brand .logo-word { display: inline; }
  .side-link { justify-content: flex-start; padding: 0 10px; }
  .topbar-burger { display: none; }
  .shell-scrim { display: none !important; }
  .video-grid:not(.is-list) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .side, .vcard, .vthumb::after, .side-link { transition: none; }
  .vcard:hover { transform: none; }
}
