:root {
    color-scheme: light;
    --bg-body: #eef1f6;
    --bg-card: #0f1828;
    --bg-screen: #f7f8fb;
    --bg-form: #ffffff;
    --text-title: #0f1a2e;
    --text-sub: #6b7585;
    --text-label: #3d4758;
    --input-border: #d8dee8;
    --input-bg: #fff;
    --input-text: #1f2a3a;
    --staff-btn-bg: #f4f6fa;
    --staff-btn-border: #e2e7ef;
    --staff-btn-text: #1f2a3a;
    --box-shadow-form: rgba(15, 24, 40, 0.1);
    --box-shadow-card: 0 1px 2px rgba(15, 24, 40, 0.04), 0 4px 14px rgba(15, 24, 40, 0.06);
    --bg-panel: #ffffff;
    --border-panel: #e4e8ef;
    --color-primary: #1d60a2;
    --color-primary-hover: #2478c4;
    --color-primary-soft: #e8f1fa;
    --bg-accent: #eaf2fb;
    --radius-sm: 12px;
    --radius-md: 14px;
    --radius-lg: 16px;
    --page-pad: 16px;
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --success: #10b981;
    --danger: #c0392b;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-body: #0b1220;
    --bg-card: #111827;
    --bg-screen: #0f172a;
    --bg-form: #1e293b;
    --text-title: #f1f5f9;
    --text-sub: #94a3b8;
    --text-label: #cbd5e1;
    --input-border: #334155;
    --input-bg: #1e293b;
    --input-text: #f8fafc;
    --staff-btn-bg: #1e293b;
    --staff-btn-border: #334155;
    --staff-btn-text: #f1f5f9;
    --box-shadow-form: rgba(0, 0, 0, 0.35);
    --box-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 18px rgba(0, 0, 0, 0.25);
    --bg-panel: #1e293b;
    --border-panel: #334155;
    --color-primary: #60a5fa;
    --color-primary-hover: #93c5fd;
    --color-primary-soft: #1e3a5f;
    --bg-accent: #1e3a8a;
}


/* Ensure all select elements and options have matching readable background and text */

select {
    color-scheme: inherit;
}

select option {
    background-color: var(--bg-form, #ffffff);
    color: var(--text-title, #0f1a2e);
}

[data-theme="dark"] select option {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="light"] select option {
    background-color: #ffffff !important;
    color: #0f1a2e !important;
}


/* Quick mission dropdown elements */

.quick-mission-select {
    color-scheme: inherit;
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-title);
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.quick-mission-select option {
    background-color: var(--bg-form, #ffffff) !important;
    color: var(--text-title, #0f1a2e) !important;
    padding: 8px 10px;
}

[data-theme="dark"] .quick-mission-select option {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="light"] .quick-mission-select option {
    background-color: #ffffff !important;
    color: #0f1a2e !important;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    background: var(--bg-screen);
    color: var(--text-title);
    transition: background 0.25s ease, color 0.25s ease;
}


/* Login page may need its own scroll on small screens */

body:has(#screenLogin) {
    overflow: auto;
    max-height: none;
    height: auto;
    min-height: 100%;
}

body:has(#screenLogin) .app-container,
body:has(#screenLogin) .mobile-frame,
body:has(#screenLogin) .screen-content {
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
}

.dc-scroll {
    overflow-y: auto;
    overflow-x: hidden !important;
    width: 100%;
    box-sizing: border-box;
}

.dc-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.dc-scroll::-webkit-scrollbar-thumb {
    background: var(--border-panel);
    border-radius: 99px;
}

.hidden {
    display: none !important;
}

.btn:disabled {
    opacity: .65;
    cursor: wait;
}


/* Floating top-controls removed — theme/lang live in header status bar */

.top-controls {
    display: none !important;
}

.control-btn {
    background: var(--bg-form);
    color: var(--text-title);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--box-shadow-card);
    transition: background 0.2s, transform 0.15s;
}

.control-btn:hover {
    transform: translateY(-1px);
}


/* SDK status chip removed */

.mb-sdk-chip,
#mb-sdk-chip {
    display: none !important;
}

.status-clock {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-title);
    flex: none;
}

.app-header-status.status-bar--light {
    color: var(--text-title);
    background: var(--bg-form);
    border-bottom: none;
    padding: 10px var(--page-pad) 4px;
}

.theme-toggle--light {
    background: #eef2f7;
    color: #0f1a2e;
    box-shadow: var(--box-shadow-card);
    border: 1.5px solid var(--border-panel);
}

.header-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1.5px solid #f0c9c4;
    background: #fbeeed;
    color: #c0392b;
    border-radius: 99px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    flex: none;
    line-height: 1;
    transition: background .15s, transform .15s;
}

.header-logout-btn:active {
    transform: scale(.96);
}

.header-logout-btn svg {
    flex: none;
}

[data-theme="dark"] .header-logout-btn {
    background: #3a1c1a;
    border-color: #5c2a28;
    color: #ef6b5e;
}

[data-theme="dark"] .theme-toggle--light {
    background: var(--bg-panel);
    color: var(--text-title);
    border-color: var(--border-panel);
}

.lang-switch--light {
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
}

.lang-switch--light .lang-btn {
    color: var(--text-sub);
}

.lang-switch--light .lang-btn.is-active {
    background: var(--color-primary);
    color: #fff;
}


/* ── Full-screen app shell (no phone frame) ── */

.app-container {
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: var(--bg-screen);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    overflow: hidden;
}

.mobile-frame {
    width: 100%;
    max-width: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen-content {
    background: var(--bg-screen);
    border-radius: 0;
    overflow: hidden;
    position: relative;
    height: 100%;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.text-title {
    color: var(--text-title);
}

.text-sub {
    color: var(--text-sub);
}

.text-label {
    color: var(--text-label);
}

.bg-card {
    background: var(--bg-card);
}

.bg-panel {
    background: var(--bg-panel);
}

.bg-form {
    background: var(--bg-form);
}


/* Header — pinned at top while content scrolls */

#app-header.app-header-shell,
#app-header {
    flex: none;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
    background: var(--bg-form);
    width: 100%;
}

.app-header-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--page-pad) 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-title);
    flex: none;
    background: var(--bg-form);
    position: sticky;
    top: 0;
    z-index: 52;
}

.app-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--page-pad) 14px;
    border-bottom: 1px solid var(--border-panel);
    flex: none;
    background: var(--bg-form);
    position: sticky;
    top: 0;
    z-index: 51;
    box-shadow: 0 1px 0 var(--border-panel);
}

.app-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #eab308;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex: none;
}

.app-greeting {
    flex: 1;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.02em;
}


/* Hide fake phone signal/battery on tablet+ */

.phone-chrome-icons {
    display: flex;
}

@media (min-width: 768px) {
    .phone-chrome-icons {
        display: none !important;
    }
}


/* Footer nav — pinned at bottom while content scrolls */

.app-footer-nav,
#app-footer {
    background: var(--bg-form);
    border-top: 1px solid var(--border-panel);
    padding: 10px 8px calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    flex: none;
    flex-shrink: 0;
    direction: ltr;
    box-shadow: 0 -4px 20px rgba(15, 24, 40, 0.04);
    position: sticky;
    bottom: 0;
    z-index: 50;
    margin-top: auto;
    width: 100%;
}

#app-footer {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    display: block;
}

#app-footer .app-footer-nav {
    margin-top: 0;
}

.nav-item {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    flex: 1;
    text-decoration: none;
    color: var(--text-sub);
    transition: color 0.15s;
}

.nav-item span {
    font-size: 11px;
    font-weight: 600;
}


/* Kanban Cards */

.kanban-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-title);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow-wrap: anywhere;
    word-break: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.kanban-card-date {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 600;
}

.kanban-card-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-accent);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}


/* Task detail — compact phone-sized sheet (not full desktop) */

#task-detail-panel {
    position: absolute !important;
    inset: 0 !important;
    z-index: 80 !important;
    background: rgba(15, 24, 40, 0.45) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}

#task-detail-panel[style*="display: flex"],
#task-detail-panel[style*="display:flex"] {
    display: flex !important;
    flex-direction: column !important;
}

#task-detail-panel>div:first-child {
    position: relative;
    z-index: 2;
}

#task-detail-panel>#task-detail-content,
#task-detail-panel>.dc-scroll {
    position: relative;
    z-index: 1;
    padding-top: 26px !important;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    #task-detail-panel>div:first-child {
        border-radius: 16px 16px 0 0;
        background: var(--bg-screen);
        flex: none;
        width: min(392px, 100%);
        margin-inline: auto;
    }
    #task-detail-panel>#task-detail-content,
    #task-detail-panel>.dc-scroll {
        border-radius: 0 0 16px 16px;
        background: var(--bg-screen);
        max-height: min(70vh, 640px);
        width: min(392px, 100%);
        margin-inline: auto;
        box-shadow: 0 16px 40px rgba(15, 24, 40, 0.2);
    }
}

.task-detail-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-title);
    margin-bottom: 16px;
}

.task-detail-box {
    background: var(--bg-form);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: var(--box-shadow-card);
    border: 1px solid var(--border-panel);
}

.task-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.task-detail-row:last-child {
    margin-bottom: 0;
}

.task-detail-label {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 600;
}

.task-detail-value {
    font-size: 13px;
    color: var(--text-title);
    font-weight: 700;
}

.task-detail-notes-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-title);
    margin-bottom: 8px;
}

.task-detail-notes {
    font-size: 14px;
    color: var(--text-title);
    font-weight: 600;
    line-height: 1.55;
    background: var(--bg-form);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-sm);
    padding: 14px;
    white-space: pre-wrap;
    margin-bottom: 20px;
    min-height: 72px;
}

.task-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.task-detail-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    box-sizing: border-box;
}

.task-detail-btn--edit {
    flex: 2;
    border: none;
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(29, 96, 162, 0.28);
}

.task-detail-btn--done {
    flex: 1.5;
    border: none;
    background: #10b981;
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.28);
}

.task-detail-btn--done.is-done {
    background: #059669;
    opacity: 0.85;
    cursor: default;
    box-shadow: none;
}

.task-detail-btn--delete {
    flex: 1;
    border: 2px solid #ef4444;
    background: var(--bg-form);
    color: #ef4444;
}

[data-theme="dark"] .task-detail-btn--delete {
    background: transparent;
}


/* ── Add / Edit task — workspace editor ── */

.mission-editor {
    padding-bottom: 20px !important;
}

.me-banner {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 16px;
    color: #fff;
}

.me-banner-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 120% at 100% 0%, rgba(156, 195, 236, 0.35), transparent 55%), linear-gradient(145deg, #1d60a2 0%, #16223a 100%);
}

[data-theme="dark"] .me-banner-bg {
    background: radial-gradient(ellipse 80% 120% at 100% 0%, rgba(96, 165, 250, 0.25), transparent 55%), linear-gradient(145deg, #1a4f86 0%, #0d1420 100%);
}

.me-banner-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 18px 20px;
}

.me-back {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex: none;
    backdrop-filter: blur(6px);
}

.me-banner-copy {
    flex: 1;
    min-width: 0;
}

.me-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 4px;
}

.me-heading {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
    color: #fff;
}

.me-private {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    user-select: none;
    flex: none;
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
}

.me-private input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.me-private-track {
    width: 34px;
    height: 20px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.25);
    position: relative;
    flex: none;
    transition: background 0.2s;
}

.me-private-track::after {
    content: '';
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.me-private input:checked+.me-private-track {
    background: #22c55e;
}

.me-private input:checked+.me-private-track::after {
    transform: translateX(14px);
}

[dir="rtl"] .me-private input:checked+.me-private-track::after {
    transform: translateX(-14px);
}

.me-linked {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
    background: var(--bg-panel);
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-panel);
}

.me-linked-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e6f4ec;
    color: #2e8a63;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
    flex: none;
}

.me-linked-body {
    flex: 1;
    min-width: 0;
}

.me-linked-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-title);
}

.me-linked-meta {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 2px;
}

.me-linked-av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eaf2fb;
    color: var(--color-primary);
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.me-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
}

.me-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.me-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.me-block {
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 24, 40, 0.04);
}

.me-block-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, var(--color-primary-soft) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-panel);
}

.me-step {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--color-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.me-block-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-title);
    line-height: 1.2;
}

.me-block-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    margin-top: 2px;
}

.me-block-body {
    padding: 16px;
}

.me-title-input {
    font-size: 16px !important;
    font-weight: 700 !important;
    padding: 14px 15px !important;
}

.me-gap {
    margin: 0;
}

.me-side-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: 16px;
    padding: 14px 14px 16px;
}

.me-side-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-sub);
    margin-bottom: 12px;
}

.me-drop-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.me-drop-icon {
    font-size: 22px;
    line-height: 1;
}

.form-field {
    min-width: 0;
    margin-bottom: 14px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-field--flush {
    margin-bottom: 0;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.mission-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mission-option {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    cursor: pointer;
    padding: 10px 11px;
    border-radius: 11px;
    background: var(--bg-form);
    border: 1px solid var(--border-panel);
}

.mission-option input {
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
    flex: none;
    margin: 0;
}

.mission-media-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.mission-dropzone {
    border: 2px dashed var(--border-panel);
    border-radius: 14px;
    padding: 16px 14px;
    background: var(--bg-form);
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}

.mission-dropzone.is-dragover {
    border-color: var(--color-primary);
    background: rgba(29, 96, 162, 0.06);
}

.me-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px var(--page-pad);
    background: var(--bg-form);
    border-top: 1px solid var(--border-panel);
    box-shadow: 0 -6px 20px rgba(15, 24, 40, 0.06);
}

.me-actions--dock {
    position: relative;
    flex: none;
    flex-shrink: 0;
    z-index: 45;
    width: 100%;
    margin: 0;
    border-radius: 0;
    backdrop-filter: none;
}

[data-theme="dark"] .me-actions {
    background: var(--bg-form);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
}

.me-actions-spacer {
    flex: 1;
}

.me-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border: none;
    white-space: nowrap;
}

.me-btn--primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(29, 96, 162, 0.28);
    min-width: 140px;
}

.me-btn--primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.me-btn--ghost {
    background: var(--bg-form);
    color: var(--text-title);
    border: 1px solid var(--border-panel);
}

.me-btn--danger {
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #ef4444;
}

.me-btn--danger[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    .me-banner-row {
        flex-wrap: wrap;
    }
    .me-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .me-actions-spacer {
        display: none;
    }
    .me-btn--primary {
        flex: 1;
        min-width: 0;
    }
    .me-btn--ghost {
        flex: 1;
    }
}

@media (min-width: 900px) {
    .me-layout {
        grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
        gap: 16px;
    }
    .me-heading {
        font-size: 26px;
    }
    .me-side {
        position: sticky;
        top: 8px;
    }
}


/* Task List Rows — card aesthetic */

.task-row-card {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 14px 15px;
    margin-bottom: 11px;
    box-shadow: var(--box-shadow-card);
    border: 1px solid var(--border-panel);
    display: flex;
    align-items: flex-start;
    gap: 11px;
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    transition: transform 0.15s, box-shadow 0.15s;
}

.task-row-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(15, 24, 40, 0.1);
}

.task-row-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-title);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.task-row-desc {
    font-size: 12.5px;
    color: var(--text-sub);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.task-row-badge-container {
    margin-top: 9px;
}

.task-row-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
}

.task-row-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-panel);
    flex: none;
}

.task-group-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 16px 2px 11px;
}

.task-group-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.task-group-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-title);
}

.task-group-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-sub);
}


/* Home Mission Rows */

.home-mission-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 2px;
    border-bottom: 1px solid var(--border-panel);
    text-decoration: none;
}

.home-mission-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

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

.home-mission-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-title);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-mission-date {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-sub);
    margin-top: 3px;
}

.home-mission-badge {
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 99px;
    padding: 4px 12px;
    flex: none;
}

.align-dynamic {
    text-align: right;
}

[dir="ltr"] .align-dynamic {
    text-align: left;
}


/* Page body padding helper — this is the scroll region */

.page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px var(--page-pad) 20px;
    -webkit-overflow-scrolling: touch;
}


/* Main scroll areas inside screen (header/footer stay put) */

.screen-content>.page-body,
.screen-content>#mb-live-home,
.screen-content>#mb-mission-form,
.screen-content>.dc-scroll:not(.app-header-status):not(.app-footer-nav):not(#kanban-board):not(.kanban-board) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.screen-content>#kanban-board,
.screen-content>.kanban-board {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: calc(100dvh - 140px) !important;
    max-height: calc(100dvh - 140px) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

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

.home-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 22px;
}


/* ── Login (Biz1 Inquiry / Showcase style) ── */

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    font-size: 13px;
    font-weight: 700;
    flex: none;
}

.status-bar--dark {
    color: #fff;
    background: #16223a;
}

[data-theme="dark"] .status-bar--dark {
    background: #0d1420;
}

.status-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
}

.status-icons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    flex: none;
    transition: background .2s ease, transform .15s ease;
    font-size: 15px;
    line-height: 1;
    padding: 0;
}

.theme-toggle:active {
    transform: scale(.94);
}

.theme-toggle .icon-moon {
    display: none;
}

.theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}


/* Light-mode header: force visible contrast (overrides white login styles) */

.theme-toggle.theme-toggle--light {
    background: #e8eef5;
    color: #16223a;
    border: 1.5px solid #cfd7e3;
    box-shadow: 0 1px 3px rgba(15, 24, 40, .08);
}

[data-theme="dark"] .theme-toggle.theme-toggle--light {
    background: var(--bg-panel);
    color: var(--text-title);
    border-color: var(--border-panel);
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .14);
}

.lang-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .72);
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 99px;
    cursor: pointer;
    line-height: 1;
    font-family: inherit;
}

.lang-btn.is-active {
    background: #fff;
    color: #16223a;
}

.brand-hero {
    background: linear-gradient(165deg, #1d60a2 0%, #16223a 100%);
    padding: 36px 22px 42px;
    flex: none;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .brand-hero {
    background: linear-gradient(165deg, #1a4f86 0%, #0d1420 100%);
}

.brand-blob {
    position: absolute;
    border-radius: 50%;
}

.brand-blob--tr {
    top: -40px;
    right: -30px;
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, .06);
}

.brand-blob--bl {
    bottom: -50px;
    left: -20px;
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, .04);
}

[dir="ltr"] .brand-blob--tr {
    right: auto;
    left: -30px;
}

[dir="ltr"] .brand-blob--bl {
    left: auto;
    right: -20px;
}

.brand-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .14);
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.brand-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -.4px;
    position: relative;
}

.brand-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, .78);
    margin-top: 8px;
    font-weight: 600;
    position: relative;
}

.login-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 20px;
    margin-top: -18px;
    position: relative;
}

.login-card {
    background: var(--bg-form);
    border-radius: 20px;
    padding: 22px 18px 20px;
    box-shadow: var(--box-shadow-card);
    border: 1px solid var(--border-panel);
}

.login-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-title);
    margin-bottom: 6px;
}

.login-hint {
    font-size: 12.5px;
    color: var(--text-sub);
    font-weight: 600;
    margin-bottom: 16px;
}

.error-box {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: #fbeeed;
    border: 1px solid #f0c9c4;
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    margin-bottom: 16px;
}

[data-theme="dark"] .error-box {
    background: #3a1c1a;
    border-color: #5c2a28;
}

.error-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #c0392b;
    line-height: 1.45;
}

[data-theme="dark"] .error-text {
    color: #ef6b5e;
}

.field {
    margin-bottom: 14px;
}

.field--tight {
    margin-bottom: 8px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    color: var(--text-label);
    font-weight: 600;
    margin-bottom: 7px;
}

.req {
    color: #c0392b;
}

.input {
    width: 100%;
    padding: 13px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    color: var(--input-text);
    text-align: right;
    background: var(--input-bg);
    font-family: inherit;
    outline: none;
}

.input:focus {
    border-color: var(--color-primary);
}

.input--ltr {
    direction: ltr;
}

.input--pass {
    padding: 13px 13px 13px 46px;
}

.input--otp {
    text-align: center;
    letter-spacing: 3px;
}

.otp-resend {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.resend-otp {
    border: none;
    background: transparent;
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 8px;
    cursor: pointer;
}

.resend-otp:disabled {
    opacity: .6;
    cursor: not-allowed;
}

[dir="ltr"] .input {
    text-align: left;
}

[dir="ltr"] .input--pass {
    padding: 13px 46px 13px 13px;
}

.pass-wrap {
    position: relative;
}

.pass-toggle {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa3b0;
}

[dir="ltr"] .pass-toggle {
    left: auto;
    right: 8px;
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 20px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.remember span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
}

.biz1-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
}

.btn-login {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #1d60a2, #16487c);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: inherit;
    box-shadow: 0 6px 16px rgba(29, 96, 162, .28);
}

[data-theme="dark"] .btn-login {
    background: linear-gradient(135deg, #4d9de0, #2e78b8);
    box-shadow: 0 6px 16px rgba(77, 157, 224, .28);
}

.team-box {
    margin-top: 18px;
    padding: 14px 12px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-panel);
    box-shadow: var(--box-shadow-card);
}

.team-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 10px;
    text-align: center;
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fill-user {
    text-align: right;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-panel);
    background: var(--staff-btn-bg);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-title);
    font-family: inherit;
}

[dir="ltr"] .fill-user {
    text-align: left;
}

.demo-users {
    margin-top: 16px;
    background: var(--color-primary-soft);
    border: 1px solid color-mix(in srgb, var(--color-primary) 38%, var(--border-panel));
    border-radius: 14px;
    padding: 14px 16px 16px;
}

.demo-users-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 12px;
    text-align: left;
}

.demo-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.demo-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
    direction: ltr;
}

.demo-user-btn {
    width: auto;
    flex: 0 0 auto;
    margin-inline-start: auto;
    white-space: nowrap;
    text-align: center;
    padding: 7px 10px;
    border-radius: 10px;
    border: none;
    background: var(--color-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    font-family: inherit;
    transition: background 0.2s ease, transform 120ms ease;
}

.demo-user-btn:hover {
    background: var(--color-primary-hover);
}

.demo-user-creds {
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 600;
    direction: ltr;
    text-align: left;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.footer-note,
.login-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 600;
}

.gv-in {
    width: 100%;
    border: 1.5px solid var(--border-panel);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-title);
    background: var(--bg-form);
    outline: none;
    font-family: inherit;
}

.gv-in::placeholder {
    color: var(--text-sub);
    font-weight: 600;
}

.gv-in:focus {
    border-color: var(--color-primary);
}

textarea.gv-in,
textarea {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
    max-height: 240px;
}


/* Filter Options Modal Styling */

.filter-category-title {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    display: block;
}

.filter-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.filter-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 99px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    background: var(--bg-panel);
    color: var(--text-title);
    border: 1.5px solid var(--border-panel);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-option:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.filter-option.is-active {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    border-color: var(--color-primary) !important;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(29, 96, 162, 0.4);
    transform: scale(1.03);
}

[data-theme="dark"] .filter-option {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .filter-option:hover {
    border-color: var(--color-primary);
    color: #60a5fa;
}

[data-theme="dark"] .filter-option.is-active {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
}


/* ── Realtime: pulse + toast ── */

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
    }
    100% {
        box-shadow: 0 0 0 18px rgba(16, 185, 129, 0);
    }
}

.pulse-animation {
    animation: pulse-green 0.65s ease-out 2;
}

#mb-toast-host {
    position: fixed;
    bottom: 88px;
    z-index: 2147483001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: min(92vw, 360px);
}

[dir="rtl"] #mb-toast-host {
    left: 16px;
}

[dir="ltr"] #mb-toast-host {
    right: 16px;
}

.mb-toast {
    pointer-events: auto;
    background: var(--bg-form);
    color: var(--text-title);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: 0 8px 28px rgba(15, 24, 40, 0.16);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    animation: toast-in 0.28s ease-out;
}

.mb-toast.is-leaving {
    animation: toast-out 0.25s ease-in forwards;
}

.mb-toast-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    flex: none;
    margin-top: 4px;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

.mission-filter-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    direction: ltr;
    unicode-bidi: isolate;
}

.mission-filter-area {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.mission-filter-header>* {
    direction: ltr;
}

.mission-filter-chips {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 14px;
    scrollbar-width: none;
    direction: ltr;
    unicode-bidi: isolate;
}

.mission-filter-chips .mb-filter-chip {
    flex: 0 0 auto;
    order: initial;
}


/* ── Tablet ── */

@media (min-width: 768px) {
     :root {
        --page-pad: 28px;
    }
    .app-header-status,
    .app-header-bar {
        padding-left: var(--page-pad);
        padding-right: var(--page-pad);
    }
    .page-body {
        padding: 16px var(--page-pad) 28px;
    }
    #mb-task-filter-chips {
        gap: 10px;
    }
}


/* ── Desktop: full-screen dashboard ── */

@media (min-width: 1024px) {
     :root {
        --page-pad: 48px;
    }
    .app-header-status {
        padding: 14px var(--page-pad) 6px;
    }
    .app-header-bar {
        padding: 12px var(--page-pad) 16px;
    }
    .app-greeting {
        font-size: 24px;
    }
    .page-body {
        padding: 20px var(--page-pad) 32px;
        max-width: none;
    }
    /* Tasks: card grid */
    .task-group-container {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 14px;
        align-items: start;
        margin-bottom: 28px !important;
    }
    .task-group-header {
        grid-column: 1 / -1;
        margin: 8px 0 4px;
    }
    .task-row-card {
        margin-bottom: 0;
        height: 100%;
        min-height: 110px;
    }
    /* Home stats stretch full width */
    .home-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
    .home-stats-grid .stat-card {
        padding: 20px 22px;
    }
    /* Task editor — full usable width */
    #mb-mission-form.mission-editor {
        max-width: none;
        margin-inline: 0;
        width: 100%;
    }
    /* Kanban — columns share full board width */
    .kanban-board {
        padding: 10px var(--page-pad) !important;
        gap: 16px !important;
        align-items: stretch !important;
        width: 100% !important;
        height: calc(100dvh - 140px) !important;
        max-height: calc(100dvh - 140px) !important;
        min-height: 0 !important;
    }
    .kanban-column {
        flex: 1 1 240px !important;
        width: auto !important;
        max-width: none !important;
        min-width: 230px !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
    /* Footer more compact as sidebar-like bar */
    .app-footer-nav {
        padding: 12px 24px calc(14px + env(safe-area-inset-bottom, 0px));
    }
    .nav-item span {
        font-size: 12px;
    }
    /* Filter bottom sheet → centered panel on desktop */
    #task-filter-panel>div {
        border-radius: var(--radius-lg) !important;
        max-width: 480px;
        margin: auto;
        width: calc(100% - 48px);
    }
    #task-filter-panel {
        justify-content: center !important;
        align-items: center;
    }
}


/* Login — inquiry desktop split */

@media (min-width: 768px) {
    .status-bar {
        padding: 14px 28px 10px;
    }
    .brand-hero {
        padding: 48px 32px 56px;
    }
    .brand-title {
        font-size: 34px;
    }
    .login-scroll {
        padding: 0 28px 32px;
        max-width: 520px;
        width: 100%;
        margin-inline: auto;
    }
    .login-card {
        padding: 28px 24px 24px;
    }
}

@media (min-width: 1024px) {
    #screenLogin.login-screen {
        display: grid;
        grid-template-columns: minmax(320px, 1.05fr) minmax(380px, 0.95fr);
        grid-template-rows: auto 1fr;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        flex-direction: unset;
    }
    #screenLogin .status-bar {
        grid-column: 1 / -1;
    }
    #screenLogin .brand-hero {
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 48px 40px;
        margin: 0;
    }
    #screenLogin .login-scroll {
        margin-top: 0;
        max-width: 460px;
        padding: 40px 36px 48px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}


/* Large desktop breathing room */

@media (min-width: 1400px) {
     :root {
        --page-pad: 56px;
    }
    .task-group-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}