/* Фирменный стиль Меренги (brand/): олива, чернила, молоко, ягода, лист. Светлая тема — принудительно. */
:root{
  --olive:#8E8E70; --olive-d:#6E6E55; --ink:#29221C; --beige:#DBD2CA; --milk:#FCF9F9;
  --berry:#E31E24; --leaf:#009846; --line:#E6E1DB; --muted:#8b857f; --card:#FFFFFF;
  --amber:#B8860B; --nav-h:64px;
  --safe-top: calc(var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: var(--tg-safe-area-inset-bottom, 0px);
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--milk);color:var(--ink);font:15px/1.45 "IBM Plex Sans",-apple-system,system-ui,sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}
body{min-height:100vh}
.brand-title{font-family:"Playfair Display",Georgia,serif;font-weight:600;font-size:22px;letter-spacing:-.01em}
.muted{color:var(--muted)} .small{font-size:12.5px} .mono{font-family:ui-monospace,Menlo,monospace}
.screen{min-height:100vh;padding:24px}
.center{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:10px}
.logo-dot{width:56px;height:56px;border-radius:50%;background:var(--olive);position:relative}
.logo-dot::after{content:"";position:absolute;inset:16px;border-radius:50%;background:var(--milk)}

#hdr{position:sticky;top:0;z-index:5;background:var(--milk);padding:calc(10px + var(--safe-top)) 16px 8px;border-bottom:1px solid var(--line)}
.hdr-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
#main{padding:12px 16px calc(var(--safe-bottom) + 24px)}

.btn{border:0;border-radius:12px;padding:10px 14px;font:inherit;font-weight:600;cursor:pointer;background:var(--olive);color:#fff}
.btn.secondary{background:#fff;color:var(--ink);border:1px solid var(--line)}
.btn.danger{background:var(--berry);color:#fff}
.btn.sm{padding:7px 11px;font-size:13px;border-radius:10px}
.btn-ghost{border:1px solid var(--line);background:#fff;border-radius:10px;width:36px;height:36px;font-size:18px;color:var(--olive-d);cursor:pointer}
.btn:disabled{opacity:.5}

.cards{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}
.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px 14px}
.card .k{font-size:12px;color:var(--muted)} .card .v{font-size:22px;font-weight:700;line-height:1.2;margin-top:2px}
.card.alert .v{color:var(--berry)} .card.ok .v{color:var(--leaf)}

.tabs{display:flex;gap:6px;margin:4px 0 12px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:4px}
.tabs button{flex:1;border:0;background:none;font:inherit;font-size:13.5px;padding:7px;border-radius:9px;color:var(--muted)}
.tabs button.active{background:var(--olive);color:#fff;font-weight:600}

.list{display:flex;flex-direction:column;gap:8px}
.row{background:#fff;border:1px solid var(--line);border-radius:14px;padding:12px 14px;display:flex;gap:10px;align-items:flex-start}
.row .ic{font-size:18px;width:24px;flex:none;line-height:1.3}
.row .body{flex:1;min-width:0}
.row .t{font-weight:600} .row .d{color:var(--muted);font-size:13px;margin-top:2px}
.row.tap{cursor:pointer}
.badge{display:inline-block;font-size:11px;padding:2px 7px;border-radius:999px;background:var(--beige);color:var(--ink);margin-left:6px;vertical-align:middle}
.badge.open{background:#fde8e9;color:var(--berry)} .badge.mom{background:#f1f0e9;color:var(--olive-d)} .badge.manual{background:#e6f4ec;color:var(--leaf)}
.badge.kind{background:#f1f0e9;color:var(--olive-d)} .badge.admin{background:var(--ink);color:#fff}

h2{font-size:15px;font-weight:600;margin:16px 0 8px;color:var(--olive-d);text-transform:uppercase;letter-spacing:.04em}
.empty{padding:26px 16px;text-align:center;color:var(--muted);background:#fff;border:1px dashed var(--line);border-radius:14px}
.note{font-size:12.5px;color:var(--muted);margin:10px 2px}

.sheet{position:fixed;inset:0;z-index:20}
.sheet-bg{position:absolute;inset:0;background:rgba(41,34,28,.35)}
.sheet-body{position:absolute;left:0;right:0;bottom:0;max-height:88vh;overflow:auto;background:var(--milk);border-radius:18px 18px 0 0;padding:8px 16px calc(20px + var(--safe-bottom))}
.sheet-grip{width:40px;height:4px;border-radius:2px;background:var(--beige);margin:6px auto 12px}

.field{margin:10px 0} .field label{display:block;font-size:12.5px;color:var(--muted);margin-bottom:4px}
.field input[type=text],.field input[type=number],.field select{width:100%;font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#fff}
.chk{display:flex;align-items:center;gap:8px;padding:8px 0;font-size:14.5px}
.chk input{width:18px;height:18px;accent-color:var(--olive-d)}
.actions{display:flex;gap:8px;margin-top:14px} .actions .btn{flex:1}

#toast{position:fixed;left:16px;right:16px;top:calc(12px + var(--safe-top));z-index:30;background:var(--ink);color:#fff;padding:10px 14px;border-radius:12px;font-size:14px;box-shadow:0 6px 20px rgba(0,0,0,.2)}
#toast.err{background:var(--berry)}
.floor{margin:14px 0 6px;font-weight:600;color:var(--olive-d)}
.chamber{display:flex;justify-content:space-between;align-items:center;gap:10px}
.chamber .name{font-weight:600;font-size:14.5px}
.chamber .meta{font-size:12.5px;color:var(--muted)}
.chamber .open{color:var(--berry);font-weight:700}

/* главный экран — список разделов, замок там, где нет доступа */
#hdr-home{cursor:pointer}
.sections{display:flex;flex-direction:column;gap:10px}
.sec{display:flex;align-items:center;gap:14px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:16px;cursor:pointer}
.sec .sic{font-size:28px;width:40px;text-align:center;flex:none}
.sec .st{font-weight:600;font-size:16px}
.sec .sd{color:var(--muted);font-size:13px;margin-top:2px}
.sec .arrow{margin-left:auto;color:var(--beige);font-size:20px}
.sec.locked{background:var(--milk)}
.sec.locked .st{color:var(--muted)}
.sec.locked .sic{opacity:.7}
.hello{margin:6px 0 16px;font-size:15px}

.hdr-btns{display:flex;gap:8px}
.menu{display:flex;flex-direction:column;gap:8px}
.menu .row{align-items:center}
.switch{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;background:#fff;border:1px solid var(--line);border-radius:14px}
.switch input{width:20px;height:20px;accent-color:var(--olive-d)}
