:root {
    --ink: #16343c;
    --muted: #5b737a;
    --paper: #f6f1e8;
    --card: #fffcf7;
    --line: #e4d9c8;
    --teal: #0f766e;
    --teal-2: #14b8a6;
    --coral: #c45c4a;
    --ok: #2f6b4f;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(900px 400px at 10% -10%, rgba(20, 184, 166, 0.12), transparent 50%),
        var(--paper);
    font-family: 'Source Sans 3', system-ui, sans-serif;
    line-height: 1.5;
}
h1, h2, strong, .brand strong {
    font-family: Fraunces, Georgia, serif;
    font-weight: 600;
}
h1 { font-size: 2rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 16px; }
a { color: var(--teal); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.top {
    border-bottom: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.92);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 4;
}
.top-inner, nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.top-inner { justify-content: space-between; padding: 14px 0; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.brand em { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.mark {
    width: 36px; height: 36px; border-radius: 12px;
    background: linear-gradient(135deg, var(--teal), var(--teal-2));
    color: white; display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
nav a, nav button {
    background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer;
    text-decoration: none; padding: 0;
}
.did { color: var(--muted); font-size: 13px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; color: var(--teal); margin: 28px 0 6px; }
.muted { color: var(--muted); }
.hero { display: flex; justify-content: space-between; gap: 24px; margin: 28px 0 8px; }
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.kpis article, .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 10px 30px rgba(22, 52, 60, 0.04);
}
.kpis article, .pill {
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}
.kpis article:hover {
    transform: translateY(-3px);
    border-color: #d2c4ae;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -4px 10px rgba(22, 52, 60, 0.08),
        0 14px 26px rgba(22, 52, 60, 0.12);
}
.kpis span { color: var(--muted); font-size: 13px; }
.kpis strong { display: block; font-size: 1.6rem; margin-top: 4px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.sub { color: var(--muted); font-size: 12px; }
.summary { max-width: 280px; }
.pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 12px; background: #e7f4f2; color: var(--teal);
}
.pill:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 4px 10px rgba(22, 52, 60, 0.12);
}
.pill.no, .pill.cancelled { background: #f8e7e3; color: var(--coral); }
.pill.completed { background: #e5f3ea; color: var(--ok); }
.pill.scheduled { background: #e7f0f8; color: #1d4e89; }
.pill.in { background: #e7f0f8; color: #1d4e89; }
.pill.out { background: #f4e9d6; color: #8a5a12; }
.banner.ok { background: #e5f3ea; color: var(--ok); padding: 12px 14px; border-radius: 10px; margin: 0 0 20px; line-height: 1.45; }
.filters {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr 0.9fr 0.9fr auto;
    gap: 12px;
    align-items: end;
    margin: 0 0 16px;
}
.filters label { display: block; font-size: 13px; color: var(--muted); }
.filters input, .filters select {
    width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 10px;
    border: 1px solid var(--line); font: inherit; background: white;
}
.filter-actions { margin: 0; display: flex; gap: 12px; align-items: center; }
.filters button.btn { border: 0; cursor: pointer; }
audio { width: 160px; height: 32px; }
.transcript { list-style: none; padding: 0; }
.transcript li { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #f3eee6; }
.transcript .user { background: #e7f4f2; }
.transcript span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn {
    display: inline-block; background: var(--teal); color: white; text-decoration: none;
    padding: 8px 14px; border-radius: 999px; font-size: 14px;
}
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.foot { color: var(--muted); font-size: 13px; padding: 32px 20px 40px; }
.login-body { display: grid; place-items: center; }
.login-card {
    width: min(420px, 92vw); background: var(--card); border: 1px solid var(--line);
    border-radius: 20px; padding: 28px; box-shadow: 0 20px 50px rgba(22, 52, 60, 0.08);
}
.login-card label { display: block; margin: 16px 0 8px; font-size: 14px; }
.login-card input, .login-card button {
    width: 100%; padding: 12px 14px; border-radius: 10px; font: inherit;
}
.login-card input { border: 1px solid var(--line); background: white; }
.login-card button { border: 0; background: var(--teal); color: white; cursor: pointer; font-weight: 600; }
.banner.error { background: #f8e7e3; color: var(--coral); padding: 10px 12px; border-radius: 10px; margin: 0 0 16px; }
.banner.error a { color: inherit; font-weight: 600; }
.banner.warn { background: #fff4d6; color: #6b4f00; padding: 12px 14px; border-radius: 10px; margin: 0 0 20px; line-height: 1.45; }
.banner.warn code { font-size: 0.92em; }
.crumb { margin-top: 24px; color: var(--muted); }
.prose { white-space: pre-wrap; }
.empty-note { margin-top: 8px; }
.doctor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-stack label { display: block; margin: 0 0 14px; }
.form-stack input, .form-stack textarea, .form-stack select {
    width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--line); font: inherit; background: white;
}
.form-stack .check input { width: auto; margin-right: 8px; }
.form-stack button.btn { border: 0; cursor: pointer; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cal-nav h2 { margin: 0; }
.cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.cal-head { font-size: 12px; color: var(--muted); text-align: center; }
.cal-cell {
    min-height: 64px; border: 1px solid var(--line); background: white;
    border-radius: 10px; padding: 8px; text-align: left; cursor: pointer; font: inherit;
}
.cal-cell.empty { border: 0; background: transparent; cursor: default; }
.cal-cell.has-appts { background: #e7f4f2; }
.cal-count {
    display: block; font-size: 11px; color: var(--teal); margin-top: 4px;
}
.modal {
    position: fixed; inset: 0; background: rgba(22, 52, 60, 0.35);
    display: grid; place-items: center; z-index: 20; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
    width: min(560px, 100%); max-height: 86vh; overflow: auto;
    background: var(--card); border-radius: 16px; padding: 18px 20px;
    border: 1px solid var(--line);
}
.modal-card header { display: flex; justify-content: space-between; align-items: center; }
.icon-btn { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--ink); }
.appt-row { border-top: 1px solid var(--line); padding: 12px 0; }
.move-form { display: grid; gap: 8px; margin-top: 8px; }
.move-form label { font-size: 13px; }
.move-form input, .move-form select { padding: 8px; border-radius: 8px; border: 1px solid var(--line); font: inherit; }
@media (max-width: 860px) {
    .charts, .split { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr 1fr; }
    nav .did { display: none; }
}
