:root {
    --brand-purple: #817ba4;
    --brand-teal: #7ccab9;
    --brand-gray: #636162;
    --bg: #f3f2f7;
    --bg-deep: #e7e5ef;
    --ink: #636162;
    --ink-strong: #3f3e40;
    --muted: #636162;
    --line: #c9c6d2;
    --card: #ffffff;
    --accent: #817ba4;
    --accent-deep: #6a6490;
    --teal: #7ccab9;
    --teal-deep: #3f8a7c;
    --teal-soft: #e7f6f2;
    --purple-soft: #eeecf4;
    --warn: #a35a5a;
    --ok: #3f8a7c;
    --shadow: 0 16px 40px rgba(63, 62, 64, 0.12);
    --serif: "Literata", Georgia, serif;
    --sans: "Outfit", "Segoe UI", sans-serif;
    --page-max: 1320px;
    --side-width: 250px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(1000px 480px at 100% -8%, rgba(129, 123, 164, 0.16) 0%, transparent 55%),
        radial-gradient(800px 420px at 0% 100%, rgba(124, 202, 185, 0.14) 0%, transparent 50%),
        var(--bg);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
}
body.app {
    height: 100vh;
    overflow: hidden;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; color: var(--ink-strong); }
h1 { font-size: 2rem; line-height: 1.15; margin: 0.15rem 0 0; }
h2 { font-size: 1.25rem; margin: 0 0 0.8rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.35rem; }
a { color: var(--accent-deep); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .button, a.button, a.ghost, .ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 0;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.7rem 1.15rem;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
}
button:hover, .button:hover, a.button:hover { background: var(--accent-deep); color: #fff; }
.ghost, button.ghost, a.ghost, a.button.ghost, .search-actions button {
    background: transparent;
    color: var(--accent-deep);
    border: 1px solid var(--line);
}
.ghost:hover, button.ghost:hover, a.ghost:hover, a.button.ghost:hover, .search-actions button:hover {
    border-color: var(--teal);
    color: var(--teal-deep);
    background: var(--teal-soft);
}
.button.small, .ghost.small, a.button.small, a.ghost.small,
button.small {
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
}
button:disabled { opacity: 0.6; cursor: wait; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
}
textarea { resize: vertical; min-height: 180px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(124, 202, 185, 0.45);
    border-color: var(--teal);
}

.mobile-bar,
.side-backdrop {
    display: none;
}
.shell {
    display: grid;
    grid-template-columns: var(--side-width) minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.side {
    padding: 1.25rem 1rem;
    background: #2c2b2d;
    color: #f4f4f5;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.side a { color: #e4e3e7; text-decoration: none; }
.brand { display: flex; gap: 0.75rem; align-items: center; color: white !important; }
.brand strong, .brand small { display: block; }
.brand strong {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 560;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.brand small { color: #b8b7bc; font-size: 0.78rem; margin-top: 0.12rem; }
.brand-mark {
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #6a6490 0%, var(--brand-purple) 45%, var(--brand-teal) 100%);
    color: #fff;
    font-family: var(--serif);
    font-weight: 680;
    font-size: 1.15rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
}
.side nav { display: flex; flex-direction: column; gap: 0.25rem; }
.side nav a { padding: 0.55rem 0.7rem; border-radius: 10px; }
.side nav a.active, .side nav a:hover {
    background: rgba(124, 202, 185, 0.2);
    color: white;
}
.side nav a.side-cta {
    display: flex;
    margin-bottom: 0.55rem;
    padding: 0.75rem 0.9rem;
    border-radius: 999px;
    text-align: center;
    justify-content: center;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff !important;
    background: linear-gradient(135deg, var(--brand-teal), var(--brand-purple));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}
.side nav a.side-cta:hover,
.side nav a.side-cta.active {
    color: #fff !important;
    filter: brightness(1.08);
    background: linear-gradient(135deg, var(--brand-teal), var(--brand-purple));
}
.side-user {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0;
    padding: 0.55rem 0.55rem;
    border-radius: 14px;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.side-user:hover,
.side-user.active {
    background: rgba(124, 202, 185, 0.16);
    border-color: rgba(124, 202, 185, 0.28);
}
.side-avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(145deg, var(--brand-purple), var(--brand-teal));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.side-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
.side-user-meta strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-user-meta small {
    color: #b8b7bc;
    font-size: 0.75rem;
}
.side-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.side-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e4e3e7 !important;
    font-weight: 600;
    background: transparent;
}
.side-logout:hover {
    background: rgba(163, 90, 90, 0.22);
    border-color: rgba(163, 90, 90, 0.45);
    color: #fff !important;
}
.main {
    padding: 1.6rem 1.8rem 3rem;
    max-width: var(--page-max);
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.page-head, .category-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--ink); font-weight: 600; }
.lede { color: var(--ink); }
.muted { color: var(--ink); opacity: 0.85; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.1rem 1.15rem 1.2rem;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin-top: 1.2rem; }
.stats article {
    background: var(--card);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-top: 3px solid var(--teal);
}
.stats span { color: var(--muted); font-size: 0.85rem; }
.stats strong { display: block; font-family: var(--serif); font-size: 2rem; color: var(--brand-purple); }

.dash-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.35rem;
    margin: 1.1rem 0 0;
    padding: 0.85rem 0 1.15rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 0.95rem;
}
.dash-metrics strong {
    color: var(--ink-strong);
    font-weight: 600;
    margin-right: 0.25rem;
}
.dash-section-title {
    margin: 0;
    font-size: 1.1rem;
}
.dash-week-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1.1rem;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
    color: var(--ink);
}
.dash-week-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
}
.dash-week-item strong {
    margin-left: 0.3rem;
    color: var(--ink-strong);
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
th, td {
    text-align: left;
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.inline-form, .filter-grid { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; }
.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grow { flex: 1; min-width: 220px; }
.stack, .stack-lg { display: grid; gap: 0.8rem; }
.narrow { max-width: 460px; }
.auth-card {
    width: min(440px, calc(100% - 2rem));
    margin: 8vh auto;
    background: var(--card);
    border-radius: 24px;
    padding: 1.6rem;
    box-shadow: var(--shadow);
}
body.bare { min-height: 100vh; }
.flash { padding: 0.75rem 0.9rem; border-radius: 12px; margin: 0 0 1rem; }
.flash-ok { background: var(--teal-soft); color: var(--teal-deep); }
.flash-error, .form-error { background: #f8eaea; color: var(--warn); }
.form-error { padding: 0.7rem 0.8rem; border-radius: 12px; }
.search-results {
    margin-top: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    max-height: 280px;
    overflow: auto;
    z-index: 4;
    position: relative;
    box-shadow: var(--shadow);
}
.search-hit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: left;
    background: transparent;
    color: var(--ink-strong);
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 0.9rem;
    cursor: pointer;
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover { background: var(--purple-soft); }
.search-hit-name {
    font-weight: 600;
    color: var(--ink-strong);
    line-height: 1.3;
}
.search-hit-chip {
    flex: 0 0 auto;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--teal-soft);
    color: var(--teal-deep);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
}
.search-actions { display: flex; gap: 0.4rem; }
.note-read { white-space: normal; font-size: 1.05rem; line-height: 1.7; }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.meta-row span { background: var(--purple-soft); color: var(--accent-deep); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.9rem; }
.picked { margin: 0 0 0.4rem; padding-left: 1.1rem; }
.option-edit { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; align-items: center; margin: 0.45rem 0; }
.option-admin-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.option-admin-block {
    padding-top: 0.35rem;
    border-top: 1px solid var(--line);
}
.option-admin-block:first-child {
    border-top: 0;
    padding-top: 0;
}
.option-admin-head {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f7f6fa;
    color: inherit;
    cursor: pointer;
    text-align: left;
    box-shadow: none;
}
.option-admin-head:hover {
    background: var(--purple-soft);
    color: inherit;
}
.option-admin-block.is-open .option-admin-head {
    border-color: rgba(129, 123, 164, 0.45);
    background: var(--purple-soft);
}
.option-admin-chevron {
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--accent-deep);
    border-bottom: 2px solid var(--accent-deep);
    transform: rotate(-45deg);
    transition: transform 0.18s ease;
    flex: 0 0 auto;
}
.option-admin-block.is-open .option-admin-chevron {
    transform: rotate(45deg);
}
.option-admin-head h2 {
    margin: 0;
    flex: 1;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-deep);
}
.option-admin-body {
    margin-top: 0.65rem;
    padding: 0 0.15rem 0.2rem;
}
.option-admin-empty { margin: 0 0 0.55rem; }
.option-admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.55rem;
    align-items: center;
    margin: 0 0 0.45rem;
}
.option-admin-row input[type="text"] {
    margin: 0;
    min-height: 2.35rem;
    border-radius: 999px;
    background: #f7f6fa;
    padding: 0.5rem 0.9rem;
}
.option-admin-row input[type="text"]:focus {
    background: #fff;
}
.option-active {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f0efef;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.option-active input {
    width: auto;
    margin: 0;
    accent-color: var(--teal-deep);
}
.option-active.is-on {
    background: var(--teal-soft);
    border-color: rgba(63, 138, 124, 0.35);
    color: var(--teal-deep);
}
.option-admin-add {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--line);
}
.option-admin-add-top {
    margin-top: 0;
    margin-bottom: 0.55rem;
    padding-top: 0;
    padding-bottom: 0.55rem;
    border-top: 0;
    border-bottom: 1px dashed var(--line);
}
.option-add-spacer { width: 4.5rem; }
.check { flex-direction: row; align-items: center; gap: 0.35rem; }
.check input { width: auto; }
.pager { display: flex; gap: 0.8rem; align-items: center; }
.setup-steps { padding-left: 1.1rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.row-actions form.inline { display: inline; margin: 0; }
.row-actions .ghost { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--teal-soft); color: var(--teal-deep); padding: 0.15rem 0.4rem; border-radius: 6px; }
.hint.ok { color: var(--teal-deep); font-weight: 500; }
.card-title { margin: 0 0 0.85rem; font-size: 1.15rem; }
.card-title-row { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; margin-bottom: 0.5rem; }
.card-title-row .card-title { margin: 0; }
.tight { margin: 0.2rem 0 0.8rem; }
.small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.session-form { padding-bottom: 5rem; }
.session-meta .meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: start;
}
.meta-span { grid-column: 1 / -1; }
.client-search { position: relative; }
.search-toolbar { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.45rem; }
.hint { font-size: 0.85rem; color: var(--muted); }
.pad { padding: 0.7rem; }

.category-stack { display: grid; gap: 0.65rem; }
.category {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}
.category summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--purple-soft);
}
.category summary::-webkit-details-marker { display: none; }
.category summary::after {
    content: '+';
    color: var(--brand-purple);
    font-size: 1.1rem;
    line-height: 1;
}
.category[open] summary::after { content: '–'; }
.cat-title { font-family: var(--serif); font-weight: 560; }
.cat-count {
    margin-left: auto;
    background: var(--teal-soft);
    color: var(--teal-deep);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
}
.category-body { padding: 0.85rem 1rem 1rem; border-top: 1px solid var(--line); }
.category-tools { display: grid; grid-template-columns: 1fr auto; gap: 0.55rem; align-items: center; }
.option-list {
    display: grid;
    gap: 0.15rem;
    margin-top: 0.7rem;
    max-height: 220px;
    overflow: auto;
    padding-right: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #faf9fc;
}
.option-list.is-expanded { max-height: 480px; }
.option {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.6rem 0.75rem;
    margin: 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}
.option:last-child { border-bottom: 0; }
.option:hover { background: var(--purple-soft); }
.option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0.15rem 0 0;
    flex: 0 0 1.15rem;
    border: 1.5px solid var(--brand-purple);
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
}
.option input[type="checkbox"]::before {
    content: '';
    width: 0.55rem;
    height: 0.55rem;
    transform: scale(0);
    transition: transform 0.12s ease;
    box-shadow: inset 1em 1em #fff;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}
.option input[type="checkbox"]:checked {
    background: var(--brand-teal);
    border-color: var(--teal-deep);
}
.option input[type="checkbox"]:checked::before {
    transform: scale(1);
}
.option span {
    flex: 1;
    line-height: 1.4;
    cursor: pointer;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; min-height: 0; }
.chip {
    background: var(--teal-soft);
    color: var(--teal-deep);
    border: 0;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
}
.chip:hover { background: #d5efe8; }
.note-card textarea { min-height: 160px; }
.form-bar {
    position: sticky;
    bottom: 0.75rem;
    z-index: 5;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}

/* CRM toolbar + modal (global) */
.list-shell { padding-top: 1rem; }
.crm-toolbar {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}
.crm-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}
.crm-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-purple);
    pointer-events: none;
    font-size: 1rem;
}
.crm-search input {
    padding-left: 2.2rem;
    padding-right: 2.4rem;
    border-radius: 999px;
    background: #f7f6fa;
}
.crm-search input:focus { background: #fff; }
.crm-search input[type="search"]::-webkit-search-decoration,
.crm-search input[type="search"]::-webkit-search-cancel-button,
.crm-search input[type="search"]::-webkit-search-results-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
button.crm-clear {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    border: 0;
    font-size: 1.2rem;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
}
button.crm-clear.is-on {
    display: inline-flex;
}
button.crm-clear:hover {
    background: var(--purple-soft);
    color: var(--ink);
}
.crm-toolbar-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.crm-filters {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}
.crm-filters-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.15fr) minmax(170px, 1.5fr) repeat(4, minmax(118px, 1fr)) auto;
    gap: 0.55rem;
    align-items: end;
}
.crm-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    min-width: 0;
}
.crm-field-grow {
    min-width: 0;
}
.crm-field-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0.8;
}
.crm-field input,
.crm-field select {
    width: 100%;
    min-height: 2.45rem;
    border-radius: 999px;
    background: #f7f6fa;
    padding: 0.55rem 0.85rem;
}
.crm-field input:focus,
.crm-field select:focus {
    background: #fff;
}
.crm-filters-actions {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    white-space: nowrap;
    padding-bottom: 1px;
}
.crm-filters-meta {
    justify-content: flex-start;
}
.crm-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.crm-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--purple-soft);
    color: var(--accent-deep);
    white-space: nowrap;
}
.crm-pill-muted {
    background: #f0efef;
    color: var(--ink-strong);
}
.crm-pill-soft {
    background: var(--teal-soft);
    color: var(--teal-deep);
}
.crm-pill-warn {
    background: #f6e8e8;
    color: var(--warn);
}
.log-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.crm-actions form.inline {
    display: inline-flex;
    margin: 0;
}
button.perm-toggle {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}
button.perm-toggle.is-on {
    background: var(--teal-soft);
    color: var(--teal-deep);
    border-color: rgba(63, 138, 124, 0.35);
}
button.perm-toggle.is-on:hover {
    background: #d5efe8;
    color: var(--teal-deep);
}
button.perm-toggle.is-off {
    background: #f6e8e8;
    color: var(--warn);
    border-color: rgba(163, 90, 90, 0.3);
}
button.perm-toggle.is-off:hover {
    background: #efd6d6;
    color: var(--warn);
}
.psy-add-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
}
.gorusme-filters-psy {
    grid-template-columns: minmax(170px, 1.5fr) repeat(4, minmax(118px, 1fr)) auto;
}

/* Görüşme detay */
.detail-head { align-items: flex-start; }
.detail-sub {
    margin: 0.35rem 0 0;
    color: var(--ink);
    font-size: 0.98rem;
}
.detail-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.85rem 0 0.2rem;
}
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 1rem;
    margin-top: 1rem;
    align-items: start;
}
.detail-note-wide { grid-column: 1 / -1; }
.detail-card { margin-top: 0; }
.detail-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.detail-card-head h2 { margin: 0; }
.detail-groups {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.detail-group {
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #faf9fc;
}
.detail-group h3 {
    margin: 0 0 0.45rem;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-deep);
}
.detail-list {
    margin: 0;
    padding-left: 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.detail-list li { color: var(--ink-strong); }
.detail-note-card {
    position: sticky;
    top: 1rem;
}
.detail-note-body {
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--ink-strong);
}
.crm-hint { min-height: 1.2rem; }
.pager-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}
.pager-info { margin: 0; color: var(--ink); font-size: 0.9rem; }
.pager-links { display: flex; gap: 0.5rem; align-items: center; }
.pager-page { font-weight: 600; color: var(--ink-strong); }
.ghost.small.is-disabled,
.ghost.small:disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.data-table th {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
    font-weight: 600;
}
.data-table tbody tr:hover { background: var(--purple-soft); }
.crm-table th { white-space: nowrap; }
.crm-name {
    font-weight: 600;
    color: var(--ink-strong);
    text-decoration: none;
}
.crm-name:hover { color: var(--accent-deep); }
.crm-badge {
    display: inline-flex;
    min-width: 1.8rem;
    justify-content: center;
    background: var(--teal-soft);
    color: var(--teal-deep);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.crm-actions {
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}
.crm-actions > a,
.crm-actions > form,
.crm-actions > button,
.crm-actions > span {
    display: inline-flex;
    vertical-align: middle;
    align-items: center;
    margin-left: 0.4rem;
}
.crm-actions > :first-child {
    margin-left: 0;
}
.empty-row td {
    text-align: center;
    color: var(--ink);
    padding: 2rem 0.75rem;
    opacity: 0.8;
}

body.modal-open { overflow: hidden; }
.modal[hidden] { display: none !important; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(44, 43, 45, 0.55);
}
.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.2rem 1.25rem;
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.modal-x {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 999px;
    background: var(--purple-soft);
    color: var(--ink-strong);
    border: 0;
    font-size: 1.25rem;
    line-height: 1;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.35rem;
}

@media (max-width: 1180px) {
    .crm-filters-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .crm-filters-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
    .psy-add-row {
        grid-template-columns: 1fr 1fr;
    }
    .psy-add-row .crm-filters-actions {
        grid-column: 1 / -1;
    }
}
@media (max-width: 960px) {
    .session-meta .meta-grid { grid-template-columns: 1fr 1fr; }
    .category-tools { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-note-card { position: static; }
}
@media (max-width: 860px) {
    body.app {
        height: auto;
        overflow: auto;
    }
    body.app.nav-open {
        overflow: hidden;
    }
    .shell {
        display: block;
        height: auto;
        overflow: visible;
    }
    .mobile-bar {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.55rem;
        position: sticky;
        top: 0;
        z-index: 30;
        padding: 0.65rem 0.85rem;
        background: #2c2b2d;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        color: #fff !important;
        min-width: 0;
        flex: 1;
    }
    .mobile-brand .brand-mark {
        width: 2.1rem;
        height: 2.1rem;
        font-size: 1rem;
        border-radius: 0.7rem;
        box-shadow: none;
    }
    .mobile-brand strong,
    .mobile-brand small {
        display: block;
    }
    .mobile-brand strong {
        font-family: var(--serif);
        font-size: 0.98rem;
        line-height: 1.15;
    }
    .mobile-brand small {
        color: #b8b7bc;
        font-size: 0.72rem;
    }
    .mobile-nav-btn {
        flex: 0 0 auto;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        border-radius: 0.7rem;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: transparent;
        color: #fff;
        display: grid;
        place-items: center;
    }
    .mobile-nav-btn:hover {
        background: rgba(124, 202, 185, 0.18);
        color: #fff;
    }
    .hamburger {
        width: 1.15rem;
        height: 0.85rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .hamburger span {
        display: block;
        height: 2px;
        width: 100%;
        border-radius: 2px;
        background: currentColor;
        transition: transform 0.2s ease, opacity 0.2s ease;
        transform-origin: center;
    }
    body.nav-open .hamburger span:nth-child(1) {
        transform: translateY(0.35rem) rotate(45deg);
    }
    body.nav-open .hamburger span:nth-child(2) {
        opacity: 0;
    }
    body.nav-open .hamburger span:nth-child(3) {
        transform: translateY(-0.35rem) rotate(-45deg);
    }
    .side-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(40, 39, 41, 0.45);
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }
    .side-backdrop[hidden] {
        display: none !important;
    }
    .side {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 40;
        width: min(300px, 86vw);
        height: 100vh;
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.28);
    }
    body.nav-open .side {
        transform: translateX(0);
    }
    .side nav {
        flex-direction: column;
        flex-wrap: nowrap;
    }
    .side nav a.side-cta {
        margin-bottom: 0.35rem;
    }
    .side-foot {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }
    .side-logout { width: 100%; }
    .main {
        height: auto;
        overflow: visible;
        padding: 1rem 0.9rem 2rem;
        max-width: none;
    }
    .page-head h1 {
        font-size: 1.55rem;
    }
    .page-head .button,
    .detail-head-actions .button {
        width: 100%;
    }
    .dash-metrics {
        gap: 0.55rem 1rem;
        font-size: 0.9rem;
    }
    .crm-actions {
        white-space: normal;
        text-align: left;
    }
    .crm-actions > a,
    .crm-actions > form,
    .crm-actions > button,
    .crm-actions > span {
        margin: 0.2rem 0.35rem 0.2rem 0;
    }
    .crm-actions .button,
    .crm-actions form.inline .button {
        width: auto;
    }
    .table-wrap {
        margin: 0 -0.15rem;
    }
    .data-table th,
    .data-table td,
    table th,
    table td {
        padding: 0.55rem 0.35rem;
        font-size: 0.9rem;
    }
    .stats, .form-grid, .filter-grid, .session-meta .meta-grid { grid-template-columns: 1fr; }
    .option-edit {
        grid-template-columns: 1fr auto;
        gap: 0.45rem;
    }
    .option-edit input[type="text"] {
        grid-column: 1 / -1;
    }
    .page-head, .card-title-row, .form-bar, .crm-toolbar, .detail-head { flex-direction: column; align-items: stretch; }
    .crm-search { max-width: none; }
    .crm-toolbar-meta { justify-content: space-between; width: 100%; }
    .crm-filters-row { grid-template-columns: 1fr; }
    .psy-add-row { grid-template-columns: 1fr; }
    .crm-filters-actions { width: 100%; }
    .crm-filters-actions .button { flex: 1; }
    .detail-head-actions { width: 100%; }
    .option-admin-body {
        margin-top: 0.5rem;
        padding: 0;
    }
    .option-admin-row {
        grid-template-columns: 1fr auto;
        gap: 0.45rem 0.5rem;
        margin: 0;
        padding: 0.55rem 0;
        border-bottom: 1px solid var(--line);
        align-items: center;
    }
    .option-admin-row input[type="text"] {
        grid-column: 1 / -1;
        border-radius: 12px;
        min-height: 2.2rem;
        padding: 0.45rem 0.8rem;
    }
    .option-admin-row .option-active {
        justify-self: start;
        padding: 0.3rem 0.6rem;
        font-size: 0.78rem;
    }
    .option-admin-row .button {
        width: auto;
        min-width: 4.4rem;
        justify-self: end;
        padding: 0.4rem 0.75rem;
    }
    .option-admin-add,
    .option-admin-add-top {
        grid-template-columns: minmax(0, 1fr) auto;
        border-bottom: 0;
        padding: 0.55rem 0;
    }
    .option-admin-add input[type="text"],
    .option-admin-add-top input[type="text"] {
        grid-column: auto;
    }
    .option-admin-add-top {
        margin-bottom: 0.15rem;
        padding-bottom: 0.65rem;
        border-bottom: 1px dashed var(--line);
    }
    .option-admin-add {
        margin-top: 0.15rem;
        padding-top: 0.65rem;
        border-top: 1px dashed var(--line);
    }
    .option-add-spacer { display: none; }
    .option-admin-empty { margin: 0.4rem 0; }
    .session-meta .meta-grid { grid-template-columns: 1fr; }
    .form-bar {
        bottom: 0.4rem;
        flex-direction: column;
        align-items: stretch;
    }
    .form-bar .button { width: 100%; }
    .auth-card {
        width: min(440px, calc(100% - 1.25rem));
        margin: 1.25rem auto;
        padding: 1.15rem;
    }
}

/* Seans takibi / danışan durumu */
.page-head-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.status-suggest {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  border-left: 3px solid var(--ink, #2c2b2d);
}
.status-card .status-form { margin-top: .4rem; }
.status-history { margin-top: 1rem; }
.status-history summary { cursor: pointer; color: var(--muted, #6b6a6d); }
.timeline-list { list-style: none; margin: .6rem 0 0; padding: 0; }
.timeline-list li {
  padding: .55rem 0; border-bottom: 1px solid var(--line, #e6e4e1);
  display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center;
}
.timeline-list li:last-child { border-bottom: 0; }
.plan-progress {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .45rem 0 0;
  min-width: 0;
  max-width: 100%;
}
.plan-progress > span {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: .85rem;
}
.plan-progress-bar {
  flex: 1 1 auto;
  min-width: 0;
  height: .45rem;
  border-radius: 999px;
  background: #eceae7;
  position: relative;
  overflow: hidden;
}
.plan-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--pct, 0%);
  max-width: 100%;
  background: var(--ink, #2c2b2d);
  border-radius: inherit;
}
.plan-form-wrap { margin-top: .75rem; }
.plan-form-wrap summary { cursor: pointer; font-weight: 500; }
.checkbox-inline { display: flex; align-items: center; gap: .5rem; }
.inline-form { display: inline; }
.crm-status-filter select { min-width: 12rem; }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.status-dist { display: flex; flex-wrap: wrap; gap: .5rem; }
.status-dist .crm-pill strong { margin-left: .35rem; }
.attendance-planlandi { background: #f3f0ea; }
.attendance-geldi { background: #e7f0e8; }
.attendance-danisan_iptal,
.attendance-uzman_iptal { background: #f3ece7; }
.attendance-ertelendi { background: #eeeaf3; }
.attendance-habersiz_gelmedi { background: #f5e8e8; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.reschedule-fields {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line, #e6e4e1);
  gap: .85rem;
}
#plan-card {
  max-width: 100%;
  overflow-x: hidden;
}
.plan-section-title {
  margin: 1rem 0 .55rem;
  font-size: .95rem;
  font-weight: 600;
}
.plan-past-wrap {
  margin-top: .9rem;
}
.plan-past-wrap > summary {
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  list-style: none;
  margin-bottom: .55rem;
}
.plan-past-wrap > summary::-webkit-details-marker { display: none; }
.plan-grid {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-width: 0;
  max-width: 100%;
}
.plan-tile {
  border: 1px solid var(--line, #e6e4e1);
  border-radius: 12px;
  padding: .85rem 1rem;
  background: #faf9f7;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.plan-tile-current {
  background: #fff;
  border-color: #d8d4ce;
}
.plan-tile-past {
  opacity: .92;
}
.plan-tile-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem .75rem;
}
.plan-tile-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .55rem;
  min-width: 0;
}
.plan-tile-title strong {
  font-size: 1rem;
}
.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.3;
  background: #ebe7e1;
  color: var(--ink, #2c2b2d);
  white-space: nowrap;
}
.plan-badge-aktif {
  background: #e5efe8;
  color: #2a4a34;
}
.plan-badge-oneri {
  background: #ece8f4;
  color: #3d3560;
}
.plan-badge-muted {
  background: #eceae7;
  color: #5c5a58;
}
.plan-tile-meta {
  margin: .4rem 0 0;
  font-size: .9rem;
  overflow-wrap: anywhere;
}
.plan-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}
.crm-actions-appt {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  max-width: 100%;
}
.appt-att-select {
  min-width: 9rem;
  max-width: 100%;
  font-size: .9rem;
}
