/* Компоненты. Все значения берутся из tokens.css — здесь ни одного цвета
 * или размера напрямую.
 *
 * Повадка Notion: белый лист, волосяные линии, цвет только там, где несёт
 * смысл, переходы почти мгновенные. Тишина вокруг содержания, а не оформление
 * поверх него.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('/static/tokens.css');

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 var(--t-md)/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ================= каркас ================= */

.shell { display: flex; min-height: 100%; }

/* ---- боковая колонка ---- */

.side {
    width: var(--sidebar-w);
    flex: none;
    background: var(--bg-sunk);
    border-right: 1px solid var(--line);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 12px;
    font-size: var(--t-md);
    font-weight: 600;
    color: var(--text);
}
.side .brand .mark {
    width: 20px; height: 20px;
    flex: none;
    border-radius: var(--r-sm);
    background: var(--text);
    color: var(--bg);
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    font-size: var(--t-md);
    color: var(--text-2);
    transition: background var(--ease), color var(--ease);
}
.side nav a:hover { background: var(--bg-hover); color: var(--text); }
.side nav a.on { background: var(--bg-active); color: var(--text); font-weight: 500; }
svg.ic { width: 16px; height: 16px; flex: none; opacity: .75; }
.side nav a.on svg.ic { opacity: 1; }
.side nav a .cnt {
    margin-left: auto;
    font-size: var(--t-xs);
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.side nav a.on .cnt { color: var(--text-2); }

.side .foot { margin-top: auto; padding-top: 10px; }
.side .who {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    font-size: var(--t-sm);
    color: var(--text-2);
}
.side .who .av {
    width: 20px; height: 20px; flex: none;
    border-radius: 50%;
    background: var(--pill-blue-bg);
    color: var(--pill-blue-ink);
    display: grid; place-items: center;
    font-size: 11px; font-weight: 600;
}

.ghost {
    background: none; border: 0; cursor: pointer;
    font: inherit; font-size: var(--t-sm);
    color: var(--text-2);
    padding: 6px 8px;
    border-radius: var(--r-sm);
    width: 100%;
    text-align: left;
    display: flex; align-items: center; gap: 8px;
    transition: background var(--ease), color var(--ease);
}
.ghost:hover { background: var(--bg-hover); color: var(--text); }


/* ---- страница ---- */

.page { flex: 1; min-width: 0; }
.page .inner {
    max-width: var(--page-w);
    margin: 0 auto;
    padding: 40px 60px 80px;
    animation: rise .18s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

h1.title {
    font-size: var(--t-title);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
    margin: 0 0 4px;
}
.sub { color: var(--text-3); font-size: var(--t-md); margin: 0 0 26px; }
.sub b { color: var(--text-2); font-weight: 500; }
.sub .alarm { color: var(--pill-red-ink); font-weight: 500; }

/* ================= фильтры ================= */

.bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }

select, input[type="text"], input[type="search"] {
    font: inherit;
    font-size: var(--t-md);
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 5px 9px;
    transition: border-color var(--ease), box-shadow var(--ease);
}
select { cursor: pointer; }
input[type="search"] { flex: 1; min-width: 180px; }
select:hover, input:hover { border-color: var(--text-3); }
select:focus, input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ================= таблица ================= */

table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    font-size: var(--t-sm);
    font-weight: 400;
    color: var(--text-3);
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
tbody td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
tbody tr { transition: background var(--ease); }
tbody tr:hover td { background: var(--bg-hover); }

td.id { width: 1%; color: var(--text-3); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
td.who { white-space: nowrap; }
td.what a { font-weight: 400; }
td.what a:hover { text-decoration: underline; text-underline-offset: 2px; }
td.when { white-space: nowrap; color: var(--text-2); font-size: var(--t-sm); }
td.when .none { color: var(--text-3); }
td.st { width: 1%; white-space: nowrap; }

.avatar {
    display: inline-grid; place-items: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 11px; font-weight: 600;
    margin-right: 7px;
    vertical-align: -5px;
    background: var(--pill-gray-bg);
    color: var(--pill-gray-ink);
}

/* ================= метки ================= */

.pill {
    display: inline-block;
    font-size: var(--t-xs);
    line-height: 18px;
    padding: 0 7px;
    border-radius: var(--r-sm);
    background: var(--pill-gray-bg);
    color: var(--pill-gray-ink);
    white-space: nowrap;
}
.pill.red   { background: var(--pill-red-bg);   color: var(--pill-red-ink); }
.pill.amber { background: var(--pill-amber-bg); color: var(--pill-amber-ink); }
.pill.green { background: var(--pill-green-bg); color: var(--pill-green-ink); }
.pill.blue  { background: var(--pill-blue-bg);  color: var(--pill-blue-ink); }

/* ================= карточка ================= */

.meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 26px; }
.meta .row { display: flex; align-items: center; width: 100%; min-height: 30px; }
.meta .k {
    width: 148px; flex: none;
    color: var(--text-3);
    font-size: var(--t-md);
}
.meta .v { font-size: var(--t-md); }

.quote {
    background: var(--bg-inset);
    border-radius: var(--r-md);
    padding: 14px 16px;
    white-space: pre-wrap;
    line-height: 1.6;
    margin-bottom: 26px;
}

h2.sec {
    font-size: var(--t-lg);
    font-weight: 600;
    margin: 32px 0 8px;
    letter-spacing: -.01em;
}

.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
    display: flex;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    font-size: var(--t-md);
}
.feed li:last-child { border-bottom: 0; }
.feed time {
    flex: none; width: 118px;
    color: var(--text-3);
    font-size: var(--t-sm);
    font-variant-numeric: tabular-nums;
}
.feed .note { color: var(--text-2); }

/* ================= кнопки ================= */

.acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 6px; }

button.btn {
    font: inherit;
    font-size: var(--t-md);
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 6px 12px;
    box-shadow: var(--shadow);
    transition: background var(--ease), border-color var(--ease);
}
button.btn:hover { background: var(--bg-hover); }
button.btn:active { background: var(--bg-active); }
button.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.btn.primary {
    background: var(--accent); color: var(--accent-ink);
    border-color: transparent;
}
button.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
button.btn.quiet { box-shadow: none; border-color: transparent; color: var(--text-2); }
button.btn.quiet:hover { background: var(--bg-hover); color: var(--text); }
button.btn.warn:hover { color: var(--pill-red-ink); background: var(--pill-red-bg); border-color: transparent; }

/* ================= пусто и вход ================= */

.blank {
    text-align: center;
    padding: 64px 0;
    color: var(--text-3);
    font-size: var(--t-md);
}
.blank .big { font-size: 26px; margin-bottom: 10px; opacity: .5; }

.gate {
    max-width: 380px;
    margin: 0 auto;
    padding: 96px 20px;
    text-align: center;
}
.gate .mark {
    width: 44px; height: 44px; margin: 0 auto 20px;
    border-radius: var(--r-lg);
    background: var(--text); color: var(--bg);
    display: grid; place-items: center;
    font-size: 19px; font-weight: 700;
}
.gate h1 { font-size: 22px; font-weight: 600; margin: 0 0 10px; letter-spacing: -.01em; }
.gate p { color: var(--text-2); margin: 0 0 8px; }
.gate .err { color: var(--pill-red-ink); font-weight: 500; }

/* ================= телефон ================= */

.side .toggle { display: none; }

@media (max-width: 820px) {
    .shell { flex-direction: column; }
    .side {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        align-items: center;
        gap: 4px;
        padding: 8px 10px;
        overflow-x: auto;
    }
    .side .brand { padding: 0 10px 0 2px; }
    .side .brand span { display: none; }
    .side nav { flex-direction: row; gap: 2px; }
    .side nav a .cnt { margin-left: 4px; }
    .side .foot { margin-top: 0; margin-left: auto; padding-top: 0; display: flex; }
    .side .who span { display: none; }
    .ghost { width: auto; }
    .ghost span { display: none; }

    .page .inner { padding: 24px 16px 60px; }
    h1.title { font-size: 26px; }
    .hide-sm { display: none; }
    .meta .k { width: 116px; }
    .feed li { flex-direction: column; gap: 2px; }
    .feed time { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
