/* Мини-приложение NotDoneByOne.
   Палитра и характер — с notdonebyone.ru, но интерфейс спокойнее:
   меньше капса и хайрлайнов, больше воздуха, мягкие скругления.
   Красный оставлен акцентом и появляется только там, где важно. */

:root {
    --bg:          #0B0B0C;
    --surface:     #151517;
    --surface-2:   #1C1C1F;
    --surface-3:   #232327;
    --hairline:    rgba(255, 255, 255, 0.075);
    --hairline-2:  rgba(255, 255, 255, 0.14);

    --text:        #F5F5F7;
    --text-2:      #A1A1A6;
    --text-3:      #6E6E73;

    --accent:      #FC1C46;
    --accent-soft: rgba(252, 28, 70, 0.14);
    --green:       #32D74B;
    --amber:       #FFD60A;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
            system-ui, "Segoe UI", Roboto, sans-serif;

    --r-sm: 10px;
    --r:    14px;
    --r-lg: 20px;
    --r-xl: 28px;

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
    --s5: 24px; --s6: 32px; --s7: 44px;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body { display: flex; flex-direction: column; overflow: hidden; }

/* ─────────────────────────── Шапка */

.top {
    flex: 0 0 auto;
    padding: var(--s4) var(--s4) var(--s2);
    display: flex;
    align-items: center;
    gap: var(--s3);
}

.dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(252, 28, 70, 0.7);
    flex: 0 0 auto;
}

.top h1 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.top .who {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-3);
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─────────────────────────── Переключатель разделов */

.segmented {
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
    margin: var(--s2) var(--s4) var(--s3);
    padding: 3px;
    background: var(--surface);
    border-radius: 11px;
}

.segmented button {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 4px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background 0.22s var(--ease), color 0.22s var(--ease);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.segmented button.on {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ─────────────────────────── Область прокрутки */

.view {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 var(--s4) calc(var(--s6) + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}
.view[hidden] { display: none; }

.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: var(--s5) 0 var(--s2) var(--s1);
}
.eyebrow:first-child { margin-top: var(--s2); }

/* ─────────────────────────── Списки в духе iOS */

.card {
    background: var(--surface);
    border-radius: var(--r);
    overflow: hidden;
}
.card + .card { margin-top: var(--s3); }

.row {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: 13px var(--s4);
    position: relative;
    text-align: left;
    width: 100%;
    background: none;
    border: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}
.row + .row::before {
    content: '';
    position: absolute;
    left: var(--s4); right: 0; top: 0;
    height: 1px;
    background: var(--hairline);
}
button.row { cursor: pointer; transition: background 0.15s var(--ease); }
button.row:active { background: var(--surface-2); }

.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.row-sub {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.row-aside { flex: 0 0 auto; font-size: 14px; color: var(--text-2); text-align: right; }
.row-aside small { display: block; font-size: 12px; color: var(--text-3); }

.chev { flex: 0 0 auto; width: 7px; height: 12px; opacity: 0.32; }

/* Аватар-инициалы */
.ava {
    flex: 0 0 auto;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface-3);
    font-size: 13px; font-weight: 600; color: var(--text-2);
    letter-spacing: 0.02em;
}
.ava.accent { background: var(--accent-soft); color: #FF7D92; }

/* ─────────────────────────── Метки */

.pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: var(--surface-3);
    color: var(--text-2);
}
.pill.accent { background: var(--accent-soft); color: #FF8095; }
.pill.vacant { background: transparent; border: 1px dashed var(--hairline-2); color: var(--text-3); }
.pill.today  { background: rgba(50, 215, 75, 0.16); color: var(--green); }

/* ─────────────────────────── Структура команды */

.tree { padding-top: var(--s2); }

.node {
    position: relative;
    padding-left: calc(var(--depth, 0) * 18px);
    margin-bottom: var(--s2);
}

.node-body {
    background: var(--surface);
    border-radius: var(--r);
    padding: var(--s3) var(--s4);
    position: relative;
}
.node[data-top="1"] .node-body {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    box-shadow: inset 0 0 0 1px var(--hairline);
}

/* Соединительная линия к родителю */
.node[data-depth]:not([data-depth="0"])::before {
    content: '';
    position: absolute;
    left: calc(var(--depth, 0) * 18px - 10px);
    top: -6px; bottom: 50%;
    width: 1px;
    background: var(--hairline-2);
}
.node[data-depth]:not([data-depth="0"])::after {
    content: '';
    position: absolute;
    left: calc(var(--depth, 0) * 18px - 10px);
    top: 50%;
    width: 10px; height: 1px;
    background: var(--hairline-2);
}

.node-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.node-people { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.node-dept { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ─────────────────────────── Поля */

.field { margin-bottom: var(--s3); }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: 0 0 6px var(--s1);
}

input, textarea, select {
    width: 100%;
    padding: 13px var(--s4);
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--r);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;   /* 16px, иначе iOS зумит при фокусе */
    outline: none;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
input:focus, textarea:focus { border-color: var(--hairline-2); background: var(--surface-2); }
input::placeholder { color: var(--text-3); }

.hint { font-size: 13px; color: var(--text-3); margin: 6px 0 0 var(--s1); line-height: 1.4; }

/* ─────────────────────────── Кнопки */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    width: 100%;
    padding: 14px var(--s4);
    border: 0;
    border-radius: var(--r);
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform 0.12s var(--ease), opacity 0.18s var(--ease);
}
.btn:active { transform: scale(0.985); opacity: 0.9; }
.btn:disabled { opacity: 0.4; transform: none; }

.btn.quiet { background: var(--surface); color: var(--text); }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--hairline); }

/* ─────────────────────────── Выбор ролей */

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }

.chip {
    padding: 8px 13px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.chip.on { background: var(--accent); color: #fff; }

/* ─────────────────────────── Карточка человека, выезжающая снизу */

.sheet-back {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s var(--ease);
    z-index: 40;
}
.sheet-back.open { opacity: 1; pointer-events: auto; }

.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: 0 -1px 0 var(--hairline);
    padding: var(--s2) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.34s var(--ease);
    z-index: 41;
}
.sheet.open { transform: translateY(0); }

.grabber {
    width: 36px; height: 5px;
    border-radius: 999px;
    background: var(--hairline-2);
    margin: var(--s2) auto var(--s4);
}

.sheet h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--s1); }
.sheet .sub { font-size: 14px; color: var(--text-3); margin-bottom: var(--s5); }

/* ─────────────────────────── Служебное */

.empty {
    padding: var(--s7) var(--s4);
    text-align: center;
    color: var(--text-3);
    font-size: 14px;
    line-height: 1.6;
}
.empty b { display: block; color: var(--text-2); font-weight: 600; margin-bottom: 6px; font-size: 15px; }

.note {
    padding: var(--s3) var(--s4);
    background: var(--surface);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
}
.note.ok    { box-shadow: inset 0 0 0 1px rgba(50, 215, 75, 0.3); }
.note.error { box-shadow: inset 0 0 0 1px rgba(252, 28, 70, 0.35); }

.spin {
    width: 18px; height: 18px;
    border: 2px solid var(--hairline-2);
    border-top-color: var(--text-2);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: var(--s6) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fade { animation: fade 0.3s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
