:root {
    /* Professional Palette */
    --bg: #090a0c;
    --bg-elevated: #111418;
    --bg-secondary: #161b22;
    --card-bg: #111418;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-subtle: rgba(59, 130, 246, 0.1);
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: #1e293b;
    --border-subtle: #0f172a;
    --input-bg: #0f172a;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f8fafc;
        --bg-elevated: #ffffff;
        --bg-secondary: #f6f8fa;
        --card-bg: #ffffff;
        --text: #0f172a;
        --text-secondary: #475569;
        --text-dim: #94a3b8;
        --border: #e2e8f0;
        --border-subtle: #f1f5f9;
        --input-bg: #f8fafc;
        --accent-subtle: rgba(59, 130, 246, 0.08);
    }
}

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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Layout */
.app-container {
    max-width: 1000px; /* Default, overridden via style attribute if needed */
    margin: 0 auto;
    padding: 0 1.5rem;
    padding-top: env(safe-area-inset-top);
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

/* Navigation */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    background: var(--bg);
    backdrop-filter: blur(8px);
    z-index: 100;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.app-brand-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover {
    color: var(--text);
    background: var(--accent-subtle);
}
.nav-link.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.nav-user a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.nav-user a:hover { text-decoration: underline; }

/* Standard Row Item (Holistic replacement for .settings-item, .setup-item, .status-item) */
.item-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.item-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.item-row:first-child {
    padding-top: 0;
}

.item-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.item-icon.success, .item-icon.done {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.item-icon.warning, .item-icon.pending, .item-icon.sent {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.item-icon.error, .item-icon.failed {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
}

.item-icon.accent, .item-icon.sending, .item-icon.polling {
    background: var(--accent-subtle);
    color: var(--accent);
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.125rem;
    font-size: 0.95rem;
}

.item-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-word;
}

.item-action {
    margin-top: 0.625rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header {
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

.card-body.flush { padding: 0; }

.card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.1s ease;
}

.card-link:last-child {
    border-bottom: none;
}

.card-link:hover {
    background: var(--accent-subtle);
}

.card-link-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-link-icon {
    font-size: 1.1rem;
}

.card-link-text {
    font-size: 0.9rem;
}

.card-link-arrow {
    color: var(--text-dim);
}

/* Forms */
label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    margin-bottom: 1.25rem;
}
.form-row:last-child { margin-bottom: 0; }

.form-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn:hover { 
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn:active {
    transform: translateY(0);
}
.btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    color: var(--text-dim);
    transform: none;
    box-shadow: none;
}

.btn-block { width: 100%; }

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

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Color mappings for badges */
.badge.received, .badge.incoming, .badge.accent, .badge.in_progress { 
    background: rgba(59, 130, 246, 0.1); 
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.badge.forwarded, .badge.delivered, .badge.confirmed, .badge.completed, .badge.success, .badge.done {
    background: rgba(16, 185, 129, 0.1); 
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge.confirming, .badge.pending, .badge.retry_scheduled, .badge.warning, .badge.probe_outgoing {
    background: rgba(245, 158, 11, 0.1); 
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.badge.failed, .badge.error, .badge.missing {
    background: rgba(239, 68, 68, 0.1); 
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.badge.probe, .badge.test {
    background: rgba(139, 92, 246, 0.1); 
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.badge.skipped, .badge.neutral { 
    background: rgba(100, 116, 139, 0.1); 
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: var(--accent-subtle);
    border-radius: 4px;
    font-size: 0.85rem;
}

.recipient-chip-icon {
    color: var(--accent);
    font-size: 0.75rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.clickable {
    cursor: pointer;
    transition: all 0.2s;
}
.data-table tbody tr.clickable:hover {
    background: var(--accent-subtle);
}

/* Detail View Styles (Email / Probe) */
.detail-meta {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.meta-label { color: var(--text-dim); font-weight: 500; }
.meta-value { word-break: break-word; }

.body-content {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 600px;
    overflow: auto;
}

.body-html {
    background: #fff;
    color: #000;
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.body-html iframe {
    width: 100%;
    min-height: 400px;
    border: none;
}

/* Thread / Inbox List */
.thread-list {
    list-style: none;
}

.thread-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
}

.thread-item:hover {
    background: var(--bg-elevated);
    box-shadow: inset 4px 0 0 0 var(--accent);
}

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

.thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.thread-content {
    flex: 1;
    min-width: 0;
}

.thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.thread-from {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.thread-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.thread-time {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
}

.thread-count {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
    font-weight: 600;
}

.thread-subject {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.thread-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* List Item Patterns (Dashboard / Search) */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Thread Detail View */
.thread-detail-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.thread-detail-header {
    margin-bottom: 1rem;
}

.thread-detail-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.message-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.message-header {
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.message-author {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.message-author-address {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.message-date {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
}

.message-actions {
    display: flex;
    gap: 0.75rem;
}

.message-body {
    padding: 1.5rem;
}

.message-body-text {
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.message-body-html iframe {
    width: 100%;
    border: none;
    min-height: 300px;
    background: white;
    border-radius: var(--radius-sm);
}

.attachments-list {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.attachment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.attachment-badge:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg);
}

.reply-fab {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    z-index: 100;
}

/* Detail view specialized components */
.toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    width: auto;
    border-radius: 4px;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--accent); }

.headers-table, .trace-table, .evidence-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
}
.headers-table th, .trace-table th, .evidence-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-weight: 500;
    vertical-align: top;
}
.headers-table td, .trace-table td, .evidence-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}
.headers-table tr:last-child th, .headers-table tr:last-child td,
.trace-table tr:last-child th, .trace-table tr:last-child td,
.evidence-table tr:last-child th, .evidence-table tr:last-child td { border-bottom: none; }

.trace-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.trace-badge.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.trace-badge.skipped { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.trace-badge.failed { background: rgba(239, 68, 68, 0.2); color: var(--error); }

.explanation-box {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}
.explanation-box.warning { border-left-color: var(--warning); }
.explanation-box.error { border-left-color: var(--error); }

.collapsible-section { margin-top: 1rem; }
.collapsible-header {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.collapsible-header:hover { background: rgba(88, 166, 255, 0.05); }
.collapsible-content {
    display: none;
    padding: 1rem;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
}
.collapsible-content.expanded { display: block; }
.llm-bundle-textarea {
    width: 100%;
    min-height: 300px;
    font-family: monospace;
    font-size: 0.85rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
}
.copy-btn {
    background: var(--text-dim);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.list-item {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 1rem;
    padding: 1rem;
    background: rgba(88, 166, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.list-item:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.05);
}

.list-item-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.list-item-time {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.list-item-title {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.list-item-content {
    overflow: hidden;
    min-width: 0;
}

.list-item-subject {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.list-item-detail {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.list-item-status {
    display: flex;
    align-items: center;
}

/* Login Page Specific */
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-logo {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    color: #3c4043;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid #dadce0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.google-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
    border-color: #d2d4d7;
}

.login-logo {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.login-message {
    background: var(--accent-subtle);
    border: 1px solid var(--accent-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 2rem;
}

.login-message p {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.google-icon {
    width: 20px;
    height: 20px;
}

.login-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.login-footer a {
    color: var(--text-dim);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

@media (prefers-color-scheme: dark) {
    .google-btn {
        background: #131314;
        color: #e3e3e3;
        border-color: #8e918f;
    }
}

/* Utility */
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
}

.text-secondary { color: var(--text-secondary); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

code {
    background: var(--accent-subtle);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
    color: var(--accent);
}

a { 
    color: var(--accent);
    transition: color 0.2s;
}
a:hover {
    color: var(--accent-hover);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: all 0.2s;
}
.back-link:hover { 
    color: var(--accent);
    transform: translateX(-4px);
}

/* Floating Compose Button */
.compose-fab {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    padding: 1rem 1.75rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 3rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.compose-fab:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    background: var(--accent-hover);
}

/* Compose Modal */
.compose-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.compose-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.compose-modal-content {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    height: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modal-enter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-enter {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.compose-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}
.compose-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.compose-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0;
}
.compose-field-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}
.compose-field-row label {
    width: 4rem;
    margin: 0;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}
.clean-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 1rem;
    color: var(--text);
    box-shadow: none !important;
}
.clean-input:focus { outline: none; }
.compose-body-container {
    flex: 1;
    padding: 1.5rem;
    display: flex;
}
.body-input {
    width: 100%;
    height: 100%;
    resize: none;
    font-family: inherit;
    line-height: 1.6;
    font-size: 1rem;
}
.compose-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.close-btn:hover { 
    background: var(--accent-subtle); 
    color: var(--text);
    transform: rotate(90deg);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

.hidden { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 0 1rem;
    }
    .app-header {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem 0;
    }
    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }
    .nav-user {
        order: 2;
    }
    .compose-fab {
        bottom: 1.5rem;
        right: 1.5rem;
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Validation Layout */
.validation-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .validation-layout {
        grid-template-columns: 1fr;
    }
}

.sticky-sidebar {
    position: sticky;
    top: 1.5rem;
}

.validation-section {
    margin-bottom: 2rem;
}

.validation-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.validation-section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* Config & Info Lists */
.config-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.config-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.config-value {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--text);
}

/* Inline Form Helpers */
.form-row-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row-inline input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.form-addon {
    display: flex;
    align-items: center;
    padding: 0 0.875rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-left: none;
    height: 44px; /* Matches standard input height */
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-dim);
}

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

@media (max-width: 600px) {
    .datetime-row {
        grid-template-columns: 1fr;
    }
}

.radio-group {
    display: flex;
    gap: 1.25rem;
    padding: 0.25rem 0;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

.timezone-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--accent-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.test-result {
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.test-result.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.test-result.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

/* Shortcuts Modal (Dynamically created) */
.shortcuts-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.shortcuts-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.shortcuts-modal-content {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.shortcuts-modal-header {
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.shortcuts-modal-body {
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
}
.shortcut-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}
.shortcut-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.shortcut-row kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.125rem 0.5rem;
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    min-width: 1.5rem;
    text-align: center;
    color: var(--accent);
}
