:root {
  --text: #1D1D1F;
  --muted: #6E6E73;
  --faint: #8A8A8E;
  --line: #E5E5EA;
  --row-line: #EDEDF0;
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --side: #EEEEF0;
  --side-active: #D9D9DE;
  --green: #28A745;
  --blue: #0A64D6;
  --warn-bg: #FFF4E0;
  --warn: #9A5A00;
  --danger: #C62828;
  --accent: #2EA937;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  color: var(--text); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }

.window { display: flex; height: calc(100vh - var(--pv-nav-h, 0px)); }   /* под общей строкой меню */
.sidebar {
  width: 220px; flex: none; background: var(--side); border-right: 1px solid #D8D8DC;
  padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.brand { font-weight: 700; font-size: 15px; padding: 0 10px 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  color: var(--text); text-decoration: none; font-size: 13px; min-height: 32px;
}
.sidebar a:hover { background: #E3E3E7; }
.sidebar a.active { background: var(--side-active); font-weight: 500; }
.sidebar a[hidden] { display: none; }   /* иначе display:flex выше перебивает hidden */
.sidebar svg { width: 16px; height: 16px; fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-title { font-size: 11px; font-weight: 600; color: var(--faint); padding: 18px 10px 6px; }
#recent a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.toolbar {
  height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px 0 24px; border-bottom: 1px solid var(--line); background: #FFFFFF; font-size: 15px; font-weight: 600;
}
#toolbar-actions { display: flex; gap: 8px; }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px 40px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 14px; min-height: 32px;
  border-radius: 7px; border: none; background: #E9E9EE; color: var(--text); font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #DEDEE4; }
.btn.primary { background: #1D1D1F; color: #FFFFFF; font-weight: 600; }
.btn.primary:hover { background: #3A3A3C; }
.btn.big { padding: 10px 22px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.danger { color: var(--danger); background: transparent; }

.section-label { font-size: 12px; color: var(--muted); padding: 0 0 8px 14px; text-transform: uppercase; letter-spacing: .02em; }
.card { background: var(--card); border-radius: 12px; }
.list { background: var(--card); border-radius: 12px; overflow: hidden; }
.row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 44px; border: none;
  background: var(--card); text-align: left; cursor: pointer; font-size: 14px;
}
.row .body { flex: 1; display: flex; gap: 8px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--row-line); min-width: 0; }
.row:last-child .body { border-bottom: none; }
.row:hover { background: #FAFAFB; }
.row .sub { color: var(--faint); font-size: 12px; }
.row .check { width: 16px; height: 16px; fill: none; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.row[aria-checked="true"] .check { visibility: visible; }
.mini-thumb { width: 44px; height: 25px; border-radius: 4px; box-shadow: 0 0 0 1px #DADADE; object-fit: cover; background: #FFF; flex: none; }

.drop {
  display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: 14px; background: var(--card);
  border: 1.5px dashed #B9C9BE; cursor: pointer;
}
.drop.over { border-color: var(--green); background: #F2FAF4; }
.drop .icon { width: 50px; height: 50px; border-radius: 12px; background: #F0F2F1; display: flex; align-items: center; justify-content: center; flex: none; }
.drop .icon svg { width: 24px; height: 24px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop .t { font-size: 15px; font-weight: 600; }
.drop .s { font-size: 13px; color: var(--muted); margin-top: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.grid2 { display: flex; gap: 20px; margin-top: 20px; flex-wrap: wrap; }
.grid2 > .col-main { flex: 1.3 1 380px; min-width: 0; }
.grid2 > .col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--c); }
.hex-row { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-top: 14px; color: var(--muted); }
.hex-row input { width: 96px; padding: 6px 8px; border: 1px solid #D1D1D6; border-radius: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--text); }
.hex-row input[type=color] { width: 32px; height: 32px; padding: 0; border: none; background: none; cursor: pointer; }

.preview-slide {
  aspect-ratio: 16 / 9; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); padding: 5% 6%;
  display: flex; flex-direction: column; gap: 6%; background: #FFF;
}
.preview-slide .head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #C8C8C8; padding-bottom: 3%; }
.preview-slide .head b { font-size: 12px; }
.preview-slide .logo { width: 34px; height: 9px; border-radius: 2px; }
.preview-slide .txt { font-size: 10px; line-height: 1.5; display: flex; flex-direction: column; gap: 4px; }

.option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 14px; cursor: pointer; }
.option + .option { border-top: 1px solid var(--row-line); }
.option small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.option input { width: 18px; height: 18px; accent-color: #1D1D1F; flex: none; }

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.error-box { padding: 12px 16px; border-radius: 10px; background: #FDECEC; color: var(--danger); font-size: 13px; }
.muted { color: var(--muted); }

/* job */
.progress-card { max-width: 640px; margin: 40px auto; display: flex; flex-direction: column; gap: 16px; }
.bar { height: 8px; border-radius: 5px; background: #E3E3E8; overflow: hidden; }
.bar > div { height: 100%; background: var(--green); border-radius: 5px; transition: width .4s; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1 1 150px; padding: 12px 14px; background: var(--card); border-radius: 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.stat.ok .v { color: #1E8E3E; }
.stat.warn .v { color: var(--warn); }
.viewer { display: flex; gap: 18px; margin-top: 18px; min-height: 0; }
.thumbs {
  width: 180px; flex: none; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 210px); overflow-y: auto; overflow-x: hidden; padding: 4px 8px 4px 4px;
}
.thumb { width: 100%; display: flex; gap: 6px; align-items: flex-start; border: none; background: none; padding: 0; cursor: pointer; text-align: left; flex: none; }
.thumb .num { width: 24px; font-size: 11px; color: var(--faint); text-align: right; padding-top: 2px; flex: none; }
.thumb img { flex: 1; min-width: 0; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 4px; box-shadow: 0 0 0 1px #DADADE; display: block; background: #FFF; }
.thumb.warn img { box-shadow: 0 0 0 2px #F2A33A; }
.thumb[aria-current="true"] img { box-shadow: 0 0 0 2.5px var(--green); }
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stage .big { background: var(--card); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.compare figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.compare .cap { font-size: 12px; color: var(--muted); font-weight: 600; }
.compare figure + figure .cap { color: #1E7A36; }
.compare img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 6px; box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(0,0,0,.07); background: #FFF; }
.fix { background: #F5F7FF; border: 1px solid #DCE3F7; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.fix-title { font-size: 13px; font-weight: 600; }
.fix-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fix .btn { background: #FFFFFF; box-shadow: 0 0 0 1px #CFD6EA; }
.fix .btn:hover:not(:disabled) { background: #EEF2FF; }
.fix .btn.chosen { background: #1D1D1F; color: #FFF; box-shadow: none; opacity: 1; }
.stage .nav { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.notes { margin: 0; padding-left: 18px; font-size: 13px; color: #3A3A3C; display: flex; flex-direction: column; gap: 4px; }
.notes .w { color: var(--warn); }
.warn-list { background: var(--warn-bg); border-radius: 12px; padding: 12px 16px; font-size: 13px; color: var(--warn); }
.warn-list button { border: none; background: none; color: var(--warn); text-decoration: underline; cursor: pointer; padding: 0; font-size: 13px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 10px 16px; }
td { padding: 12px 16px; border-top: 1px solid var(--row-line); font-size: 14px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.done { background: #E7F6EC; color: #1E7A36; }
.badge.warn { background: #FFF1D6; color: var(--warn); }
.badge.run { background: #E6EEF8; color: #224C80; }
.badge.error { background: #FDECEC; color: var(--danger); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }

/* templates */
.seg { display: inline-flex; padding: 2px; background: #E3E3E8; border-radius: 9px; }
.seg button { padding: 6px 14px; border: none; border-radius: 7px; background: transparent; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #FFFFFF; font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.slot { background: var(--card); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.slot .ph { aspect-ratio: 16 / 9; border-radius: 6px; border: 1.5px dashed #C7C7CC; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; text-align: center; overflow: hidden; background: #FFF; }
.slot .ph img { width: 100%; height: 100%; object-fit: cover; }
.slot .cap { display: flex; justify-content: space-between; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input[type=text] { padding: 9px 12px; border: 1px solid #D1D1D6; border-radius: 8px; font-size: 14px; color: var(--text); background: #FFF; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1D1D1F; color: #FFF;
  padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
  .slots { grid-template-columns: 1fr; }
  .viewer { flex-direction: column; }
  .thumbs { width: 100%; flex-direction: row; max-height: none; overflow-x: auto; }
  .thumb { width: 130px; }
  .compare { grid-template-columns: 1fr; }
}

.fix-title.warn { color: var(--warn); }
.fix-label { width: 110px; flex: none; font-size: 12px; color: var(--muted); align-self: center; }
.fix .btn.danger { box-shadow: none; background: transparent; padding-left: 0; }
.comment { display: flex; flex-direction: column; gap: 8px; }
.comment textarea { width: 100%; padding: 10px 12px; border: 1px solid #D1D1D6; border-radius: 8px; font-size: 14px; resize: vertical; background: #FFF; }
.comment-list { background: #EEF2FF; border-radius: 12px; padding: 10px 16px; font-size: 13px; color: #2D3F8A; }
.comment-list button { border: none; background: none; color: #2D3F8A; text-decoration: underline; cursor: pointer; padding: 0; font-size: 13px; }
.thumb.has-comment .num::after { content: ""; display: block; width: 7px; height: 7px; border-radius: 50%; background: #3B5BDB; margin: 4px 0 0 auto; }

.after-box { display: flex; flex-direction: column; gap: 8px; }
.after-box.trial img { box-shadow: 0 0 0 2.5px #3B5BDB, 0 4px 14px rgba(0,0,0,.07); }
.pending { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #EEF2FF; color: #2D3F8A; font-size: 13px; }
.pending.ready { background: #E8EDFF; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #B8C4F2; border-top-color: #3B5BDB; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.pending.same { background: #FFF4E0; color: var(--warn); }

.me[hidden] { display: none; }
.me { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid #D8D8DC; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { border: none; background: none; color: var(--blue); cursor: pointer; padding: 0; font-size: 13px; }
#gate { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
#gate[hidden] { display: none; }
.gate-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.field input[type=password] { padding: 9px 12px; border: 1px solid #D1D1D6; border-radius: 8px; font-size: 14px; color: var(--text); background: #FFF; }
