/* Sphere UI look: light gray canvas, white rounded cards, lime accents. */

:root {
    --navy: #111111;
    --navy-dark: #0a0a0a;
    --navy-mid: #2a2a2a;
    --accent: #d4f542;
    --accent-hover: #c3e62c;
    --record: #d4f542;
    --record-hover: #c3e62c;
    --record-active: #ef4444;
    --record-active-hover: #dc2626;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --surface: #b4b8be;
    --panel: #ffffff;
    --border: #ececec;
    --text: #111111;
    --muted: #6b7280;
    --menubar-height: 56px;
    --actionbar-height: 56px;
    --tabbar-height: 42px;
    --card-radius: 28px;
    --shadow: 0 10px 28px rgba(17, 17, 17, 0.08);
    --btn-ink: #111111;
    --field-bg: #ffffff;
    --field-border: #6b7280;
}

html {
    color-scheme: light;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--surface);
    color: var(--text);
}

.app-page {
    background: var(--surface);
}

.app-shell {
    background: transparent;
    border: none;
    gap: 10px;
    padding: 10px;
}

.app-menubar {
    height: auto;
    min-height: var(--menubar-height);
    background: var(--panel);
    color: var(--text);
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: 8px 14px;
    gap: 10px;
}

.app-menubar h1 {
    font-size: 1em;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, #fff 0 28%, transparent 30%),
        conic-gradient(from 200deg, #111 0 70%, var(--accent) 0 100%);
    box-shadow: none;
}

.user-name,
.recording-status {
    color: var(--muted);
}

.recording-status.active {
    color: var(--danger);
}

.logout-btn {
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: var(--btn-ink);
}

.logout-btn:hover {
    background: var(--accent);
    border-color: transparent;
    color: var(--text);
}

.fullscreen-btn {
    display: none;
    appearance: none;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: var(--btn-ink);
    padding: 6px 14px;
    font: inherit;
    font-size: 0.92em;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}

.is-docked .fullscreen-btn,
.is-fullscreen .fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    background: var(--accent);
    color: var(--text);
}

.menu-toggle {
    border-radius: 50%;
    width: 34px;
    height: 34px;
    border: none;
    background: #f3f4f6;
}

.menu-toggle:hover,
.menu-toggle[aria-expanded="true"] {
    background: var(--accent);
    border-color: transparent;
}

.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
    background: #111;
}

.app-menu-list {
    background: #fff;
    border: none;
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.app-menu-item {
    color: var(--text);
    border-radius: 14px;
}

.app-menu-item:hover {
    background: #f6f7f8;
}

.app-menu-item.is-active {
    background: var(--accent);
    color: #111;
}

.telemetry {
    border-radius: 999px;
    background: #f3f4f6;
    border: none;
    color: var(--muted);
}

.telemetry-label {
    color: var(--muted);
}

.tab-widget {
    background: var(--panel);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 12px 16px 16px;
}

.tab-panels,
.tab-panel {
    background: var(--panel);
}

.tab-widget > .tab-panels {
    border: 2px solid var(--field-border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    min-width: 0;
    overflow: hidden;
}

.tab-bar {
    background: transparent;
    border-bottom: 2px solid var(--field-border);
}

.tab-btn {
    color: var(--muted);
    border-bottom-width: 0;
}

.tab-btn:hover {
    color: var(--text);
    background: transparent;
}

.tab-btn.is-active {
    color: var(--text);
    background: var(--panel);
    border: 2px solid var(--field-border);
    border-bottom-color: var(--panel);
    margin-bottom: -2px;
}

.workspace,
.app-view.is-active {
    min-width: 0;
}

#sessionView .workspace {
    padding: 0;
}

#billingView,
#auditView,
#setupView {
    padding: 0;
    gap: 10px;
}

.report-table-wrap,
.setup-panel,
.setup-account,
.setup-add,
.automate-list,
.automate-editor,
.record-banner {
    border: none;
    border-radius: var(--card-radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: auto;
}

.report-table thead th {
    background: #fff;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.report-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.report-table tbody tr:hover,
.report-table tbody tr:focus-visible {
    background: #f4ffe0;
}

.report-table td,
.report-table th {
    color: var(--text);
    border-color: var(--border);
}

.app-actionbar {
    background: var(--panel);
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 6;
    overflow: visible;
    flex-shrink: 0;
}

.tab-panel .text-box {
    background: var(--field-bg);
    border: 2px solid var(--field-border);
    border-radius: 12px;
    color: var(--text);
}

.tab-panel .text-box:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}

.visit-box-label {
    color: var(--muted);
}

input, select, textarea {
    background: var(--field-bg);
    color: var(--text);
    border: 2px solid var(--field-border);
    border-radius: 10px;
}

.setup-add input,
.setup-add select,
.setup-password input,
.setup-role-select {
    background: #fafafa;
}

.login-page {
    background: var(--surface);
}

.login-container {
    background: #fff !important;
    border: none;
    border-radius: var(--card-radius) !important;
    box-shadow: var(--shadow) !important;
    color: var(--text);
}

.login-container h1 {
    color: var(--text) !important;
}

.login-subtitle,
.group-hint,
.login-note {
    color: var(--muted) !important;
}

.login-note {
    background: #f6f7f8 !important;
    border-radius: 18px;
}

.group-field input,
.pw-field input {
    background: #fafafa !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
}

.sso-btn {
    background: #fff !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
}

.password-submit,
.sso-btn.password-submit {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--btn-ink) !important;
}

.dock-prompt {
    position: relative;
    z-index: 5;
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 10px 14px;
    background: #fff;
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
}

.dock-prompt p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9em;
    flex: 1 1 220px;
}

.dock-prompt-btn {
    appearance: none;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    background: var(--accent);
    color: var(--btn-ink);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.dock-handoff {
    min-height: 100dvh;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 32px;
    gap: 12px;
}

.dock-handoff h1 {
    margin: 0;
    font-size: 1.4em;
}

.dock-handoff p {
    margin: 0;
    color: var(--muted);
    max-width: 28em;
}

.is-launcher .app-shell,
.is-launcher .dock-prompt,
.is-docked .dock-prompt,
.is-fullscreen .dock-prompt {
    display: none !important;
}

.is-docked .user-name {
    display: none;
}

.is-docked .app-menubar {
    height: auto;
    min-height: var(--menubar-height);
    flex-wrap: nowrap;
}

.is-docked .menubar-center {
    flex: 1 1 auto;
    justify-content: flex-start;
    min-width: 0;
}

.is-docked .telemetry-label,
html.is-docked .telemetry-label {
    display: inline !important;
    font-size: 0.76em;
}

.is-docked .telemetry,
html.is-docked .telemetry {
    padding: 5px 9px;
}

.is-docked .signal-icon {
    width: 20px;
    height: 16px;
}

.is-docked .report-table .col-time,
.is-docked .report-table .col-title,
.is-docked .report-table .col-encounter,
.is-docked .report-table .col-icd-code,
.is-docked .report-table .col-icd-desc,
.is-docked .report-table .col-notes,
.is-docked .report-table .col-completed {
    width: auto;
}

.is-docked .setup-add,
.is-docked .setup-password,
.is-docked .report-filters {
    flex-wrap: wrap;
}

.is-fullscreen {
    font-size: 16px;
}

.is-docked {
    --actionbar-height: 96px;
}

.is-docked .app-actionbar {
    flex-shrink: 0;
    min-height: 0;
    height: auto;
}

.is-docked .actionbar-buttons {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    overflow: visible;
}

.is-docked .actionbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

.is-docked .actionbar-primary {
    flex-wrap: wrap;
}

.is-docked .actionbar-nav {
    flex-wrap: nowrap;
}

.is-docked #currentBtn,
.is-docked .record-nav,
.is-docked .retention-note {
    order: 0;
}

.is-docked .retention-note {
    margin-left: auto;
    flex: 1 1 auto;
    text-align: right;
    font-size: 0.62em;
}

.is-docked .tab-panel {
    padding: 10px 12px 8px;
}

.is-fullscreen .app-actionbar {
    flex-shrink: 0;
}

.setup-appearance {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: var(--card-radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.setup-language-fields {
    display: grid;
    gap: 12px;
}

.setup-language-fields .field {
    display: grid;
    gap: 6px;
}

.setup-language-list {
    max-height: 220px;
    overflow: auto;
    display: grid;
    gap: 2px;
    padding: 8px;
    border: 2px solid var(--field-border);
    border-radius: 12px;
    background: var(--field-bg);
}

.setup-language-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.92em;
}

.setup-language-list label:hover {
    background: #f3f4f6;
}

.theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.theme-card {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 12px 8px 10px;
    border: 2px solid var(--border);
    border-radius: 18px;
    background: #fafafa;
    cursor: pointer;
    color: var(--text);
    font-size: 0.88em;
    font-weight: 650;
}

.theme-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-card.is-selected,
.theme-card:has(input:checked) {
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(212, 245, 66, 0.55);
    background: #fff;
}

.theme-swatch {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.theme-swatch-sphere {
    background: linear-gradient(135deg, #b4b8be 0 42%, #fff 42% 72%, #d4f542 72%);
}

.theme-swatch-analytics {
    background: linear-gradient(135deg, #f3f4f6 0 40%, #fff 40% 78%, #111 78%);
}

.theme-swatch-spectrum {
    background: linear-gradient(135deg, #0b0b12 0 48%, #1a1730 48% 76%, #7c5cff 76%);
}

.theme-swatch-track {
    background: linear-gradient(135deg, #e9e4f4 0 38%, #fff 38% 72%, #6d5efc 72%);
}

.theme-swatch-timeless {
    background: linear-gradient(135deg, #0b0b18 0 42%, #161624 42% 70%, #d6f56a 70%);
}

.icd-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.note-view-bar,
.section-tab-bar {
    display: flex;
    flex-shrink: 0;
    align-items: stretch;
    margin: 4px 0;
}

.note-view {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

.note-view.is-active {
    display: flex;
}

.note-view[hidden] {
    display: none !important;
}

.note-view-actions,
.note-section-actions {
    flex-shrink: 0;
    margin: 4px 0 8px;
}

.note-rich {
    outline: none;
    white-space: pre-wrap;
}

.note-rich-heading {
    margin: 0 0 0.2em;
}

.note-rich-body {
    margin: 0 0 0.9em;
}

.note-rich:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.section-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.note-sections-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 10px;
    padding-bottom: 8px;
}

.note-section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px 12px;
    display: grid;
    gap: 8px;
}

.note-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.note-section-title {
    margin: 0;
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text);
}

.note-section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.note-section-body {
    width: 100%;
    min-height: 5.5em;
    resize: vertical;
}

.note-section.is-editing .note-section-body {
    box-shadow: 0 0 0 3px rgba(212, 245, 66, 0.45);
}

@media (max-width: 720px) {
    html:not(.is-docked) .user-name {
        display: none;
    }

    html:not(.is-docked) .app-menubar {
        height: auto;
        min-height: var(--menubar-height);
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    html:not(.is-docked) .menubar-center {
        order: 3;
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    .report-table-wrap {
        overflow: auto;
    }

    .setup-add,
    .setup-password {
        flex-direction: column;
        align-items: stretch;
    }

    .theme-picker {
        grid-template-columns: 1fr;
    }
}

button.visit-btn,
button.export-btn,
button.report-ok-btn,
button.action-btn,
button.fullscreen-btn,
button.dock-prompt-btn,
button.setup-status-btn,
button.record-banner-back,
a.logout-btn {
    border-radius: 6px !important;
    padding: 6px 14px !important;
}
