:root {
  --bg: #0a0b10;
  --ink: #e9ecf5;
  --muted: #8b93a7;
  --line: rgba(255, 255, 255, .09);
  --card: rgba(20, 22, 31, .55);
  --card-hi: rgba(255, 255, 255, .09);
  --accent: #7c8cff;
  --accent-2: #b07cff;
  --warn: #ff9d5c;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --bg-image: none;
  --bg-dim: .55;
  --bg-blur: 0px;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  /* Фон и «северное сияние» лежат слоями с отрицательным z-index. Непрозрачный
     фон на body закрасил бы их — базовый цвет держим на html. */
  background: transparent;
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

/* ------------------------------------------------------------ фон */

/* Картинка отдельным слоем: затемнение и размытие крутятся, не трогая контент. */
.bg { position: fixed; inset: 0; z-index: -3; }
.bg::before {
  content: "";
  position: absolute; inset: calc(-1 * var(--bg-blur) - 10px);
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  filter: blur(var(--bg-blur));
}
.bg::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(6, 7, 11, var(--bg-dim));
}

.aurora { position: fixed; inset: 0; overflow: hidden; z-index: -2; }
.aurora span {
  position: absolute;
  width: 46vw; height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .38;
}
.aurora span:nth-child(1) { background: #3b46c4; top: -14vw; left: -8vw; }
.aurora span:nth-child(2) { background: #7b3bc4; bottom: -18vw; right: -6vw; opacity: .3; }
.aurora span:nth-child(3) { background: #1f6f8b; top: 38%; left: 48%; opacity: .22; }
.aurora::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(140% 110% at 50% 0%, transparent 45%, rgba(10, 11, 16, .92) 100%);
}
/* С картинкой цветные пятна только мешают её разглядеть. */
body.has-bg .aurora { display: none; }

/* ------------------------------------------------------------ каркас */

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 26px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.clock { font-size: 40px; font-weight: 650; letter-spacing: -1.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.hello { margin-top: 7px; color: var(--muted); font-size: 14px; }
.hello .dot { margin: 0 7px; opacity: .5; }

.top-right { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, transform .15s, border-color .15s, color .15s;
  backdrop-filter: blur(6px);
}
.icon-btn svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover { background: var(--card-hi); border-color: rgba(255,255,255,.22); transform: translateY(-1px); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(255,107,107,.45); }
.icon-btn.on { background: rgba(124,140,255,.22); border-color: rgba(124,140,255,.55); color: #cfd5ff; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- подсказки: свои, потому что нативный title ждёт секунду */

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  white-space: nowrap;
  background: #1b1e28;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------ строка ввода */

.omni { display: flex; flex-direction: column; gap: 7px; }
.omni-row { display: flex; align-items: center; gap: 10px; }
.modes { display: flex; gap: 5px; flex: 0 0 auto; }
.mode {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
  transition: all .15s;
}
.mode.active { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #0d0f1a; font-weight: 600; border-color: transparent; }

.omni-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 5px 0 14px;
  backdrop-filter: blur(8px);
  transition: border-color .15s, background .15s;
}
.omni-form:focus-within { border-color: rgba(124,140,255,.55); }
#omni { flex: 1; border: 0; background: transparent; outline: none; padding: 9px 0; font-size: 15px; }
#omni::placeholder { color: #767d92; }
.omni-go {
  width: 32px; height: 32px;
  border: 0; border-radius: 9px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0d0f1a; font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.omni-go:disabled { opacity: .45; cursor: default; }
.omni-hint { color: var(--muted); font-size: 12px; padding-left: 2px; }
.omni-hint.flash { color: var(--ok); }
.omni-hint.error { color: var(--danger); }

/* ------------------------------------------------------------ две колонки */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .85fr);
  gap: 18px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.col-head, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* --------------------------------------------- закреплённые плитки сверху */

.pins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .14s, border-color .14s, box-shadow .14s;
  backdrop-filter: blur(10px);
}
.pin:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.22); box-shadow: 0 12px 26px rgba(0,0,0,.35); }
.pin .shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pin .mark {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; overflow: hidden;
  background: rgba(255,255,255,.07);
}
.pin .mark img { width: 70%; height: 70%; object-fit: contain; }
.pin .mark.letter { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0d0f1a; font-weight: 700; font-size: 20px; }
.pin.empty {
  border: 1px dashed rgba(255,255,255,.24);
  color: var(--muted); font-size: 26px; background: rgba(255,255,255,.03);
}
.pin.empty:hover { color: var(--ink); }
.pin-x {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(18,20,28,.85); color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer; display: none; z-index: 2;
}
body.editing .pin-x { display: grid; place-items: center; }
body.editing .pin-x:hover { color: var(--danger); }

.pin-preview {
  height: 140px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); margin-bottom: 14px;
  display: grid; place-items: center; overflow: hidden;
  color: var(--muted); font-size: 12.5px;
}
.pin-preview img { width: 100%; height: 100%; object-fit: cover; }
.dlg-note { margin: 0 0 16px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.dlg-note.warn-note { color: var(--warn); }

/* ------------------------------------------------------------ закладки */

.groups { display: flex; flex-direction: column; gap: 12px; }
.group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  backdrop-filter: blur(10px);
}
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.group-title { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.group-tools { margin-left: auto; display: flex; gap: 6px; }
.mini-btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--muted);
  border-radius: 8px; padding: 4px 9px; font-size: 12px; cursor: pointer;
}
.mini-btn:hover { color: var(--ink); border-color: rgba(255,255,255,.25); }
.mini-btn.del:hover { color: var(--danger); border-color: rgba(255,107,107,.4); }

/* плитка квадратами */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.045);
  transition: background .15s, transform .12s, border-color .15s;
  cursor: pointer;
  min-width: 0;
}
.tile:hover { background: var(--card-hi); border-color: rgba(255,255,255,.16); transform: translateY(-2px); }
.tile .fav {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 32px;
  display: grid; place-items: center; overflow: hidden;
}
.tile .fav img { width: 100%; height: 100%; object-fit: contain; }
.tile .fav.letter { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0d0f1a; font-weight: 700; font-size: 15px; }
.tile .name {
  font-size: 11.5px; line-height: 1.25; text-align: center; width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.tile.dragging { opacity: .4; }
.tile.add { color: var(--muted); border: 1px dashed rgba(255,255,255,.18); background: transparent; font-size: 12px; }
.tile.add:hover { color: var(--ink); }

.tile-x {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--line); background: #1a1c25; color: var(--muted);
  font-size: 12px; line-height: 1; cursor: pointer; display: none;
}
body.editing .tile-x { display: grid; place-items: center; }
body.editing .tile-x:hover { color: var(--danger); }
body.editing .tile { cursor: grab; }
body:not(.editing) .hide-view { display: none; }
body:not(.editing) .group-tools { display: none; }

/* ------------------------------------------------------------ панели задач */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 15px 11px;
  display: flex; flex-direction: column; gap: 11px;
  backdrop-filter: blur(10px);
}
.badge {
  min-width: 26px; text-align: center;
  background: rgba(255,157,92,.18); color: var(--warn);
  border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700;
}
.badge.soft { background: rgba(124,140,255,.18); color: #aeb7ff; }

.list { display: flex; flex-direction: column; gap: 4px; }
.item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 9px;
  border-radius: 11px;
  transition: background .15s;
}
.item:hover { background: rgba(255,255,255,.05); }
.item.done .item-title { text-decoration: line-through; color: var(--muted); }

.check {
  flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px;
  border-radius: 6px; border: 1.5px solid rgba(255,255,255,.28);
  background: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: 11px; color: transparent;
  transition: all .15s;
}
.check:hover { border-color: var(--ok); color: rgba(74,222,128,.6); }
.item.done .check { background: rgba(74,222,128,.2); border-color: rgba(74,222,128,.5); color: var(--ok); }

.item-body { min-width: 0; flex: 1; }
.item-title { font-size: 13.5px; overflow-wrap: anywhere; }
.item-meta { margin-top: 3px; font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { padding: 1px 7px; border-radius: 6px; background: rgba(255,255,255,.07); }
.chip.late { background: rgba(255,107,107,.18); color: #ff9a9a; font-weight: 600; }
.chip.prio3 { background: rgba(255,157,92,.18); color: var(--warn); }
.chip.prio4 { background: rgba(255,107,107,.22); color: #ff8f8f; font-weight: 600; }

.panel-foot { margin-top: auto; padding-top: 6px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }
.panel-foot a { color: #aeb7ff; }
.empty { color: var(--muted); font-size: 13px; padding: 12px 4px; }
.empty.good { color: var(--ok); }

.foot { text-align: center; color: var(--muted); font-size: 12px; min-height: 16px; }

/* ------------------------------------------------------------ модалки */

.dlg {
  border: 1px solid var(--line);
  background: #12141c;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  width: min(440px, 92vw);
  box-shadow: var(--shadow);
}
.dlg::backdrop { background: rgba(5,6,10,.65); backdrop-filter: blur(3px); }
.dlg h3 { margin: 0 0 16px; font-size: 16px; }
.dlg label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.dlg input[type=text], .dlg select {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
}
.dlg input[type=text]:focus, .dlg select:focus { border-color: rgba(124,140,255,.55); }
.dlg select option { background: #12141c; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ghost-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
}
.ghost-btn:hover { color: var(--ink); border-color: rgba(255,255,255,.25); }
.primary-btn {
  border: 0; border-radius: 10px; padding: 8px 18px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #0d0f1a;
}

.icon-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.icon-preview {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  display: grid; place-items: center; overflow: hidden;
  font-weight: 700; color: #0d0f1a;
}
.icon-preview img { width: 100%; height: 100%; object-fit: contain; }
.icon-preview.letter { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.icon-actions { display: flex; flex-direction: column; gap: 7px; }
.icon-label { font-size: 12px; color: var(--muted); }
.icon-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

.bg-preview {
  height: 130px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04) var(--bg-image) center / cover;
  margin-bottom: 14px;
  display: grid; place-items: center;
  color: var(--muted); font-size: 12.5px;
}
.bg-buttons { display: flex; gap: 8px; margin-bottom: 18px; }
/* Подпись и значение в одну строку, ползунок под ними. */
.slider { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; }
.slider .val { color: var(--ink); font-weight: 600; }
.slider input[type=range] { grid-column: 1 / -1; width: 100%; }
.slider input[type=range] { accent-color: var(--accent); }

/* ------------------------------------------------------------ узкий экран */

@media (max-width: 1080px) {
  .columns { grid-template-columns: 1fr; }
  .col-right { flex-direction: row; }
  .col-right .panel { flex: 1; }
}

@media (max-width: 760px) {
  .pins { gap: 8px; }
  .shell { padding: 22px 14px 40px; gap: 16px; }
  .clock { font-size: 32px; }
  .col-right { flex-direction: column; }
  .omni-row { flex-wrap: wrap; }
  .omni-form { width: 100%; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}
