/* ============================================================
   ATTUNED — "MORNING STUDIO"
   A calm, warm room for a practice to live in. Linen and
   plaster, sage and terracotta, Fraunces serif with Karla body.
   Nothing hurried. Nothing loud.
   ============================================================ */

:root {
    --linen: #FAF7F1;
    --plaster: #FFFFFF;
    --sand: #F1EBE0;
    --ink: #33302B;
    --ink-soft: #6E675C;
    --hairline: #E6DFD2;
    --sage: #7A8B6F;
    --sage-deep: #55654C;
    --sage-mist: #EDF1E8;
    --terra: #C97B5D;
    --terra-deep: #A85E42;
    --terra-mist: #F7EAE3;
    --danger: #B4533E;
    --ok: #5F7D53;
    --shadow-soft: 0 10px 30px -12px rgba(83, 71, 54, 0.18);
    --shadow-lift: 0 16px 44px -16px rgba(83, 71, 54, 0.26);
    --radius: 18px;
    --radius-sm: 12px;
    --font-display: "Fraunces", serif;
    --font-body: "Karla", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--linen); }

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--linen);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}

::selection { background: var(--sage-mist); color: var(--sage-deep); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }

/* ---------- Auth scene ---------- */

.auth-body { overflow-x: hidden; }

.auth-scene { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.wash {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    animation: drift 26s ease-in-out infinite alternate;
}

.wash-a { width: 44vw; height: 44vw; background: var(--sage-mist); top: -12vw; right: -8vw; }
.wash-b { width: 36vw; height: 36vw; background: var(--terra-mist); bottom: -10vw; left: -6vw; animation-delay: -8s; }
.wash-c { width: 26vw; height: 26vw; background: #F3EFE2; top: 40%; left: 38%; animation-delay: -16s; }

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(3vw, -2vw) scale(1.08); }
}

.auth-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: 4vw;
    max-width: 72rem;
    margin: 0 auto;
    padding: 4rem 2.4rem;
}

.auth-brand { animation: settle 0.9s cubic-bezier(0.22, 0.8, 0.3, 1) both; }

.brand-mark {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 3.4rem;
    line-height: 1;
    color: var(--sage-deep);
}

.brand-mark span { color: var(--terra); }

.brand-line {
    font-size: clamp(2.4rem, 4.4vw, 3.6rem);
    line-height: 1.12;
    margin-top: 1.6rem;
    font-weight: 400;
}

.brand-line em {
    font-style: italic;
    font-weight: 500;
    color: var(--terra-deep);
}

.brand-sub {
    margin-top: 1.4rem;
    max-width: 30rem;
    color: var(--ink-soft);
    font-size: 1.05rem;
}

.brand-notes {
    margin-top: 2rem;
    list-style: none;
    display: grid;
    gap: 0.65rem;
}

.brand-notes li {
    color: var(--ink-soft);
    font-size: 0.95rem;
    padding-left: 1.6rem;
    position: relative;
}

.brand-notes li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.42em;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--sage);
}

/* ---------- Auth card ---------- */

.auth-card {
    background: var(--plaster);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    padding: 2.6rem 2.5rem 2.2rem;
    max-width: 27rem;
    margin-left: auto;
    animation: settle 0.9s 0.15s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.auth-card h1 { font-size: 2rem; }

.auth-card > p { color: var(--ink-soft); margin: 0.35rem 0 1.6rem; }

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--hairline);
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.auth-footer a { color: var(--sage-deep); font-weight: 600; }

/* ---------- Forms ---------- */

.form-group { margin-bottom: 1.05rem; }

.form-group label, .form-group .label, label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 0.35rem;
}

.form-control, input, select, textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.98rem;
    color: var(--ink);
    background: var(--linen);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 0.68rem 0.9rem;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    background: var(--plaster);
    border-color: var(--sage);
    box-shadow: 0 0 0 4px var(--sage-mist);
}

textarea { min-height: 6rem; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.error-msg {
    display: none;
    background: var(--terra-mist);
    color: var(--danger);
    border: 1px solid #E5C4B5;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.error-msg:not(:empty) { display: block; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.94rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.62rem 1.5rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--sage-deep);
    color: #FDFCF9;
    box-shadow: 0 8px 20px -10px rgba(85, 101, 76, 0.65);
}

.btn-primary:hover { background: #46543E; }

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--hairline);
}

.btn-secondary:hover { background: var(--sand); }

.btn-success { background: var(--ok); color: #FDFCF9; }
.btn-success:hover { background: #4E683F; }

.btn-danger { background: transparent; color: var(--danger); border-color: #E5C4B5; }
.btn-danger:hover { background: var(--terra-mist); }

.btn-sm { padding: 0.38rem 0.95rem; font-size: 0.84rem; }

.btn-block { width: 100%; }

.btn svg { width: 1rem; height: 1rem; }

/* ---------- App layout ---------- */

.app-layout {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--plaster);
    border-right: 1px solid var(--hairline);
    padding: 1.8rem 1.1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.75rem;
    color: var(--sage-deep);
    padding: 0 0.9rem 1.4rem;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    transition: background 0.15s, color 0.15s;
}

.nav-item svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }

.nav-item:hover { background: var(--sand); color: var(--ink); }

.nav-item.active {
    background: var(--sage-mist);
    color: var(--sage-deep);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.2rem;
    border-top: 1px solid var(--hairline);
}

.main-content {
    padding: 2.6rem 3rem 5rem;
    max-width: 74rem;
    animation: settle 0.5s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.page-header h1, .page-header h2 { font-size: 2.1rem; font-weight: 500; }

/* ---------- Dashboard ---------- */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.6rem;
}

.stat-card {
    background: var(--plaster);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.4rem 1.5rem;
    animation: settle 0.55s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }

.stat-card .label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 0.3rem;
}

.stat-card .value {
    font-family: var(--font-display);
    font-size: 2.3rem;
    font-weight: 500;
    line-height: 1.1;
    color: var(--sage-deep);
}

/* ---------- Cards ---------- */

.card {
    background: var(--plaster);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.6rem 1.7rem;
    margin-bottom: 1.3rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.card-header h2, .card-header h3 { font-size: 1.3rem; font-weight: 500; }

/* ---------- Search ---------- */

.search-bar { max-width: 24rem; margin-bottom: 1.2rem; }

/* ---------- Calendar / schedule ---------- */

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.calendar-nav { display: flex; align-items: center; gap: 0.7rem; }

.current-date {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
}

.day-schedule {
    background: var(--plaster);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.time-slot {
    display: grid;
    grid-template-columns: 5.4rem 1fr;
    border-bottom: 1px solid var(--hairline);
    min-height: 3.4rem;
}

.time-slot:last-child { border-bottom: none; }

.time-label {
    padding: 0.65rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-soft);
    border-right: 1px solid var(--hairline);
    background: var(--linen);
}

.slot-content { padding: 0.45rem 0.7rem; }

.appointment-block {
    background: var(--sage-mist);
    border-left: 3px solid var(--sage);
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.35rem;
    cursor: pointer;
    transition: transform 0.14s, box-shadow 0.14s;
}

.appointment-block:hover { transform: translateX(2px); box-shadow: var(--shadow-soft); }

.appointment-block .time { font-size: 0.74rem; font-weight: 700; color: var(--sage-deep); }
.appointment-block .client-name { font-weight: 700; font-size: 0.95rem; }
.appointment-block .type { font-size: 0.78rem; color: var(--ink-soft); }

/* ---------- Notes ---------- */

.note-editor {
    background: var(--plaster);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.8rem;
}

.note-section { margin-bottom: 1.3rem; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    background: var(--sand);
    color: var(--ink-soft);
    white-space: nowrap;
}

.badge-scheduled, .badge-active, .badge-confirmed { background: var(--sage-mist); color: var(--sage-deep); }
.badge-completed, .badge-signed, .badge-paid, .badge-approved { background: #E4EDDD; color: var(--ok); }
.badge-draft, .badge-pending, .badge-submitted { background: #F5EFDF; color: #8A6A2F; }
.badge-cancelled, .badge-denied, .badge-no_show, .badge-overdue, .badge-locked { background: var(--terra-mist); color: var(--danger); }
.badge-therapy { background: var(--sage-mist); color: var(--sage-deep); }
.badge-coaching { background: var(--terra-mist); color: var(--terra-deep); }

/* ---------- Modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(51, 48, 43, 0.38);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadein 0.2s both;
}

.modal {
    background: var(--plaster);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    width: min(34rem, 92%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 2rem 2.1rem 1.7rem;
    animation: settle 0.32s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.modal h2, .modal h3 { font-size: 1.5rem; margin-bottom: 1.2rem; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--hairline);
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    bottom: 1.6rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--linen);
    border-radius: 999px;
    padding: 0.7rem 1.5rem;
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: var(--shadow-lift);
    z-index: 200;
    animation: settle 0.3s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

/* ---------- Empty / spinner ---------- */

.empty-state {
    text-align: center;
    color: var(--ink-soft);
    padding: 2.6rem 1rem;
    font-size: 0.98rem;
}

.spinner {
    width: 2.4rem;
    height: 2.4rem;
    border: 3px solid var(--hairline);
    border-top-color: var(--sage);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Telehealth session page ---------- */

.session-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(60vw 60vw at 85% -10%, var(--sage-mist) 0%, transparent 60%),
        radial-gradient(50vw 50vw at 0% 110%, var(--terra-mist) 0%, transparent 55%),
        var(--linen);
}

.session-card {
    background: var(--plaster);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    padding: 2.4rem;
    width: min(52rem, 100%);
    text-align: center;
}

.session-card h1, .session-card h2 { margin-bottom: 0.8rem; }

.status-text { color: var(--ink-soft); margin: 0.8rem 0 1.4rem; }

.session-card video {
    width: 100%;
    border-radius: var(--radius-sm);
    background: var(--ink);
}

/* ---------- Mobile nav ---------- */

.mobile-nav { display: none; }

/* ---------- Motion ---------- */

@keyframes settle {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .auth-container { grid-template-columns: 1fr; gap: 2rem; padding: 2.4rem 1.4rem; }
    .auth-brand { text-align: center; }
    .brand-sub, .brand-notes { margin-left: auto; margin-right: auto; }
    .brand-notes li { text-align: left; }
    .auth-card { margin: 0 auto; }
    .app-layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        height: auto;
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 0.8rem;
        border-right: none;
        border-top: 1px solid var(--hairline);
        z-index: 60;
    }
    .sidebar-logo { display: none; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; flex: 1; }
    .nav-item { flex-direction: column; gap: 0.2rem; font-size: 0.66rem; padding: 0.45rem 0.7rem; }
    .sidebar-footer { margin: 0; padding: 0; border: none; }
    .main-content { padding: 1.8rem 1.2rem 7rem; }
    .form-row { grid-template-columns: 1fr; }
}
