/* ==========================================================================
   ARKENSTONE V2 — MASTER DESIGN SYSTEM + REGISTRY COMPONENTS
   ========================================================================== */

/* ── DESIGN TOKENS ── */
:root {
    --color-canvas-primary:   #0E0C08;
    --color-canvas-secondary: #131109;
    --color-surface-card:     #16130C;
    --color-ink-primary:      #F0EAD6;
    --color-ink-muted:        #8A7A58;
    --color-border-rule:      rgba(201, 168, 76, 0.2);
    --color-glass-surface:    rgba(22, 19, 12, 0.85);

    --gold:       #C9A84C;
    --gold-light: #E8C96A;
    --gold-pale:  #F5EDD0;
    --gold-faint: rgba(201, 168, 76, 0.08);

    --shadow-gold: 0 0 40px rgba(201, 168, 76, 0.12);
    --shadow-deep: 0 24px 80px rgba(0, 0, 0, 0.6);
    --glass-border: rgba(201, 168, 76, 0.3);

    --font-display: 'Cormorant Garamond', serif;
    --font-body:    'DM Sans', sans-serif;
    --font-kpi:     'DM Sans', sans-serif;

    --transition-base: 0.25s ease;
    --radius-card: 12px;
    --radius-btn:  6px;
}

[data-theme="light"] {
    --color-canvas-primary:   #F8F4E8;
    --color-canvas-secondary: #F2EDD6;
    --color-surface-card:     #FDFAF0;
    --color-ink-primary:      #1E1A10;
    --color-ink-muted:        #8A7A58;
    --color-border-rule:      #DDD0A8;
    --color-glass-surface:    rgba(253, 250, 240, 0.9);
    --shadow-deep:            0 12px 32px rgba(30, 26, 16, 0.08);
}

/* ── THEME TRANSITION ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color var(--transition-base),
                border-color var(--transition-base),
                color var(--transition-base);
}

/* ── GLOBAL BASE ── */
body {
    background-color: var(--color-canvas-primary);
    color: var(--color-ink-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ==========================================================================
   TYPOGRAPHIC ENGINE
   ========================================================================== */
h1, h2, h3, .display-font { font-family: var(--font-display); }

.display-sm {
    font-family: var(--font-display);
    font-size: clamp(36px, 5vw, 72px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--color-ink-primary);
}

.heading-lg {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.5vw, 48px);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-ink-primary);
}

.kpi-value {
    font-family: var(--font-kpi);
    font-size: clamp(24px, 2.5vw, 32px);
    font-weight: 700;
    line-height: 1.0;
    letter-spacing: -0.02em;
    color: var(--color-ink-primary);
}

.body-base {
    font-size: clamp(14px, 1.2vw, 16px);
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-ink-primary);
}

.eyebrow {
    font-family: var(--font-body);
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}

/* ==========================================================================
   LAYOUT & UTILITIES
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 40px clamp(20px, 4vw, 64px) 72px;
}

/* Utility classes (replacing non-loaded Tailwind) */
.flex              { display: flex; }
.flex-col          { flex-direction: column; }
.flex-1            { flex: 1; }
.items-center      { align-items: center; }
.items-start       { align-items: flex-start; }
.items-end         { align-items: flex-end; }
.justify-between   { justify-content: space-between; }
.justify-center    { justify-content: center; }
.gap-2             { gap: 8px; }
.gap-3             { gap: 12px; }
.gap-6             { gap: 24px; }
.mb-2              { margin-bottom: 8px; }
.mb-3              { margin-bottom: 12px; }
.mb-4              { margin-bottom: 16px; }
.mb-6              { margin-bottom: 24px; }
.mb-12             { margin-bottom: 48px; }
.mt-1              { margin-top: 4px; }
.mt-4              { margin-top: 16px; }
.pb-4              { padding-bottom: 16px; }
.pb-8              { padding-bottom: 32px; }
.pt-6              { padding-top: 24px; }
.py-16             { padding-top: 64px; padding-bottom: 64px; }
.w-full            { width: 100%; }
.max-w-2xl         { max-width: 672px; }
.text-center       { text-align: center; }
.text-right        { text-align: right; }
.text-sm           { font-size: 14px; }
.text-lg           { font-size: 18px; }
.text-2xl          { font-size: 24px; }
.text-3xl          { font-size: 30px; }
.font-semibold     { font-weight: 600; }
.font-medium       { font-weight: 500; }
.font-bold         { font-weight: 700; }
.uppercase         { text-transform: uppercase; }
.tracking-wider    { letter-spacing: 0.05em; }
.leading-relaxed   { line-height: 1.625; }
.border-b          { border-bottom: 0.5px solid var(--color-border-rule); }
.border-t          { border-top: 0.5px solid var(--color-border-rule); }
.hidden            { display: none !important; }
.w-12              { width: 48px; }
.h-px              { height: 0.5px; background: var(--color-border-rule); }
.inline-block      { display: inline-block; }
.transition-colors { transition: color var(--transition-base); }
.space-y-2 > * + * { margin-top: 8px; }

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.page-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 48px;
    border-bottom: 0.5px solid var(--color-border-rule);
    padding-bottom: 32px;
}
@media (min-width: 768px) {
    .page-header { flex-direction: row; align-items: flex-end; }
}

.header-eyebrow-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.header-divider {
    width: 48px;
    height: 0.5px;
    background: var(--color-border-rule);
}

.header-desc {
    font-size: clamp(14px, 1.2vw, 16px);
    color: var(--color-ink-muted);
    max-width: 672px;
    line-height: 1.5;
    margin-top: 16px;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ==========================================================================
   KPI STRIP
   ========================================================================== */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.kpi-card {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 2px 2px 10px 10px;
    padding: 24px 20px;
    border-top: 3px solid var(--gold);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kpi-card.insight {
    background: var(--gold-faint);
    border-top: 0.75px solid var(--color-border-rule);
    border-left: 3px solid var(--gold);
    border-radius: 0 8px 8px 0;
}

.kpi-eyebrow {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
}

.kpi-filtered-text {
    font-size: 11px;
    color: var(--color-ink-muted);
    margin-top: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-insight-text {
    font-size: 13px;
    color: var(--color-ink-muted);
    margin-top: 4px;
}

.value-confidential {
    color: var(--color-ink-muted);
    font-style: italic;
    font-size: 0.85em;
}

/* ==========================================================================
   CONTROLS
   ========================================================================== */
.controls-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}
@media (min-width: 768px) {
    .controls-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-btn);
    color: var(--color-ink-primary);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.form-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-faint);
}

.search-input {
    max-width: 380px;
    padding-left: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238A7A58' viewBox='0 0 256 256'%3E%3Cpath d='M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.filter-group {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-shrink: 0;
}

.btn-filter {
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    color: var(--color-ink-muted);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-filter.active,
.btn-filter:hover {
    background: var(--color-ink-primary);
    color: var(--color-canvas-primary);
    border-color: var(--color-ink-primary);
}

/* Filter count badge */
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(201, 168, 76, 0.2);
    color: var(--gold);
    line-height: 1;
}
.btn-filter.active .filter-count {
    background: rgba(255,255,255,0.15);
    color: var(--color-canvas-primary);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--gold);
    color: #1E1A10;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 24px;
    border: 1px solid var(--gold);
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}
.btn-primary:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-gold);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--color-ink-primary);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 24px;
    border: 1px solid var(--color-border-rule);
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}
.btn-secondary:hover {
    background: var(--color-canvas-secondary);
    border-color: var(--color-ink-muted);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-btn);
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 18px;
    flex-shrink: 0;
}
.btn-icon:hover {
    color: var(--color-ink-primary);
    border-color: var(--color-ink-primary);
    background: var(--color-canvas-secondary);
}

/* Theme toggle */
.btn-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-btn);
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 18px;
}
.btn-theme:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-faint);
}

/* ==========================================================================
   TABLE
   ========================================================================== */
.table-wrapper {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    overflow-x: auto;
    margin-bottom: 40px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

th {
    text-align: left;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    padding: 20px 16px 12px;
    border-bottom: 0.75px solid var(--color-border-rule);
    white-space: nowrap;
    user-select: none;
}

th[data-sort] {
    cursor: pointer;
}
th[data-sort]:hover {
    color: var(--color-ink-primary);
}
th[data-sort]::after {
    content: ' ⇅';
    opacity: 0.35;
    font-size: 9px;
}
th[data-sort].sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--gold); }
th[data-sort].sort-desc::after { content: ' ↓'; opacity: 1; color: var(--gold); }

td {
    padding: 16px;
    border-bottom: 0.5px solid var(--color-border-rule);
    font-size: 13px;
    vertical-align: top;
    color: var(--color-ink-primary);
    line-height: 1.5;
}

tr:last-child td { border-bottom: none; }
tr:hover td      { background-color: var(--color-canvas-primary); }

/* Row layout */
.row-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}
.row-content { flex: 1; min-width: 0; }
.row-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-ink-primary);
    margin-bottom: 4px;
    display: block;
    width: 100%;
}
.row-focus {
    font-size: 11px;
    color: var(--color-ink-muted);
    margin-bottom: 8px;
    display: block;
    width: 100%;
}
.row-status-wrap { margin-top: 4px; }
.row-client-name { font-weight: 500; display: block; width: 100%; }
.row-client-role {
    font-size: 10px;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
    display: block;
    width: 100%;
}

.location-wrap {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.location-pin {
    color: var(--gold);
    margin-top: 2px;
    flex-shrink: 0;
}

.timeline-wrap { font-size: 11px; }
.td-created-at { font-size: 11px; white-space: nowrap; color: var(--color-ink-muted); }
.timeline-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}
.timeline-row:last-child { margin-bottom: 0; }
.timeline-label {
    font-size: 9px;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    width: 32px;
    flex-shrink: 0;
}

.materials-field {
    font-size: 11px;
    line-height: 1.6;
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

/* Delete row button */
.btn-delete-row {
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--color-ink-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-base);
    font-size: 14px;
}
tr:hover .btn-delete-row { opacity: 1; }
.btn-delete-row:hover {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.08);
}

/* Detail open button */
.btn-detail-open {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-ink-muted);
    background: transparent;
    border: 0.5px solid var(--color-border-rule);
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all var(--transition-base);
    opacity: 0;
}
tr:hover .btn-detail-open { opacity: 1; }
.btn-detail-open:hover {
    color: var(--gold);
    border-color: var(--gold);
    background: var(--gold-faint);
}

/* ==========================================================================
   STATUS BADGES
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.status-active {
    background: rgba(43, 104, 69, 0.1);
    color: #1D5C38;
    border: 0.5px solid rgba(43, 104, 69, 0.3);
}
.status-active::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #1D5C38;
    flex-shrink: 0;
}

.status-completed {
    background: rgba(201, 168, 76, 0.1);
    color: #7A5818;
    border: 0.5px solid rgba(201, 168, 76, 0.4);
}
.status-completed::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #7A5818;
    flex-shrink: 0;
}

.status-pipeline {
    background: rgba(212, 149, 106, 0.1);
    color: #854020;
    border: 0.5px solid rgba(212, 149, 106, 0.3);
}
.status-pipeline::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #854020;
    flex-shrink: 0;
}

/* Status badge used as select dropdown */
select.status-badge {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238A7A58' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

/* ==========================================================================
   EDITABLE FIELDS
   ========================================================================== */
.editable-field {
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
    border: 0.75px solid transparent;
    transition: background-color var(--transition-base), border-color var(--transition-base);
    outline: none;
    display: inline-block;
    min-width: 30px;
    word-break: break-word;
}
.editable-field:hover {
    background: var(--color-canvas-secondary);
    border-color: var(--color-border-rule);
}
.editable-field:focus {
    background: var(--color-surface-card);
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-faint);
}

.value-field {
    font-weight: 700;
    font-family: var(--font-kpi);
    letter-spacing: -0.01em;
}

/* ==========================================================================
   PROJECT THUMBNAIL
   ========================================================================== */
.project-thumbnail {
    width: 44px;
    height: 44px;
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}
.project-thumbnail:hover {
    border-color: var(--gold);
    background: var(--gold-faint);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--color-ink-muted);
}
.empty-state i { font-size: 32px; display: block; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-glass-surface);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    padding: 20px;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: var(--shadow-deep);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 0.5px solid var(--color-border-rule);
}
.modal-header h2 {
    font-size: 24px;
    font-family: var(--font-display);
    font-weight: 600;
}

/* AI Panel */
.ai-assistant-panel {
    background: var(--gold-faint);
    border: 0.75px solid rgba(201, 168, 76, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}
.ai-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.ai-assistant-panel textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    background: transparent;
    border: 1px dashed var(--gold);
    border-radius: 6px;
    padding: 12px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-ink-primary);
    margin-bottom: 12px;
    outline: none;
    transition: border-color var(--transition-base), background var(--transition-base);
}
.ai-assistant-panel textarea:focus {
    border-style: solid;
    background: var(--color-surface-card);
}

/* Form grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-ink-muted);
}
.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 0.5px solid var(--color-border-rule);
}

/* ==========================================================================
   DETAIL DRAWER
   ========================================================================== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}
.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: var(--color-surface-card);
    border-left: 0.75px solid var(--color-border-rule);
    box-shadow: var(--shadow-deep);
    z-index: 160;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.detail-drawer.active {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 24px 16px;
    border-bottom: 0.5px solid var(--color-border-rule);
    flex-shrink: 0;
}
.drawer-header h2 {
    font-size: 20px;
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.drawer-image-area {
    width: 100%;
    height: 180px;
    background: var(--color-canvas-secondary);
    border-bottom: 0.5px solid var(--color-border-rule);
    overflow: hidden;
    flex-shrink: 0;
}
.drawer-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-ink-muted);
    font-size: 13px;
}
.drawer-image-placeholder i { font-size: 32px; }

.drawer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.drawer-field { display: flex; flex-direction: column; gap: 4px; }
.drawer-value {
    font-size: 14px;
    color: var(--color-ink-primary);
    font-weight: 500;
}
.drawer-sub {
    font-size: 10px;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}
.drawer-section-title {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 16px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 0.5px solid var(--color-border-rule);
}
.drawer-section-title:first-child { margin-top: 0; border-top: none; padding-top: 0; }

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 400;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--color-ink-primary);
    box-shadow: var(--shadow-deep);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 320px;
}
.toast-container.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.toast-container.success { border-left: 3px solid #1D5C38; }
.toast-container.error   { border-left: 3px solid #c0392b; }
.toast-container.info    { border-left: 3px solid var(--gold); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-container.success .toast-icon { color: #1D5C38; }
.toast-container.error   .toast-icon { color: #c0392b; }
.toast-container.info    .toast-icon { color: var(--gold); }

.toast-actions {
    display: none;
    gap: 6px;
    margin-left: 10px;
    flex-shrink: 0;
}
.toast-btn-yes, .toast-btn-no {
    font-family:    var(--font-body);
    font-size:      10px;
    font-weight:    600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding:        4px 10px;
    border-radius:  4px;
    cursor:         pointer;
    transition:     all var(--transition-base);
    white-space:    nowrap;
    line-height:    1;
}
.toast-btn-yes { background: #1D5C38; color: #F0EAD6; border: none; }
.toast-btn-yes:hover { background: #266944; }
.toast-btn-no  { background: transparent; color: var(--color-ink-muted); border: 0.75px solid var(--color-border-rule); }
.toast-btn-no:hover  { color: var(--color-ink-primary); border-color: var(--color-ink-muted); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    padding-bottom: 16px;
    border-top: 0.5px solid var(--color-border-rule);
}
.footer-copy {
    font-size: 10px;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.btn-reset-data {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-ink-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color var(--transition-base);
    font-family: var(--font-body);
}
.btn-reset-data:hover { color: #c0392b; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes spin { 100% { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; display: inline-block; }

/* ==========================================================================
   MOBILE — RESPONSIVE CARD TABLE
   ========================================================================== */
@media (max-width: 767px) {
    .table-wrapper { overflow-x: visible; }

    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }

    tr {
        background: var(--color-surface-card);
        border: 0.75px solid var(--color-border-rule);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 0;
        overflow: hidden;
    }
    tr:hover td { background: transparent; }

    td {
        padding: 12px 16px;
        border-bottom: 0.5px solid var(--color-border-rule);
        font-size: 13px;
    }
    td:last-child { border-bottom: none; }
    td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 9px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--color-ink-muted);
        margin-bottom: 4px;
    }

    .btn-delete-row { opacity: 1; }
    .btn-detail-open { opacity: 1; }

    .header-actions { flex-wrap: wrap; }
    .detail-drawer { max-width: 100%; }
    .drawer-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
}
.progress-track {
    flex: 1;
    height: 4px;
    background: var(--color-border-rule);
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--gold);
    transition: width 0.4s ease;
}
.progress-fill.complete { background: #1D5C38; }
.progress-fill.critical { background: #c0392b; }   /* < 15% on near-deadline */

.completion-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--color-ink-muted);
    white-space: nowrap;
    min-width: 26px;
    text-align: right;
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    transition: background var(--transition-base);
}
.completion-label:hover { background: var(--color-canvas-secondary); }

/* Inline completion editor — hidden number input */
.completion-input {
    width: 38px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--gold);
    border-radius: 3px;
    color: var(--color-ink-primary);
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-body);
    padding: 1px 4px;
    outline: none;
    display: none;
}
.completion-input.visible { display: inline-block; }

/* Drawer progress bar — wider */
.drawer-progress-wrap {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.drawer-progress-track {
    flex: 1;
    height: 6px;
    background: var(--color-border-rule);
    border-radius: 3px;
    overflow: hidden;
}
.drawer-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gold);
    transition: width 0.4s ease;
}
.drawer-progress-fill.complete { background: #1D5C38; }
.drawer-completion-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-ink-primary);
    min-width: 38px;
    text-align: right;
}

/* ==========================================================================
   PRIORITY DOT
   ========================================================================== */
.priority-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    margin-right: 2px;
    vertical-align: middle;
}
.priority-urgent   { background: #c0392b; box-shadow: 0 0 0 2px rgba(192,57,43,0.18); }
.priority-standard { background: var(--gold); }
.priority-parked   { background: var(--color-ink-muted); }

.priority-badge-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
}

/* Priority select — styled inline */
select.priority-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-size: 9px;
    font-weight: 600;
    font-family: var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    outline: none;
    color: var(--color-ink-muted);
    padding: 0;
}
select.priority-select:focus { color: var(--color-ink-primary); }

/* ==========================================================================
   PHASE STEPPER
   ========================================================================== */
.phase-stepper {
    display: flex;
    align-items: flex-start;
    margin-top: 10px;
    width: 100%;
}
.phase-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.phase-step:hover .phase-dot { border-color: var(--gold); }

.phase-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--color-border-rule);
    background: transparent;
    transition: all var(--transition-base);
}
.phase-step.done   .phase-dot { background: var(--gold);               border-color: var(--gold); }
.phase-step.active .phase-dot { background: var(--color-ink-primary);   border-color: var(--color-ink-primary); box-shadow: 0 0 0 2px var(--gold-faint); }

.phase-label {
    font-size: 6.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    white-space: nowrap;
    line-height: 1;
}
.phase-step.done   .phase-label { color: var(--gold); }
.phase-step.active .phase-label { color: var(--color-ink-primary); font-weight: 700; }

.phase-connector {
    flex: 1;
    height: 1.5px;
    background: var(--color-border-rule);
    margin-top: 4px; /* aligns with dot center */
    transition: background var(--transition-base);
}
.phase-connector.done { background: var(--gold); }

/* ==========================================================================
   CURRENCY BUTTON
   ========================================================================== */
.btn-currency {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    min-width: 52px;
    padding: 0 12px;
    background: transparent;
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-btn);
    color: var(--color-ink-muted);
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-base);
}
.btn-currency:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-faint);
}

/* ==========================================================================
   DUPLICATE ROW BUTTON
   ========================================================================== */
.btn-duplicate-row {
    position: absolute;
    top: 0;
    right: 28px; /* sits left of the delete button */
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--color-ink-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-base);
    font-size: 14px;
}
tr:hover .btn-duplicate-row { opacity: 1; }
.btn-duplicate-row:hover {
    color: var(--gold);
    background: var(--gold-faint);
}

/* ==========================================================================
   NOTES TEXTAREA (drawer only)
   ========================================================================== */
.notes-textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 6px;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-ink-primary);
    line-height: 1.6;
    outline: none;
    transition: border-color var(--transition-base), background var(--transition-base);
    margin-top: 8px;
}
.notes-textarea:focus {
    border-color: var(--gold);
    background: var(--color-surface-card);
    box-shadow: 0 0 0 2px var(--gold-faint);
}
.notes-save-hint {
    font-size: 9px;
    color: var(--color-ink-muted);
    margin-top: 4px;
    letter-spacing: 0.04em;
}

/* ==========================================================================
   AVG COMPLETION KPI CARD
   ========================================================================== */
.kpi-completion-bar {
    height: 3px;
    background: var(--color-border-rule);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}
.kpi-completion-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ==========================================================================
   EXPORT OPTIONS MODAL — option cards with radio selector
   ========================================================================== */
.export-option-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--color-canvas-secondary);
}
.export-option-card:hover {
    border-color: var(--gold);
    background: var(--gold-faint);
}
.export-option-card.selected {
    border-color: var(--gold);
    background: var(--gold-faint);
}

.export-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--color-border-rule);
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-base);
}
.export-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.export-radio.checked {
    border-color: var(--gold);
}
.export-radio.checked::after {
    opacity: 1;
}

.export-option-body { flex: 1; }
.export-option-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-ink-primary);
    margin-bottom: 4px;
}
.export-option-desc {
    font-size: 11px;
    color: var(--color-ink-muted);
    line-height: 1.5;
}

/* Summary field in table */
.summary-field {
    font-size: 11.5px;
    line-height: 1.6;
    display: block;
    width: 100%;
    margin-bottom: 8px;
    color: var(--color-ink-muted);
}

/* ==========================================================================
   AUTOSAVE STATUS INDICATOR
   ========================================================================== */

/* Row beneath the header actions */
.autosave-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.save-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 20px;
    border: 0.75px solid transparent;
    transition: all var(--transition-base);
    white-space: nowrap;
    font-family: var(--font-body);
}
.save-status-indicator i { font-size: 13px; }

/* State colour tokens */
.ss-unlinked  { background: rgba(138,122,88,0.08); color: var(--color-ink-muted); border-color: var(--color-border-rule); }
.ss-pending   { background: rgba(201,168,76,0.08);  color: var(--gold);            border-color: rgba(201,168,76,0.3);    }
.ss-saving    { background: rgba(201,168,76,0.08);  color: var(--gold);            border-color: rgba(201,168,76,0.3);    }
.ss-saved     { background: rgba(43,104,69,0.08);   color: #1D5C38;                border-color: rgba(43,104,69,0.25);    }
.ss-warn      { background: rgba(212,149,106,0.1);  color: #854020;                border-color: rgba(212,149,106,0.3);   }
.ss-error     { background: rgba(192,57,43,0.08);   color: #c0392b;                border-color: rgba(192,57,43,0.25);    }
.ss-info      { background: rgba(201,168,76,0.06);  color: var(--color-ink-muted); border-color: var(--color-border-rule);}

/* Autosave action buttons */
.btn-autosave-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    white-space: nowrap;
}
.btn-autosave-action i { font-size: 12px; }

.btn-link-file {
    background: var(--gold-faint);
    border: 0.75px solid rgba(201,168,76,0.4);
    color: var(--gold);
}
.btn-link-file:hover { background: rgba(201,168,76,0.15); border-color: var(--gold); }

.btn-open-file {
    background: transparent;
    border: 0.75px solid var(--color-border-rule);
    color: var(--color-ink-muted);
}
.btn-open-file:hover { border-color: var(--color-ink-muted); color: var(--color-ink-primary); }

.btn-unlink-file {
    background: transparent;
    border: 0.75px solid var(--color-border-rule);
    color: var(--color-ink-muted);
}
.btn-unlink-file:hover { border-color: #c0392b; color: #c0392b; }

.btn-save-now {
    background: transparent;
    border: 0.75px solid var(--color-border-rule);
    color: var(--color-ink-muted);
}
.btn-save-now:hover { border-color: #1D5C38; color: #1D5C38; }

/* Reconnect permission banner */
.reconnect-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(212,149,106,0.08);
    border: 0.75px solid rgba(212,149,106,0.35);
    border-left: 3px solid #854020;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--color-ink-primary);
}
.reconnect-banner i { color: #854020; font-size: 18px; flex-shrink: 0; }
.reconnect-banner-text { flex: 1; }
.reconnect-banner-text strong { display: block; font-size: 12px; font-weight: 600; color: #854020; margin-bottom: 2px; }
.reconnect-banner-text span   { font-size: 12px; color: var(--color-ink-muted); }

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; color: #000 !important; }

    .container { padding: 0 !important; max-width: none !important; }
    .table-wrapper {
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    table {
        width: 100% !important;
        min-width: 0 !important;
        page-break-inside: auto;
    }
    tr { page-break-inside: avoid; page-break-after: auto; }
    td, th {
        border-bottom: 1px solid #ddd !important;
        padding: 10px 8px !important;
        font-size: 11px !important;
    }
    /* Hide less critical print columns */
    td:nth-child(6), th:nth-child(6) { display: none; }

    .kpi-strip { display: none; }
    .btn-delete-row, .btn-detail-open { display: none !important; }

    @page { size: landscape; margin: 1.5cm; }
}

/* ==========================================================================
   ANALYTICS PANEL
   ========================================================================== */
.analytics-panel {
    margin-bottom: 24px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    padding: 24px;
    animation: fadeSlideDown 0.22s ease;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

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

.chart-card {
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    padding: 18px 20px 14px;
}

.chart-title {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    margin-bottom: 14px;
}

.chart-canvas-wrap {
    position: relative;
    height: 240px;
}

/* ==========================================================================
   VIEW TOGGLE  (Table / Gantt)
   ========================================================================== */
.view-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 8px 14px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-btn);
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}
.btn-view:hover  { border-color: var(--color-ink-muted); color: var(--color-ink-primary); }
.btn-view.active {
    background: var(--color-ink-primary);
    color: var(--color-canvas-primary);
    border-color: var(--color-ink-primary);
}

/* ==========================================================================
   GANTT WRAPPER
   ========================================================================== */
.gantt-wrapper {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    overflow: hidden;
    margin-bottom: 40px;
}

.gantt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 0.5px solid var(--color-border-rule);
    flex-wrap: wrap;
    gap: 10px;
}

.gantt-legend {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.gantt-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
}
.gantt-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.gantt-mode-btns { display: flex; gap: 4px; }

.gantt-mode-btn {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 12px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 4px;
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
}
.gantt-mode-btn:hover  { border-color: var(--color-ink-muted); color: var(--color-ink-primary); }
.gantt-mode-btn.active { background: var(--gold); border-color: var(--gold); color: #1E1A10; }

.gantt-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 68vh;
    background: transparent;
    padding: 8px 0 0;
}

.gantt-hint {
    font-size: 9.5px;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    padding: 10px 16px;
    border-top: 0.5px solid var(--color-border-rule);
}

/* Empty state reused inside gantt */
.gantt-empty {
    text-align: center;
    padding: 64px 24px;
    color: var(--color-ink-muted);
}
.gantt-empty i   { font-size: 32px; display: block; margin-bottom: 10px; }
.gantt-empty p   { font-size: 14px; line-height: 1.6; }

/* ── Gantt custom popup ── */
.gantt-popup {
    padding: 14px 18px;
    min-width: 220px;
}
.gantt-popup-name  { font-weight: 600; font-size: 13px; color: var(--color-ink-primary); margin-bottom: 5px; }
.gantt-popup-meta  { font-size: 11px; color: var(--color-ink-muted); margin-bottom: 4px; }
.gantt-popup-dates { font-size: 11px; color: var(--gold); font-weight: 500; margin-bottom: 8px; }
.gantt-popup-row   { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gantt-popup-pct   { font-size: 11px; font-weight: 600; color: var(--color-ink-primary); }

.gantt-popup-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.gantt-popup-badge-active    { background: rgba(43,104,69,0.1); color: #1D5C38; border: 0.5px solid rgba(43,104,69,0.3); }
.gantt-popup-badge-completed { background: rgba(201,168,76,0.1); color: #7A5818; border: 0.5px solid rgba(201,168,76,0.4); }
.gantt-popup-badge-pipeline  { background: rgba(212,149,106,0.1); color: #854020; border: 0.5px solid rgba(212,149,106,0.3); }

/* ==========================================================================
   FRAPPE GANTT — ARKENSTONE THEME OVERRIDES
   All rules use !important to win specificity over the library's base CSS.
   Scoped to .gantt-container to avoid leaking into other page elements.
   ========================================================================== */

/* Grid & background */
.gantt-container .gantt .grid-background           { fill: transparent !important; }
.gantt-container .gantt .grid-row                  { fill: transparent !important; }
.gantt-container .gantt .grid-row:nth-child(even)  { fill: rgba(201,168,76,0.025) !important; }
.gantt-container .gantt .row-line                  { stroke: var(--color-border-rule) !important; }
.gantt-container .gantt .tick                      { stroke: var(--color-border-rule) !important; opacity: 0.6; }
.gantt-container .gantt .tick.thick                { stroke: rgba(201,168,76,0.4) !important; opacity: 1; }
.gantt-container .gantt .today-highlight           { fill: var(--gold-faint) !important; }

/* Header date labels */
.gantt-container .gantt .upper-text {
    fill:        var(--gold) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size:   12px !important;
    font-weight: 600 !important;
}
.gantt-container .gantt .lower-text {
    fill:        var(--color-ink-muted) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size:   10px !important;
}

/* Row labels (left side) */
.gantt-container .gantt .bar-label {
    fill:        var(--color-ink-primary) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size:   11px !important;
    font-weight: 500 !important;
}

/* Bars — On-Going (green) */
.gantt-container .bar-group.gantt-bar-active .bar         { fill: rgba(29,92,56,0.75) !important; stroke: #1D5C38 !important; stroke-width: 1 !important; }
.gantt-container .bar-group.gantt-bar-active .bar-progress { fill: #1D5C38 !important; }
.gantt-container .bar-group.gantt-bar-active .bar-label   { fill: #F0EAD6 !important; }

/* Bars — Completed (gold) */
.gantt-container .bar-group.gantt-bar-completed .bar         { fill: rgba(201,168,76,0.65) !important; stroke: #C9A84C !important; stroke-width: 1 !important; }
.gantt-container .bar-group.gantt-bar-completed .bar-progress { fill: #C9A84C !important; }
.gantt-container .bar-group.gantt-bar-completed .bar-label   { fill: #1E1A10 !important; }

/* Bars — Pipeline (rust) */
.gantt-container .bar-group.gantt-bar-pipeline .bar         { fill: rgba(133,64,32,0.65) !important; stroke: #854020 !important; stroke-width: 1 !important; }
.gantt-container .bar-group.gantt-bar-pipeline .bar-progress { fill: #854020 !important; }
.gantt-container .bar-group.gantt-bar-pipeline .bar-label   { fill: #F0EAD6 !important; }

/* Resize handles */
.gantt-container .handle { fill: rgba(201,168,76,0.7) !important; }
.gantt-container .handle:hover { fill: var(--gold) !important; }

/* Popup wrapper */
.gantt-container .popup-wrapper {
    background:    var(--color-surface-card) !important;
    border:        0.75px solid var(--color-border-rule) !important;
    border-radius: 8px !important;
    box-shadow:    var(--shadow-deep) !important;
    padding:       0 !important;
    overflow:      hidden !important;
}
.gantt-container .popup-wrapper .pointer {
    border-top-color: var(--color-surface-card) !important;
}

/* ==========================================================================
   SCHEDULE HEALTH BADGES  (overdue / at-risk)
   ========================================================================== */
.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 9px;
    border-radius: 20px;
    margin-top: 6px;
    white-space: nowrap;
    line-height: 1.4;
}
.health-badge i { font-size: 11px; }

.health-overdue {
    background: rgba(192, 57, 43, 0.08);
    color: #c0392b;
    border: 0.5px solid rgba(192, 57, 43, 0.3);
}
[data-theme="dark"] .health-overdue {
    background: rgba(231, 96, 81, 0.12);
    color: #E76051;
    border-color: rgba(231, 96, 81, 0.35);
}

.health-risk {
    background: rgba(178, 106, 0, 0.08);
    color: #B26A00;
    border: 0.5px solid rgba(178, 106, 0, 0.3);
}
[data-theme="dark"] .health-risk {
    background: rgba(232, 162, 60, 0.12);
    color: #E8A23C;
    border-color: rgba(232, 162, 60, 0.35);
}

/* Attention filter chip — subtle red accent when inactive */
.btn-filter-attention { color: #c0392b; border-color: rgba(192, 57, 43, 0.35); }
.btn-filter-attention i { font-size: 13px; }
.btn-filter-attention.active,
.btn-filter-attention:hover {
    background: #c0392b;
    color: #FDFAF0;
    border-color: #c0392b;
}
.btn-filter-attention .filter-count { background: rgba(192, 57, 43, 0.15); color: #c0392b; }
.btn-filter-attention.active .filter-count { background: rgba(255, 255, 255, 0.2); color: #FDFAF0; }

/* ==========================================================================
   EDIT MODE - registry is read-only unless body has .edit-mode
   ========================================================================== */
body:not(.edit-mode) .btn-delete-row,
body:not(.edit-mode) .btn-duplicate-row { display: none !important; }

body:not(.edit-mode) .editable-select,
body:not(.edit-mode) .priority-select   { pointer-events: none; }

body:not(.edit-mode) .editable-field    { cursor: default; }
body:not(.edit-mode) .phase-step,
body:not(.edit-mode) .completion-label,
body:not(.edit-mode) .project-thumbnail { cursor: default; }

body:not(.edit-mode) .drawer-upload-row { display: none; }

#btnEditMode.active {
    background: var(--gold);
    border-color: var(--gold);
    color: #1E1A10;
}

/* Subtle gold frame around the table while editing */
body.edit-mode .table-wrapper {
    outline: 1.5px solid rgba(201, 168, 76, 0.45);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==========================================================================
   VALUE PRIVACY (admin lock)
   ========================================================================== */
.value-masked {
    color: var(--color-ink-muted);
    font-weight: 700;
    letter-spacing: 0.18em;
    user-select: none;
}

#btnValues.unlocked {
    color: var(--gold);
    border-color: var(--gold);
}

.pin-error {
    font-size: 11px;
    font-weight: 600;
    color: #c0392b;
    margin-top: 2px;
}

.chart-lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--color-canvas-secondary);
    color: var(--color-ink-muted);
    font-size: 11px;
    text-align: center;
    padding: 12px;
    border-radius: 6px;
}
.chart-lock-overlay i { font-size: 26px; color: var(--gold); }

.export-option-locked { opacity: 0.45; }

.modal-note {
    font-size: 12px;
    color: var(--color-ink-muted);
    margin-bottom: 18px;
    line-height: 1.55;
}

/* ==========================================================================
   TEAM - avatars, roster modal, member filter
   ========================================================================== */
.member-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #FDFAF0;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    border: 1.5px solid var(--color-surface-card);
    line-height: 1;
}

.assignee-stack {
    display: flex;
    align-items: center;
    margin-top: 6px;
}
.assignee-stack .member-avatar { margin-right: -6px; }
.assignee-more {
    font-size: 9px;
    font-weight: 700;
    color: var(--color-ink-muted);
    margin-left: 10px;
}

.member-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: -8px 0 20px;
}
.member-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
}
.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 5px;
    border-radius: 20px;
    border: 0.75px solid var(--color-border-rule);
    background: var(--color-surface-card);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
}
.member-chip[data-member="all"] { padding: 4px 12px; }
.member-chip:hover  { border-color: var(--color-ink-muted); color: var(--color-ink-primary); }
.member-chip.active {
    background: var(--color-ink-primary);
    color: var(--color-canvas-primary);
    border-color: var(--color-ink-primary);
}

.team-add-form {
    margin-bottom: 24px;
    max-width: 760px;
}
.team-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.team-add-field {
    position: relative;
    flex: 1;
    min-width: 160px;
}
.team-add-field-dept {
    flex: 0 0 auto;
    min-width: 150px;
}
.team-add-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--color-ink-muted);
    pointer-events: none;
    z-index: 1;
}
.team-add-input {
    padding-left: 32px !important;
}
.team-add-submit {
    flex-shrink: 0;
    white-space: nowrap;
}
.team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}
.team-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    background: var(--color-canvas-secondary);
}
.team-row-info { flex: 1; min-width: 0; }
.team-row-name { font-size: 13px; font-weight: 600; color: var(--color-ink-primary); }
.team-row-role {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-ink-muted);
    margin-top: 2px;
}
.team-remove { color: var(--color-ink-muted); }
.team-remove:hover { color: #c0392b; }
.team-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 16px;
    font-size: 12px;
    color: var(--color-ink-muted);
    text-align: center;
}
.team-empty i { font-size: 28px; color: var(--gold); }

/* ==========================================================================
   STAGE BOARD (drawer)
   ========================================================================== */
.stage-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.stage-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    background: var(--color-canvas-secondary);
}
.stage-row.stage-done   { opacity: 0.72; }
.stage-row.stage-active {
    border-color: rgba(201, 168, 76, 0.55);
    background: var(--gold-faint);
}
.stage-status-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0.75px solid var(--color-border-rule);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-base);
}
.stage-status-btn.st-done    { color: #1D5C38; border-color: rgba(29, 92, 56, 0.45); }
.stage-status-btn.st-active  { color: var(--gold); border-color: var(--gold); }
.stage-status-btn.st-pending { color: var(--color-ink-muted); }
body.edit-mode .stage-status-btn:hover { transform: scale(1.1); border-color: var(--gold); }

.stage-row-main { flex: 1; min-width: 0; }
.stage-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
}
.stage-status-label {
    font-size: 8.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-ink-muted);
    margin-top: 2px;
}
.stage-assignees {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 45%;
}
.stage-assignee.removable { cursor: pointer; }
.stage-assignee.removable:hover .member-avatar { opacity: 0.6; }
.stage-assignee-add {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 6px;
    border: 0.75px dashed var(--color-border-rule);
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    max-width: 92px;
}

/* ==========================================================================
   APP SHELL - sidebar navigation + topbar + routed views
   ========================================================================== */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 224px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-surface-card);
    border-right: 0.75px solid var(--color-border-rule);
    padding: 20px 12px 16px;
    gap: 8px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 18px;
    border-bottom: 0.5px solid var(--color-border-rule);
    margin-bottom: 10px;
}
.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--color-ink-primary);
    color: var(--gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.brand-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--color-ink-primary);
    line-height: 1.1;
}
.brand-sub {
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
}
.nav-item i { font-size: 17px; flex-shrink: 0; }
.nav-item span { flex: 1; }
.nav-item .filter-count { flex: 0 0 auto; }
.nav-item:hover {
    background: var(--color-canvas-secondary);
    color: var(--color-ink-primary);
}
.nav-item.active {
    background: var(--color-ink-primary);
    color: var(--color-canvas-primary);
}
.nav-item.active i { color: var(--gold); }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 0.5px solid var(--color-border-rule);
    padding-top: 12px;
}
.sidebar-footer .save-status-indicator { margin: 0 6px; }
.sidebar-copy {
    font-size: 8.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    padding: 0 10px;
    line-height: 1.5;
}

/* ---- Main area ---- */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--color-surface-card);
    border-bottom: 0.75px solid var(--color-border-rule);
    flex-shrink: 0;
}
.topbar-search { max-width: 420px; }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 28px clamp(20px, 3vw, 40px) 64px;
}

.app-view { animation: fadeSlideDown 0.22s ease; }

.view-header { margin-bottom: 28px; }
.view-title {
    font-family: var(--font-display);
    font-size: clamp(30px, 3.5vw, 44px);
    font-weight: 600;
    line-height: 1.1;
    color: var(--color-ink-primary);
    margin-top: 6px;
}
.view-desc {
    font-size: 13px;
    color: var(--color-ink-muted);
    max-width: 640px;
    line-height: 1.55;
    margin-top: 10px;
}

/* ---- Dashboard lists ---- */
.dash-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
@media (max-width: 900px) {
    .dash-lists { grid-template-columns: 1fr; }
}
.dash-list-card {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    padding: 18px 20px;
}
.dash-list-card .chart-title {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    background: var(--color-canvas-secondary);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
    transition: all var(--transition-base);
}
.dash-item:hover { border-color: var(--gold); }
.dash-item-main { flex: 1; min-width: 0; }
.dash-item-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-ink-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-item-sub {
    font-size: 10.5px;
    color: var(--color-ink-muted);
    margin-top: 3px;
}
.dash-item .health-badge { margin-top: 0; flex-shrink: 0; }
.dash-time {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-ink-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.dash-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 4px;
    font-size: 12px;
    color: var(--color-ink-muted);
}
.dash-empty i { font-size: 18px; }
.dash-more {
    font-size: 10.5px;
    color: var(--color-ink-muted);
    padding: 8px 4px 0;
}

/* ---- Team page ---- */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.team-card {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    padding: 18px;
}
.team-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.team-workload {
    font-size: 11px;
    color: var(--color-ink-muted);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 0.5px solid var(--color-border-rule);
}
.team-proj-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.team-proj-link {
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--color-ink-primary);
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 14px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--transition-base);
}
.team-proj-link:hover { border-color: var(--gold); color: var(--gold); }
.team-proj-more {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-ink-muted);
    align-self: center;
}

/* ---- Settings panel (right slide-over) ---- */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(900px, 96vw);
    height: min(680px, 90vh);
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-deep);
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.35, 1), opacity 0.2s ease;
    z-index: 220;
    overflow: hidden;
}
.settings-panel.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}
/* Round the inner columns to match the card's corners */
.settings-panel .settings-roster-col { border-top-left-radius: var(--radius-card); border-bottom-left-radius: var(--radius-card); }

/* ── Two-column layout ── */
.settings-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Left: Team Roster ── */
.settings-roster-col {
    width: 268px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 0.75px solid var(--color-border-rule);
    background: var(--color-canvas-secondary);
    overflow: hidden;
}
.settings-roster-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 12px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    border-bottom: 0.5px solid var(--color-border-rule);
    flex-shrink: 0;
}
.settings-roster-header i { font-size: 14px; margin-right: 6px; color: var(--gold); vertical-align: -2px; }
.settings-roster-count {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-ink-muted);
    background: var(--color-border-rule);
    border-radius: 10px;
    padding: 2px 7px;
}
.settings-roster-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.sroster-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 7px 12px;
    position: relative;
    transition: background var(--transition-base);
}
.sroster-row:hover { background: var(--color-border-rule); }
.sroster-row:hover .sroster-actions { opacity: 1; pointer-events: auto; }
.sroster-self { background: var(--gold-faint) !important; }
.sroster-info { flex: 1; min-width: 0; padding-top: 2px; }
.sroster-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sroster-role {
    font-size: 10px;
    color: var(--color-ink-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sroster-workload {
    font-size: 10px;
    color: var(--gold);
    font-weight: 600;
    margin-top: 2px;
}
.sroster-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    flex-shrink: 0;
    margin-top: 1px;
}
.sroster-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-ink-muted);
    transition: all 0.15s;
    padding: 0;
}
.sroster-btn:hover { background: var(--color-border-rule); color: var(--color-ink-primary); }
.sroster-btn.sroster-remove:hover { color: #c0392b; }
.sroster-btn i { font-size: 12px; }
.sroster-btn.sroster-perm-on { color: #2ea05a; background: rgba(46,160,90,0.12); }
.sroster-btn.sroster-perm-on:hover { background: rgba(46,160,90,0.2); color: #2ea05a; }
.settings-roster-add {
    padding: 12px 12px 14px;
    border-top: 0.75px solid var(--color-border-rule);
    flex-shrink: 0;
}
.settings-roster-add-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    margin-bottom: 8px;
}

/* ── Right: Settings content ── */
.settings-content-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.settings-content-header {
    padding: 20px 24px;
    border-bottom: 0.5px solid var(--color-border-rule);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

/* ── Settings tab bar ── */
.settings-tab-bar {
    display: flex;
    padding: 0 20px;
    border-bottom: 0.75px solid var(--color-border-rule);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.settings-tab-bar::-webkit-scrollbar { display: none; }
.settings-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 14px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-base);
}
.settings-tab i { font-size: 13px; }
.settings-tab:hover { color: var(--color-ink-primary); }
.settings-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.settings-tab-body {
    flex: 1;
    overflow-y: auto;
}
.settings-tab-panel {
    display: none;
    padding: 20px 24px 48px;
}
.settings-tab-panel.active { display: block; }

/* ── Help tab: shortcuts grid ── */
.help-shortcuts-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 16px;
    margin-top: 10px;
}
.help-shortcut-row { display: contents; }
.help-shortcut-row kbd {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 5px;
    border: 0.75px solid var(--color-border-rule);
    background: var(--color-canvas-secondary);
    color: var(--color-ink-primary);
    white-space: nowrap;
    align-self: center;
    display: inline-block;
}
.help-shortcut-row span {
    font-size: 12px;
    color: var(--color-ink-secondary);
    align-self: center;
}

/* ── Settings sub-cards ─────────────────────────────────────────────────── */
.settings-card {
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
}
.settings-card-danger {
    border-color: rgba(192,57,43,0.25);
    background: rgba(192,57,43,0.03);
}
.settings-card-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 0.5px solid var(--color-border-rule);
    display: flex;
    align-items: center;
    gap: 6px;
}
.settings-card-title i { font-size: 13px; color: var(--gold); }

/* ── Pref rows (label + control pairs) ─────────────────────────────────── */
.pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--color-border-rule);
}
.pref-row:last-of-type { border-bottom: none; }
.pref-label { font-size: 12px; font-weight: 600; color: var(--color-ink-primary); line-height: 1.3; }
.pref-sub   { font-size: 10px; color: var(--color-ink-muted); margin-top: 2px; line-height: 1.4; }
.pref-select {
    width: 136px;
    font-size: 11px;
    padding: 6px 10px;
    flex-shrink: 0;
}

/* ── Toggle switch ──────────────────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--color-border-rule);
    border-radius: 22px;
    transition: background 0.2s;
}
.toggle-track::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--gold); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(16px); }
.toggle-switch input:focus-visible + .toggle-track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Profile tab ────────────────────────────────────────────────────────── */
.profile-tab-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 10px;
    margin-bottom: 16px;
}
.profile-tab-name {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--color-ink-primary);
    line-height: 1.2;
}
.profile-tab-username { font-size: 11px; color: var(--color-ink-muted); margin-top: 3px; }

/* ── Profile photo upload ─────────────────────────────────────────────────── */
.profile-photo-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.profile-avatar-upload {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
}
.profile-avatar-upload .member-avatar {
    width: 72px !important;
    height: 72px !important;
    font-size: 26px !important;
    border-radius: 50%;
    pointer-events: none;
}
.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s;
    color: #fff;
    font-size: 22px;
    pointer-events: none;
}
.profile-avatar-upload:hover .profile-avatar-overlay { opacity: 1; }
.profile-photo-side {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.profile-photo-hint { font-size: 11px; color: var(--color-ink-muted); line-height: 1.4; }
.profile-remove-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 6px;
    background: transparent;
    color: var(--color-ink-secondary);
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.15s, color 0.15s;
}
.profile-remove-photo-btn:hover { background: rgba(192,57,43,0.08); color: #c0392b; border-color: rgba(192,57,43,0.3); }

/* ── Colour swatches (profile + add-member) ──────────────────────────────── */
.color-swatches-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    transition: transform 0.12s, border-color 0.12s;
}
.color-swatch:hover { transform: scale(1.18); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--color-ink-primary); }
.form-label-hint { font-size: 10px; color: var(--color-ink-muted); font-weight: 400; }

.settings-signout-btn {
    width: 100%;
    padding: 11px 16px;
    border: 0.75px solid rgba(192,57,43,0.4);
    border-radius: 10px;
    background: transparent;
    color: #c0392b;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    margin-top: 4px;
}
.settings-signout-btn:hover { background: #c0392b; color: white; border-color: #c0392b; }
.settings-signout-btn i { font-size: 16px; }

/* ── System health grid ─────────────────────────────────────────────────── */
.health-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.health-stat {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    padding: 12px 14px;
}
.health-stat-value {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-ink-primary);
    line-height: 1;
    margin-bottom: 5px;
}
.health-stat-label {
    font-size: 10px;
    color: var(--color-ink-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Logout confirmation overlay ────────────────────────────────────────── */
.logout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(3px);
}
.logout-overlay.active { opacity: 1; pointer-events: auto; }
.logout-card {
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 18px;
    padding: 36px 28px 28px;
    width: min(340px, 92vw);
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.28), 0 0 0 0.75px var(--color-border-rule);
    position: relative;
}
.logout-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-ink-muted);
    transition: all 0.15s;
}
.logout-close:hover { background: var(--color-border-rule); color: var(--color-ink-primary); }
.logout-close i { font-size: 14px; }
.logout-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.logout-head .member-avatar { margin: 0 auto; }
.logout-head-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-ink-primary);
    line-height: 1.2;
}
.logout-head-username { font-size: 12px; color: var(--color-ink-muted); }
.logout-msg {
    font-size: 12px;
    color: var(--color-ink-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}
.logout-actions {
    display: flex;
    gap: 10px;
}
.logout-actions .btn-secondary { flex: 1; justify-content: center; }
.logout-confirm-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #c0392b;
    color: white;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}
.logout-confirm-btn:hover { background: #a93226; }
.logout-confirm-btn i { font-size: 15px; }
.settings-hint {
    font-size: 11px;
    color: var(--color-ink-muted);
    line-height: 1.55;
    margin-bottom: 10px;
}
.settings-btn-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}
.settings-row-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    background: var(--color-canvas-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-base);
    margin-bottom: 8px;
}
.settings-row-btn:hover { border-color: var(--gold); }
.settings-row-btn i { font-size: 16px; color: var(--gold); flex-shrink: 0; }

.currency-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.currency-opt {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 8px 14px;
    border-radius: 8px;
    border: 0.75px solid var(--color-border-rule);
    background: var(--color-canvas-secondary);
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
}
.currency-opt:hover { border-color: var(--gold); color: var(--color-ink-primary); }
.currency-opt.active {
    background: var(--color-ink-primary);
    color: var(--gold);
    border-color: var(--color-ink-primary);
}

/* ---- Responsive: icon rail on narrow screens ---- */
@media (max-width: 1024px) {
    .sidebar { width: 64px; padding: 16px 8px; }
    .sidebar .brand-text,
    .sidebar .nav-item span,
    .sidebar .sidebar-copy,
    .sidebar .save-status-indicator span,
    .sidebar .nav-item .filter-count { display: none; }
    .nav-item { justify-content: center; padding: 12px 0; }
    .nav-item i { font-size: 19px; }
    .sidebar-brand { justify-content: center; padding-bottom: 14px; }
    .sidebar-footer .save-status-indicator { justify-content: center; }
}
@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; }
    .topbar-search { max-width: none; flex: 1 1 100%; order: 2; }
}

/* ---- Print: only the active view content ---- */
@media print {
    .app-shell { display: block; height: auto; overflow: visible; }
    .sidebar, .topbar { display: none !important; }
    .main-area, .view-container { overflow: visible; padding: 0; }
    .settings-panel, .detail-drawer, .drawer-overlay, .project-modal-wrap { display: none !important; }
}

/* ==========================================================================
   AUTH - login screen, profile chip, member photos
   ========================================================================== */

/* Photo avatars (img fills the circle) */
.member-avatar { overflow: hidden; position: relative; }
.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Login screen ---- */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    background: var(--color-canvas-primary);
    padding: 48px 20px;
}
.login-screen.active { display: flex; }

.login-box {
    width: 100%;
    max-width: 720px;
    text-align: center;
}
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
    text-align: left;
}
.login-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 600;
    color: var(--color-ink-primary);
    margin-bottom: 8px;
}
.login-sub {
    font-size: 13px;
    color: var(--color-ink-muted);
    margin-bottom: 32px;
}

.login-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.login-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px 14px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition-base);
}
.login-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.login-card.selected {
    border-color: var(--gold);
    background: var(--gold-faint);
    box-shadow: 0 0 0 2px var(--gold-faint);
}
.login-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
    line-height: 1.25;
}
.login-card-role {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-ink-muted);
    line-height: 1.3;
}
.login-card-admin {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
}

.login-pass-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 480px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.login-who {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-ink-primary);
    white-space: nowrap;
}
.login-pass-row .form-input { max-width: 200px; }
.login-hint {
    font-size: 11px;
    color: var(--color-ink-muted);
    margin-top: 28px;
    line-height: 1.6;
}

/* ---- Topbar profile chip ---- */
.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 6px;
    border-radius: 22px;
    border: 0.75px solid var(--color-border-rule);
    background: var(--color-canvas-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
    cursor: pointer;
    transition: all var(--transition-base);
}
.profile-chip:hover { border-color: var(--gold); }
.profile-chip-name { line-height: 1; }

/* ── Profile quick-action dropdown ── */
.profile-chip-wrap {
    position: relative;
}
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 600;
    overflow: hidden;
    animation: pdFadeIn 0.12s ease;
}
@keyframes pdFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pd-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 12px;
    background: var(--color-canvas-secondary);
}
.pd-head-info { min-width: 0; }
.pd-head-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-ink-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pd-head-role {
    font-size: 10px;
    color: var(--color-ink-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pd-sep {
    height: 0.75px;
    background: var(--color-border-rule);
    margin: 0;
}
.pd-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-ink-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}
.pd-item:hover { background: var(--color-canvas-secondary); }
.pd-item i { font-size: 15px; color: var(--color-ink-muted); flex-shrink: 0; }
.pd-item:hover i { color: var(--gold); }
.pd-item-danger { color: #c0392b; }
.pd-item-danger i { color: #c0392b; }
.pd-item-danger:hover { background: rgba(192,57,43,0.06); }
.pd-item-danger:hover i { color: #c0392b; }

/* ---- Profile modal ---- */
.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 0 18px;
    margin-bottom: 16px;
    border-bottom: 0.5px solid var(--color-border-rule);
}

/* ---- Team card additions ---- */
.team-username {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--gold);
    margin-top: 3px;
}
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    background: var(--gold-faint);
    border: 0.5px solid rgba(201, 168, 76, 0.35);
    border-radius: 14px;
    padding: 3px 9px;
    flex-shrink: 0;
    align-self: flex-start;
}
.team-card-self { border-color: rgba(201, 168, 76, 0.5); }
.self-tag {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    background: var(--gold-faint);
    border-radius: 8px;
    padding: 2px 7px;
    vertical-align: middle;
}
.team-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 0.5px solid var(--color-border-rule);
}
.team-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    border: 0.75px solid var(--color-border-rule);
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all var(--transition-base);
}
.team-action:hover { border-color: var(--gold); color: var(--color-ink-primary); }

/* ── Team card permission row (team:view toggle) ── */
.team-perm-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 2px 0;
    margin-top: 4px;
    border-top: 0.5px solid var(--color-border-rule);
}
.team-perm-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.team-perm-label i { font-size: 13px; }
.team-perm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
}
.team-perm-track {
    width: 32px;
    height: 17px;
    border-radius: 9px;
    background: var(--color-border-rule);
    position: relative;
    display: block;
    transition: background 0.2s;
    flex-shrink: 0;
}
.team-perm-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    display: block;
}
.team-perm-toggle.on .team-perm-track { background: var(--gold); }
.team-perm-toggle.on .team-perm-thumb { transform: translateX(15px); }
.team-perm-state {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-ink-muted);
    min-width: 18px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.team-perm-toggle.on .team-perm-state { color: var(--gold); }

/* ── Team: avatar wrap + status dot ── */
.team-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
}
.status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--color-surface-card);
}
.status-dot-online  { background: #27ae60; }
.status-dot-recent  { background: #f39c12; }
.status-dot-offline { background: var(--color-border-rule); }

.team-last-seen {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 400;
    color: var(--color-ink-muted);
}
.team-last-seen .status-dot {
    position: static;
    width: 7px;
    height: 7px;
    border: none;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   MEMBER ACTIVITY HISTORY (reports sub-view)
   ══════════════════════════════════════════════════════════════════════════ */
.mh-wrap {
    display: flex;
    gap: 0;
    height: calc(100vh - 220px);
    min-height: 500px;
}

/* Sidebar */
.mh-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 0.75px solid var(--color-border-rule);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mh-sidebar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-ink-muted);
    padding: 14px 16px 10px;
    flex-shrink: 0;
}
.mh-member-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 12px;
}
.mh-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-ink-primary);
    cursor: pointer;
    transition: background 0.12s;
    text-align: left;
}
.mh-member-row:hover    { background: var(--color-canvas-secondary); }
.mh-member-row.active   { background: var(--gold-faint); color: var(--gold); font-weight: 600; }
.mh-member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-count {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-ink-muted);
    background: var(--color-canvas-secondary);
    border-radius: 10px;
    padding: 1px 7px;
    flex-shrink: 0;
}
.mh-member-row.active .mh-count { background: rgba(201,168,76,0.15); color: var(--gold); }

/* Main area */
.mh-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mh-controls {
    padding: 14px 20px 10px;
    border-bottom: 0.75px solid var(--color-border-rule);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.mh-ctrl-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mh-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.mh-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 20px;
    border: 0.75px solid var(--color-border-rule);
    background: transparent;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--color-ink-secondary);
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.mh-chip:hover   { border-color: var(--gold); color: var(--color-ink-primary); }
.mh-chip.active  { background: var(--gold-faint); border-color: var(--gold); color: var(--gold); font-weight: 600; }
.mh-chip-cat.active { background: color-mix(in srgb, var(--mhc) 12%, transparent); border-color: var(--mhc); color: var(--mhc); }

/* Feed */
.mh-feed {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
}
.mh-day-group { margin-bottom: 24px; }
.mh-day-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-ink-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 0.5px solid var(--color-border-rule);
}
.mh-entries { display: flex; flex-direction: column; gap: 2px; }
.mh-entry {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.1s;
}
.mh-entry:hover { background: var(--color-canvas-secondary); }
.mh-entry-ava { flex-shrink: 0; padding-top: 2px; }
.mh-entry-body { flex: 1; min-width: 0; }
.mh-entry-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.mh-entry-who {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
}
.mh-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    border: 0.75px solid;
}
.mh-pill i { font-size: 11px; }
.mh-entry-time {
    font-size: 10px;
    color: var(--color-ink-muted);
    margin-left: auto;
    white-space: nowrap;
}
.mh-entry-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.mh-entry-detail {
    font-size: 11px;
    color: var(--color-ink-secondary);
    font-style: italic;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mh-proj-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--color-ink-muted);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.12s;
}
.mh-proj-link:hover { color: var(--gold); }
.mh-proj-link i { font-size: 11px; }

/* ==========================================================================
   TASKS & SUBTASKS
   ========================================================================== */
.task-count-pill {
    font-size: 9px;
    font-weight: 700;
    color: var(--gold);
    background: var(--gold-faint);
    border-radius: 10px;
    padding: 2px 8px;
    vertical-align: middle;
}

.task-add-row { margin-bottom: 10px; }
.task-add-input { font-size: 12px; padding: 9px 12px; }

.tasks-empty {
    font-size: 11.5px;
    color: var(--color-ink-muted);
    padding: 6px 2px 2px;
    line-height: 1.5;
}

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

.task-row {
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    background: var(--color-canvas-secondary);
    padding: 8px 10px;
}
.task-row.done { opacity: 0.62; }

.task-main {
    display: flex;
    align-items: center;
    gap: 8px;
}
.task-check {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 17px;
    color: var(--color-ink-muted);
    display: inline-flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    transition: all var(--transition-base);
}
.task-check:hover   { color: var(--gold); transform: scale(1.12); }
.task-check.checked { color: #1D5C38; }
.task-check.sub     { font-size: 14px; }

.task-title {
    flex: 1;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-ink-primary);
    line-height: 1.4;
    min-width: 0;
}
.task-row.done .task-title {
    text-decoration: line-through;
    color: var(--color-ink-muted);
}
/* Inline title editing affordance (tasks + subtasks) */
/* readonly task — no hover/edit affordances */
.task-row.task-readonly .task-title,
.task-row.task-readonly .subtask-title { cursor: default; }
.task-due-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-surface-raised, #f5f5f5);
    color: var(--color-ink-muted);
}
.task-due-badge.overdue { color: #c0392b; font-weight: 600; }
.task-stage-badge, .task-ws-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--color-surface-raised, #f5f5f5);
    color: var(--color-ink-muted);
}
.task-pri-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(180,106,0,0.12);
    color: #B26A00;
}
.task-assignee-readonly { cursor: default !important; }

.task-title[contenteditable], .subtask-title[contenteditable] {
    cursor: text;
    border-radius: 4px;
    padding: 1px 4px;
    margin: -1px -4px;
    transition: background 0.1s, box-shadow 0.1s;
    outline: none;
}
.task-title[contenteditable]:hover, .subtask-title[contenteditable]:hover {
    background: var(--gold-faint);
}
.task-title[contenteditable]:focus, .subtask-title[contenteditable]:focus {
    background: var(--color-surface-card);
    box-shadow: 0 0 0 1.5px var(--gold-pale);
    text-decoration: none;
    cursor: text;
}

.task-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-ink-muted);
    font-size: 13px;
    padding: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: all var(--transition-base);
}
.task-row:hover .task-delete,
.subtask-row:hover .task-delete { opacity: 1; }
.task-delete:hover { color: #c0392b; }

.task-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 7px 0 0 25px;
}
.task-due {
    font-family: var(--font-body);
    font-size: 10px;
    padding: 3px 6px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 6px;
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    width: 118px;
}
.task-due.overdue {
    border-color: rgba(192, 57, 43, 0.5);
    color: #c0392b;
    font-weight: 700;
}
.task-stage {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 6px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 6px;
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    max-width: 90px;
}
.task-assignees {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.task-assignee { cursor: pointer; }
.task-assignee:hover .member-avatar { opacity: 0.6; }
.task-assignee-add {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    width: 26px;
    height: 20px;
    border: 0.75px dashed var(--color-border-rule);
    border-radius: 10px;
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
}

.task-subs { margin: 6px 0 0 25px; }
.subtask-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
}
.subtask-title {
    flex: 1;
    font-size: 11.5px;
    color: var(--color-ink-primary);
    line-height: 1.4;
    min-width: 0;
}
.subtask-row.done .subtask-title {
    text-decoration: line-through;
    color: var(--color-ink-muted);
}
.subtask-add-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 11px;
    padding: 4px 8px;
    border: none;
    border-bottom: 0.75px dashed var(--color-border-rule);
    background: transparent;
    color: var(--color-ink-primary);
    outline: none;
}
.subtask-add-input:focus { border-bottom-color: var(--gold); }

/* Task counter chip (table rows + team activity) */
.task-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--color-ink-muted);
    background: var(--color-canvas-secondary);
    border: 0.5px solid var(--color-border-rule);
    border-radius: 10px;
    padding: 2px 8px;
    margin-top: 6px;
    width: fit-content;
}
.task-chip i { font-size: 11px; color: var(--gold); }
.task-chip-overdue { color: #c0392b; border-color: rgba(192, 57, 43, 0.4); }

/* Dashboard My Tasks rows */
.dash-task { cursor: pointer; }
.dash-task-check {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--color-ink-muted);
    display: inline-flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    transition: all var(--transition-base);
}
.dash-task-check:hover { color: #1D5C38; transform: scale(1.15); }

/* ==========================================================================
   QUICK-ASSIGN POPOVER
   ========================================================================== */
.assignee-stack.assign-open {
    cursor: pointer;
    border-radius: 14px;
    padding: 2px 6px 2px 2px;
    margin-left: -2px;
    transition: background var(--transition-base);
    width: fit-content;
}
.assignee-stack.assign-open:hover { background: var(--gold-faint); }

.assign-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px dashed var(--color-border-rule);
    color: var(--color-ink-muted);
    font-size: 11px;
    margin-left: 8px;
    flex-shrink: 0;
    transition: all var(--transition-base);
}
.assignee-stack.assign-open:hover .assign-plus {
    border-color: var(--gold);
    color: var(--gold);
}

.assign-popover {
    position: fixed;
    z-index: 300;
    width: 250px;
    background: var(--color-surface-card);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 10px;
    box-shadow: var(--shadow-deep);
    overflow: hidden;
    animation: fadeSlideDown 0.16s ease;
}
.assign-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    border-bottom: 0.5px solid var(--color-border-rule);
}
.assign-popover-list {
    max-height: 264px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.assign-member-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-family: var(--font-body);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-base);
}
.assign-member-row:hover { background: var(--color-canvas-secondary); }
.assign-member-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.assign-member-row i { font-size: 15px; color: var(--color-ink-muted); flex-shrink: 0; }
.assign-member-row.assigned i { color: #1D5C38; }
.assign-popover-foot {
    padding: 8px 12px;
    font-size: 9.5px;
    color: var(--color-ink-muted);
    border-top: 0.5px solid var(--color-border-rule);
}

/* ==========================================================================
   BRAND LOGO (sidebar + login screen)
   ========================================================================== */
.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-logo-lg {
    width: 48px;
    height: 48px;
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 2 — ATTACHMENTS (detail drawer)
   ══════════════════════════════════════════════════════════════════════════ */
.attachment-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
    background: var(--color-canvas-secondary);
}
.attachment-icon { font-size: 18px; color: var(--gold); flex-shrink: 0; }
.attachment-name {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-ink-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-name:hover { color: var(--gold); text-decoration: underline; }
.attachment-meta {
    font-size: 10.5px;
    color: var(--color-ink-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.attachment-delete {
    border: none;
    background: none;
    color: var(--color-ink-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}
.attachment-delete:hover { color: #c0392b; background: var(--color-canvas-primary); }

.attachment-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border: 1.5px dashed var(--color-border-rule);
    border-radius: 10px;
    color: var(--color-ink-muted);
    font-size: 12px;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.attachment-drop i { font-size: 20px; }
.attachment-drop.dragging {
    border-color: var(--gold);
    background: var(--color-canvas-secondary);
}
.attachment-browse {
    color: var(--gold);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}
.attachment-hint { font-size: 10px; opacity: 0.75; }

/* Activity feed rows reuse .dash-item; just align the avatar */
.dash-activity { justify-content: flex-start; }
.dash-activity .dash-time { margin-left: auto; }


/* ==========================================================================
   ROLE-BASED UI VISIBILITY
   body.is-admin is stamped by auth.js after login.
   Elements marked [data-admin-only] and .btn-delete-row are hidden for
   non-admin accounts. Server-side guards are the real security layer —
   this is purely a UX clarity improvement.
   ========================================================================== */
body:not(.is-admin) [data-admin-only]  { display: none !important; }
body:not(.is-admin) .btn-delete-row    { display: none !important; }

/* ==========================================================================
   MY PRIORITY — per-member personal tier column (replaces Value for members)
   ========================================================================== */
.mypri-empty { color: var(--color-ink-muted); opacity: 0.5; font-size: 13px; }
.mypri-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 8px;
    border-radius: 8px;
    border: 1px solid var(--color-border-rule);
    background: var(--color-surface-card);
}
.mypri-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-ink-muted); flex-shrink: 0; }
.mypri-select {
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-ink-primary);
    cursor: pointer;
    outline: none;
    padding-right: 2px;
}
/* Tier colours — dot + subtle tinted chip */
.mypri-wrap.mypri-p1 { border-color: rgba(192,57,43,0.4);  background: rgba(192,57,43,0.08); }
.mypri-wrap.mypri-p1 .mypri-dot { background: #c0392b; }
.mypri-wrap.mypri-p1 .mypri-select { color: #c0392b; }
.mypri-wrap.mypri-p2 { border-color: var(--gold-pale);      background: var(--gold-faint); }
.mypri-wrap.mypri-p2 .mypri-dot { background: #b8860b; }
.mypri-wrap.mypri-p2 .mypri-select { color: #9a6f08; }
.mypri-wrap.mypri-p3 { border-color: rgba(44,95,138,0.35);  background: rgba(44,95,138,0.07); }
.mypri-wrap.mypri-p3 .mypri-dot { background: #2C5F8A; }
.mypri-wrap.mypri-p3 .mypri-select { color: #2C5F8A; }
.mypri-wrap.mypri-p4 { border-color: var(--color-border-rule); }
.mypri-wrap.mypri-p4 .mypri-dot { background: #7a7a7a; }
.mypri-wrap.mypri-none .mypri-select { color: var(--color-ink-muted); font-weight: 600; }

/* Admin column toggle button in the Value/My-Priority header */
.col-toggle-btn {
    border: none;
    background: none;
    color: var(--color-ink-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 5px;
    font-size: 12px;
    vertical-align: middle;
}
.col-toggle-btn:hover { color: var(--gold); background: var(--gold-faint); }

/* ── Clickable rows (view mode) ── */
body:not(.edit-mode) #projectTable tbody tr { cursor: pointer; }
body:not(.edit-mode) #projectTable tbody tr:hover .row-name { text-decoration: underline; text-underline-offset: 2px; }

/* ── Location → Open in Maps link ── */
.location-maps-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    text-decoration: none;
    opacity: 0.85;
}
.location-maps-link:hover { opacity: 1; text-decoration: underline; }
.location-maps-link i { font-size: 13px; }

/* ── Next actionable date chip (timeline cell) ── */
.next-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 6px 0 2px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.next-date i { font-size: 12px; }
.next-date.overdue  { background: #fdecea; color: #c0392b; }
.next-date.upcoming { background: var(--gold-faint); color: #9a6f08; }
[data-theme="dark"] .next-date.overdue  { background: rgba(192,57,43,0.18); }
[data-theme="dark"] .next-date.upcoming { background: var(--gold-faint); }

/* ── Stage status dropdown (replaces click-to-cycle) ── */
.phase-step .phase-select {
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    color: var(--color-ink-muted);
    cursor: pointer;
    outline: none;
    max-width: 96px;
    padding: 0 2px;
}
.phase-step.active .phase-select { color: var(--gold); font-weight: 700; }
.phase-step.done   .phase-select { color: #1D5C38; }

/* ── Sticky table header (desktop; the wrapper already scrolls both axes) ── */
@media (min-width: 1024px) {
    .table-wrapper { max-height: calc(100vh - 230px); }
    #projectTable thead th {
        position: sticky;
        top: 0;
        z-index: 6;
        background: var(--color-surface-card);
        box-shadow: 0 1px 0 var(--color-border-rule);
    }
}

/* ==========================================================================
   DASHBOARD REFRESH — role-aware: greeting, My Work tracker, My Projects,
   meetings on top; analytics below. Value cards/charts hidden for members.
   ========================================================================== */
body:not(.is-admin):not(.perm-team-view) .member-hide { display: none !important; }

/* team:view permission — show Member History sub-nav in Reports */
body:not(.is-admin):not(.perm-team-view) .team-view-only { display: none !important; }

.dash-analytics-label {
    margin: 30px 0 14px;
    font-size: 11px;
    color: var(--color-ink-muted);
}

/* ── Greeting + day chips ── */
.dash-greeting { margin-bottom: 20px; }
.dash-greeting-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--color-ink-primary);
    line-height: 1.3;
    margin-bottom: 12px;
}
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    font-size: 12px;
    color: var(--color-ink-muted);
}
.dash-chip strong { color: var(--color-ink-primary); font-size: 13px; }
.dash-chip.warn { background: #fdecea; border-color: #f5c6c0; color: #c0392b; }
.dash-chip.warn strong { color: #c0392b; }

/* ── My Work hero ── */
.dash-mywork-card {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft, 0 2px 12px rgba(0,0,0,0.05));
    padding: 18px 20px;
    margin-bottom: 24px;
}
.dash-mywork-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.dash-mywork-head .chart-title { margin: 0; }
.mywork-tabs { display: flex; gap: 4px; }
.mywork-tab {
    border: 1px solid var(--color-border-rule);
    background: transparent;
    color: var(--color-ink-muted);
    border-radius: 16px;
    padding: 4px 12px;
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}
.mywork-tab:hover { background: var(--gold-faint); color: var(--gold); }
.mywork-tab.active { background: var(--gold); color: #1a0f00; border-color: var(--gold); }

.mywork-group { margin-top: 14px; }
.mywork-group:first-child { margin-top: 0; }
.mywork-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 7px;
}
.mywork-group-label span {
    background: var(--color-canvas-secondary);
    color: var(--color-ink-muted);
    border-radius: 8px;
    padding: 0 6px;
    font-size: 10px;
    margin-left: 2px;
}
.mywork-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 8px;
    border-radius: 10px;
    transition: background 0.1s;
}
.mywork-row:hover { background: var(--gold-faint); }
.mywork-check {
    flex-shrink: 0;
    width: 24px; height: 24px;
    border: none; background: none;
    color: var(--color-ink-muted);
    font-size: 19px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.mywork-check:hover { color: #1D5C38; }
.mywork-thumb {
    flex-shrink: 0;
    width: 42px; height: 42px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-canvas-secondary);
}
.mywork-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mywork-thumb-ph {
    display: flex; align-items: center; justify-content: center;
    color: var(--color-ink-muted); font-size: 18px;
}
.mywork-main { flex: 1; min-width: 0; cursor: pointer; }
.mywork-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-ink-primary);
    line-height: 1.3;
    margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mywork-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11.5px;
    color: var(--color-ink-muted);
}
.mywork-proj { color: var(--color-ink-muted); }
.mywork-due { display: inline-flex; align-items: center; gap: 3px; }
.mywork-due.overdue { color: #c0392b; font-weight: 600; }
.mywork-subs { display: inline-flex; align-items: center; gap: 3px; }
.mywork-meta i { font-size: 12px; }

/* Priority badge (reuses tier colors) */
.mywork-pri {
    flex-shrink: 0;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
    letter-spacing: 0.03em;
}
.mywork-pri.mypri-p1 { background: rgba(192,57,43,0.12); color: #c0392b; }
.mywork-pri.mypri-p2 { background: var(--gold-faint); color: #9a6f08; }
.mywork-pri.mypri-p3 { background: rgba(44,95,138,0.12); color: #2C5F8A; }
.mywork-pri.mypri-p4 { background: var(--color-canvas-secondary); color: var(--color-ink-muted); }

.mywork-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 8px;
    color: var(--color-ink-muted);
    font-size: 13px;
}
.mywork-empty i { font-size: 26px; }

/* ── My Projects strip ── */
.dash-section { margin-bottom: 24px; }
.dash-section .chart-title { margin-bottom: 12px; }
.myprojects-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.myproj-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--color-border-rule);
    border-radius: 12px;
    background: var(--color-surface-card);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
    transition: border-color 0.12s, transform 0.1s, box-shadow 0.12s;
}
.myproj-card:hover { border-color: var(--gold-pale); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.myproj-thumb {
    flex-shrink: 0;
    width: 52px; height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-canvas-secondary);
}
.myproj-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.myproj-thumb-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--color-ink-muted); font-size: 20px; }
.myproj-body { flex: 1; min-width: 0; }
.myproj-name {
    font-size: 13px; font-weight: 600; color: var(--color-ink-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.myproj-sub {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--color-ink-muted);
    margin: 3px 0 6px;
}
.myproj-sub span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.myproj-bar { height: 4px; border-radius: 3px; background: var(--color-canvas-secondary); overflow: hidden; }
.myproj-fill { height: 100%; background: var(--gold); border-radius: 3px; }
.myproj-card .next-date { margin: 4px 0; }

/* ── Today's meetings ── */
.dash-meetings { display: flex; flex-direction: column; gap: 8px; }
.dash-meeting {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border: 1px solid var(--color-border-rule);
    border-radius: 10px;
    background: var(--color-surface-card);
}
.dash-meeting-time {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 13px;
    color: var(--gold);
    min-width: 58px;
}
.dash-meeting-title { font-size: 13px; font-weight: 600; color: var(--color-ink-primary); }
.dash-meeting-sub { font-size: 11px; color: var(--color-ink-muted); }

/* ==========================================================================
   RESPONSIVE — phone/tablet pass  (additive; intentionally appended at EOF
   so it overrides earlier rules and stays out of the way of feature CSS)

   Root cause it fixes: the projects table carries a desktop min-width
   (~1100px) for its multi-column layout. On phones the rows are already
   display:block "cards", so that min-width forced the whole page ~1100px
   wide and pushed the topbar actions + card content off-screen.
   ========================================================================== */
@media (max-width: 767px) {
    /* 1 — kill the desktop table min-width so cards fit the viewport */
    .table-wrapper            { overflow-x: visible; }
    .table-wrapper table      { min-width: 0 !important; width: 100%; }

    /* 2 — safety net: no stray wide child may scroll the whole view */
    .view-container           { overflow-x: hidden; }

    /* 3 — clamp controls that ship intrinsic / fixed widths */
    .view-container select,
    .row-status-wrap select   { max-width: 100%; }
    .progress-wrap,
    .row-status-wrap,
    .location-wrap,
    .timeline-wrap            { max-width: 100%; }
    .progress-wrap            { width: 100%; }

    /* 4 — topbar: let the action cluster wrap instead of overflowing */
    .topbar                   { flex-wrap: wrap; }
    .topbar-actions           { flex-wrap: wrap; flex-shrink: 1; min-width: 0;
                                row-gap: 8px; justify-content: flex-end; }

    /* 5 — comfortable touch targets for the icon buttons */
    .topbar-actions .btn-icon,
    .topbar-actions > button  { min-height: 40px; }
}

/* AI settings — "Load models for this key" link-button */
.ai-load-models {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 2px;
    background: none;
    border: none;
    color: var(--gold);
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}
.ai-load-models:hover { text-decoration: underline; }
.ai-load-models:disabled { opacity: 0.6; cursor: default; text-decoration: none; }
.ai-load-models i { font-size: 13px; }

/* ══════════════════════════════════════════════════════════════════════════
   PRESENCE & STATUS MESSAGE
   ══════════════════════════════════════════════════════════════════════════ */

.team-status-row {
    margin-top: 4px;
}
.team-status-msg {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--color-ink-muted);
    font-style: italic;
    max-width: 100%;
}
.team-status-msg i.ph-chat-circle-text {
    color: var(--gold);
    font-size: 13px;
    flex-shrink: 0;
}
.team-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.team-status-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: var(--color-ink-muted);
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}
.team-status-edit:hover {
    color: var(--gold);
    background: rgba(201, 168, 76, 0.1);
}
.team-status-edit i { font-size: 12px; }

/* ══════════════════════════════════════════════════════════════════════════
   MEMBER HISTORY — DETAIL PANEL (sparkline, heatmap, AI health)
   ══════════════════════════════════════════════════════════════════════════ */

.mh-member-detail {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--color-border-rule);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.mh-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.mh-detail-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-ink-primary);
}
.mh-detail-role {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--color-ink-muted);
    margin-top: 1px;
}
.mh-ai-health-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.25);
    border-radius: 20px;
    color: var(--gold);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.mh-ai-health-btn:hover { background: rgba(201, 168, 76, 0.18); border-color: rgba(201, 168, 76, 0.5); }
.mh-ai-health-btn:disabled { opacity: 0.6; cursor: default; }
.mh-ai-health-btn i { font-size: 14px; }

.mh-ai-health-card {
    background: rgba(201, 168, 76, 0.06);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12.5px;
    color: var(--color-ink-primary);
    line-height: 1.6;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.mh-ai-health-card i { margin-top: 2px; flex-shrink: 0; }

.mh-charts-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.mh-chart-block {
    flex: 1;
    min-width: 200px;
}
.mh-chart-block-wide {
    flex: 2;
    min-width: 320px;
}
.mh-chart-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-ink-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.mh-chart-label i { font-size: 12px; }
.mh-sparkline-box,
.mh-heatmap-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    padding: 8px 10px;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mh-spark-svg {
    width: 100%;
    height: 56px;
}
.mh-spark-hint {
    font-size: 10px;
    color: var(--color-ink-muted);
}
.spark-dot { fill: var(--gold); }
.mh-heatmap-svg {
    display: block;
}
.mh-loading {
    font-size: 11px;
    color: var(--color-ink-muted);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════════════════
   BOTTLENECK DETECTION
   ══════════════════════════════════════════════════════════════════════════ */

#bottleneckCard { display: none; }
body.is-admin #bottleneckCard,
body.perm-team-view #bottleneckCard { display: block; }

.bn-header {
    font-size: 12px;
    font-weight: 600;
    color: #e67e22;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bn-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-rule);
    flex-wrap: wrap;
}
.bn-row:last-child { border-bottom: none; }
.bn-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
}
.bn-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-ink-primary);
}
.bn-role {
    font-size: 10.5px;
    color: var(--color-ink-muted);
}
.bn-stats {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.bn-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(230, 126, 34, 0.12);
    color: #e67e22;
    border: 1px solid rgba(230, 126, 34, 0.25);
}
.bn-overdue {
    background: rgba(192, 57, 43, 0.12);
    color: #c0392b;
    border-color: rgba(192, 57, 43, 0.25);
}
.bn-projs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex: 1;
    align-items: center;
}
.bn-proj-tag {
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border-rule);
    border-radius: 4px;
    color: var(--color-ink-muted);
    white-space: nowrap;
}

/* ── Globe config card ─────────────────────────────────────────────────── */
.globe-config-card { display: flex; flex-direction: column; gap: 0; }

.globe-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 14px;
}
.globe-toggle-cb  { width: auto; margin: 0; flex-shrink: 0; }
.globe-toggle-label { font-size: 13px; color: var(--color-ink-base); }

.globe-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    margin-bottom: 6px;
}

/* location search row (replaces coord inputs) */
.globe-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.globe-search-input {
    flex: 1;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    color: var(--color-ink-base);
    font-size: 12px;
    font-family: var(--font-body);
    padding: 5px 10px;
    outline: none;
    min-width: 0;
}
.globe-search-input:focus { border-color: var(--color-gold); }
.globe-search-input::placeholder { color: var(--color-ink-muted); }
.globe-coord-display {
    font-size: 10.5px;
    color: var(--color-ink-muted);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
    min-height: 14px;
}

.btn-globe-geocode {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    color: var(--color-gold);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s;
}
.btn-globe-geocode:hover { background: rgba(160,134,82,.12); }
.btn-globe-geocode:disabled { opacity: .5; pointer-events: none; }

/* geocode results dropdown */
.globe-geocode-results {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}
.globe-geocode-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-ink-muted);
    padding: 6px 10px 4px;
    border-bottom: 1px solid var(--color-border-rule);
}
.globe-geocode-option {
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background .12s;
}
.globe-geocode-option:last-child { border-bottom: none; }
.globe-geocode-option:hover { background: rgba(160,134,82,.08); }
.globe-geocode-option strong { font-size: 12px; color: var(--color-ink-base); }
.globe-geocode-sub { font-size: 10px; color: var(--color-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* OSM map preview */
.globe-map-preview { margin-bottom: 8px; border-radius: 8px; overflow: hidden; position: relative; }
.globe-map-iframe  { width: 100%; height: 160px; border: none; display: block; }
.globe-map-link    {
    display: block;
    text-align: center;
    font-size: 10px;
    padding: 4px;
    background: var(--color-bg-subtle);
    color: var(--color-ink-muted);
    text-decoration: none;
}
.globe-map-link:hover { color: var(--color-gold); }

/* folder picker */
.globe-folder-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}
.globe-folder-input {
    flex: 1;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    color: var(--color-ink-base);
    font-size: 12px;
    padding: 6px 8px;
    outline: none;
}
.globe-folder-input:focus { border-color: var(--color-gold); }

.btn-globe-browse {
    padding: 6px 9px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    color: var(--color-ink-muted);
    cursor: pointer;
    font-size: 14px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.btn-globe-browse:hover { color: var(--color-gold); background: rgba(160,134,82,.1); }

.globe-folder-picker {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-rule);
    border-radius: 6px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 6px;
}
.globe-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background .12s;
}
.globe-picker-row:last-child { border-bottom: none; }
.globe-picker-row:hover { background: rgba(160,134,82,.08); }
.globe-picker-name  { font-size: 12px; color: var(--color-ink-base); }
.globe-picker-count { font-size: 10px; color: var(--color-ink-muted); flex-shrink: 0; }
.globe-picker-empty { padding: 12px 10px; font-size: 12px; color: var(--color-ink-muted); text-align: center; }

.globe-folder-hint {
    font-size: 11px;
    min-height: 14px;
    margin-bottom: 2px;
}

/* ── Task & Creative timers ────────────────────────────────────────────── */
/* Title rows that contain a timer need flex so the pill sits beside the text */
.mywork-title,
.tov-task-title,
.dash-item-name {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}
/* Color tiers — applied to both .task-timer.running and .dash-task-timer */
.task-timer.running.timer-green,
.dash-task-timer.timer-green {
    color: #3aaa6a;
    background: rgba(58,170,106,.10);
    border-color: rgba(58,170,106,.25);
}
.task-timer.running.timer-amber,
.dash-task-timer.timer-amber {
    color: #c98a2a;
    background: rgba(201,138,42,.10);
    border-color: rgba(201,138,42,.25);
}
.task-timer.running.timer-red,
.dash-task-timer.timer-red {
    color: #d94f4f;
    background: rgba(217,79,79,.10);
    border-color: rgba(217,79,79,.25);
}
.task-timer.done {
    color: var(--color-ink-muted);
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border-rule);
}
.task-timer-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    animation: timer-pulse 1.8s ease-in-out infinite;
}
@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .25; }
}

/* Dashboard task-age badge (oldest open task, shown in table row) */
.dash-task-timer {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 2px 7px;
    border-radius: 20px;
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: default;
}

/* Creative hub timer — sits in .kcard-meta */
.creative-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    padding: 2px 6px;
    border-radius: 20px;
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}
.creative-timer.running { /* color comes from .timer-green/amber/red */ }
.creative-timer.running.timer-green { color: #3aaa6a; background: rgba(58,170,106,.10); border-color: rgba(58,170,106,.25); }
.creative-timer.running.timer-amber { color: #c98a2a; background: rgba(201,138,42,.10); border-color: rgba(201,138,42,.25); }
.creative-timer.running.timer-red   { color: #d94f4f; background: rgba(217,79,79,.10);  border-color: rgba(217,79,79,.25);  }
.creative-timer.done {
    color: var(--color-ink-muted);
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border-rule);
}

/* kcard-meta needs flex to let the timer push to the right */
.kcard-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* ── Globe Help Panel ────────────────────────────────────────────────────── */
.pm-card-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.globe-help-btn {
    background: none;
    border: 1px solid var(--color-border-rule);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-ink-muted);
    font-size: 12px;
    transition: border-color .15s, color .15s;
    flex-shrink: 0;
}
.globe-help-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}
.globe-help-panel {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border-rule);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-ink-muted);
}
.globe-help-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.globe-help-step:last-of-type { margin-bottom: 12px; }
.globe-help-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-gold);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.globe-help-step > div { line-height: 1.5; }
.globe-help-step strong { color: var(--color-ink); }
.globe-help-ask {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--color-gold);
    border-radius: 6px;
    background: rgba(212,175,55,.08);
    color: var(--color-gold);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    margin-top: 2px;
}
.globe-help-ask:hover { background: rgba(212,175,55,.18); }

/* ── AI Chat Quick-Help Prompts ──────────────────────────────────────────── */
.chat-quick-help {
    padding: 10px 14px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--color-border-rule);
}
.chat-quick-btn {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--color-border-rule);
    background: rgba(255,255,255,.04);
    color: var(--color-ink-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, color .15s, background .15s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-quick-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
    background: rgba(212,175,55,.08);
}
.chat-quick-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-ink-faint, rgba(255,255,255,.25));
    padding: 8px 14px 2px;
}

/* ══════════════════════════════════════════════════════════════
   P4 — SHELL RTL (body.prod-lang-ar: Arabic production mode)
   Active only while the Production tab is open in Arabic.
   ══════════════════════════════════════════════════════════════ */

body.prod-lang-ar .app-shell { direction: rtl; }

/* Move sidebar to the right */
body.prod-lang-ar .sidebar {
    border-right: none;
    border-left: 0.75px solid var(--color-border-rule);
    order: 2;
}

/* Sidebar brand: reverse logo + text order */
body.prod-lang-ar .sidebar-brand {
    flex-direction: row-reverse;
    border-bottom: 0.5px solid var(--color-border-rule);
}
body.prod-lang-ar .brand-text { text-align: right; }

/* Nav items: icon on right, label on left */
body.prod-lang-ar .sidebar-nav .nav-item,
body.prod-lang-ar .sidebar-footer .nav-item {
    flex-direction: row-reverse;
}

/* Use Arabic font stack for nav labels */
body.prod-lang-ar .sidebar .nav-item span {
    font-family: 'Segoe UI', 'Tahoma', 'Arial Unicode MS', system-ui, sans-serif;
    letter-spacing: 0;
}

/* Save status indicator */
body.prod-lang-ar .save-status-indicator { flex-direction: row-reverse; }
body.prod-lang-ar .sidebar-copy { text-align: right; direction: rtl; }

/* ══════════════════════════════════════════════════════════════
   GLOBAL i18n — Language toggle + Header cleanup + RTL expansions
   (body.prod-lang-ar is set by AppI18n and applies globally)
══════════════════════════════════════════════════════════════ */

/* ── Language toggle button in topbar ── */
.btn-lang-toggle {
    font-size: 12px; font-weight: 700; letter-spacing: .04em;
    padding: 5px 13px; border-radius: 20px;
    background: none;
    border: 1.5px solid var(--color-border-rule);
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: background .14s, color .14s, border-color .14s;
    white-space: nowrap;
}
.btn-lang-toggle:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(201,162,39,.06);
}
.btn-lang-toggle.btn-lang-ar {
    background: rgba(201,162,39,.10);
    color: var(--gold);
    border-color: rgba(201,162,39,.35);
}

/* ── Projects tab: view-header with inline action buttons ── */
.view-header-flex {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.view-header-title { flex: 1; min-width: 0; }
.view-header-actions {
    display: flex; gap: 8px; align-items: center;
    padding-bottom: 4px; flex-shrink: 0;
}

/* ── Values button in Settings panel ── */
#btnValues {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
}
#btnValues i { font-size: 14px; }
#btnValues.unlocked { color: var(--gold); border-color: rgba(201,162,39,.4); }

/* ══════════════════════════════════════════════════════════════
   RTL EXPANSIONS — settings, modals, profile dropdown,
   attendance module, toasts
   All under body.prod-lang-ar (set by AppI18n globally)
══════════════════════════════════════════════════════════════ */

/* Settings panel */
body.prod-lang-ar .settings-panel          { direction: rtl; }
body.prod-lang-ar .settings-tab-bar        { flex-direction: row-reverse; }
body.prod-lang-ar .settings-tab            { flex-direction: row-reverse; gap: 6px; }
body.prod-lang-ar .settings-card-title     { flex-direction: row-reverse; }
body.prod-lang-ar .settings-row-btn        { flex-direction: row-reverse; text-align: right; }
body.prod-lang-ar .settings-btn-col        { align-items: flex-end; }
body.prod-lang-ar .pref-row                { flex-direction: row-reverse; }
body.prod-lang-ar .form-label              { text-align: right; display: block; }
body.prod-lang-ar .profile-photo-row       { flex-direction: row-reverse; }
body.prod-lang-ar .profile-photo-side      { text-align: right; }
body.prod-lang-ar .currency-row            { flex-direction: row-reverse; }
body.prod-lang-ar .settings-content-header { flex-direction: row-reverse; }
body.prod-lang-ar .settings-content-header > div { text-align: right; }

/* Profile dropdown */
body.prod-lang-ar .profile-dropdown  { direction: rtl; text-align: right; }
body.prod-lang-ar .pd-item           { flex-direction: row-reverse; }
body.prod-lang-ar .pd-head           { flex-direction: row-reverse; text-align: right; }

/* Modals (logout confirm, export, etc.) */
body.prod-lang-ar .modal-overlay,
body.prod-lang-ar .att-modal         { direction: rtl; }
body.prod-lang-ar .modal-header      { flex-direction: row-reverse; }
body.prod-lang-ar .modal-footer      { flex-direction: row-reverse; }

/* Toast notifications — flip to left side in Arabic */
body.prod-lang-ar .toast-container,
body.prod-lang-ar #toastContainer    { right: auto !important; left: 16px !important; }
body.prod-lang-ar .toast             { flex-direction: row-reverse; text-align: right; }

/* Attendance module shell */
body.prod-lang-ar .att-head          { direction: rtl; text-align: right; }
body.prod-lang-ar .att-panel-h       { flex-direction: row-reverse; direction: rtl; }
body.prod-lang-ar .att-kpis          { flex-direction: row-reverse; }
body.prod-lang-ar .att-table         { direction: rtl; }
body.prod-lang-ar .att-table th,
body.prod-lang-ar .att-table td      { text-align: right; }
body.prod-lang-ar .att-gt-list       { direction: rtl; }
body.prod-lang-ar .att-gt-row        { flex-direction: row-reverse; }
body.prod-lang-ar .att-gt-add-row    { flex-direction: row-reverse; direction: rtl; }
body.prod-lang-ar .att-modal         { direction: rtl; text-align: right; }
body.prod-lang-ar .att-modal-head    { flex-direction: row-reverse; }
body.prod-lang-ar .att-leave-by      { direction: rtl; text-align: right; }
body.prod-lang-ar .att-board-grid    { direction: rtl; }
body.prod-lang-ar .att-board-card    { text-align: right; }
body.prod-lang-ar .att-gt-clear-row  { direction: rtl; }
