* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--ge-color-bg, #faf9f8); color: var(--ge-color-text, #201f1e);
  min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.muted { color: var(--ge-color-text-secondary, #605e5c); }
.small { font-size: 12px; }
a { color: var(--ge-color-brand, #4f46e5); }

.mark { width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--ge-brand-gradient, linear-gradient(135deg, #4f46e5, #7c6cf0));
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 17px; }
.mark.big { width: 56px; height: 56px; border-radius: 14px; font-size: 30px; }

/* Хедер-канон: sticky, высота 56px; вафля крайней слева, бренд после, аккаунт-меню справа */
.topbar { display: flex; align-items: center; gap: 14px; height: 56px;
  padding: 0 18px; background: var(--ge-color-surface, #fff);
  border-bottom: 1px solid var(--ge-color-border, #e1dfdd);
  position: sticky; top: 0; z-index: 40; }
.rs-header-left { display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.rs-header-right { display: flex; align-items: center; }
.navbtn { font-size: 13px; cursor: pointer; color: var(--ge-color-text, #201f1e);
  padding: 5px 11px; border-radius: 7px; border: 1px solid transparent; line-height: 1; white-space: nowrap; }
.navbtn:hover { background: var(--ge-color-bg, #f3f2f1); border-color: var(--ge-color-border, #e1dfdd); }
.navbtn.active { background: var(--ge-color-brand, #4f46e5); color: #fff; border-color: transparent; }
/* «Назад» — заметная кнопка возврата, единый паттерн во всех под-разделах */
.backbtn { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--ge-color-brand, #4f46e5); padding: 5px 11px; border-radius: 7px;
  border: 1px solid var(--ge-color-border, #e1dfdd); background: var(--ge-color-surface, #fff); margin-right: 10px; }
.backbtn:hover { background: var(--ge-color-bg, #f3f2f1); }
.adminview { flex: 1; padding: 18px 22px; overflow: auto; }
.help { max-width: 760px; line-height: 1.5; }
.help h3 { margin: 18px 0 6px; font-size: 15px; }
.help ul { margin: 0 0 8px; padding-left: 20px; }
.help li { margin: 3px 0; }
.help code { background: var(--ge-color-surface, #f3f2f1); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--ge-color-surface, #fff); border: 1px solid var(--ge-color-border, #e1dfdd);
  border-radius: var(--ge-radius-md, 8px); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--ge-color-brand, #4f46e5); }
.stat .l { font-size: 12px; color: var(--ge-color-text-secondary, #605e5c); margin-top: 4px; }

.btn { display: inline-block; background: var(--ge-color-brand, #4f46e5); color: #fff;
  border: none; border-radius: var(--ge-radius-md, 8px); padding: 9px 16px;
  font-size: 14px; cursor: pointer; text-decoration: none; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:hover { filter: brightness(1.05); }

.guest { max-width: 520px; margin: 8vh auto; text-align: center; padding: 0 20px; }
.guest .mark.big { margin: 0 auto 16px; }
.guest h1 { font-size: 26px; margin: 0 0 8px; }

.work { flex: 1; display: grid; grid-template-columns: 312px 1fr; min-height: 0; align-items: start; }
/* Сайдбар-канон: sticky под хедером 56px; не скроллится с телом; ширина 312px (+20%). */
.sidebar { background: var(--ge-color-surface, #fff); border-right: 1px solid var(--ge-color-border, #e1dfdd);
  position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px - var(--gsf-footer-h, 52px)); overflow-y: auto; }
.side-head { padding: 14px 16px; font-weight: 700; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ge-color-text-secondary, #605e5c); }
.projects { list-style: none; margin: 0; padding: 0; }
.projects li { padding: 10px 16px; cursor: pointer; font-size: 14px;
  border-left: 3px solid transparent; }
.projects li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.projects li:hover { background: var(--ge-color-bg, #faf9f8); }
.ptag { font-size: 10px; padding: 1px 6px; border-radius: 999px; flex: none;
  background: var(--ge-color-bg, #f3f2f1); color: var(--ge-color-text-secondary, #605e5c);
  border: 1px solid var(--ge-color-border, #e1dfdd); }
.projects li.active { background: var(--ge-color-bg, #faf9f8);
  border-left-color: var(--ge-color-brand, #4f46e5); font-weight: 600; }

.content { padding: 18px 22px; overflow: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ge-color-border, #e1dfdd); margin-bottom: 14px; }
.tab { background: none; border: none; padding: 8px 14px; cursor: pointer; font-size: 14px;
  color: var(--ge-color-text-secondary, #605e5c); border-bottom: 2px solid transparent; }
.tab.active { color: var(--ge-color-brand, #4f46e5); border-bottom-color: var(--ge-color-brand, #4f46e5); font-weight: 600; }
.panel-head { font-size: 16px; margin-bottom: 12px; }
.add { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.add input { padding: 7px 10px; border: 1px solid var(--ge-color-border, #e1dfdd);
  border-radius: var(--ge-radius-sm, 6px); font-size: 13px; }
.add input[type=text], #tTitle { flex: 1; min-width: 200px; }

.tasks { display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--ge-color-surface, #fff); border: 1px solid var(--ge-color-border, #e1dfdd);
  border-radius: var(--ge-radius-md, 8px); padding: 10px 14px; display: grid;
  grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; }
.row .title { font-size: 14px; font-weight: 600; }
.row .dates { font-size: 12px; color: var(--ge-color-text-secondary, #605e5c); }
.row select, .row input[type=number] { padding: 4px 8px; border: 1px solid var(--ge-color-border, #e1dfdd);
  border-radius: 6px; font-size: 12px; }
.bar { height: 6px; background: var(--ge-color-border, #e1dfdd); border-radius: 999px; overflow: hidden; width: 90px; }
.bar > i { display: block; height: 100%; background: var(--ge-color-brand, #4f46e5); }
.empty { padding: 24px; text-align: center; color: var(--ge-color-text-secondary, #605e5c); }

/* Футер — общий suite-footer.js (фиксированный внизу, токены семейства). */
.err { background: var(--ge-color-err-bg, #fde7e9); color: var(--ge-color-err, #a4262c); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* Правый drawer для правки свойств (BRAND-KIT §4 п.6: не инлайн, не нативные диалоги) */
.drawer-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1000; display: flex; justify-content: flex-end; }
.drawer { background: var(--ge-color-surface, #fff); width: 460px; max-width: calc(100vw - 24px); height: 100%;
  box-shadow: -8px 0 30px rgba(0,0,0,.18); display: flex; flex-direction: column; animation: drawerIn .16s ease-out; }
@keyframes drawerIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--ge-color-border, #e1dfdd); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-close { cursor: pointer; font-size: 20px; line-height: 1; color: var(--ge-color-text-secondary, #605e5c);
  background: none; border: none; padding: 4px 8px; border-radius: 6px; }
.drawer-close:hover { background: var(--ge-color-bg, #f3f2f1); }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--ge-color-border, #e1dfdd); }
.drawer label { display: block; font-size: 12px; color: var(--ge-color-text-secondary, #605e5c); margin: 0 0 4px; }
.drawer .fld { margin-bottom: 12px; }
.drawer input, .drawer textarea, .drawer select { width: 100%; padding: 7px 10px;
  border: 1px solid var(--ge-color-border, #e1dfdd); border-radius: 6px; font-size: 14px; font-family: inherit; }
.drawer textarea { min-height: 70px; resize: vertical; }

/* In-page модалка (вместо prompt/confirm — запрет браузерных диалогов) */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 1000; }
.modal { background: var(--ge-color-surface, #fff); border-radius: var(--ge-radius-lg, 12px);
  padding: 20px; width: 380px; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal label { display: block; font-size: 12px; color: var(--ge-color-text-secondary, #605e5c); margin: 10px 0 4px; }
.modal input, .modal select { width: 100%; padding: 8px 10px; border: 1px solid var(--ge-color-border, #e1dfdd); border-radius: 6px; font-size: 14px; }
.modal .row-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btn.ghost { background: none; color: var(--ge-color-text, #201f1e); border: 1px solid var(--ge-color-border, #e1dfdd); }

/* Тосты (вместо alert) */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1100; }
.toast { background: var(--ge-color-surface, #fff); border: 1px solid var(--ge-color-border, #e1dfdd);
  border-left: 4px solid var(--ge-color-brand, #4f46e5); border-radius: 8px; padding: 10px 14px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); max-width: 320px; }
.toast.err { border-left-color: #a4262c; color: #a4262c; background: #fff; }
