/* ================================================
   RAiS Scoping Assistant — Style
   Mobile-first, professional, restoration industry
   ================================================ */

:root {
    --brand: #1a5276;
    --brand-light: #2e86c1;
    --brand-dark: #0e2f44;
    --accent: #e67e22;
    --success: #27ae60;
    --danger: #c0392b;
    --warning: #f39c12;
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dce1e8;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --transition: 0.2s ease;
}

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

html, body { height: 100%; }
html { overflow: hidden; }
body { overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }

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

/* ─── Screens ─────────────────────────────────── */

.screen { display: none; }
.screen.active { display: flex; }
#app-screen { flex-direction: column; height: 100vh; min-height: 0; overflow: hidden; overscroll-behavior-y: none; }
#login-screen { justify-content: center; align-items: center; min-height: 100vh; }

/* ─── Card / Auth ────────────────────────────── */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    margin: 1rem;
}

.logo-area {
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.logo-area .brand-icon-img {
    display: block;
    margin: 0 auto;
}
.logo-area h1 {
    font-size: 2rem;
    color: var(--brand);
    letter-spacing: 2px;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}
.logo-area .subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0;
}

.field {
    margin-bottom: 1rem;
}
.field label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}
.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.15);
}
.field textarea {
    resize: vertical;
}

/* ─── Buttons ────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}
.btn:hover {
    background: var(--bg);
}
.btn.primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.btn.primary:hover {
    background: var(--brand-dark);
}
.btn.danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn.small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}
.btn.icon-only.small {
    padding: 0.3rem 0.4rem;
}
.btn.full-width {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Thicker border for New Job button */
#new-job-btn {
    border-width: 2px;
    border-color: var(--brand-light);
    font-weight: 500;
}

/* ─── Tabs ───────────────────────────────────── */

.tab-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}
.tab {
    padding: 0.4rem 0.9rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--transition);
}
.tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

/* ─── Form Toggle / 2FA ──────────────────────── */

#two-fa-form {
    margin-top: 1rem;
}
#two-fa-code {
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 0.5rem;
}

/* ─── App Header ─────────────────────────────── */

#app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--brand);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.user-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    margin-right: 0.75rem;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ─── App Layout ─────────────────────────────── */

#app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}
#sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
}
#sidebar h2 {
    font-size: 0.95rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}
#content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* ─── Empty State ────────────────────────────── */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-light);
}
.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* ─── Job View ───────────────────────────────── */

.job-header {
    margin-bottom: 1.25rem;
}
.job-header h2 {
    font-size: 1.3rem;
    margin-bottom: 0.4rem;
}
.job-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
    flex-wrap: wrap;
}
.job-customer-name {
    font-weight: 600;
    color: var(--text);
}
.job-meta-link {
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-light);
    transition: all 0.2s ease;
}
.job-meta-link:hover {
    background: var(--brand-light);
    border-color: var(--brand);
    color: var(--brand);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.job-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* ─── Status badges & selects ────────────────── */

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.status-new       { background: #eafaf1; color: var(--success); }
.status-estimate  { background: #fff3cd; color: #856404; }
.status-demo      { background: #f8d7da; color: #721c24; }
.status-drying    { background: #d1ecf1; color: #0c5460; }
.status-review    { background: #e2e3e5; color: #383d41; }
.status-complete  { background: #d4edda; color: #155724; }

.status-select {
    border: none;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    color: inherit;
}
.status-select option { font-weight: 500; }

.status-select.status-new      { background: #eafaf1; color: var(--success); }
.status-select.status-estimate { background: #fff3cd; color: #856404; }
.status-select.status-demo     { background: #f8d7da; color: #721c24; }
.status-select.status-drying   { background: #d1ecf1; color: #0c5460; }
.status-select.status-review   { background: #e2e3e5; color: #383d41; }
.status-select.status-complete { background: #d4edda; color: #155724; }

/* ─── Filter Chips ───────────────────────────── */

.status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.filter-chip {
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}
.filter-chip:hover {
    border-color: var(--brand-light);
    color: var(--brand);
}
.filter-chip.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* ─── Email Chips ────────────────────────────── */
.email-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}
.email-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text);
}
.email-chip .remove {
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.75rem;
    line-height: 1;
    padding: 0 0.15rem;
}
.email-chip .remove:hover {
    color: var(--error);
}
.email-chip.empty {
    font-style: italic;
    color: var(--text-light);
    background: transparent;
    border: 1px dashed var(--border);
}

/* ─── List Items ─────────────────────────────── */

.list-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    transition: background var(--transition);
}
.list-item:hover {
    background: #e8eaef;
}
.list-item.active {
    background: var(--brand);
    color: #fff;
}
.list-item .item-main {
    flex: 1;
    min-width: 0;
}
.list-item .item-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item .item-meta {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* ─── Gear Button ────────────────────────────── */

.gear-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    color: var(--text-light);
    transition: color var(--transition);
}
.list-item:not(.active) .gear-btn:hover {
    color: var(--brand);
}
.list-item.active .gear-btn {
    color: rgba(255,255,255,0.7);
}
.list-item.active .gear-btn:hover {
    color: #fff;
}

/* ─── Job Body (Rooms + Chat) ────────────────── */

.job-body {
    display: flex;
    gap: 1.25rem;
}
.rooms-panel {
    flex: 1;
    min-width: 0;
}
.left-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab-btn.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
.tab-btn:hover {
    color: var(--text);
}
.notes-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
#job-notes-textarea {
    flex: 1;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    min-height: 200px;
}
#chat-container {
    width: 360px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
#chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.msg {
    max-width: 85%;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}
.msg.user {
    align-self: flex-end;
    background: var(--brand);
    color: #fff;
}
.msg.bot {
    align-self: flex-start;
    background: var(--bg);
    color: var(--text);
}
.msg .msg-meta {
    font-size: 0.7rem;
    margin-top: 0.2rem;
    opacity: 0.7;
}
#chat-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    min-height: 44px;
    max-height: 200px;
    resize: vertical;
    overflow-y: auto;
    field-sizing: content;
    line-height: 1.4;
}
#chat-input:focus {
    outline: none;
    border-color: var(--brand-light);
}

/* ─── Progress ───────────────────────────────── */

.progress-area {
    margin-top: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}
.progress-area h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}
#phase-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.phase-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-light);
}
.phase-badge.active {
    background: var(--brand);
    color: #fff;
}
.phase-badge.complete {
    background: var(--success);
    color: #fff;
}

/* ─── Scope Form ─────────────────────────────── */
.app-footer-links {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ─── Scope Form ─────────────────────────────── */
.scope-form h3 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.room-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.room-actions {
    display: flex;
    gap: 0.4rem;
}
.item-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: flex-end;
}
.item-form input,
.item-form select {
    flex: 1;
}
.item-form input[type="number"] {
    max-width: 80px;
}
.item-form .btn.small {
    flex-shrink: 0;
}
.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.5rem;
}
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.85rem;
}
.item-row button {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition);
}
.item-row button:hover {
    opacity: 1;
}

/* ─── Toast ──────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    background: var(--text);
    color: #fff;
    font-size: 0.9rem;
    z-index: 300;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: opacity var(--transition), transform var(--transition);
    max-width: 90%;
    text-align: center;
}
.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ─── Modal ──────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal h3 { margin-bottom: 1rem; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ─── Two-Factor Auth Modal ─────────────────────── */

.twofa-setup-modal {
    max-width: 420px;
}
.twofa-qr-container {
    display: flex;
    justify-content: center;
    margin: 0.75rem 0;
}
.twofa-qr-container img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
}

/* ─── Jobs List Overlay ───────────────────────── */

.jobs-list-modal {
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.jobs-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.jobs-list-header h2 { margin: 0; font-size: 1.25rem; }
.jobs-list-filters {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.jobs-search-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
}
.jobs-search-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0,107,130,0.15);
}
.jobs-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.5rem 1.5rem;
}
.jobs-list-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}
.jobs-list-item:hover { border-color: var(--brand-light); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.jobs-list-item:last-child { margin-bottom: 0; }
.jobs-list-item-number { font-weight: 600; font-size: 0.95rem; color: var(--brand); }
.jobs-list-item-name  { font-size: 0.85rem; color: var(--text); }
.jobs-list-item-meta  { font-size: 0.75rem; color: var(--text-light); }
.jobs-list-item-status {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.status-new       { background: #eafaf1; color: var(--success); }
.status-estimate  { background: #fff3cd; color: #856404; }
.status-demo      { background: #f8d7da; color: #721c24; }
.status-drying    { background: #d1ecf1; color: #0c5460; }
.status-review    { background: #e2e3e5; color: #383d41; }
.status-complete  { background: #d4edda; color: #155724; }

/* ─── Typeahead / Autocomplete ──────────────── */

.typeahead-container {
    position: relative;
}
.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: var(--shadow);
}
.typeahead-dropdown .dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.typeahead-dropdown .dropdown-item:hover,
.typeahead-dropdown .dropdown-item.active {
    background: var(--bg);
}
.typeahead-dropdown .dropdown-no-match {
    padding: 0.5rem 0.75rem;
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

/* ─── Profile Panel ──────────────────────────── */

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.profile-header h2 {
    margin: 0;
}

.profile-header .btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-color: var(--brand);
    color: var(--brand);
    background: transparent;
}
.profile-header .btn:hover {
    background: var(--brand);
    color: #fff;
}

.profile-section {
    margin-bottom: 2.5rem;
}
.profile-section:last-child {
    margin-bottom: 0;
}

.info-row {
    display: flex;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.info-row .label {
    display: inline-block;
    min-width: 80px;
    text-align: left;
    font-weight: 500;
    margin-right: 0.5rem;
}

.profile-panel {
    display: flex;
    gap: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.logo-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.logo-preview {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    object-fit: contain;
    background: var(--bg);
    padding: 0.5rem;
    border: 1px solid var(--border);
}
.company-info {
    flex: 1;
}
.company-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.company-owner {
    font-size: 0.85rem;
    color: var(--text-light);
}
.company-details {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
}
.team-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}
.team-table thead tr {
    border-bottom: 1px solid var(--border);
}
.team-table th {
    text-align: left;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
}
.team-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    background: var(--bg);
    border-radius: var(--radius);
}
.team-table tr:last-child td {
    border-bottom: none;
}
.team-table .member-name {
    font-weight: 500;
    color: var(--text);
}
.team-table .member-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
}
.team-table .member-initials {
    color: var(--text-light);
}
.team-table .member-role {
    font-weight: 500;
    color: var(--text);
}
.team-table .team-actions {
    text-align: right;
    white-space: nowrap;
}
.team-table .team-actions .btn.small {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    min-height: 0;
}
.member-status {
    justify-self: start;
}
.status-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    display: inline-block;
}
.status-badge.active { background: #eafaf1; color: var(--success); }
.status-badge.inactive { background: var(--bg); color: var(--text-light); }
.member-initials {
    justify-self: start;
}
.member-role {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
    justify-self: start;
}
.member-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
    margin-top: 0.15rem;
}

/* ─── Review Panel ─────────────────────────────── */

.review-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.review-summary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.review-stat {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}
.review-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand);
}
.review-stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}
.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.review-table th,
.review-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.review-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Feedback Button (fixed bottom-left) ──────── */

.feedback-btn {
    position: fixed;
    bottom: 2.6rem;
    right: 1rem;
    z-index: 250;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background var(--transition);
}
.feedback-btn:hover {
    background: var(--brand-dark);
}
.feedback-btn svg {
    width: 16px;
    height: 16px;
}

.beta-tag {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 249;
    padding: 0.3rem 0.7rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 1px;
}

/* ─── Feedback Overlay ─────────────────────────── */

.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}
.feedback-modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.fb-voice-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.fb-mic-status {
    font-size: 0.8rem;
    color: var(--brand);
}

/* ─── Forgot Password ──────────────────────────── */

.forgot-password-modal { max-width: 420px; }
#forgot-token-display {
    background: var(--bg);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    margin: 0.5rem 0;
}

/* ─── Misc ───────────────────────────────────── */

.hidden { display: none !important; }
.loading { opacity: 0.6; pointer-events: none; }
.empty-hint {
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
    padding: 2rem;
}

/* ─── Input with button ────────────────────────── */

.input-with-btn {
    display: flex;
    gap: 0.5rem;
}
.input-with-btn input { flex: 1; }

/* ─── Email list editor ────────────────────────── */

.email-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.email-row input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}
.email-row-display {
    padding: 0.35rem 0.6rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.85rem;
}

/* ─── Scrollbar Styling ────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--brand);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-dark);
}

/* ─── Mobile Responsive ────────────────────────── */


.header-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    vertical-align: middle;
}
.header-icon-circle img {
    width: 44px;
    height: 44px;
    transform: scale(1.75) translateY(-1px);
    display: block;
}

@media (max-width: 768px) {

    /* Mobile header layout */
    #app-header {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        align-items: center;
        padding: 0.5rem 0.75rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        transform: none;
        filter: none;
        perspective: none;
    }
    #app-header .header-left {
        grid-column: 1;
        grid-row: 1 / 3;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        align-self: center;
    }
    #app-header .header-left .header-brand {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-size: 1.0rem;
        line-height: 1.1;
        gap: 0;
    }
    #app-header .header-left .header-brand .brand-line1 {
        font-weight: 700;
        letter-spacing: 0.5px;
    }
    #app-header .header-left .header-brand .brand-line2 {
        font-weight: 700;
        opacity: 0.9;
    }
    #app-header .header-left .header-icon-circle {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        border-radius: 50%;
        box-shadow: 0 1px 4px rgba(0,0,0,0.15);
        flex-shrink: 0;
    }
    #app-header .header-left .header-icon-circle img {
        width: 40px;
        height: 40px;
        transform: scale(1.6) translateY(-1px);
        display: block;
    }
    #app-header .header-right {
        grid-column: 2;
        grid-row: 1 / 3;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        gap: 0.2rem;
    }
    #app-header .user-name {
        order: 1;
        margin-right: 0;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    #app-header .header-actions {
        order: 2;
        display: flex;
        align-items: center;
        gap: 0.4rem;
        transform: translateY(-2px);
    }

    #app-main { flex-direction: column; flex: 1; min-height: 0; overflow: hidden; margin-top: 3.5rem; }
    #sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        height: 100%;
        overflow: hidden;
        padding: 0.75rem;
    }
    .sidebar-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
    #sidebar-active-jobs {
        flex: 1 1 auto;
        min-height: 100px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        margin-top: 0;
    }
    #sidebar-jobs-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 4px;
    }
    .sidebar-footer {
        flex: 0 0 auto;
        padding: 1.0rem 1rem 1.5rem;
        text-align: center;
        background: linear-gradient(180deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.14) 100%);
        border-top: 1px solid rgba(37,99,235,0.15);
        border-radius: 12px;
        margin: 1rem 0 0.3rem;
    }
    #sidebar .sidebar-footer h2 {
        font-size: clamp(1.1rem, 5.2vw, 1.5rem);
        margin-bottom: 0.25rem;
        color: var(--text);
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-transform: none;
        max-width: 100%;
        line-height: 1.2;
    }
    .sidebar-footer p {
        font-size: clamp(0.85rem, 3.8vw, 1.0rem);
        color: var(--text-light);
        max-width: 100%;
        margin: 0 auto;
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Hide empty-state on mobile — footer replaces it */
    #empty-state {
        display: none !important;
    }
    #content-area {
        flex: 1 1 auto;
        min-height: 120px;
        overflow-y: auto;
        padding: 1rem;
    }
    /* On home screen, hide content-area — sidebar welcome replaces it */
    #content-area.compact {
        display: none;
    }
    .job-body { flex-direction: column; }
    .rooms-panel { width: 100%; }
    #chat-container { height: 350px; }
    .card { padding: 1.5rem; }
    .msg { max-width: 90%; }
    .review-summary { gap: 1rem; }
    .review-stat-num { font-size: 1.25rem; }
    .review-table { font-size: 0.75rem; }
    .team-member { gap: 0.5rem; }
    .feedback-btn {
        bottom: 2.0rem;
        right: 0.5rem;
        left: auto;
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
    .beta-tag {
        bottom: 0.5rem;
        right: 0.5rem;
        left: auto;
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
    .modal-actions {
        margin-bottom: 4rem;
    }
}


.user-info-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 0.15rem;
}
.user-info-block .user-name { font-size: 0.85rem; font-weight: 600; color: var(--surface); }
.user-info-block .user-meta { display: flex; align-items: center; gap: 0.4rem; }
.user-info-block .gear-btn {
    background: none;
    border: none;
    color: var(--surface);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ─── Hide feedback on login page ───────────── */
#login-screen.active ~ .feedback-btn {
    display: none !important;
}
/* Header button height alignment */
#logout-btn { padding: 0.35rem 0.6rem; height: 1.75rem; }
#profile-btn { font-size: 1.55rem; padding: 0; height: 1.75rem; width: 1.75rem; display: inline-flex; align-items: center; justify-content: center; }
#profile-btn span { display: inline-flex; align-items: center; justify-content: center; line-height: 1; transform: translateY(1px); }
/* Help button — same height/width as gear (profile-btn), larger question mark */
#help-btn {
    font-size: 1.4rem;
    padding: 0;
    height: 1.75rem;
    width: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#help-btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    transform: scale(1.15);
}


.recording {
    animation: pulse-red 1.2s infinite;
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(198, 54, 39, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(198, 54, 39, 0); }
    100% { box-shadow: 0 0 0 0 rgba(198, 54, 39, 0); }
}
/* 2FA status badges */
.status-badge.success { background: #eafaf1; color: var(--success); }
.status-badge.neutral { background: #f0f0f0; color: #666; }

/* Checkbox field layout */
.checkbox-field .checkbox-label { display:flex;align-items:center;gap:0.5rem;cursor:pointer; }
.checkbox-field .checkbox-label input { width:auto;min-width:1rem; }

/* ─── Invite Grid Layout ───────────────────────────────── */



.job-header-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.job-title-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}
.job-title-group h2 {
    margin: 0;
    font-size: 1.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.job-header-title-row .btn.small.icon-only {
    width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 0.85rem;
}



/* ─── Sidebar Collapse ───────────────────────── */

.app-container.job-active .sidebar {
    width: 48px;
    min-width: 48px;
    overflow: hidden;
    transition: width 0.3s ease;
}
.app-container.job-active .sidebar > *:not(.sidebar-expand-btn) {
    opacity: 0;
    pointer-events: none;
}
.sidebar-expand-btn {
    position: absolute;
    top: 0.75rem;
    left: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    z-index: 10;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.app-container.job-active .sidebar .sidebar-expand-btn {
    opacity: 1;
}
.sidebar-expand-btn:hover {
    background: var(--bg);
}

/* ─── Team & Invite Tables ─────────────────────────── */
.team-table,
.invite-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.team-table thead tr,
.invite-table thead tr {
    border-bottom: 1px solid var(--border);
}
.team-table th,
.invite-table th {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    text-align: left;
}
.team-table td,
.invite-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid var(--border-light);
}
.team-table tbody tr:last-child td,
.invite-table tbody tr:last-child td {
    border-bottom: none;
}
.team-table tbody tr:hover,
.invite-table tbody tr:hover {
    background: var(--bg);
}
.member-name .member-email {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}
.team-table .team-actions,
.invite-table .invite-actions {
    white-space: nowrap;
    text-align: right;
}
.team-table .team-actions .btn,
.invite-table .invite-actions .btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    min-height: 0;
    margin-left: 0.3rem;
}
.invite-table .invite-email {
    word-break: break-all;
}
.invite-table .invite-role {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}
.invite-table .invite-expiry {
    font-size: 0.8rem;
}

/* ─── Cross-table column alignment (desktop) ──────────────── */
@media (min-width: 769px) {
    .team-table,
    .invite-table {
        table-layout: fixed;
    }
    .col-name { width: 35%; }
    .col-initials { width: 10%; }
    .col-role { width: 15%; }
    .col-status { width: 15%; }
    .col-actions { width: 25%; }
    .sidebar-footer { display: none; }
}
/* ─── Sidebar sections (mobile home layout) ──────────────────────────── */
.sidebar-header { }
.sidebar-body   { flex: 1; min-height: 0; }

/* ─── Sidebar Active Jobs Widget ──────────────────────────────────────────── */

.sidebar-jobs-widget {
    margin-top: 1rem;
}
.sidebar-jobs-heading {
    font-size: 0.95rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}
.sidebar-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar-job-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.6rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    padding-left: 1.5rem;
}
.sidebar-job-item:hover {
    border-color: var(--brand);
    background: var(--bg);
}
.sidebar-job-item.active {
    border-color: var(--brand);
    background: var(--brand-pale, #e8f4fd);
}
.sidebar-job-status-dot {
    position: absolute;
    left: 0.5rem;
    top: 0.7rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.sidebar-job-field {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
    font-size: 0.85rem;
}
.sidebar-job-label {
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}
.sidebar-job-number {
    font-weight: 600;
    color: var(--brand);
    font-size: 0.85rem;
}
.sidebar-job-name {
    color: var(--text);
    font-size: 0.85rem;
}
.sidebar-job-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}
.sidebar-view-all {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--brand);
    text-decoration: none;
    text-align: right;
}
.sidebar-view-all:hover {
    text-decoration: underline;
}
