/* ===========================================================
   Photo Calendar Creator — веб-версия
   Палитра снята с настоящего окна программы (Help/Interface.png)
   =========================================================== */
:root{
  --panel:        #f0f0f0;
  --panel-alt:    #e8e8e8;
  --field:        #ffffff;
  --border-light: #acacac;
  --border-dark:  #808080;
  --field-border: #abadb3;
  --text:         #000000;
  --text-dim:     #3d3d3d;
  --accent:       #ff8a00;
  --accent-hit:   #ff8a00;
  --title-from:   #7a97b3;
  --title-to:     #94adc4;
  --group-from:   #87a7c6;
  --group-to:     #7193b5;
  --red:          #c02020;
  --ui: "Segoe UI", Tahoma, "Trebuchet MS", Verdana, sans-serif;
  --sunken: inset 1px 1px 0 #808080, inset -1px -1px 0 #ffffff;
}

*{ box-sizing:border-box; }
/* атрибут hidden обязан побеждать любые правила display */
[hidden]{ display:none !important; }
html,body{ height:100%; }
body{
  margin:0; padding:10px; background:#fff;
  font:12px/1.35 var(--ui); color:var(--text);
  overflow:hidden;
}

/* ---------- окно ---------- */
.window{
  height:calc(100vh - 16px); display:flex; flex-direction:column;
  max-width:1204px; margin:0 auto;
  background:var(--panel); border:0; border-radius:18px;
  box-shadow:0 0 0 1px rgba(255,138,0,.22), 0 10px 38px rgba(255,138,0,.30);
  overflow:hidden;
}
.titlebar{
  display:flex; align-items:center; gap:8px; padding:4px 6px;
  background:linear-gradient(180deg,var(--title-from),var(--title-to));
  border-bottom:1px solid #5c7a97; color:#fff;
  text-shadow:0 1px 0 rgba(0,0,0,.35); flex:0 0 auto;
}
.win-icon{ width:16px; height:16px; border-radius:2px;
  background:linear-gradient(135deg,#fff 0 45%, #ffd24a 45% 100%);
  border:1px solid #4a6b88; }
.win-title{ font-weight:600; letter-spacing:.2px; }
.win-buttons{ margin-left:auto; display:flex; gap:4px; }
.win-buttons i{ width:22px; height:18px; display:grid; place-items:center; font-style:normal;
  font-size:11px; background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.35);
  border-radius:2px; }

/* ---------- меню ---------- */
.menubar{ display:flex; gap:2px; padding:2px 4px; background:var(--panel);
  border-bottom:1px solid var(--border-light); flex:0 0 auto; }
.menu{ position:relative; }
.menu > button{
  font:12px var(--ui); background:none; border:1px solid transparent; padding:3px 9px;
  border-radius:2px; cursor:default; color:var(--text);
}
.menu > button:hover,.menu.open > button{ background:var(--accent-hit); border-color:#2a7fd0; color:#fff; }
.menu ul{ position:absolute; z-index:60; top:100%; left:0; min-width:230px; margin:0; padding:3px;
  list-style:none; background:#fbfbfb; border:1px solid var(--border-dark);
  box-shadow:2px 3px 8px rgba(0,0,0,.28); display:none; }
.menu.open ul{ display:block; }
.menu li{ padding:5px 10px; display:flex; justify-content:space-between; gap:18px; cursor:default; }
.menu li:hover{ background:var(--accent-hit); color:#fff; }
.menu li.sep{ height:1px; padding:0; margin:4px 2px; background:var(--border-light); }
.menu li span{ color:var(--text-dim); font-size:11px; }
.menu li:hover span{ color:#eaf4ff; }

/* ---------- панель инструментов ---------- */
.toolbar{ display:flex; align-items:stretch; flex-wrap:wrap; gap:4px; padding:6px 8px;
  background:#fff;
  justify-content:center;
  border-bottom:1px solid #ffe0c2; flex:0 0 auto; }
.tb{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  min-width:64px; min-height:56px; white-space:nowrap;
  padding:3px 6px; font:11px var(--ui); color:var(--text-dim); background:transparent;
  border:1px solid transparent; border-radius:10px; cursor:pointer; }
.tb span{ white-space:nowrap; line-height:1.15; }
.tb svg{ width:22px; height:22px; fill:none; stroke:#ff8a00; stroke-width:1.7;
  stroke-linecap:round; stroke-linejoin:round; }
.tb:hover{ background:#fff4e6; border-color:#ffd9ad; }
.tb:active{ background:#ffe7cc; }
.tb.active{ background:#ffe0bd; border-color:#ffb066; }
.tb.active svg{ stroke:#b4560a; }
.tb.small{ min-width:0; padding:4px 6px; }
.tb-sep{ width:1px; margin:2px 5px; background:var(--border-light);
  box-shadow:1px 0 0 #fff; }
.svg-sprite{ display:none; }

/* ---------- тело ---------- */
.body{ flex:1 1 auto; display:flex; min-height:0; }

/* ---------- панель свойств ---------- */
.props{ width:400px; flex:0 0 auto; display:flex; flex-direction:column;
  background:var(--panel); border-right:1px solid var(--border-light); min-height:0; }
.tabs{ display:flex; gap:0; padding:4px 4px 0; background:var(--panel-alt);
  flex-wrap:wrap; justify-content:flex-start; margin:0;
  border-bottom:1px solid var(--border-light); }
.tab{ font:12px var(--ui); padding:5px 12px; background:linear-gradient(180deg,#fdfdfd,#eeeeee);
  border:1px solid var(--border-light); border-bottom:none; margin-right:2px;
  border-radius:3px 3px 0 0; cursor:pointer; color:var(--text-dim); }
.tab.active{ background:#fff; color:var(--text); font-weight:600; padding-bottom:6px; }
.props-body{ flex:1 1 auto; overflow-y:auto; padding:8px; }
.tabpage{ display:none; }
.tabpage.active{ display:block; }

fieldset{ margin:0 0 9px; padding:9px 8px 8px; border:1px solid var(--border-light);
  border-radius:2px; background:var(--panel); }
fieldset legend{ font-weight:600; color:#33546f; padding:0 4px; font-size:11.5px; }
.row{ display:flex; align-items:center; gap:6px; margin:0 0 6px; }
.row > span{ flex:0 0 112px; color:var(--text-dim); }
.row input[type=number],.row select,.row input[type=text],.row input[type=search]{ flex:1 1 auto; min-width:0; }
input[type=number],select,input[type=text],input[type=search],textarea{
  font:12px var(--ui); color:var(--text); background:var(--field);
  border:1px solid var(--field-border); padding:3px 5px; border-radius:1px;
}
textarea{ width:100%; resize:vertical; margin-bottom:6px; }
input[type=range]{ flex:1 1 auto; min-width:0; accent-color:var(--accent); }
input[type=color]{ width:38px; height:22px; padding:0; border:1px solid var(--field-border);
  background:var(--field); }
output{ font-size:11px; color:var(--text-dim); min-width:34px; text-align:right; }
.check{ display:flex !important; align-items:center !important; justify-content:flex-start !important;
  gap:10px !important; flex-wrap:nowrap; margin:0 0 6px; color:var(--text-dim); text-align:left; }
.check input[type=checkbox]{ width:16px !important; height:16px !important; min-width:16px !important;
  margin:0 !important; flex:0 0 auto !important; accent-color:#ff8a00; }
.check span{ flex:0 1 auto; white-space:normal; }
.check.inline{ margin:0; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }

.btn{ font:12px var(--ui); color:var(--text); padding:4px 9px; cursor:pointer;
  background:linear-gradient(180deg,#fdfdfd,#e4e4e4);
  border:1px solid var(--border-light); border-radius:12px; }
.btn:hover{ background:#fff4e6; border-color:#ffd9ad; }
.btn:active{ background:#ffe7cc; box-shadow:var(--sunken); }
.btn.primary{ background:#ff8a00; border-color:#ff8a00; color:#fff; font-weight:700; }
.btn.wide{ width:100%; margin-top:4px; }
.btn.grow{ flex:1 1 auto; }
.btn.sel{ background:linear-gradient(180deg,#cfe2f5,#b3d1ec); border-color:#5f92c0; font-weight:600; }
.btnline{ display:flex; gap:4px; margin:0 0 6px; }
.hint{ color:var(--text-dim); font-size:11px; margin:6px 0 0; }
.dim{ color:#6a6a6a; }

/* клипарт — на всю высоту левой панели, 2 столбика */
.props-body{ display:flex; flex-direction:column; overflow:hidden; }
.tabpage.active:not(.clip-page){ overflow-y:auto; flex:1 1 auto; min-height:0; }
.tabpage.clip-page.active{
  flex:1 1 auto; min-height:0; display:flex; flex-direction:column;
}
.clip-fs{
  flex:1 1 auto; min-height:0; display:flex; flex-direction:column;
  margin:0 !important; height:100%;
}
.clipart-grid{
  flex:1 1 auto; min-height:0;
  display:grid; grid-template-columns:repeat(auto-fill,minmax(84px,1fr)); gap:6px;
  align-content:start;
  overflow:auto; padding:6px; background:var(--field);
  border:1px solid var(--field-border); border-radius:12px; margin-bottom:8px;
}
.clipart-grid button{
  padding:4px; background:#fff; border:1px solid #eef1f6; border-radius:10px;
  cursor:pointer; aspect-ratio:1/1; width:auto; height:auto; overflow:hidden;
  display:flex; align-items:center; justify-content:center; box-sizing:border-box;
  transition:border-color .15s, background .15s, transform .15s;
}
.clipart-grid button:hover{
  border-color:#ffd9ad; background:#fff7ef; transform:translateY(-1px);
}
.clipart-grid img{ max-width:100%; max-height:100%; object-fit:contain; display:block; }
.clip-fs .row{ flex:0 0 auto; }
.clip-fs .hint{ flex:0 0 auto; margin-top:4px; }

/* старая верхняя лента клипарта больше не используется */
.clipbar, #clipbar, #clipSide{ display:none !important; }
#about{ display:none !important; }

/* стиль сайта ПРИНТСС: скруглённые поля и плитки */
input[type=text], input[type=search], input[type=number], select, textarea{ border-radius:10px; }
.clipart-grid button{ border-radius:10px; }
/* кнопка «Печать» убрана из панели по просьбе владельца */
.toolbar [data-act="print"]{ display:none !important; }

/* в окне редактора скрыты полоса заголовка и строка меню */
.titlebar, .menubar{ display:none; }

/* заголовок над редактором в стиле сайта */
.hero-editor{ flex:0 0 auto; padding:14px 20px 12px; background:#fff; border-bottom:1px solid #ffe0c2; text-align:center; }
.hero-editor h1{ margin:0; font:800 clamp(18px,2.4vw,26px)/1.2 inherit; color:#141821; letter-spacing:-.2px; }
.hero-editor p{ margin:5px 0 0; font-size:13px; color:#8a8f99; }

/* ---------- рабочая область ---------- */
.workspace{ flex:1 1 auto; min-width:0; overflow:auto; padding:10px;
  background:repeating-conic-gradient(#e9e9e9 0% 25%, #f6f6f6 0% 50%) 50%/18px 18px;
  display:flex; justify-content:center; align-items:flex-start; }
.stage{ position:relative; background:#fff; box-shadow:0 0 0 1px #9a9a9a, 0 6px 22px rgba(0,0,0,.34); }
#canvas{ display:block; }
.stage.grid::after{ content:""; position:absolute; inset:0; pointer-events:none;
  background-image:linear-gradient(to right, rgba(0,120,190,.16) 1px, transparent 1px),
                   linear-gradient(to bottom, rgba(0,120,190,.16) 1px, transparent 1px);
  background-size:var(--cellw,70px) var(--cellh,70px); }

/* ---------- нижняя панель ---------- */
.bottombar{ display:flex; align-items:center; gap:14px; padding:5px 8px; flex:0 0 auto;
  background:linear-gradient(180deg,#f2f2f2,#e2e2e2); border-top:1px solid var(--border-light); }
.pages{ display:flex; align-items:center; gap:6px; min-width:0; flex:1 1 auto; }
.lbl{ color:var(--text-dim); }
.page-strip{ display:flex; gap:5px; overflow-x:auto; padding:2px; max-width:100%; }
.page-thumb{ position:relative; width:44px; height:60px; flex:0 0 auto; padding:0;
  border:1px solid var(--border-light); background:#fff; cursor:pointer; }
.page-thumb canvas{ width:100%; height:100%; display:block; }
.page-thumb.active{ border-color:var(--accent); box-shadow:0 0 0 2px rgba(0,128,192,.35); }
.page-thumb b{ position:absolute; left:2px; bottom:1px; font-size:9px; color:#fff;
  text-shadow:0 0 3px #000; }
.zoom{ display:flex; align-items:center; gap:5px; flex:0 0 auto; }
#zoomLabel{ min-width:44px; text-align:center; font-variant-numeric:tabular-nums; }

/* ---------- строка состояния ---------- */
.statusbar{ display:flex; gap:0; flex:0 0 auto; border-top:1px solid var(--border-light);
  background:var(--panel); font-size:11px; color:var(--text-dim); }
.statusbar > span{ padding:3px 10px; border-right:1px solid var(--border-light); }
.statusbar .msg{ margin-left:auto; color:#1c5f2a; font-weight:600; }

/* ---------- модальные окна ---------- */
.modal{ position:fixed; inset:0; z-index:100; background:rgba(30,40,50,.42);
  display:grid; place-items:center; padding:20px; }
.dialog{ width:min(880px,96vw); max-height:88vh; display:flex; flex-direction:column;
  background:var(--panel); border:0; box-shadow:0 0 0 1px rgba(255,138,0,.18), 0 14px 44px rgba(255,138,0,.26); }
.dialog.small{ width:min(560px,96vw); }
.dlg-title{ display:flex; align-items:center; padding:5px 8px; color:#fff; font-weight:600;
  background:linear-gradient(180deg,var(--group-from),var(--group-to));
  border-bottom:1px solid #5c7a97; text-shadow:0 1px 0 rgba(0,0,0,.3); }
.dlg-x{ margin-left:auto; background:rgba(255,255,255,.2); border:1px solid rgba(255,255,255,.35);
  color:#fff; width:22px; height:18px; cursor:pointer; font-size:11px; }
.dlg-body{ padding:10px; overflow:auto; }
.dlg-foot{ display:flex; align-items:center; gap:8px; padding:8px; border-top:1px solid var(--border-light); }
.dlg-hint{ margin-right:auto; color:var(--text-dim); font-size:11px; }

.gallery{ display:grid; grid-template-columns:repeat(auto-fill,minmax(118px,1fr)); gap:8px; }
.gallery figure{ margin:0; border:1px solid var(--border-light); background:#fff; padding:5px;
  cursor:pointer; text-align:center; }
.gallery figure:hover{ border-color:var(--accent); }
.gallery figure.sel{ border-color:var(--accent); box-shadow:0 0 0 2px rgba(0,128,192,.35); }
.gallery img{ width:100%; height:104px; object-fit:contain; display:block; }
.gallery figcaption{ font-size:10.5px; color:var(--text-dim); margin-top:4px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cat-title{ width:100%; margin:10px 0 4px; font-weight:600; color:#33546f;
  border-bottom:1px solid var(--border-light); }

.about-logo{ text-align:center; font:700 20px var(--ui); color:#33546f; padding:8px 0 12px; }
.about p{ margin:0 0 8px; text-align:justify; }

.holiday-form{ display:flex; gap:6px; margin-bottom:8px; flex-wrap:wrap; }
.holiday-form input[type=text]{ width:90px; }
.holiday-form #holName{ width:auto; flex:1 1 220px; }
.holiday-list{ max-height:46vh; overflow:auto; background:#fff; border:1px solid var(--field-border); }
.holiday-list div{ display:flex; gap:10px; padding:4px 8px; border-bottom:1px solid #eee; }
.holiday-list div:nth-child(odd){ background:#fafafa; }
.holiday-list b{ flex:0 0 56px; font-variant-numeric:tabular-nums; }
.holiday-list .red{ color:var(--red); font-size:11px; }
.holiday-list button{ margin-left:auto; }

/* ---------- печать ---------- */
#printImage{ display:none; }
@media print{
  body{ background:#fff; padding:0; overflow:visible; }
  .window > *:not(.body){ display:none !important; }
  .body{ display:block; }
  .props,.bottombar,.statusbar,.toolbar,.menubar,.titlebar,.hero-editor{ display:none !important; }
  .workspace{ padding:0; background:#fff; display:block; overflow:visible; }
  .stage{ box-shadow:none; }
  .stage.grid::after{ display:none; }
  #canvas{ display:none !important; }
  #printImage{ display:block !important; width:100%; height:auto; }
  @page{ margin:0; }
}

/* общий вид окна редактора: мягкие рамки, скругления, светлые панели */
.props{ background:#fbfcfe; border-right:1px solid #eef1f6; }
.props fieldset{ border:1px solid #eef1f6; border-radius:14px; background:#fff; margin:0 0 10px; }
.props legend{ color:#8a8f99; font-weight:700; padding:0 6px; }
.props input[type=text], .props input[type=search], .props input[type=number], .props select, .props textarea{
  border:1px solid #e6e9f0; border-radius:9px; padding:6px 9px; font:12.5px var(--ui); color:#141821; background:#fff; }
.props input:focus, .props select:focus, .props textarea:focus{ outline:0; border-color:#ff8a00; box-shadow:0 0 0 3px rgba(255,138,0,.14); }
.bottombar{ border-top:1px solid #eef1f6; background:#fbfcfe; }
.statusbar{ border-top:1px solid #eef1f6; color:#8a8f99; }
/* ---- закладка «Заказ» ---- */
.ord-result{ margin-top:10px; font-size:12.6px; line-height:1.5; color:#2b3140; }
.ord-result table{ width:100%; border-collapse:collapse; margin:4px 0 0; }
.ord-result td{ padding:4px 0; border-bottom:1px dashed #e6e9f0; vertical-align:top; }
.ord-result td.n{ text-align:right; white-space:nowrap; font-weight:600; }
.ord-result tr.tot td{ border-bottom:0; padding-top:8px; font-weight:800; font-size:14px; color:#141821; }
.ord-result .ok{ color:#1a7f3c; font-weight:700; }
.ord-result .bad{ color:#a11f1f; font-weight:700; }
.ord-result a{ color:#0080c0; }
.ord-result .num{ font-size:20px; font-weight:800; color:#141821; }
/* на узком экране панель занимает всю ширину, окно растёт по содержимому */
@media(max-width:900px){
  body{ overflow:auto; }
  .props{ width:100%; border-right:0; border-bottom:1px solid #eef1f6; }
  .body{ flex-direction:column; }
  .window{ height:auto; min-height:0; max-width:100%; }
  .workspace{ order:-1; min-height:44vh; }
  .props-body{ overflow:visible; }
  .bottombar{ flex-wrap:wrap; }
}

/* Телефон: холст сверху, настройки и форма заказа — крупными полями в одну колонку */
@media(max-width:760px){
  body{ padding:0; font-size:13px; }
  .window{ border-radius:12px; }
  .titlebar{ padding:6px 8px; }
  .tb{ min-width:58px; min-height:54px; border-radius:8px; }
  .tb svg{ width:21px; height:21px; }
  .tb span{ font-size:12px; line-height:1.2; }
  .toolbar{ justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; padding:4px 6px; }
  .workspace{ padding:6px; min-height:52vh; }
  .props-body{ padding:8px 10px 16px; }
  fieldset{ padding:10px; margin-bottom:12px; }
  fieldset legend{ font-size:12px; padding:0 6px; }
  .row{ flex-wrap:wrap; gap:4px 8px; margin-bottom:10px; }
  .row > span{ flex:1 1 100%; font-size:12px; }
  .row input[type=number],.row select,.row input[type=text],.row input[type=search]{ flex:1 1 100%; }
  input[type=number],select,input[type=text],input[type=search],textarea{
    font-size:16px; padding:8px 10px; min-height:42px; border-radius:8px;
  }
  /* в форме заказа поля наследуют мелкий шрифт окна — на телефоне он неудобен */
  .props input[type=number],.props select,.props input[type=text],.props input[type=tel],
  .props input[type=email],.props textarea{ font-size:16px !important; min-height:42px; }
  input[type=color]{ width:52px; height:42px; }
  output{ min-width:46px; font-size:12px; }
  .check{ align-items:flex-start !important; gap:8px !important; margin-bottom:10px; }
  .check input[type=checkbox]{ width:20px !important; height:20px !important; min-width:20px !important; }
  .btn{ min-height:42px; padding:8px 14px; font-size:14px; border-radius:10px; }
  .btnline{ display:flex; flex-direction:column; gap:8px; }
  .btnline .btn,.btnline .btn.grow,.btnline .btn.wide{ flex:1 1 auto; width:100%; }
  .ord-result{ font-size:12.5px; }
  .bottombar{ gap:6px; padding:6px; }
  .pages{ flex:1 1 100%; order:-1; }
}
