:root {
  --brand: #1B50A2; --brand-d: #143E7E; --brand-soft: #E8EFFA; --ink: #172033; --ink2: #3B475C; --muted: #5B6678;
  --line: #DCE2EC; --line2: #E6EAF1; --bg: #F5F7FB; --card: #FFFFFF; --warn: #C2410C; --warn-soft: #FDEEE6; --ok: #1B50A2; --amber: #B45309;
  --r: 10px; --sh: 0 1px 2px rgba(23,32,51,.04), 0 4px 16px rgba(23,32,51,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Noto Sans Georgian', 'FiraGO', 'Segoe UI', Sylfaen, system-ui, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); } a:hover { color: var(--brand-d); }
h1 { font-size: 20px; margin: 0; font-weight: 700; } h2 { font-size: 15px; margin: 0; font-weight: 700; } h3 { font-size: 14px; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .warn { color: var(--warn); } .amber { color: var(--amber); } .brand { color: var(--brand); }
.mono { font-variant-numeric: tabular-nums; }

/* გარსი */
.app { display: flex; min-height: 100vh; }
.side { width: 248px; flex: 0 0 248px; background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 4px; }
.side-logo { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 10px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; }
.side-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.side-logo .ph { font-size: 20px; font-weight: 700; color: var(--brand); }
.side-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-name span { font-size: 12px; color: var(--muted); }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-cap { font-size: 11px; color: #6B7385; text-transform: uppercase; letter-spacing: 1px; padding: 0 10px 5px; }
.side-cap.owner { color: var(--amber); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 0 10px; border-radius: 7px; text-decoration: none; color: var(--ink2); }
.nav:hover { background: #F2F5FA; color: var(--ink); }
.nav.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .badge { font-size: 11px; background: var(--warn); color: #fff; border-radius: 10px; padding: 1px 7px; }
.side-ctx { display: flex; flex-direction: column; gap: 4px; padding: 0 6px; }
.side-ctx select { height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: #fff; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line2); padding: 12px 10px 0; font-size: 11px; color: var(--muted); line-height: 1.6; }
.side-foot b { color: var(--brand); }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; position: sticky; top: 0; z-index: 20; }
.top .grow { flex: 1 1 0; }
.icon-btn.menu-btn { display: none; }
.user { display: flex; align-items: center; gap: 10px; }
.ava { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.user-name { display: flex; flex-direction: column; line-height: 1.2; } .user-name span { font-size: 12px; color: var(--muted); }
.page { padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-head .grow { flex: 1 1 0; }
.foot { margin-top: auto; padding: 14px 24px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.banner { padding: 12px 16px; border-radius: var(--r); background: var(--warn-soft); color: #7C2D12; border: 1px solid #F6C9B2; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.info { background: var(--brand-soft); color: #123A78; border-color: #C9D8F1; }

/* კომპონენტები */
.btn { height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid #CBD3E1; background: #fff; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: #F6F8FB; color: var(--ink); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.pri:hover { background: var(--brand-d); }
.btn.danger { color: var(--warn); border-color: #F0C3AE; } .btn.danger:hover { background: var(--warn-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: #EEF2F8; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { width: 32px; height: 32px; border-radius: 7px; border: 1px solid transparent; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink2); }
.icon-btn:hover { background: #EEF2F8; } .icon-btn svg { width: 16px; height: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.card-h .grow { flex: 1 1 0; }
.card-b { padding: 14px 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.kpi span { font-size: 12px; color: var(--muted); } .kpi b { font-size: 20px; } .kpi small { font-size: 12px; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.col-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-top: 1px solid #EEF1F6; vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #F8FAFD; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; } .tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.st i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st.on { color: var(--ok); } .st.off { color: var(--warn); } .st.wait { color: var(--muted); }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; background: #EEF1F6; font-size: 12px; color: var(--ink2); white-space: nowrap; }
.pill.brand { background: var(--brand-soft); color: var(--brand); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 34px; padding: 0 13px; border-radius: 17px; border: 1px solid #CBD3E1; background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty b { color: var(--ink); font-size: 15px; }
.bar { height: 8px; background: var(--line2); border-radius: 4px; overflow: hidden; } .bar > div { height: 100%; background: var(--brand); }
.list-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; }
.thumb { width: 72px; height: 40px; border-radius: 5px; background: #E8EDF5 center/cover no-repeat; flex: 0 0 auto; border: 1px solid var(--line2); }

/* ფორმები */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label, .fld > .lbl { font-size: 12px; color: var(--muted); }
.inp, .fld input:not([type=checkbox]):not([type=color]):not([type=radio]), .fld select, .fld textarea { height: 38px; border: 1px solid #CBD3E1; border-radius: 8px; padding: 0 11px; background: #fff; width: 100%; min-width: 0; }
.fld textarea { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.inp:focus, .fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid rgba(27,80,162,.25); border-color: var(--brand); }
.fld input[type=color] { width: 100%; height: 38px; border: 1px solid #CBD3E1; border-radius: 8px; padding: 3px; background: #fff; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.search { height: 38px; border: 1px solid #CBD3E1; border-radius: 8px; padding: 0 12px; background: #F6F8FB; min-width: 220px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { position: relative; } .days input { position: absolute; opacity: 0; }
.days span { display: inline-flex; width: 44px; height: 34px; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid #CBD3E1; cursor: pointer; font-size: 13px; font-weight: 600; }
.days input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.days input:focus-visible + span { outline: 2px solid var(--brand); }

/* გადამრთველი */
.sw { flex: 0 0 auto; width: 46px; height: 26px; border-radius: 13px; border: 0; padding: 3px; cursor: pointer; background: #C3CAD6; display: flex; }
.sw::after { content: ''; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.sw[aria-pressed=true] { background: var(--brand); } .sw[aria-pressed=true]::after { transform: translateX(20px); }
.sw:disabled { opacity: .5; cursor: not-allowed; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; align-items: start; }
.feat { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-top: 1px solid #F0F2F6; }
.feat > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.feat b { font-weight: 600; } .feat span { font-size: 12px; color: var(--muted); }

/* მოდალი */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.38); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: min(620px, 100%); box-shadow: 0 20px 60px rgba(15,23,42,.25); display: flex; flex-direction: column; max-height: none; }
.modal.wide { width: min(980px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.modal-h h2 { flex: 1; font-size: 16px; }
.modal-b { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line2); flex-wrap: wrap; }
.modal-f .grow { flex: 1; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #172033; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; animation: tIn .2s ease; }
.toast.err { background: var(--warn); }
@keyframes tIn { from { transform: translateY(8px); opacity: 0; } }
.cred { background: #F3F7FD; border: 1px solid #CFDAEE; border-radius: 10px; padding: 14px; font-size: 15px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.cred b { font-family: ui-monospace, Consolas, monospace; }

/* შესვლა */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--sh); }
.wordmark { font-size: 34px; font-weight: 700; color: var(--brand); letter-spacing: -.5px; line-height: 1; }
.wordmark small { font-size: 12px; color: #6B7385; letter-spacing: 2px; text-transform: uppercase; margin-left: 8px; font-weight: 600; }
.login-foot { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.6; }

/* მედია */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.m-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; text-align: left; padding: 0; }
.m-card:hover { border-color: #AFC2E3; }
.m-card.sel { outline: 3px solid var(--brand); outline-offset: -1px; }
.m-prev { aspect-ratio: 16/10; background: #E8EDF5 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #6B7385; font-weight: 700; position: relative; }
.m-prev .tag { position: absolute; left: 8px; top: 8px; font-size: 11px; background: rgba(23,32,51,.75); color: #fff; padding: 2px 7px; border-radius: 5px; }
.m-meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.m-meta span { font-size: 12px; color: var(--muted); }
.drop { border: 2px dashed #B8C6DD; border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted); background: #fff; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.up-list { display: flex; flex-direction: column; gap: 8px; }
.up-row { display: flex; gap: 10px; align-items: center; font-size: 13px; } .up-row .bar { flex: 1; }

/* ლეიაუთები */
.l-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.l-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.l-prev { position: relative; background: #EEF2F8; aspect-ratio: 16/9; overflow: hidden; display: block; }
.l-prev .rg { position: absolute; background: var(--brand); opacity: .82; border: 1px solid #fff; border-radius: 2px; }
.l-meta { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.l-meta > div { flex: 1; min-width: 0; display: flex; flex-direction: column; } .l-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: start; }
.tpl { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.tpl:hover, .tpl.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(27,80,162,.18); }
.tpl .l-prev { border-radius: 6px; }

/* დიზაინერი */
.des { display: grid; grid-template-columns: 210px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.des-pal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.pal { min-height: 62px; border: 1px solid var(--line); border-radius: 8px; background: #F6F8FB; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; padding: 6px 4px; text-align: center; }
.pal:hover { border-color: var(--brand); background: var(--brand-soft); }
.pal svg { width: 20px; height: 20px; color: var(--brand); }
.stage-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stage { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 0 0 1px #CBD3E1; overflow: hidden; user-select: none; touch-action: none; }
.stage-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(27,80,162,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(27,80,162,.06) 1px, transparent 1px); }
.rg-box { position: absolute; box-sizing: border-box; outline: 1px dashed rgba(27,80,162,.55); cursor: move; overflow: hidden; }
.rg-box.sel { outline: 2px solid var(--brand); outline-offset: -1px; }
.rg-live { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; overflow: hidden; }
.rg-tag { position: absolute; left: 4px; top: 4px; font-size: 11px; background: rgba(23,32,51,.78); color: #fff; padding: 1px 7px; border-radius: 4px; pointer-events: none; z-index: 2; white-space: nowrap; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; }
.rg-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--brand); font-size: 12px; background: rgba(232,239,250,.75); pointer-events: none; text-align: center; padding: 4px; }
.rg-h { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--brand); border-radius: 3px; z-index: 3; }
.rg-h.se { right: -2px; bottom: -2px; cursor: nwse-resize; } .rg-h.e { right: -2px; top: calc(50% - 6px); cursor: ew-resize; } .rg-h.s { bottom: -2px; left: calc(50% - 6px); cursor: ns-resize; }
.rg-box:not(.sel) .rg-h { display: none; }
.items { display: flex; flex-direction: column; gap: 6px; }
.it-row { display: flex; align-items: center; gap: 8px; border: 1px solid #CFDAEE; background: #F3F7FD; border-radius: 8px; padding: 6px 6px 6px 10px; cursor: pointer; }
.it-row.on { border-color: var(--brand); background: var(--brand-soft); }
.it-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.it-row b { font-size: 11px; color: var(--brand); text-transform: uppercase; letter-spacing: .5px; }
.it-row span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows-ed { display: flex; flex-direction: column; gap: 6px; }
.rows-ed .r { display: grid; gap: 6px; align-items: center; }
.rows-ed input { height: 34px !important; padding: 0 8px !important; }
.sec-ed { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #FAFBFD; }
.media-pick { display: flex; gap: 8px; align-items: center; }
.media-pick .thumb { width: 64px; height: 40px; }

/* განრიგი */
.week { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); min-width: 760px; }
.week-h { padding: 10px 6px; font-size: 12px; font-weight: 600; color: var(--ink2); border-left: 1px solid #EEF1F6; text-align: center; }
.week-h.today { color: var(--brand); }
.week-col { position: relative; border-left: 1px solid #EEF1F6; }
.week-col.today { background: #F7FAFF; }
.hline { position: absolute; left: 0; right: 0; border-top: 1px solid #F0F2F6; }
.hlbl { position: absolute; right: 6px; font-size: 11px; color: var(--muted); transform: translateY(-6px); }
.ev { position: absolute; border-radius: 6px; padding: 4px 6px; overflow: hidden; font-size: 12px; line-height: 1.25; cursor: pointer; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.ev b { display: block; font-weight: 600; } .ev span { opacity: .9; font-size: 11px; }
.nowline { position: absolute; left: 0; right: 0; border-top: 2px solid var(--warn); z-index: 5; }

/* რიგი */
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.q-now { font-size: 64px; font-weight: 800; color: var(--brand); line-height: 1; font-variant-numeric: tabular-nums; }
.q-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.q-actions .btn { justify-content: center; height: 48px; font-size: 15px; }

.preview-frame { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: 8px; background: #000; }

@media (max-width: 1180px) { .des { grid-template-columns: minmax(0, 1fr) 320px; } .des-left { grid-column: 1 / -1; } .des-pal { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); } }
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .app.menu-open .side { transform: none; }
  .icon-btn.menu-btn { display: inline-flex; }
  .page { padding: 16px; } .top { padding: 10px 16px; }
  .des { grid-template-columns: minmax(0, 1fr); }
  .form { grid-template-columns: minmax(0, 1fr); }
  .user-name { display: none; }
}
