/* TSY Catalog Studio — admin panel */
@import url('/fonts/fonts.css');

:root {
  --navy: #0b1f3a; --navy-2: #13294a; --navy-3: #1c3760; --orange: #f36b21; --orange-2: #ff7d36;
  --ink: #0f1f36; --muted: #67788f; --line: #e3e8ef; --bg: #f3f5f9; --card: #fff;
  --ok: #18a058; --warn: #e8a317; --err: #e2483d; --info: #2f6fde;
  --r: 14px; --r-sm: 10px; --sh: 0 1px 2px rgba(15,31,54,.04), 0 6px 22px rgba(15,31,54,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Yekan Bakh', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[x-cloak] { display: none !important; }
.ic { flex: none; }
h1, h2, h3, h4 { font-family: 'Peyda', sans-serif; margin: 0; line-height: 1.4; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--navy); color: #c9d4e4; display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; }
.side .brand .mk { width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; --logo-light: #0b1f3a; --logo-accent: #f36b21; }
.side .brand .mk svg { width: 28px; height: 28px; }
.side .brand b { display: block; font-family: 'Peyda'; font-size: 15.5px; font-weight: 800; }
.side .brand small { display: block; font-size: 11.5px; color: #8fa1bb; }
.side .grp { font-size: 11.5px; color: #6f83a1; padding: 14px 12px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: #c9d4e4; transition: background .15s, color .15s; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: linear-gradient(90deg, rgba(243,107,33,.22), rgba(243,107,33,.08)); color: #fff; box-shadow: inset -3px 0 0 var(--orange); }
.side nav a .ic { color: #8fa1bb; }
.side nav a.on .ic { color: var(--orange); }
.side nav a .tag { margin-inline-start: auto; background: rgba(255,255,255,.1); border-radius: 99px; font-size: 11px; padding: 0 8px; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.05); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--orange), #ff9b5e); color: #fff; font-weight: 800; flex: none; }
.side .me b { display: block; color: #fff; font-size: 13.5px; line-height: 1.4; }
.side .me small { color: #8fa1bb; font-size: 11.5px; }
.side .me form { margin-inline-start: auto; }
.side .me button { background: none; border: 0; color: #8fa1bb; cursor: pointer; padding: 6px; border-radius: 8px; }
.side .me button:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { min-width: 0; padding: 26px 32px 60px; }
.top { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.top h1 { font-size: 24px; font-weight: 800; }
.top .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.top .sp { flex: 1; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.crumbs a:hover { color: var(--orange); }

/* elements */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: #c8d2df; background: #fafbfd; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-2); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.dark:hover { background: var(--navy-3); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: #fff3f2; border-color: #f4c3bf; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(15,31,54,.05); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 34px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); border: 1px solid #edf0f5; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 15.5px; }
.card-h .sp { flex: 1; }
.card-b { padding: 20px; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: #eef2f7; color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.published { background: #e6f6ee; color: var(--ok); }
.badge.draft { background: #fdf3de; color: #b47c0b; }
.badge.archived { background: #eef0f3; color: #7d8898; }
.badge.info { background: #e8f0fd; color: var(--info); }
.badge.orange { background: #fff0e7; color: #d4561a; }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #fff0e7; color: var(--orange); }
.stat .ico.b { background: #e8f0fd; color: var(--info); }
.stat .ico.g { background: #e6f6ee; color: var(--ok); }
.stat .ico.n { background: #e9edf4; color: var(--navy); }
.stat b { display: block; font-family: 'Peyda'; font-size: 24px; font-weight: 900; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12.5px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .lbl { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 0 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 13px; line-height: 1.8; resize: vertical; }
.input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(243,107,33,.12); }
.input.code { font-family: ui-monospace, monospace; font-size: 12px; direction: ltr; }
.err { color: var(--err); font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 40px; height: 23px; border-radius: 99px; background: #d5dce6; position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: inset-inline-start .2s; }
.switch input:checked + i { background: var(--orange); }
.switch input:checked + i::after { inset-inline-start: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid #f0f2f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fbfcfe; }

/* alerts & toast */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px; }
.alert.ok { background: #e6f6ee; color: #0f6b3b; }
.alert.bad { background: #fdeceb; color: #a1261d; }

/* catalog cards */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.cc { display: flex; flex-direction: column; background: #fff; border-radius: var(--r); border: 1px solid #edf0f5; box-shadow: var(--sh); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.cc:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15,31,54,.1); }
.cc .cv { position: relative; height: 210px; background: var(--tint, #eef2f7); display: grid; place-items: center; overflow: hidden; }
.cc .cv img { max-height: 84%; max-width: 84%; box-shadow: 0 10px 24px rgba(0,0,0,.18); border-radius: 2px; }
.cc .cv .ph { width: 52%; aspect-ratio: var(--ar, .7); border-radius: 3px; box-shadow: 0 10px 24px rgba(0,0,0,.18); display: grid; place-items: center; color: #fff; font-family: 'Peyda'; font-weight: 900; font-size: 22px; }
.cc .cv .tl { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; gap: 5px; }
.cc .cv .tr { position: absolute; top: 10px; inset-inline-end: 10px; }
.cc .bd { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.cc .bd h4 { font-size: 14.5px; line-height: 1.5; }
.cc .bd small { color: var(--muted); font-size: 12px; }
.cc .ft { display: flex; gap: 4px; padding: 8px 10px 12px; border-top: 1px solid #f1f3f7; }
.cc .ft .btn { flex: 1; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters .input { height: 38px; width: auto; min-width: 140px; }
.filters .search { position: relative; flex: 1; min-width: 220px; }
.filters .search .input { width: 100%; padding-inline-start: 38px; }
.filters .search .ic { position: absolute; inset-inline-start: 12px; top: 50%; translate: 0 -50%; color: var(--muted); }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; position: relative; }
.bars .b i { display: block; border-radius: 4px 4px 2px 2px; background: var(--navy); min-height: 2px; }
.bars .b i.d { background: var(--orange); }
.bars .b:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; translate: -50% -6px; background: var(--ink); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 3; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid #f1f3f7; }
.list-item:last-child { border-bottom: 0; }
.list-item .t { flex: 1; min-width: 0; }
.list-item .t b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .t small { color: var(--muted); font-size: 12px; }
.thumb-sm { width: 42px; height: 54px; border-radius: 4px; object-fit: cover; background: #eef2f7; box-shadow: 0 2px 6px rgba(0,0,0,.08); flex: none; }

/* options (radio cards) */
.opts { display: grid; gap: 12px; }
.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; }
.opt .box { display: block; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; transition: all .15s; height: 100%; }
.opt:hover .box { border-color: #c7d1de; }
.opt input:checked + .box { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(243,107,33,.12); }
.opt .box b { display: block; font-size: 14px; }
.opt .box small { color: var(--muted); font-size: 12px; line-height: 1.6; display: block; }
.swatches { display: flex; gap: 4px; margin: 10px 0 8px; }
.swatches i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.page-shape { display: grid; place-items: center; height: 70px; }
.page-shape span { display: block; background: #e9eef5; border: 1.5px solid #c9d3e1; border-radius: 3px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 10px; display: grid; place-items: center; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 13px; }
.pagination .on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination .dis { opacity: .4; }

.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.matrix input { width: 18px; height: 18px; accent-color: var(--orange); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .ic { color: #c1cad7; margin-bottom: 8px; }

.modal-bg { position: fixed; inset: 0; background: rgba(9,18,33,.5); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); background: #fff; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal .card-b { max-height: 70vh; overflow: auto; }

.mobile-bar { display: none; }
@media (max-width: 1100px) { .g-main { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 90; translate: 105% 0; transition: translate .3s; }
  [dir=ltr] .side { translate: -105% 0; }
  .side.open { translate: 0 0; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 50; }
  .main { padding: 18px 16px 50px; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
