/* Оболочка приложения по макету дизайнера (pravki/alfred-granola-topnav.html):
   верхнее меню, окна. Общая для всех страниц приложения.
   С 05.11.2026 приложение занимает всё окно браузера: серого поля вокруг и рамки
   со скруглёнными углами больше нет (просьба владельца). */
:root {
    --g-bg: #f5f5f5;
    --g-subtle: #f9f9f9;
    --g-selected: #f0f0f0;
    --g-line: #e7e7e7;
    --g-text: #2c2c2c;
    --g-muted: #727272;
    --g-faint: #929292;
    --g-border: #bdbdbd;
    --g-accent: #ea2a2a;
    --g-accent-hover: #d92525;
    --g-accent-disabled: #f3b1b1;
    --g-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --g-serif: Georgia, serif;
}

html:has(body.g-shell) { height: 100%; background: var(--g-bg); }
body.g-shell {
    box-sizing: border-box;
    height: 100dvh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--g-bg);
    color: var(--g-text);
    font: 14px/1.5 var(--g-font);
}
.g-shell *, .g-shell *::before, .g-shell *::after { box-sizing: border-box; }
.g-shell [hidden] { display: none !important; }
.g-app {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}
.g-page { flex: 1; min-height: 0; overflow: auto; }

/* ---------- Верхнее меню ---------- */
.top-navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    min-height: 72px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--g-line);
    background: #fff;
    flex: none;
    font: 14px/1.5 var(--g-font);
    color: var(--g-text);
}
.top-navigation .brand { display: flex; align-items: center; width: max-content; border-radius: 8px; color: #111; }
.top-navigation .brand svg { display: block; width: 122px; height: auto; }
.top-navigation .brand:focus-visible,
.top-navigation .global-nav a:focus-visible { outline: 2px solid var(--g-muted); outline-offset: 2px; }
.top-navigation .global-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px;
    border-radius: 10px;
    background: var(--g-subtle);
}
.top-navigation .global-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 8px;
    color: var(--g-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 19.5px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .16s, color .16s;
}
.top-navigation .global-nav a:hover { background: var(--g-selected); }
.top-navigation .global-nav a[aria-current="page"] { background: var(--g-selected); color: var(--g-text); }
.top-navigation svg.g-icon { width: 18px; height: 18px; flex-shrink: 0; }
.top-navigation .nav-account {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    line-height: 18px;
    text-align: left;
    cursor: pointer;
}
.top-navigation .nav-account:focus-visible { outline: none; }
.top-navigation .nav-account:focus-visible .avatar { outline: 2px solid var(--g-muted); outline-offset: 2px; }
.top-navigation .nav-account:hover .avatar { background: var(--g-selected); }
.top-navigation .avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--g-line);
    border-radius: 50%;
    font-size: 10px;
    line-height: 15px;
    transition: background .16s;
}
.top-navigation .nav-account small { display: block; color: var(--g-muted); font-size: 10px; line-height: 15px; }

/* ---------- Окна ---------- */
dialog.g-dialog {
    /* margin:auto — центр экрана. Явно, потому что meetings.css обнуляет margin у всех
       элементов (* { margin: 0 }), и на странице «Встречи» окно уезжало в левый верхний угол. */
    margin: auto;
    width: min(580px, calc(100vw - 32px));
    max-height: 85dvh;
    padding: 0;
    border: 1px solid var(--g-line);
    border-radius: 14px;
    box-shadow: 0 20px 80px #00000018;
    background: #fff;
    color: var(--g-text);
    font: 14px/1.5 var(--g-font);
}
dialog.g-dialog[open] { display: flex; flex-direction: column; }
dialog.g-dialog::backdrop { background: #00000020; }
.g-dialog > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Сброс общего header { … } из meetings.css (тень, рамка, скругление, отступ снизу). */
    position: static;
    margin: 0;
    padding: 20px 24px;
    border: 0;
    border-bottom: 1px solid var(--g-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-shrink: 0;
}
.g-dialog h2 { margin: 0; font-size: 18px; font-weight: 500; line-height: 27px; letter-spacing: -.3px; }
.g-dialog .g-dialog-body { padding: 24px; overflow: auto; min-height: 0; }
.g-dialog > footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--g-line);
    flex-shrink: 0;
}
.g-dialog > footer:empty { display: none; }

/* Кнопки и поля — классы g-*, чтобы не задевать старые стили страниц. */
.g-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
    text-decoration: none;
    transition: background .16s, color .16s;
}
.g-btn:hover { background: var(--g-selected); }
.g-btn:focus-visible { outline: 2px solid var(--g-muted); outline-offset: 2px; }
.g-btn:disabled { opacity: .45; cursor: default; }
.g-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.g-btn-primary { background: var(--g-accent); color: #fff; font-weight: 500; }
.g-btn-primary:hover { background: var(--g-accent-hover); }
.g-btn-primary:disabled, .g-btn-primary:disabled:hover { background: var(--g-accent-disabled); color: #fff; opacity: 1; }
.g-btn-secondary { background: var(--g-selected); }
.g-btn-quiet { color: var(--g-muted); }
.g-btn-quiet.active { background: var(--g-selected); color: var(--g-text); }
.g-btn-danger { color: #bd2929; }
.g-btn-icon { width: 32px; height: 32px; min-height: 32px; padding: 7px; color: var(--g-muted); }

.g-helper { margin: 0 0 20px; color: var(--g-muted); font-size: 12px; line-height: 1.7; }
.g-error { margin: 0 0 12px; color: #bd2929; font-size: 12px; }
.g-label { display: flex; flex-direction: column; gap: 7px; margin: 0 0 16px; color: var(--g-muted); font-size: 12px; line-height: 18px; }
.g-input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--g-line);
    border-radius: 8px;
    background: #fff;
    color: var(--g-text);
    font: inherit;
    font-size: 13px;
    line-height: 1.6;
    outline: none;
}
.g-input::placeholder { color: var(--g-faint); }
.g-input:focus { border-color: var(--g-border); }
textarea.g-input { min-height: 180px; resize: vertical; }
.g-counter { margin: -6px 0 14px; color: var(--g-muted); font-size: 11px; line-height: 16.5px; }
.g-help { margin: 16px 0 0; padding: 12px 14px; border-radius: 8px; background: var(--g-subtle); color: var(--g-muted); font-size: 12px; line-height: 18px; }
.g-help summary { cursor: pointer; }
.g-help p { margin: 10px 0 0; line-height: 1.6; }

.g-menu-actions { display: flex; flex-direction: column; gap: 4px; }
.g-menu-actions a, .g-menu-actions button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    line-height: 19.5px;
    text-decoration: none;
    cursor: pointer;
}
.g-menu-actions a:hover, .g-menu-actions button:hover { background: var(--g-selected); }
.g-menu-actions svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--g-muted); }
.g-menu-actions hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--g-line); }

.g-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--g-line);
    font-size: 13px;
    line-height: 19.5px;
}
.g-list-item > .g-item-copy { flex: 1; min-width: 0; }
.g-item-copy strong { display: block; font-weight: 500; overflow-wrap: anywhere; }
.g-item-copy small {
    display: -webkit-box;
    margin-top: 4px;
    overflow: hidden;
    color: var(--g-muted);
    font-size: 11px;
    line-height: 16.5px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.g-list-item .g-btn { font-size: 11px; }
.g-list-empty { padding: 14px 0; color: var(--g-muted); font-size: 13px; }
.g-badge { color: var(--g-muted); font-size: 11px; white-space: nowrap; }

.g-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1000;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--g-text);
    color: #fff;
    font: 12px/1.5 var(--g-font);
    opacity: 0;
    transform: translate(-50%, 8px);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.g-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
    .top-navigation { gap: 12px; padding: 12px 16px; grid-template-columns: auto 1fr auto; }
    .top-navigation .global-nav a { padding: 8px 10px; font-size: 12px; }
    .top-navigation .nav-account > div { display: none; }
    .top-navigation .brand svg { width: 106px; }
}
@media (max-width: 480px) {
    .top-navigation { grid-template-columns: 1fr auto; }
    .top-navigation .global-nav { grid-row: 2; grid-column: 1 / -1; width: 100%; }
}

/* ---------- Перетаскиваемая граница колонок (pane-splitter.js) — как .mtg-splitter во «Встречах» ---------- */
.g-splitter { position: absolute; top: 0; bottom: 0; z-index: 5; width: 9px; margin-left: -4px; cursor: col-resize; touch-action: none; }
.g-splitter[hidden] { display: none; }
.g-splitter::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: var(--g-accent); opacity: 0; transition: opacity .16s; }
.g-splitter:hover::after, .g-splitter.is-active::after { opacity: 1; }
/* Пока тянем — не выделяем текст и не отдаём события полям (textarea перехватывала бы движение). */
.is-resizing { cursor: col-resize; user-select: none; }
.is-resizing > :not(.g-splitter) { pointer-events: none; }

/* ---------- Выпадающий список (g-select.js) ---------- */
.g-chevron { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; margin: -3px 0 0 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
select.g-native { display: none !important; }
.g-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--g-line);
    border-radius: 8px;
    background: var(--g-subtle);
    color: var(--g-text);
    font: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 18px;
    text-align: left;
    cursor: pointer;
}
.g-select > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-select:focus-visible { outline: 2px solid #aaa; outline-offset: 2px; }
.g-select:disabled { opacity: .45; cursor: default; }
.g-label > .g-select { width: 100%; min-height: 40px; margin-top: 6px; }
.g-popup {
    position: fixed;
    inset: auto;
    z-index: 1100;
    box-sizing: border-box;
    width: max-content;
    max-width: calc(100vw - 24px);
    max-height: min(400px, calc(100dvh - 24px));
    margin: 0;
    padding: 6px;
    overflow: auto;
    border: 1px solid var(--g-line);
    border-radius: 10px;
    background: #fff;
    color: var(--g-text);
    font: 12px/1.5 var(--g-font);
    box-shadow: 0 10px 32px #00000016;
}
.g-popup > button {
    position: relative;
    display: flex;
    width: 100%;
    padding: 9px 34px 9px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    white-space: normal;
    cursor: pointer;
}
.g-popup > button:hover { background: var(--g-selected); }
.g-popup > button:disabled { opacity: .45; cursor: default; }
.g-popup > button[aria-selected="true"] { background: var(--g-selected); font-weight: 500; }
.g-popup > button[aria-selected="true"]::after { content: '✓'; position: absolute; right: 12px; color: var(--g-muted); }
.g-popup > button:focus-visible { outline: 1px solid #999; outline-offset: -1px; background: var(--g-selected); }
.g-popup > .g-popup-group { padding: 10px 12px 4px; color: var(--g-muted); font-size: 11px; }

/* Раскрывающийся блок: шеврон справа, как в макете. */
.g-shell details > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; list-style: none; cursor: pointer; }
.g-shell details > summary::-webkit-details-marker { display: none; }
.g-shell details > summary::after { content: ''; width: 6px; height: 6px; flex: 0 0 6px; margin: -3px 2px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .16s; }
.g-shell details[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
.g-label > .g-select { color: inherit; }
