/* MyWriters.life — Warm Hollywood Theme */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;900&family=Inter:wght@300;400;500;600;700&family=Courier+Prime:wght@400;700&display=swap');

:root {
    --bg-dark: #f7f3ec;
    --bg-card: #ffffff;
    --bg-card-hover: #faf8f4;
    --bg-input: #f0ebe2;
    --bg-hover: #ece7dd;
    --border: #ddd5c8;
    --border-light: #c9bfb0;
    --text: #2c2417;
    --text-muted: #7a6f60;
    --text-dim: #a39882;
    --gold: #b8922e;
    --gold-dark: #96760f;
    --gold-light: #d4a843;
    --gold-glow: rgba(184, 146, 46, 0.12);
    --red: #b33025;
    --red-glow: rgba(179, 48, 37, 0.1);
    --green: #2d7a4f;
    --green-glow: rgba(45, 122, 79, 0.1);
    --blue: #2a6496;
    --cream: #fffdf8;
    --brown: #4a3728;
    --brown-light: #6b5443;
    --radius: 6px;
    --radius-lg: 12px;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-script: 'Courier Prime', 'Courier New', monospace;
    --shadow-sm: 0 2px 8px rgba(74, 55, 40, 0.08);
    --shadow-md: 0 4px 20px rgba(74, 55, 40, 0.1);
    --shadow-lg: 0 8px 40px rgba(74, 55, 40, 0.12);
    --shadow-gold: 0 0 20px rgba(184, 146, 46, 0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::selection {
    background: var(--gold-light);
    color: var(--brown);
}

a {
    color: var(--gold-dark);
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}
a:hover {
    color: var(--brown);
}

/* ==================== NAVIGATION ==================== */
.main-nav {
    background: var(--brown);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
/* Hamburger button — hidden on desktop */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(245,240,232,0.8);
    border-radius: 2px;
    transition: all 0.3s;
}

.nav-inner {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.nav-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #f5f0e8;
    letter-spacing: -0.5px;
}
.nav-logo span {
    color: var(--gold-light);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}
.nav-links a {
    color: rgba(245, 240, 232, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.3s;
}
.nav-links a:hover {
    color: #f5f0e8;
}
.nav-btn, .nav-btn-outline {
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.nav-btn {
    background: var(--gold-light);
    color: var(--brown);
    box-shadow: none;
}
.nav-btn:hover {
    background: #e8be5a;
    color: var(--brown);
}
.nav-btn-outline {
    border: 1px solid rgba(245, 240, 232, 0.3);
    color: rgba(245, 240, 232, 0.8) !important;
}
.nav-btn-outline:hover {
    border-color: var(--gold-light);
    color: var(--gold-light) !important;
}

/* Nav Links */
.nav-link {
    color: rgba(245,240,232,0.7) !important;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.2s;
}
.nav-link:hover {
    color: #f5f0e8 !important;
}
.nav-sep {
    width: 1px;
    height: 20px;
    background: rgba(245,240,232,0.15);
    margin: 0 4px;
}
.nav-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #c0392b;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 14px;
    text-align: center;
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
}
.nav-dropdown-btn {
    background: rgba(245,240,232,0.06);
    border: 1px solid rgba(245,240,232,0.15);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--font-ui);
    font-weight: 500;
    color: rgba(245,240,232,0.75);
    transition: all 0.2s;
    letter-spacing: 0.2px;
}
.nav-dropdown-btn:hover,
.nav-dropdown.open .nav-dropdown-btn {
    background: rgba(245,240,232,0.12);
    border-color: rgba(245,240,232,0.3);
    color: #f5f0e8;
}
.nav-dropdown-admin {
    border-color: rgba(201, 168, 76, 0.3);
    color: var(--gold-light) !important;
}
.nav-dropdown-admin:hover,
.nav-dropdown.open .nav-dropdown-admin {
    background: rgba(201, 168, 76, 0.15);
    border-color: rgba(201, 168, 76, 0.5);
}
.nav-dropdown-account {
    background: rgba(245,240,232,0.1);
    border-color: rgba(245,240,232,0.25);
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--brown);
    border: 1px solid rgba(245,240,232,0.12);
    border-radius: var(--radius-lg);
    padding: 6px 0;
    min-width: 190px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    z-index: 200;
    backdrop-filter: blur(10px);
}
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
    animation: dropIn 0.15s ease-out;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.nav-dropdown-menu a {
    display: block;
    padding: 9px 18px;
    font-size: 0.83rem;
    color: rgba(245,240,232,0.8) !important;
    transition: all 0.12s;
}
.nav-dropdown-menu a:hover {
    background: rgba(245,240,232,0.1);
    color: #f5f0e8 !important;
    padding-left: 22px;
}
.nav-dropdown-divider {
    border-top: 1px solid rgba(245,240,232,0.1);
    margin: 4px 0;
}
.nav-dropdown-label {
    padding: 6px 18px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold-light);
    opacity: 0.7;
    pointer-events: none;
}

/* ==================== CONTAINER ==================== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 24px;
    flex: 1;
}

/* Wide page layout for logged-in pages */
.page-wide {
    width: 100%;
    max-width: 100%;
}
.page-wide h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.page-wide .subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* ==================== FLASH MESSAGES ==================== */
.flash {
    max-width: 100%;
    margin: 16px auto 0;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}
.flash-success {
    background: var(--green-glow);
    color: var(--green);
    border: 1px solid rgba(39, 174, 96, 0.25);
}
.flash-error {
    background: var(--red-glow);
    color: var(--red);
    border: 1px solid rgba(192, 57, 43, 0.25);
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 22px;
}
.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.93rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold-dark);
    box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-group textarea {
    min-height: 120px;
    resize: vertical;
}
.form-group .script-textarea {
    font-family: var(--font-script);
    font-size: 0.9rem;
    line-height: 1.6;
    min-height: 400px;
    background: #fff;
    color: #1a1a1a;
    border: 2px solid var(--border);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}
.btn-primary {
    background: var(--brown);
    color: #f5f0e8;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--brown-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--gold-dark);
    color: var(--gold);
    background: var(--bg-hover);
}
.btn-danger {
    background: var(--red-glow);
    color: var(--red);
    border: 1px solid rgba(192, 57, 43, 0.25);
}
.btn-danger:hover {
    background: rgba(192, 57, 43, 0.25);
}
.btn-sm {
    padding: 8px 16px;
    font-size: 0.78rem;
}
.btn-block {
    display: block;
    width: 100%;
}

/* ==================== AUTH PAGES ==================== */
.auth-page {
    max-width: 520px;
    margin: 60px auto;
}
.auth-page h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.auth-page .subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* ==================== HERO ==================== */
.hero {
    text-align: center;
    padding: 100px 20px 80px;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 500px;
    background: radial-gradient(circle, rgba(184, 146, 46, 0.06) 0%, transparent 60%);
    pointer-events: none;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 20px;
    line-height: 1.15;
}
.hero h1 span {
    color: var(--gold-dark);
    font-style: italic;
}
.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 44px;
    line-height: 1.7;
    font-weight: 300;
}
.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ==================== FEATURES ==================== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 60px;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: border-color 0.4s, box-shadow 0.4s, transform 0.3s;
}
.feature-card:hover {
    border-color: var(--gold-dark);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}
.feature-card .icon {
    font-size: 1.8rem;
    margin-bottom: 16px;
    display: inline-block;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    background: var(--gold-glow);
    border-radius: var(--radius);
}
.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 10px;
    font-weight: 600;
}
.feature-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ==================== DASHBOARD ==================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
}

.script-list {
    display: grid;
    gap: 12px;
}
.script-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.script-card:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}
.script-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 6px;
    font-weight: 600;
}
.script-card h3 a {
    color: var(--text);
    transition: color 0.2s;
}
.script-card h3 a:hover {
    color: var(--gold);
}
.script-meta {
    display: flex;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.2px;
}
.script-meta span::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}
.script-meta span:first-child::before {
    display: none;
}
.script-actions {
    display: flex;
    gap: 6px;
}

/* ==================== SCREENPLAY FORMAT ==================== */
.screenplay {
    background: #fff;
    color: #1a1a1a;
    font-family: var(--font-script);
    font-size: 12pt;
    line-height: 1.5;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 72px 108px 72px 144px;
    border-radius: var(--radius);
    min-height: 792px;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.screenplay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-dark));
    border-radius: var(--radius) var(--radius) 0 0;
}
.screenplay .heading {
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 24px;
}
.screenplay .character-name {
    text-transform: uppercase;
    margin-top: 24px;
    margin-left: 168px;
    font-weight: 700;
    color: #333;
}
.screenplay .dialogue {
    margin-left: 96px;
    margin-right: 96px;
}
.screenplay .action {
    margin-top: 12px;
}
.screenplay .parenthetical {
    margin-left: 132px;
    font-style: italic;
    color: #555;
}

/* ==================== PLAYBACK ==================== */
.playback-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    position: sticky;
    top: 64px;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brown);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.play-btn:hover {
    background: var(--brown-light);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}
.play-btn svg {
    width: 20px;
    height: 20px;
    fill: #f5f0e8;
}
.current-line {
    background: rgba(201, 168, 76, 0.12) !important;
    border-left: 3px solid var(--gold) !important;
    transition: background 0.3s;
}

/* ==================== VOICE ASSIGNMENT ==================== */
.voice-grid {
    display: grid;
    gap: 12px;
}
.voice-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.3s;
}
.voice-card:hover {
    border-color: var(--border-light);
}
.voice-card .char-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
}
.voice-card select {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

/* ==================== RECORDING ==================== */
.record-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--red);
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}
.record-btn.recording {
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.5); }
    50% { box-shadow: 0 0 0 14px rgba(192, 57, 43, 0); }
}
.record-btn::after {
    content: '';
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.record-btn.recording::after {
    border-radius: 3px;
    width: 16px;
    height: 16px;
}

/* ==================== CAST LINES ==================== */
.line-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: border-color 0.3s;
}
.line-card:hover {
    border-color: var(--border-light);
}
.line-number {
    color: var(--text-dim);
    font-size: 0.78rem;
    min-width: 32px;
    padding-top: 3px;
    font-weight: 600;
}
.line-content {
    font-family: var(--font-script);
    flex: 1;
    line-height: 1.6;
}
.line-status {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.line-status.recorded {
    background: var(--green-glow);
    color: var(--green);
}
.line-status.pending {
    background: var(--gold-glow);
    color: var(--gold);
}

/* ==================== PROFILE ==================== */
.profile-header {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 40px;
}
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold-dark);
    background: var(--bg-input);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.1);
}
.profile-info h1 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    margin-bottom: 6px;
    font-weight: 700;
}
.profile-info .role-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 14px;
    border-radius: 20px;
    background: var(--gold-glow);
    color: var(--gold);
    margin-bottom: 12px;
    border: 1px solid rgba(201, 168, 76, 0.2);
}
.visibility-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 8px;
}
.visibility-badge.public {
    background: var(--green-glow);
    color: var(--green);
    border: 1px solid rgba(39, 174, 96, 0.2);
}
.visibility-badge.private {
    background: rgba(100, 100, 110, 0.12);
    color: var(--text-dim);
    border: 1px solid rgba(100, 100, 110, 0.15);
}

/* ==================== EMPTY STATES ==================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-state h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text);
    font-weight: 600;
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}
.tab {
    padding: 12px 24px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}
.tab:hover {
    color: var(--text);
}
.tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* ==================== FOOTER ==================== */
.main-footer {
    border-top: 1px solid var(--border);
    padding: 40px 24px 28px;
    margin-top: auto;
    background: var(--brown);
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: rgba(245, 240, 232, 0.6);
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    text-align: left;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(245, 240, 232, 0.1);
}
.footer-col h4 {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(245, 240, 232, 0.85);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}
.footer-col a {
    display: block;
    padding: 3px 0;
    font-size: 0.78rem;
    color: rgba(245, 240, 232, 0.45) !important;
    transition: color 0.2s;
}
.footer-col a:hover {
    color: rgba(245, 240, 232, 0.8) !important;
}
@media (max-width: 768px) {
    .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
    .footer-col h4 { font-size: 0.75rem; }
    .footer-col a { font-size: 0.72rem; }
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 0.78rem;
    flex-wrap: wrap;
}
.footer-links a {
    color: rgba(245, 240, 232, 0.5) !important;
    transition: color 0.2s;
}
.footer-links a:hover {
    color: rgba(245, 240, 232, 0.8) !important;
}

/* ==================== PLAY PAGE — SIDE-BY-SIDE ==================== */
.play-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: start;
    max-width: 100%;
}
.play-sidebar {
    position: sticky;
    top: 84px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}
.play-sidebar::-webkit-scrollbar {
    width: 4px;
}
.play-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}
.playback-controls-side {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.voice-panel {
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.voice-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.voice-row:last-of-type {
    border-bottom: none;
}
.voice-row-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 70px;
    white-space: nowrap;
}
.voice-row select {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.8rem;
}
.voice-row select:focus {
    outline: none;
    border-color: var(--gold-dark);
}
.play-script {
    min-width: 0;
}
.play-script .screenplay {
    margin: 0;
}

/* Clickable dialogue lines in play mode */
.play-script .line[data-type="dialogue"] {
    cursor: pointer;
    transition: background 0.2s, border-left 0.2s;
    padding: 2px 4px;
    border-left: 3px solid transparent;
    border-radius: 2px;
}
.play-script .line[data-type="dialogue"]:hover {
    background: rgba(201, 168, 76, 0.06);
}

/* ==================== EMAIL / WEBMAIL ==================== */
.email-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
    min-height: 60vh;
}
.email-sidebar {
    position: sticky;
    top: 84px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.email-folders {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.email-folder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    color: var(--text);
    transition: background 0.2s;
}
.email-folder:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.email-folder.active {
    background: var(--gold-glow);
    color: var(--gold-dark);
    font-weight: 600;
}
.folder-badge {
    background: var(--gold-dark);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}
.email-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.email-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-input);
}
.email-list {
    display: flex;
    flex-direction: column;
}
.email-row {
    display: grid;
    grid-template-columns: 180px 1fr 80px;
    gap: 16px;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
    transition: background 0.15s;
}
.email-row:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.email-row.unread {
    font-weight: 600;
    background: var(--bg-card);
}
.email-row.unread .email-from {
    color: var(--brown);
}
.email-from {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.email-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}
.email-row.unread .email-subject {
    color: var(--text);
}
.email-date {
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
}
.email-message {
    padding: 32px;
}
.email-body {
    margin-top: 20px;
    line-height: 1.7;
}
.email-compose {
    padding: 24px;
}

/* ==================== UTILITY CLASSES ==================== */

/* --- Spacing --- */
.m-0 { margin: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* --- Typography --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.72rem; }
.text-micro { font-size: 0.78rem; color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-body { font-size: 0.85rem; }
.text-base { font-size: 0.9rem; }
.text-md { font-size: 0.95rem; }
.text-lg { font-size: 1rem; }
.text-xl { font-size: 1.1rem; }
.text-2xl { font-size: 1.2rem; }
.text-3xl { font-size: 1.4rem; }
.text-4xl { font-size: 1.6rem; }
.text-5xl { font-size: 1.8rem; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-brown { color: var(--brown); }
.text-gold { color: var(--gold); }
.text-cream { color: #f5f0e8; }
.text-upper { text-transform: uppercase; }
.text-bold { font-weight: 700; }
.text-semibold { font-weight: 600; }
.text-light { font-weight: 300; }
.leading-tight { line-height: 1.5; }
.leading-normal { line-height: 1.6; }
.leading-loose { line-height: 2.2; }
.tracking-wide { letter-spacing: 0.5px; }

/* --- Text combos (most common inline patterns) --- */
.text-muted-sm { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.text-muted-xs { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.text-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.text-label-spaced { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.text-list-item { font-size: 0.82rem; color: var(--text-muted); line-height: 2.2; padding-left: 16px; }

/* --- Headings --- */
.heading-sm { font-family: var(--font-display); font-size: 0.95rem; margin-bottom: 8px; }
.heading-md { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 16px; }
.heading-lg { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 16px; }
.heading-xl { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 8px; }
.heading-2xl { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 12px; }
.heading-hero { font-family: var(--font-display); font-size: 1.8rem; text-align: center; margin-bottom: 8px; }
.heading-display { font-size: 1.8rem; font-weight: 900; font-family: var(--font-display); color: var(--brown); }

/* --- Card variants --- */
.card-compact { padding: 20px; }
.card-med { padding: 24px; }
.card-flush { padding: 0; overflow: hidden; }
.card-dark { background: var(--brown); color: #f5f0e8; border: none; }

/* --- Grid layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-sm { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-gap-8 { gap: 8px; }
.grid-gap-12 { gap: 12px; }
.grid-gap-20 { gap: 20px; }

/* --- Flexbox --- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start { display: flex; align-items: flex-start; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* --- Button variants --- */
.pill-link {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    color: var(--text-muted) !important;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}
.pill-link:hover {
    border-color: var(--gold-dark);
    color: var(--gold) !important;
}
.btn-light { background: #f5f0e8; color: var(--brown) !important; }
.btn-outline-light {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(245,240,232,0.4);
    color: #f5f0e8 !important;
    text-decoration: none;
}
.btn-outline-light:hover { border-color: #f5f0e8; }

/* --- Stat box (for dashboard/tool stat displays) --- */
.stat-box {
    text-align: center;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    font-family: var(--font-display);
    color: var(--brown);
}
.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* --- Table cells --- */
.td { padding: 6px 10px; border: 1px solid var(--border); }
.td-header { padding: 6px 10px; border: 1px solid var(--border); font-weight: 600; background: var(--bg-input); }
.table-full { width: 100%; border-collapse: collapse; }

/* --- Misc utilities --- */
.inline { display: inline; }
.block { display: block; }
.w-full { width: 100%; }
.opacity-80 { opacity: 0.8; }
.no-decoration { text-decoration: none; }
.dotted-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--text-muted); }
.hover-lift { transition: transform 0.2s; }
.hover-lift:hover { transform: translateY(-3px); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-left { padding-left: 16px; }
.subtitle-sm { margin-top: 12px; margin-bottom: 4px; color: var(--text); font-weight: 600; }

/* --- CTA banner (brown/dark background call to action) --- */
.cta-banner {
    text-align: center;
    padding: 40px;
    background: var(--brown);
    color: #f5f0e8;
    border: none;
    border-radius: var(--radius-lg);
}
.cta-banner h2, .cta-banner h3 { color: #f5f0e8; }
.cta-banner p { opacity: 0.8; margin-bottom: 20px; }

/* --- Form inputs outside .form-group --- */
input, textarea, select {
    font-family: var(--font-ui);
    color: var(--text);
}
textarea {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.93rem;
    min-height: 120px;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
}
textarea:focus {
    outline: none;
    border-color: var(--gold-dark);
    box-shadow: 0 0 0 3px var(--gold-glow);
}
select:not(.form-group select) {
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    width: 100%;
}
input:not(.form-group input):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="file"]) {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.93rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
input:not(.form-group input):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="file"]):focus {
    outline: none;
    border-color: var(--gold-dark);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
    --bg-dark: #0a0a0c;
    --bg-card: #131316;
    --bg-card-hover: #18181c;
    --bg-input: #0e0e11;
    --bg-hover: #1c1c20;
    --border: #1e1e24;
    --border-light: #2a2a32;
    --text: #e0ddd8;
    --text-muted: #7a7780;
    --text-dim: #4a4850;
    --gold: #c9a84c;
    --gold-dark: #b8922e;
    --gold-light: #e4c564;
    --gold-glow: rgba(201, 168, 76, 0.12);
    --brown: #c9a84c;
    --brown-light: #d4b45a;
    --cream: #1a1a1e;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
}
[data-theme="dark"] .main-nav {
    background: #0d0d10;
}
[data-theme="dark"] .script-subnav {
    background: rgba(255,255,255,0.03);
    border-top-color: rgba(255,255,255,0.05);
}
[data-theme="dark"] .script-subnav-menu {
    background: #131316;
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .main-footer {
    background: #0d0d10;
}
[data-theme="dark"] .screenplay {
    background: #1a1a1e;
    color: #d0cdc8;
}
[data-theme="dark"] .screenplay .character-name {
    color: var(--gold);
}
[data-theme="dark"] .screenplay .parenthetical {
    color: #888;
}
[data-theme="dark"] .btn-primary {
    background: var(--gold-dark);
    color: #000;
}
[data-theme="dark"] .btn-primary:hover {
    background: var(--gold);
}
[data-theme="dark"] .nav-btn {
    background: var(--gold-dark);
    color: #000;
}
[data-theme="dark"] .line-comments {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.08) !important;
}
[data-theme="dark"] .line-comments input {
    background: #1a1a1e !important;
    border-color: #2a2a32 !important;
    color: var(--text) !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 960px) {
    .play-layout { grid-template-columns: 1fr; }
    .play-sidebar { position: static; max-height: none; }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .nav-links { gap: 14px; }
    .screenplay { padding: 36px 24px; }
    .screenplay .character-name { margin-left: 60px; }
    .screenplay .dialogue { margin-left: 36px; margin-right: 36px; }
    .page-header { flex-direction: column; gap: 16px; align-items: flex-start; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .script-card { flex-direction: column; gap: 16px; align-items: flex-start; }
    .voice-card { flex-direction: column; gap: 12px; align-items: flex-start; }
    .container { padding: 24px 16px; }
    .auth-page { max-width: 100% !important; }
}
@media (max-width: 768px) {
    /* Hamburger nav */
    .hamburger { display: flex; }
    .nav-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 8px; justify-content: space-between; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 4px !important;
        padding: 12px 0 8px;
        border-top: 1px solid rgba(245,240,232,0.1);
        margin-top: 8px;
    }
    .nav-links.nav-open { display: flex; }
    .nav-links a, .nav-links .nav-link {
        padding: 10px 16px !important;
        border-radius: var(--radius);
        font-size: 0.88rem !important;
        width: 100%;
    }
    .nav-links a:hover, .nav-links .nav-link:hover {
        background: rgba(245,240,232,0.08);
    }
    .nav-sep { display: none; }
    .nav-dropdown { width: 100%; }
    .nav-dropdown-btn { width: 100%; text-align: left; border-radius: var(--radius) !important; padding: 10px 16px !important; font-size: 0.88rem !important; }
    .nav-dropdown-menu { position: static; box-shadow: none; border: none; background: rgba(245,240,232,0.05); border-radius: var(--radius); margin-top: 4px; }
    .nav-dropdown-menu a { padding: 10px 24px !important; font-size: 0.85rem !important; }
    .nav-btn, .nav-btn-outline { width: 100%; text-align: center; padding: 12px !important; }

    /* All grids collapse to 1 column (inline + class-based) */
    [style*="grid-template-columns:repeat(2"], .grid-2 { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:repeat(3"], .grid-3 { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:repeat(4"], .grid-4 { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:1fr 1fr"], .grid-2-sm { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:2fr 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:3fr 2fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:250px 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:240px 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:200px 1fr"] { grid-template-columns: 1fr !important; }

    /* Play layout */
    .play-layout { grid-template-columns: 1fr !important; }
    .play-sidebar { position: static !important; max-height: none !important; }

    /* Email layout */
    .email-layout { grid-template-columns: 1fr !important; }
    .email-sidebar { position: static !important; }
    .email-row { grid-template-columns: 1fr !important; gap: 4px !important; }
    .email-row .email-date { text-align: left !important; }

    /* Screenplay */
    .screenplay { padding: 24px 16px !important; }
    .screenplay .character-name { margin-left: 20px !important; }
    .screenplay .dialogue { margin-left: 16px !important; margin-right: 16px !important; }
    .screenplay .parenthetical { margin-left: 24px !important; }

    /* Script nav wrap */
    [style*="border-bottom:1px solid var(--border)"] { }

    /* Cards */
    .card { padding: 16px !important; }

    /* Hero */
    .hero h1, h1 { font-size: 1.4rem !important; }
    .hero p { font-size: 0.9rem !important; }

    /* Tables scroll inside cards */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card[style*="padding:0"] { overflow-x: auto !important; }
    th, td { white-space: nowrap; padding: 8px 10px !important; font-size: 0.78rem !important; }

    /* Scroll hint for compare table */
    .scroll-hint { display: block !important; }

    /* Admin forms stack */
    [style*="display:flex"][style*="align-items:flex-end"] { flex-direction: column !important; align-items: stretch !important; }
    [style*="display:flex"][style*="gap:12px"][style*="flex-wrap:wrap"] { flex-direction: column !important; }

    /* Admin action buttons */
    [style*="display:flex"][style*="gap:4px"] { flex-wrap: wrap !important; }
    [style*="display:flex"][style*="gap:6px"] { flex-wrap: wrap !important; }

    /* Support layout */
    [style*="grid-template-columns:200px 1fr"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:200px 1fr 80px"] { grid-template-columns: 1fr !important; }

    /* Buttons wrap */
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .script-actions { flex-wrap: wrap; }

    /* Profile */
    .profile-header { flex-direction: column !important; align-items: center !important; text-align: center; }
    .profile-avatar { width: 80px !important; height: 80px !important; }

    /* Compare table */
    .card[style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

    /* Footer */
    .footer-links { gap: 10px !important; padding: 0 16px; }
    .footer-links a { font-size: 0.75rem !important; }
    .main-footer { padding: 20px 12px !important; }
    .footer-inner p { font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .container { padding: 12px 10px; }
    h1 { font-size: 1.2rem !important; }
    .btn { padding: 10px 20px; font-size: 0.8rem; }
    .btn-sm { padding: 6px 12px; font-size: 0.72rem; }

    /* Script nav smaller */
    [style*="border-bottom:1px solid var(--border)"] .btn { padding: 4px 8px !important; font-size: 0.65rem !important; }
}
@media print {
    .main-nav, .main-footer, .play-sidebar, .btn, button, .nav-dropdown,
    .char-filter, .flash, .record-btn, .line-rec-controls, .playback-controls,
    .playback-controls-side, .script-actions { display: none !important; }
    .container { max-width: 100%; padding: 0; }
    .screenplay { box-shadow: none; border: none; padding: 36px; max-width: 100%; }
    .play-layout { grid-template-columns: 1fr; }
    body { background: #fff; color: #000; }
}

/* Modal Animations */
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalSlideIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes modalSlideOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95) translateY(-10px); } }
