/* Публикации PandaKids — интерфейс для телефона в первую очередь.
   Зелёный — бамбук панды, оранжевый — «лучшее время». */
:root {
  --bg: #f5f6f4;
  --panel: #ffffff;
  --ink: #17191a;
  --muted: #646b66;
  --line: #dfe3df;
  --accent: #2f6b45;
  --accent-ink: #ffffff;
  --accent-soft: #e5efe8;
  --hot: #c2560c;
  --hot-soft: #fbeadc;
  --bad: #b42318;
  --ok: #1f7a3f;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121413; --panel: #1b1e1c; --ink: #eef1ee; --muted: #9aa39d; --line: #2c312e;
    --accent: #5fae7c; --accent-ink: #0d1a12; --accent-soft: #1f3327;
    --hot: #f0954c; --hot-soft: #3a2616; --bad: #f2786b; --ok: #6fcf8e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .01em; }
.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.tabs a {
  padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.link { background: none; border: 0; color: var(--muted); padding: 6px 4px; text-decoration: underline; }

.banner {
  background: var(--hot-soft); color: var(--hot); padding: 8px max(16px, env(safe-area-inset-left, 0px));
  font-size: 14px; text-align: center;
}
.view {
  max-width: 760px; margin: 0 auto; display: grid; gap: 16px;
  padding-block: 16px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card h2 { margin: 0; font-size: 17px; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.err { color: var(--bad); font-size: 14px; margin: 0; }
h1 { font-size: 22px; margin: 0; }

label.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=password], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }

.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 14px; min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.big { width: 100%; font-size: 17px; min-height: 52px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* фото */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--muted);
  display: grid; gap: 6px; justify-items: center;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; line-height: 1;
}
.thumb .n { position: absolute; left: 6px; bottom: 4px; font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7); }

/* Canva: кнопки рядом и сетка дизайнов с названиями */
.center-row { justify-content: center; }
.row input[type=search] { flex: 1; min-width: 0; }
.thumbs.canva { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.thumb.design { border: 1px solid var(--line); padding: 0; cursor: pointer; font: inherit; }
.thumb.design:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.thumb.design .n {
  left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* аккаунты и выбор */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 8px 12px; min-height: 40px;
}
.chip[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 10px 6px; min-height: 44px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.counter { font-size: 13px; color: var(--muted); text-align: right; }

/* время */
.when-now { font-weight: 600; }
.hot { background: var(--hot-soft); border-color: var(--hot); color: var(--hot); }
.cal { display: grid; gap: 6px; }
.cal-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; }
.cal-head .title { font-weight: 600; text-align: center; border: 0; background: none; padding: 8px; text-decoration: underline dotted; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .wd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid button {
  aspect-ratio: 1; border: 1px solid transparent; background: var(--bg); border-radius: 8px; padding: 0; min-height: 36px;
  font-variant-numeric: tabular-nums; position: relative;
}
.cal-grid button.past { color: var(--muted); text-decoration: line-through; background: transparent; cursor: default; }
.cal-grid button.today { border-color: var(--accent); font-weight: 700; }
.cal-grid button.sel { background: var(--accent); color: var(--accent-ink); }
.cal-grid button .dots { position: absolute; left: 0; right: 0; bottom: 3px; font-size: 10px; line-height: 1; color: var(--accent); }
.cal-grid button.sel .dots { color: var(--accent-ink); }
.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.months button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 12px 4px; }
.hours { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hours button, .mins button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 10px 4px; min-height: 44px; font-variant-numeric: tabular-nums; }
.hours button.good { border-color: var(--accent); }
.hours button:disabled { opacity: .35; text-decoration: line-through; }
.mins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.legend { font-size: 13px; color: var(--muted); }

/* итог и списки */
.summary { display: grid; gap: 4px; font-size: 15px; }
.summary b { font-weight: 600; }
.batch { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.batch:first-child { border-top: 0; }
.batch img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.batch .meta { min-width: 0; display: grid; gap: 4px; }
.batch .cap { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.items { display: grid; gap: 2px; font-size: 14px; }
.st { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.st.done { color: var(--ok); border-color: var(--ok); }
.st.error { color: var(--bad); border-color: var(--bad); }
.st.pending, .st.running { color: var(--accent); border-color: var(--accent); }
.st.cancelled { color: var(--muted); text-decoration: line-through; }
.item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item a { color: var(--accent); }
.user { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.user:first-child { border-top: 0; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; font-size: 14px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; max-width: calc(100% - 32px);
  box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 10;
}
/* студия */
.thumbs.studio { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.thumbs.studio .thumb { aspect-ratio: 4 / 5; cursor: pointer; border: 3px solid transparent; }
.thumbs.studio .thumb.picked { border-color: var(--accent); }
.thumb .pick {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.35); color: #fff; font-weight: 700; line-height: 1;
}
.thumb .pick[aria-pressed=true] { background: var(--accent); }
.card-preview { width: 100%; max-width: 480px; aspect-ratio: 4 / 5; justify-self: center; border-radius: 10px; background: var(--bg); object-fit: cover; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.source-box { position: relative; justify-self: center; max-width: 480px; width: 100%; cursor: crosshair; }
.source-box .source { width: 100%; display: block; border-radius: 10px; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.mark {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); border: 3px solid #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
input[type=range] { width: 100%; accent-color: var(--accent); }
.source-box.erasing { cursor: crosshair; touch-action: none; user-select: none; }
.source-box .ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; border-radius: 10px; }
.seg.two-seg { grid-template-columns: 1fr 1fr; }

/* день в календаре: свободные часы */
.slots { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.slot { display: grid; grid-template-columns: 76px 1fr 1fr; gap: 8px; align-items: start; padding: 8px 10px; border-top: 1px solid var(--line); }
.slot:first-child { border-top: 0; }
.slot.best { background: var(--hot-soft); }
.slot.good { background: var(--accent-soft); }
.slot.past { opacity: .55; }
.slot-time { font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 6px; white-space: nowrap; }
.slot-col { display: grid; gap: 4px; min-width: 0; }
.slot-label { font-size: 12px; color: var(--muted); }
.slot-busy { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.slot-add { min-height: 36px; padding: 6px 10px; font-size: 14px; justify-self: start; }
@media (max-width: 420px) { .slot { grid-template-columns: 58px 1fr 1fr; gap: 6px; padding: 8px 6px; } .slot-add { padding: 6px 8px; } }

.center { min-height: 70vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 380px; }
