@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   THEME SYSTEM - CSS Variables
   ============================================ */

:root {
    /* Base Purple Palette */
    --purple-50: #faf5ff;
    --purple-100: #f3e8ff;
    --purple-200: #e9d5ff;
    --purple-300: #d8b4fe;
    --purple-400: #c084fc;
    --purple-500: #a855f7;
    --purple-600: #9333ea;
    --purple-700: #7c3aed;
    --purple-800: #6b21a8;
    --purple-900: #581c87;

    /* Accent Colors */
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --rose-400: #fb7185;
    --rose-500: #f43f5e;
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --sky-400: #38bdf8;
    --sky-500: #0ea5e9;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;
    --info: #3b82f6;
    --info-light: #60a5fa;

    /* Shared Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   SUNSET THEME
   Warm, soft coral/peach
   ============================================ */
[data-theme="sunset"] {
    --primary: #fb7185;              /* rose-400 */
    --primary-dark: #f43f5e;         /* rose-500 */
    --primary-light: #ffe4e6;        /* light rose */
    --primary-glow: rgba(244, 63, 94, 0.28);

    --bg-base: #fff7ed;              /* warm, light peach */
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #fffbeb;
    --bg-active: #fed7aa;
    --bg-input: #ffffff;

    --text-primary: #3b0f1f;         /* deep wine */
    --text-secondary: #7c2d12;       /* warm brown/orange */
    --text-muted: #9a3412;
    --text-dim: #f97316;

    --border: #fed7aa;
    --border-light: #ffedd5;
    --border-focus: #f97316;

    --shadow-sm: 0 1px 3px rgba(124, 45, 18, 0.08);
    --shadow-md: 0 4px 12px rgba(124, 45, 18, 0.1);
    --shadow-lg: 0 10px 25px rgba(124, 45, 18, 0.12);
    --shadow-xl: 0 20px 40px rgba(124, 45, 18, 0.14);
    --shadow-glow: 0 0 30px var(--primary-glow);

    --gradient-bg:
        radial-gradient(ellipse at 10% 0%, rgba(248, 113, 113, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 90% 100%, rgba(251, 191, 36, 0.12) 0%, transparent 55%);
}

/* ============================================
   OCEAN THEME
   Clean blue, clinical + calm
   ============================================ */
[data-theme="ocean"] {
    --primary: #38bdf8;              /* sky-400 */
    --primary-dark: #0ea5e9;         /* sky-500 */
    --primary-light: #e0f2fe;        /* sky-100 */
    --primary-glow: rgba(56, 189, 248, 0.3);

    --bg-base: #f0f9ff;              /* very light blue */
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e0f2fe;
    --bg-active: #bae6fd;
    --bg-input: #ffffff;

    --text-primary: #0f172a;         /* slate-900 */
    --text-secondary: #0e7490;       /* teal-ish blue */
    --text-muted: #0369a1;
    --text-dim: #38bdf8;

    --border: #bae6fd;
    --border-light: #7dd3fc;
    --border-focus: #0ea5e9;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.14);
    --shadow-glow: 0 0 30px var(--primary-glow);

    --gradient-bg:
        radial-gradient(ellipse at 15% 0%, rgba(56, 189, 248, 0.16) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 100%, rgba(37, 99, 235, 0.1) 0%, transparent 55%);
}

/* ============================================
   VIBRANT THEME
   Purple/teal, playful but still “pro”
   ============================================ */
[data-theme="vibrant"] {
    --primary: #a855f7;              /* purple-500 */
    --primary-dark: #7c3aed;         /* purple-700 */
    --primary-light: #e9d5ff;        /* purple-200 */
    --primary-glow: rgba(168, 85, 247, 0.3);

    --bg-base: #faf5ff;              /* soft lavender */
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f3e8ff;
    --bg-active: #e9d5ff;
    --bg-input: #ffffff;

    --text-primary: #2e1065;         /* deep purple */
    --text-secondary: #4c1d95;
    --text-muted: #6b21a8;
    --text-dim: #a855f7;

    --border: #ddd6fe;
    --border-light: #e9d5ff;
    --border-focus: #a855f7;

    --shadow-sm: 0 1px 3px rgba(46, 16, 101, 0.08);
    --shadow-md: 0 4px 12px rgba(46, 16, 101, 0.1);
    --shadow-lg: 0 10px 25px rgba(46, 16, 101, 0.12);
    --shadow-xl: 0 20px 40px rgba(46, 16, 101, 0.14);
    --shadow-glow: 0 0 30px var(--primary-glow);

    --gradient-bg:
        radial-gradient(ellipse at 20% 0%, rgba(168, 85, 247, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(45, 212, 191, 0.12) 0%, transparent 55%);
}

/* ============================================
   LIGHT THEME
   Neutral, almost “default”, very EMR-friendly
   ============================================ */
[data-theme="light"] {
    --primary: #0ea5e9;              /* soft blue accent */
    --primary-dark: #0369a1;
    --primary-light: #e0f2fe;
    --primary-glow: rgba(14, 165, 233, 0.25);

    --bg-base: #f9fafb;              /* neutral, near-white */
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-active: #e5e7eb;
    --bg-input: #ffffff;

    --text-primary: #111827;         /* gray-900 */
    --text-secondary: #374151;
    --text-muted: #4b5563;
    --text-dim: #6b7280;

    --border: #e5e7eb;
    --border-light: #d1d5db;
    --border-focus: #0ea5e9;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 30px var(--primary-glow);

    --gradient-bg:
        radial-gradient(ellipse at 15% 0%, rgba(148, 163, 184, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 100%, rgba(14, 165, 233, 0.12) 0%, transparent 55%);
}

/* ============================================
   DARK THEME
   Dark slate with teal highlights
   ============================================ */
[data-theme="dark"] {
    /* Teal accent (same family as mint) */
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-light: #5eead4;
    --primary-glow: rgba(45, 212, 191, 0.45);

    /* BACKGROUNDS
       Keep the main page background the same (#020617),
       but make surfaces slightly lighter so they stand out. */
    --bg-base: #020617;          /* main app background (unchanged) */
    --bg-elevated: #02071f;      /* subtle lift for panels/sidebars */
    --bg-card: #020b27;          /* cards & main components */
    --bg-hover: #031022;         /* hover state – a touch brighter */
    --bg-active: #041326;        /* active/selected */
    --bg-input: #020a20;         /* inputs slightly separated from cards */

    /* TEXT */
    --text-primary: #f3f4f6;     /* brighter for legibility */
    --text-secondary: #e5e7eb;   /* for labels, subtle headings */
    --text-muted: #9ca3af;       /* helper text / hints */
    --text-dim: #22c55e;         /* keep as subtle “live” accent if you use it */

    /* BORDERS – stronger so outlines are easy to follow */
    --border: #1f2937;           /* slate-800-ish, clearly visible */
    --border-light: #334155;     /* for dividers / subtle outlines */
    --border-focus: #2dd4bf;     /* teal focus ring for inputs, buttons */

    /* SHADOWS – soften but make elevation readable */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.7);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.85);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.85);
    --shadow-xl: 0 24px 60px rgba(15, 23, 42, 0.9);
    --shadow-glow: 0 0 40px var(--primary-glow);

    /* BACKGROUND GLOW – kept for subtle depth */
    --gradient-bg:
        radial-gradient(ellipse at 0% 0%, rgba(45, 212, 191, 0.2) 0%, transparent 55%),
        radial-gradient(ellipse at 100% 100%, rgba(88, 28, 135, 0.35) 0%, transparent 55%);
}


/* ============================================
   MINT THEME
   ============================================ */
[data-theme="mint"] {
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-light: #5eead4;
    --primary-glow: rgba(45, 212, 191, 0.3);

    --bg-base: #f0fdfa;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e6fffa;
    --bg-active: #ccfbf1;
    --bg-input: #ffffff;

    --text-primary: #0d3331;
    --text-secondary: #115e59;
    --text-muted: #0f766e;
    --text-dim: #14b8a6;

    --border: #99f6e4;
    --border-light: #5eead4;
    --border-focus: #14b8a6;

    --shadow-sm: 0 1px 3px rgba(13, 51, 49, 0.08);
    --shadow-md: 0 4px 12px rgba(13, 51, 49, 0.1);
    --shadow-lg: 0 10px 25px rgba(13, 51, 49, 0.12);
    --shadow-xl: 0 20px 40px rgba(13, 51, 49, 0.15);
    --shadow-glow: 0 0 30px var(--primary-glow);

    --gradient-bg: radial-gradient(ellipse at 20% 0%, rgba(45, 212, 191, 0.1) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 100%, rgba(147, 51, 234, 0.05) 0%, transparent 50%);
}

/* ============================================
   BODY & BASE STYLES
   ============================================ */
body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-bg);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.header-btn {
    padding: 10px 18px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn:hover:not(.disabled) {
    background: var(--bg-active);
    color: var(--text-primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.header-btn.disabled {
    opacity: 0.6;
    cursor: default;
}

/* ============================================
   THEME SWITCHER
   ============================================ */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    position: relative;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.theme-btn[data-theme="dark"] { background: linear-gradient(135deg, #1e1730, #362952); }
.theme-btn[data-theme="light"] { background: linear-gradient(135deg, #ffffff, #f3f0f9); }
.theme-btn[data-theme="vibrant"] { background: linear-gradient(135deg, #e879f9, #c084fc); }
.theme-btn[data-theme="ocean"] { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.theme-btn[data-theme="sunset"] { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.theme-btn[data-theme="mint"] { background: linear-gradient(135deg, #14b8a6, #2dd4bf); }

.theme-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    z-index: 100;
}

.theme-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   PATIENT INFO
   ============================================ */
.patient-info {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px;
    padding: 18px;
    background: var(--bg-hover);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.patient-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.patient-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.patient-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.patient-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============================================
   MAIN GRID LAYOUT
   ============================================ */
.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.template-sidebar {
    position: sticky;
    top: 20px;    
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.template-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-templates {
    margin-bottom: 24px;
}

.template-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    text-align: left;
}

.template-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
    transform: translateX(4px);
    border-color: var(--primary);
}

.template-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.template-icon {
    font-size: 18px;
}

/* ============================================
   SECTION SELECTOR (Sidebar Checkboxes)
   ============================================ */
.section-selector {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.section-selector-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-selector-scroll {
    max-height: none;
    padding-bottom: 8px;
}

.section-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.section-checkbox:last-child {
    margin-bottom: 0;
}

.section-checkbox:hover {
    background: var(--bg-active);
    border-color: var(--primary);
}

.section-checkbox.selected {
    background: rgba(168, 85, 247, 0.15);
    border-color: var(--primary);
}

.section-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.section-checkbox label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content-area {
    min-height: 600px;
}

/* ============================================
   SECTIONS (Collapsible Cards)
   ============================================ */
.section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    display: none;
}

.section.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section.collapsed .section-content {
    display: none;
}

.section-header {
    padding: 16px 20px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.section-header:hover {
    background: var(--bg-active);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.expand-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    font-size: 12px;
}

.section.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   TEETH SELECTION SUMMARY (Visible at Top)
   ============================================ */
.teeth-summary {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 16px;
}

.teeth-summary-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.teeth-summary-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.teeth-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
}

.teeth-summary-item .label {
    font-weight: 600;
    color: var(--primary);
}

.teeth-summary-item .teeth {
    color: var(--text-muted);
}

.teeth-summary-empty {
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
}

/* ============================================
   QUICK SELECT BUTTONS
   ============================================ */
.quick-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.quick-item {
    padding: 12px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    position: relative;
}

.quick-item:hover {
    background: var(--bg-active);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.quick-item.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ============================================
   COMPLAINT TAGS (Chips)
   ============================================ */
.complaint-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.complaint-tag {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.complaint-tag:hover {
    background: var(--bg-active);
    border-color: var(--primary);
    color: var(--text-primary);
}

.complaint-tag.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.complaint-teeth-helper {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* ============================================
   TOOTH GRID (New visual selector)
   ============================================ */
.tooth-grid-container {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-top: 12px;
    border: 1px solid var(--border);
}

.tooth-chart-label,
.tooth-grid-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: block;
}

/* Legend */
.tooth-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.legend-item:hover {
    background: var(--bg-active);
}

.legend-item.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.2);
}

.legend-color.missing {
    background: repeating-linear-gradient(
        45deg,
        #d1d5db 0,
        #d1d5db 4px,
        #f9fafb 4px,
        #f9fafb 8px
    );
}

/* Grid layout for 32 teeth (16 x 2) */
.tooth-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 6px;
    max-width: 720px;
    margin: 0 auto;
    padding: 8px;
    background: var(--bg-card);
    border-radius: 8px;
    position: relative;
}

/* Midline indicator */
.tooth-grid::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 10%;
    bottom: 10%;
    width: 2px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        #ddd 20%,
        #ddd 80%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Tooth button container */
.tooth-btn {
    position: relative;
    background: #fafafa;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px; /* match the visual size better */
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    width: 90%;
    height: 90%;
    aspect-ratio: 1 / 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;    
    --tooth-scale: 1.25;
    transform: scale(var(--tooth-scale));
    transform-origin: center;
}

/* Quadrant labels under the grid (created by initToothChart) */
.quadrant-labels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
}

.quadrant-label {
    padding: 4px;
    background: var(--bg-card);
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.quadrant-label:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

/* =========================================================
   GROUPING TOGGLE (Quadrants / Sextants)
   ========================================================= */

.grouping-wrapper {
    margin-top: 8px;
}

.grouping-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 8px;
    background: var(--bg-hover, #f3f4f6);
    border-radius: var(--radius-full, 9999px);
    padding: 3px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.grouping-toggle-btn {
    padding: 4px 14px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-full, 9999px);
    background: transparent;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    transition: var(--transition, all 0.2s ease);
}

.grouping-toggle-btn:hover {
    color: var(--text-primary, #111827);
}

.grouping-toggle-btn.selected {
    background: var(--bg-elevated, #ffffff);
    color: var(--primary-dark, #0d9488);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.sextant-labels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 0 4px;
    color: var(--text-dim);
    text-align: center;
}

.sextant-labels .quadrant-label {
    font-size: 11px;
    padding: 6px 4px;
}

/* ============================================
   COMMENTS AREA
   ============================================ */
.comments-area {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comments-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   DICTATE BUTTON – SOFT / THEME-FRIENDLY
   ============================================ */

.dictate-btn {
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;

    /* Soft shadow to match your UI */
    box-shadow: var(--shadow-sm);
}

/* Hover = subtle tint, not aggressive */
.dictate-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    transform: translateY(-1px);
}

/* Active (mouse down) */
.dictate-btn:active {
    background: var(--bg-active);
    transform: translateY(0);
}

/* ============================================
   RECORDING STATE – Calm but clearly alerting
   ============================================ */

.dictate-btn.recording {
    background: rgba(var(--danger-rgb, 239, 68, 68), 0.12); /* soft red wash */
    color: var(--danger);
    border-color: var(--danger-light);

    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25); /* soft red glow */
    animation: pulseSoft 1.6s infinite;
}

/* Softer pulse than hard flashing */
@keyframes pulseSoft {
    0%   { box-shadow: 0 0 4px rgba(239, 68, 68, 0.15); }
    50%  { box-shadow: 0 0 12px rgba(239, 68, 68, 0.35); }
    100% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.15); }
}


.comments-input {
    width: 100%;
    min-height: 90px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
}

.comments-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============================================
   AUTOCOMPLETE (ICD-10 Search)
   ============================================ */
.autocomplete-container {
    position: relative;
}

.autocomplete-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.autocomplete-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 4px;
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 100;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.autocomplete-item:hover {
    background: var(--bg-hover);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-code {
    font-weight: 700;
    color: var(--primary);
}

.autocomplete-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================
   TWO-COLUMN LAYOUT
   ============================================ */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   CHECKBOX & RADIO GROUPS
   ============================================ */
.checkbox-group,
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-item:hover,
.radio-item:hover {
    background: var(--bg-active);
    border-color: var(--primary);
}

.checkbox-item.selected,
.radio-item.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   ACTION BUTTONS (Sticky Footer)
   ============================================ */
.action-buttons {    
    bottom: 0;
    background: var(--bg-base);
    padding: 20px;
    margin: 0 -20px -20px -20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    z-index: 10;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-active);
    color: var(--text-primary);
    border-color: var(--primary);
}

.btn.disabled {
    opacity: 0.6;
    cursor: default;
}

/* ============================================
   NOTE OUTPUT
   ============================================ */
.note-output {
    display: none;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 24px;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.note-output.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 16px;
}

.note-header h2 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}

.note-content {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
    color: var(--text-primary);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header-actions,
    .template-sidebar,
    .action-buttons,
    .dictate-btn,
    .expand-icon,
    .theme-switcher {
        display: none !important;
    }

    .main-grid {
        display: block;
    }
    
    .section {
        page-break-inside: avoid;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }

    .section-header {
        background: #f5f5f5;
    }

    .section.collapsed .section-content {
        display: block !important;
    }
    
    .note-content {
        background: white;
        border: 1px solid #ddd;
    }
}

/* ============================================
   RESPONSIVE: TABLET
   ============================================ */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .template-sidebar {
        position: relative;
        top: 0;
        margin-bottom: 20px;
    }
    
    .patient-info {
        grid-template-columns: 1fr 1fr;
    }

    .template-card {
        display: flex;
        flex-direction: column;
    }

    .quick-templates {
        margin-bottom: 16px;
    }

    .section-selector {
        border-top: none;
        padding-top: 0;
        border-left: 1px solid var(--border);
        padding-left: 16px;
        margin-left: 16px;
    }
}

/* ============================================
   RESPONSIVE: MOBILE
   ============================================ */
@media (max-width: 640px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .theme-switcher {
        width: 100%;
        justify-content: center;
    }
    
    .patient-info {
        grid-template-columns: 1fr;
    }
    
    .quick-select {
        grid-template-columns: 1fr 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        padding: 16px;
        margin: 0 -12px -12px -12px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .note-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .note-header .btn {
        width: 100%;
    }

    .section-selector {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        border-top: 1px solid var(--border);
        padding-top: 16px;
        margin-top: 16px;
    }

    .teeth-summary-content {
        flex-direction: column;
    }

    .teeth-summary-item {
        width: 100%;
    }

    .tooth-grid {
        gap: 4px;
        max-width: 100%;
    }
    
    .tooth-btn {
        --tooth-scale: 1.1;
        aspect-ratio: 1 / 1.3;
    }
}









/* ============================================
   SECTION SELECTOR – CUSTOMIZATION MODE
   ============================================ */

.section-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 10px;
}

.section-selector-helper {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Customize toggle button */
.section-customize-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-hover);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.section-customize-toggle:hover {
    background: var(--bg-active);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.section-customize-toggle-icon {
    font-size: 13px;
}

.section-customize-toggle-pill {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-customize-toggle.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.section-customize-toggle.active .section-customize-toggle-pill {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Drag handle + delete button – hidden outside customization mode */

.section-drag-handle {
    width: 18px;
    flex-shrink: 0;
    font-size: 14px;
    color: var(--text-muted);
    cursor: grab;
    user-select: none;
    display: none;
    opacity: 0.7;
}

.section-selector.customizing .section-drag-handle {
    display: inline-flex;
}

.section-drag-handle:active {
    cursor: grabbing;
}

.section-delete-btn {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--danger-light);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.section-selector.customizing .section-delete-btn {
    display: inline-flex;
}

.section-delete-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    transform: translateY(-1px) scale(1.02);
}

/* Adjust checkbox row layout when customization is on */

.section-checkbox {
    position: relative;
}

.section-selector.customizing .section-checkbox {
    padding-left: 10px;
    gap: 10px;
}

/* Drag feedback */
.section-checkbox.dragging {
    opacity: 0.7;
    transform: scale(0.99);
    box-shadow: var(--shadow-md);
}

.section-checkbox.drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: 2px;
}

/* Remove animation */
.section-removing {
    opacity: 0;
    transform: translateX(8px);
    transition: var(--transition);
}

/* ============================================
   CUSTOMIZATION TOOLBAR
   ============================================ */

.section-customize-toolbar {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
    background: linear-gradient(
        135deg,
        rgba(148, 163, 184, 0.08),
        rgba(14, 165, 233, 0.06)
    );
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.section-customize-toolbar.active {
    display: flex;
}

.section-customize-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.section-customize-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.25);
    animation: sectionStatusPulse 1.5s infinite;
}

@keyframes sectionStatusPulse {
    0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.3); }
    70% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

.section-customize-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Toolbar buttons */

.section-customize-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-full);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
}

.section-customize-btn .icon {
    font-size: 12px;
}

.section-customize-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-sm), var(--shadow-glow);
}

.section-customize-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.section-customize-btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border);
}

.section-customize-btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-focus);
}

.section-customize-btn-ghost {
    background: rgba(255, 255, 255, 0.4);
    color: var(--primary-dark);
    border-color: rgba(148, 163, 184, 0.5);
}

.section-customize-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* ============================================
   SECTION EDITOR OVERLAY (Add New Section)
   ============================================ */

.section-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80;
    backdrop-filter: blur(8px);
}

.section-editor-overlay.active {
    display: flex;
}

.section-editor-dialog {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    padding: 20px 22px 18px;
    animation: sectionEditorIn 0.22s ease-out;
}

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

.section-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.section-editor-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-editor-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.section-editor-close {
    border: none;
    background: transparent;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.section-editor-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Form layout */

.section-editor-grid {
    display: grid;
    grid-template-columns: 1.3fr 1.3fr;
    gap: 12px 16px;
    margin-bottom: 16px;
}

.section-editor-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-editor-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-editor-field input[type="text"],
.section-editor-field input[type="password"] {
    padding: 9px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
}

.section-editor-field input[type="text"]:focus,
.section-editor-field input[type="password"]:focus{
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Inline checkbox field */

.section-editor-field-inline {
    align-self: flex-start;
    padding: 8px 10px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.inline-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Key preview */

.section-key-preview {
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    border: 1px dashed var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Footer */

.section-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================
   RESPONSIVE: EDITOR
   ============================================ */

@media (max-width: 640px) {
    .section-editor-dialog {
        margin: 0 10px;
        padding: 16px 16px 14px;
    }

    .section-editor-grid {
        grid-template-columns: 1fr;
    }

    .section-customize-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Edit button (pencil) – only in customization mode */
.section-edit-btn {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.section-selector.customizing .section-edit-btn {
    display: inline-flex;
}

.section-edit-btn:hover {
    background: var(--bg-active);
    color: var(--primary-dark);
    transform: translateY(-1px) scale(1.02);
}


/* Smooth "Saved" animation on toolbar Save button */
.section-customize-btn.saved-pulse {
    background: var(--success);
    border-color: var(--success);
    color: white;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
    transition: all 0.25s ease-out;
}

.section-customize-btn.saved-pulse {
    animation: savedPulse 1.2s ease-out;
}

@keyframes savedPulse {
    0%   { transform: scale(1); box-shadow: 0 0 0 rgba(16,185,129,0); }
    40%  { transform: scale(1.06); box-shadow: 0 0 10px rgba(16,185,129,0.45); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(16,185,129,0); }
}




/* ============================================
   EDIT VISUAL STYLES
   ============================================ */

/* ===== keep your existing styles, then add/extend with this ===== */

/* --- Component container & toolbar: theme-aware --- */

.section-component {
    position: relative;
    margin-bottom: 18px;    
    border-radius: var(--radius-md);
    background: var(--bg-elevated);    
    transition: transform 150ms ease-out, box-shadow 150ms ease-out, background-color 150ms ease-out;
}

/* Edit state visuals */
.section.section-editing .section-component {
    border: 1px dashed var(--border);
    box-shadow: var(--shadow-md);
    padding: 40px 18px 18px;   /* extra top so toolbar doesn't overlap content */
}

.section.section-editing .section-component:hover {
    box-shadow: var(--shadow-lg);
}

.section:not(.section-editing) .section-add {
    display: none;
}

.section:not(.section-editing) .section-add-menu {
    display: none !important;
}

/* Component toolbar pill */
.component-toolbar {
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    border-radius: 999px;
    /* gradient that adapts to theme */
    background:
      radial-gradient(circle at top left, var(--primary-glow), transparent 60%),
      var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 11px;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    z-index: 3; /* above quick-select chips */
}

.section.section-editing .section-component:hover .component-toolbar,
.section.section-editing .section-component.dragging .component-toolbar {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.component-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.component-drag-handle {
    font-size: 13px;
    cursor: grab;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    user-select: none;
    color: var(--text-muted);
}

.section.section-editing .section-component.dragging .component-drag-handle {
    cursor: grabbing;
}

.component-drag-handle:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.component-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    font-size: 10px;
    color: var(--text-secondary);
}

.component-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.component-actions button {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 11px;
    transition: var(--transition);
}

.component-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* Dragging ghost */
.section-component.dragging {
    cursor: grabbing;
    box-shadow: var(--shadow-lg);
    z-index: 5;
}

/* Editable text styling */
.editable-text[contenteditable="true"] {
    outline: none;
    border-radius: 4px;
    padding-inline: 3px;
    box-shadow: 0 0 0 1px var(--border-focus);
    background: var(--bg-hover);
}

/* Comments / text area container */
.comments-area {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 14px 14px 10px;
    background:
      radial-gradient(circle at top left, var(--primary-glow), transparent 60%),
      var(--bg-card);
}

/* Editable placeholder textarea hint */
.section.section-editing textarea[data-editable-placeholder="true"] {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--primary-glow);
}

/* --- "Add component" footer --- */

.section-add {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.section-add-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px dashed var(--border-light);
    background: var(--bg-base);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.section-editing .section-add-btn {
    opacity: 1;
}

.section-add-plus {
    font-size: 18px;
    margin-top: -1px;
}

.section-add-btn:hover {
    border-style: solid;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Add component menu */
.section-add-menu {
    margin-top: 10px;
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.section-add-menu.open {
    display: grid;
}

.section-add-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background:
      radial-gradient(circle at top left, var(--primary-glow), transparent 60%),
      var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.section-add-option:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.option-icon {
    font-size: 16px;
}

.option-main {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.option-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Modal (app-style popups) – theme-driven --- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    /* subtle dim that works in light & dark */
    background:
      linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.45));
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-dialog {
    width: 100%;
    max-width: 420px;
    background:
      radial-gradient(circle at 5% 0%, var(--primary-glow), transparent 55%),
      var(--bg-card);
    border-radius: 18px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: fadeIn 0.18s ease-out;
}

.modal-header {
    padding: 14px 18px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background:
      linear-gradient(120deg, var(--bg-base), var(--bg-card));
}

.modal-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);    
}

.modal-close-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 999px;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.modal-body {
    padding: 14px 18px 10px;
    background: var(--bg-card);
}

.modal-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.modal-footer {
    padding: 10px 18px 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border);
    background: var(--bg-base);
}

.modal-primary-btn,
.modal-secondary-btn,
.modal-outline-btn {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 14px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    transition: var(--transition);
}

/* primary = theme primary pill */
.modal-primary-btn {
    background: var(--primary);
    color: var(--bg-base);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.modal-primary-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

/* secondary = subtle outline aligned with theme */
.modal-secondary-btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.modal-secondary-btn:hover {
    border-color: var(--border-focus);
}

/* full-width helper button (e.g., + Add option) */
.modal-outline-btn {
    width: 100%;
    margin-top: 8px;
    background: var(--bg-base);
    color: var(--text-secondary);
    border-color: var(--border);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.modal-outline-btn:hover {
    border-color: var(--border-focus);
}

/* inputs inside modal */
.modal-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 12px;
    outline: none;
    margin-bottom: 4px;
    box-shadow: var(--shadow-sm);
}

.modal-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--primary-glow);
}

/* list of quick-select options */
.modal-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 2px;
}

.modal-list-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* small circular icon button (remove row) */
.modal-icon-btn {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-base);
    color: var(--text-muted);
    font-size: 11px;
    height: 26px;
    width: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

/* use a fixed red for delete; small accent is OK across themes */
.modal-icon-btn:hover {
    border-color: #fb7185;
    color: #be123c;
    background: #fee2e2;
}

.modal-error {
    color: #be123c;
    font-size: 11px;
    margin-top: 4px;
}



.component-customize-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 999px;

    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;

    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);

    transition: var(--transition);
}

.component-customize-toggle:hover {
    background: var(--bg-active);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-md);
}

.component-customize-toggle-icon {
    font-size: 14px;
    line-height: 1;
}

.component-customize-toggle-label {
    font-weight: 600;
    font-size: 12px;
}

.component-customize-toggle-pill {
    background: var(--primary);
    color: white;

    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
}

.modal-mode-group {
  margin-bottom: 12px;
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
}

.modal-mode-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
}






/* ============================================
   ACCOUNT MENU (Header)
   ============================================ */
.account-menu {
    position: relative;
    display: inline-flex;
}

.account-btn {
    display: flex;
    padding: 10px 14px;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.account-btn:hover {
    background: var(--bg-hover);
}

.account-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: var(--shadow-sm);
    flex: 0 0 auto;
}

.account-label {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    text-align: left;
}

.account-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.account-plan {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.account-caret {
    margin-left: 2px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Popover */
.account-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: var(--transition);
    z-index: 200;
}

.account-menu.open .account-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.account-popover-header {
    padding: 10px 10px 8px 10px;
}

.account-popover-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
}

.account-popover-sub {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.account-popover-group {
    padding: 6px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.account-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
    text-align: left;
}

.account-item:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.account-item:active {
    transform: translateY(1px);
}

.account-item-icon {
    width: 18px;
    display: inline-flex;
    justify-content: center;
}

.account-item.danger {
    color: var(--danger);
}

.account-item.danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

.account-popover-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 6px;
}

/* Focus ring for keyboard users */
.account-btn:focus-visible,
.account-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}


/* ============================================
   VISIT TYPE (SPECIAL FIRST SECTION)
   ============================================ */

.section.section-visit-type {
  display: block; /* this section should always render when visible */
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
}

/* Subtle "special" header treatment */
.section.section-visit-type .section-header {
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.10), rgba(45, 212, 191, 0.02)),
    var(--bg-hover);
}

.section.section-visit-type .section-header:hover {
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.16), rgba(45, 212, 191, 0.03)),
    var(--bg-active);
}

/* Icon: keep your gradient but make it a touch more "system" */
.section.section-visit-type .section-icon {
  box-shadow: var(--shadow-md);
}

/* Right side toggle */
.visit-type-manage-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.visit-type-manage-toggle:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.visit-type-manage-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-active);
  border: 1px solid var(--border);
}

.visit-type-manage-pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
}

/* When ON */
.section-visit-type.manage-on .visit-type-manage-pill {
  background: rgba(45, 212, 191, 0.18);
  border-color: var(--border-focus);
  color: var(--text-secondary);
}

/* Content area: slightly tighter than other sections */
.section.section-visit-type .section-content {
  padding: 16px 20px 18px;
}

/* Chips bar */
.visit-type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Chip */
.visit-type-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.visit-type-chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.visit-type-chip-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 14px;
}

.visit-type-chip-label {
  white-space: nowrap;
}

/* Active */
.visit-type-chip.active {
  border-color: var(--border-focus);
  background: rgba(45, 212, 191, 0.10);
  box-shadow: var(--shadow-md);
}

/* Manage-mode actions (hidden by default) */
.visit-type-chip-actions {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.section-visit-type.manage-on .visit-type-chip-actions {
  display: inline-flex;
}

/* Small action buttons on chip */
.visit-type-edit,
.visit-type-delete {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.visit-type-edit:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.visit-type-delete:hover {
  border-color: rgba(239, 68, 68, 0.45); /* danger tint */
  background: rgba(239, 68, 68, 0.08);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Add button (only in manage mode) */
.visit-type-add {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  border: 1px dashed var(--border-focus);
  background: rgba(45, 212, 191, 0.06);
  color: var(--text-secondary);
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.section-visit-type.manage-on .visit-type-add {
  display: inline-flex;
}

.visit-type-add:hover {
  background: rgba(45, 212, 191, 0.12);
  transform: translateY(-1px);
}

/* Hint line */
.visit-type-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}


/* ============================================
   VISIT TYPE special section (built on quick-item)
   ============================================ */

.section.section-visit-type {
  display: block;
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
}

/* gentle accent so it feels "system-level" */
.section.section-visit-type .section-header {
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.10), rgba(45, 212, 191, 0.02)),
    var(--bg-hover);
}

/* selector layout */
.visit-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Make quick-item feel like a "pill" only inside Visit Type (subtle) */
.section-visit-type .quick-item {
  text-align: left;
  padding-right: 44px; /* room for actions when manage mode is on */
}

/* Actions hidden by default */
.visit-type-actions {
  display: none;
  /*position: absolute;*/
  top: 6px;
  right: 6px;
  gap: 6px;
  margin-left: 10px;
  margin-right: -25px;
}

/* Show actions only in manage mode */
.section-visit-type.manage-on .visit-type-actions {
  display: inline-flex;
}

/* Action buttons look like tiny pills */
.visit-type-edit,
.visit-type-delete {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text-secondary);
}

.visit-type-edit:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.visit-type-delete:hover {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.10);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Add button appears only in manage mode */
.visit-type-add {
  display: none;
  border-style: dashed;
  border-color: var(--border-focus);
  background: rgba(45, 212, 191, 0.06);
  font-weight: 700;
}

.section-visit-type.manage-on .visit-type-add {
  display: inline-block;
}

/* Hint line */
.visit-type-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Manage toggle (right side) */
.visit-type-manage-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.visit-type-manage-toggle:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.visit-type-manage-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-active);
  border: 1px solid var(--border);
}

.visit-type-manage-pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
}

.section-visit-type.manage-on .visit-type-manage-pill {
  background: rgba(45, 212, 191, 0.18);
  border-color: var(--border-focus);
  color: var(--text-secondary);
}



/* ============================================
   RESET PASSWORD PAGE
   ============================================ */

.page-container {
  display: flex;
  justify-content: center;
  margin-top: 60px;
}

.reset-password-card {
  width: 420px;
  padding: 24px;
}

.card {
  background: var(--panel-bg);
  border-radius: 14px;
  box-shadow: var(--panel-shadow);
}

.card-header h2 {
  margin: 0;
  font-size: 22px;
}

.card-subtitle {
  margin-top: 6px;
  color: var(--muted-text);
}

.form-group {
  margin-bottom: 18px;
}

.card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.header-btn.primary {
  background: var(--accent);
  color: white;
}

#generateNoteBtn:hover span {
    animation: sparkle 0.6s ease-in-out infinite;
    filter: drop-shadow(0 0 4px gold);
}

@keyframes sparkle {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    50% { transform: scale(0.9) rotate(10deg); }
    75% { transform: scale(1.3) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.section-cta {
  text-align: center;
  margin-top: 3rem;
}

.section-cta p {
  color: #94a3b8;
  font-size: 1rem;
}

.section-cta a {
  color: #2dd4bf;
  text-decoration: none;
  font-weight: 500;
}

.section-cta a:hover {
  text-decoration: underline;
}

.cancel-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 8px 0;
  }

  .cancel-icon {
    text-align: center;
    margin-bottom: 20px;
  }

  .cancel-icon .icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--bg-active) 0%, var(--border) 100%);
    border-radius: 50%;
    animation: wobble 2s ease-in-out infinite;
  }

  .cancel-icon .icon-circle svg {
    width: 36px;
    height: 36px;
    color: var(--primary-dark);
  }

  @keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
  }

  .cancel-headline {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 8px;
  }

  .cancel-subtext {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.6;
  }

  /* Special Offer Box */
  .cancel-offer {
    background: linear-gradient(135deg, var(--bg-base) 0%, var(--bg-active) 100%);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
  }

  .cancel-offer::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
  }

  @keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, 10%); }
  }

  .offer-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-elevated);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 6px 14px;
    border-radius: 100px;
    margin-bottom: 12px;
    position: relative;
  }

  .offer-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 6px;
    position: relative;
  }

  .offer-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    position: relative;
  }

  /* What You'll Lose */
  .cancel-lose {
    background: #fef2f2;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
  }

  .cancel-lose-title {
    font-size: 12px;
    font-weight: 700;
    color: #dc2626;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .cancel-lose-title svg {
    width: 14px;
    height: 14px;
  }

  .cancel-lose-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
  }

  .cancel-lose-item:last-child {
    margin-bottom: 0;
  }

  .cancel-lose-item svg {
    width: 18px;
    height: 18px;
    color: #ef4444;
    flex-shrink: 0;
    margin-top: 1px;
  }

  .cancel-lose-item span {
    font-size: 14px;
    color: #991b1b;
    line-height: 1.4;
  }

  /* Buttons */
  .cancel-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .btn-stay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--bg-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md), var(--shadow-glow);
  }

  .btn-stay:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
  }

  .btn-stay svg {
    width: 18px;
    height: 18px;
  }

  .btn-leave {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .btn-leave:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
  }

  /* Footer note */
  .cancel-note {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
  }


  /* Past Due Account State */
.account-btn.account-past-due {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    animation: pastDuePulse 2s ease-in-out infinite;
}

.account-btn.account-past-due:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
}

.account-avatar.past-due {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    font-size: 16px;
    font-weight: 900;
}

.account-plan.past-due {
    color: #ef4444;
    font-weight: 700;
}

@keyframes pastDuePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
    }
}

/* Past Due Banner in Popover */
.account-popover-past-due-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 12px 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #dc2626;
}

/* Highlighted menu item (for Billing when past due) */
.account-item.highlight {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    font-weight: 700;
}

.account-item.highlight:hover {
    background: rgba(239, 68, 68, 0.15);
}

.account-item.highlight .account-item-icon {
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}



/* ============================================
   Medications Component Styles
   ============================================ */
/* ============================================
   Medications Component Styles
   ============================================ */
.medications-list {
    padding: 16px;
}

/* ============================================
   Customization Panel Base Styles
   ============================================ */
.component-customize-panel {
    display: none;
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border);
    padding: 16px;
    animation: slideDown 0.2s ease;
}

.component-customize-panel.open {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.customize-section {
    margin-bottom: 16px;
}

.customize-section:last-child {
    margin-bottom: 0;
}

.customize-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.customize-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: var(--transition);
}

.customize-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.customize-panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.customize-done-btn {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.customize-done-btn:hover {
    background: var(--primary-dark);
}

/* Summary Section */
.medications-summary {
    background: var(--bg-hover);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.medications-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    /* margin-bottom: 12px; */
    font-size: 14px;
}

.medications-summary-content {
    display: none;
    min-height: 24px;
}

.medications-summary-empty {
    color: var(--primary-dark);
    font-style: italic;
    font-size: 14px;
}

.medications-summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.medication-summary-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--primary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.medication-summary-tag .med-name {
    font-weight: 600;
}

.medication-summary-tag .med-details {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Quick Add Section */
.medications-quick-add {
    margin-bottom: 16px;
}

.medications-quick-add-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.common-medications {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.common-med-btn {
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition);
}

.common-med-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.common-med-btn.added {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Add Custom Medication Form */
.medication-add-form {
    background: var(--bg-hover);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.medication-add-form-title {
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
    /* margin-bottom: 12px; */
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.medication-form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
    display: none;
}

.medication-form-row-btn {
    margin-top: 12px;
    display: none;
}

@media (max-width: 900px) {
    .medication-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 500px) {
    .medication-form-row {
        grid-template-columns: 1fr;
    }
}

.medication-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.medication-form-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.medication-form-group input,
.medication-form-group select {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: var(--transition);
}

.medication-form-group input:focus,
.medication-form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.medication-form-group input::placeholder {
    color: var(--text-muted);
}

.medication-add-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.medication-add-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.medication-add-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Medications Table */
.medications-table-container {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.medications-table {
    width: 100%;
    border-collapse: collapse;
}

.medications-table th {
    background: var(--bg-hover);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.medications-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-elevated);
}

.medications-table tr:last-child td {
    border-bottom: none;
}

.medications-table tr:hover td {
    background: var(--bg-hover);
}

.medications-table .med-name-cell {
    font-weight: 600;
}

.medications-table .med-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: var(--transition);
}

.medications-table .med-remove-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.medications-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-elevated);
}

/* NKDA / No Medications Toggle */
.nkda-toggle {
    display: none;
    /* display: flex; */
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    transition: var(--transition);
}

.nkda-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.nkda-toggle label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.nkda-toggle.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* Frequency Pills */
.frequency-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ============================================
   Customization Panel - Medications Specific
   ============================================ */
.customize-common-meds {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.customize-med-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-primary);
}

.customize-med-tag .remove-med {
    width: 16px;
    height: 16px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.customize-med-tag .remove-med:hover {
    background: var(--primary-dark);
}

.customize-add-med-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
}

@media (max-width: 900px) {
    .customize-add-med-row {
        grid-template-columns: 1fr 1fr;
    }
    .customize-add-med-row .customize-add-btn {
        grid-column: 1 / -1;
    }
}

.customize-add-med-row input,
.customize-add-med-row select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: var(--transition);
}

.customize-add-med-row input:focus,
.customize-add-med-row select:focus {
    outline: none;
    border-color: var(--border-focus);
}

.customize-add-med-row input::placeholder {
    color: var(--text-muted);
}

.customize-add-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.customize-add-btn:hover {
    background: var(--primary-dark);
}

/* Options Editor */
.customize-options-editor {
    margin-top: 12px;
}

.customize-options-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.customize-options-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.customize-option-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
}

.customize-option-tag .remove-option {
    width: 14px;
    height: 14px;
    border: none;
    background: var(--text-muted);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0.7;
}

.customize-option-tag .remove-option:hover {
    background: var(--danger);
    opacity: 1;
}

.customize-options-add-row {
    display: flex;
    gap: 6px;
}

.customize-options-add-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-primary);
    background: var(--bg-input);
}

.customize-options-add-row input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.customize-options-add-btn {
    padding: 6px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.customize-options-add-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--text-primary);
}

.customize-subsection {
    padding: 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.customize-subsection-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}



/***
THEETH 
    ============================================ */

/* Surface Popover Styles - Add to your existing teeth selection CSS */

/* Container needs relative positioning for popover */
.tooth-grid-container {
  position: relative;
}



/* Tooth button adjustments */
.tooth-btn {
  position: relative;
}

/* Surface indicator on tooth */
.tooth-surface-indicator {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Summary styling */
.teeth-summary-item .teeth {
  display: inline-block;
  background: #2a2a3e;
  padding: 2px 8px;
  border-radius: 4px;
  margin: 2px;
  font-size: 13px;
  color: #e0e0e0;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .surface-popover {
    padding: 5px 6px;
    gap: 3px;
  }
  
  .surface-chip {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}


.teeth-selection {
    margin-bottom: 18px;
}

.quadrant-hint {
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--warning, #f59e0b);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-sm, 8px);
    padding: 6px 12px;
    margin: 6px 4px 0;
    animation: hintSlideIn 0.2s ease;
    transition: opacity 0.3s ease;
}

.quadrant-hint.fade-out {
    opacity: 0;
}

@keyframes hintSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}