/* ==========================================================================
   ARKENSTONE V2 — PHASE 3: REALTIME COLLABORATION & POLISH
   Loaded after registry.css; uses the same design tokens.
   ========================================================================== */

/* ── TOPBAR: search wrapper + global search dropdown ── */
.topbar { position: relative; }
.topbar-search-wrap {
    position: relative;
    flex: 1;
    max-width: 420px;
}
.topbar-search-wrap .topbar-search { max-width: none; width: 100%; }

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 420px;
    overflow-y: auto;
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-deep);
    z-index: 240;
    padding: 6px;
}
.search-dropdown.hidden { display: none; }
.gs-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
}
.gs-group i { color: var(--gold); font-size: 12px; }
.gs-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
}
.gs-item:hover, .gs-item.active { background: var(--gold-faint); }
.gs-item.active { outline: 1px solid var(--glass-border); }
.gs-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-ink-primary);
}
.gs-sub { font-size: 10.5px; color: var(--color-ink-muted); }
.gs-none {
    padding: 16px 12px;
    font-size: 12px;
    color: var(--color-ink-muted);
    text-align: center;
}

/* ── AI SEARCH (Ask-AI row + grounded answer panel) ── */
.gs-ask-ai {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    border: 1px solid var(--gold-pale);
    background: var(--gold-faint);
}
.gs-ask-ai i { color: var(--gold); font-size: 15px; flex-shrink: 0; }
.gs-ask-ai .gs-label { font-weight: 600; }
.gs-ask-ai .gs-sub { margin-left: auto; }

.gs-ai-panel { display: flex; flex-direction: column; }
.gs-ai-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 8px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    border-bottom: 1px solid var(--color-border-rule);
    margin-bottom: 8px;
}
.gs-ai-head i { color: var(--gold); font-size: 13px; }
.gs-ai-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-ink-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    border-radius: 4px;
}
.gs-ai-close:hover { color: var(--color-ink-primary); background: var(--color-canvas-secondary); }
.gs-ai-body { padding: 0 10px 8px; }
.gs-ai-answer {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--color-ink-primary);
}
.gs-ai-answer p { margin: 0 0 6px; }
.gs-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.gs-ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--gold-pale);
    border-radius: 14px;
    background: var(--color-canvas-secondary);
    color: var(--color-ink-primary);
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.gs-ai-chip:hover { background: var(--gold-faint); border-color: var(--gold); }
.gs-ai-chip i { font-size: 12px; color: var(--gold); }

/* ── NOTIFICATIONS: bell + badge + panel ── */
.btn-bell { position: relative; }
.notif-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 9px;
    background: #c0392b;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}
.notif-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: 480px;
    overflow-y: auto;
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-deep);
    z-index: 240;
}
.notif-panel.hidden { display: none; }
.notif-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--color-surface-card);
    border-bottom: 0.75px solid var(--color-border-rule);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    z-index: 1;
}
.notif-mark-all {
    border: none;
    background: transparent;
    color: var(--gold);
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-clear-all {
    border: none;
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    transition: color 0.12s, background 0.12s;
}
.notif-clear-all:hover { color: #c0392b; background: rgba(192,57,43,0.08); }
.notif-list { padding: 6px; }
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
}
.notif-item:hover { background: var(--gold-faint); }
.notif-item.unread { background: var(--color-canvas-secondary); }
.notif-item.unread:hover { background: var(--gold-faint); }
.notif-body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.notif-msg {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-ink-primary);
    line-height: 1.4;
}
.notif-detail {
    font-size: 11px;
    color: var(--color-ink-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notif-time { font-size: 9.5px; color: var(--color-ink-muted); margin-top: 2px; }
.notif-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    margin-top: 6px;
    flex-shrink: 0;
}
.notif-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gold-faint);
    color: var(--gold);
    font-size: 14px;
    flex-shrink: 0;
}
.notif-type-icon.overdue { background: rgba(192, 57, 43, 0.12); color: #c0392b; }
.notif-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 28px 18px;
    font-size: 12px;
    color: var(--color-ink-muted);
    text-align: center;
}

/* ── PRESENCE: viewing chip + live-connection dot ── */
.drawer-presence {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 3px 10px 3px 4px;
    border-radius: 999px;
    background: var(--gold-faint);
    border: 0.75px solid var(--color-border-rule);
    font-size: 10px;
    font-weight: 600;
    color: var(--color-ink-muted);
}
.drawer-presence .member-avatar { margin-right: -4px; }
.save-status-indicator.rt-live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1D8C4E;
    margin-right: 5px;
    box-shadow: 0 0 6px rgba(29, 140, 78, 0.7);
}

/* ── COMMENTS / DISCUSSION ── */
.comment-row {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--color-border-rule);
}
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
}
.comment-time { font-size: 10px; color: var(--color-ink-muted); }
.comment-delete {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--color-ink-muted);
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.comment-row:hover .comment-delete { opacity: 0.7; }
.comment-delete:hover { color: #c0392b; opacity: 1; }
.comment-body {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--color-ink-primary);
    margin-top: 2px;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.comment-body .mention {
    color: var(--gold);
    font-weight: 600;
    background: var(--gold-faint);
    border-radius: 3px;
    padding: 0 2px;
}
.comments-empty, .comments-loading {
    padding: 14px 0;
    font-size: 12px;
    color: var(--color-ink-muted);
}
.comment-compose {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-top: 10px;
}
.comment-input {
    flex: 1;
    resize: vertical;
    min-height: 44px;
    max-height: 160px;
    padding: 9px 11px;
    font-family: var(--font-body);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--color-ink-primary);
    background: var(--color-canvas-secondary);
    border: 0.75px solid var(--color-border-rule);
    border-radius: 8px;
}
.comment-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-faint);
}
.comment-send { padding: 9px 12px; flex-shrink: 0; }
.mention-suggest {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    width: 260px;
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    border-radius: 8px;
    box-shadow: var(--shadow-deep);
    z-index: 50;
    padding: 4px;
}
.mention-suggest.hidden { display: none; }
.mention-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-ink-primary);
    text-align: left;
}
.mention-opt:hover, .mention-opt.active { background: var(--gold-faint); }
.mention-uname { margin-left: auto; font-size: 10.5px; color: var(--color-ink-muted); }

/* ── TODAY PANEL (dashboard digest) ── */
.today-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 10px;
}
.today-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 0.75px solid var(--color-border-rule);
    background: var(--color-canvas-secondary);
    font-size: 10.5px;
    color: var(--color-ink-muted);
}
.today-chip strong { color: var(--color-ink-primary); font-weight: 700; }
.today-chip.warn {
    border-color: rgba(192, 57, 43, 0.4);
    background: rgba(192, 57, 43, 0.07);
}
.today-chip.warn strong { color: #c0392b; }
.today-news {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
}
.today-news i { color: var(--gold); font-size: 13px; }

/* ── CALENDAR VIEW ── */
.cal-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.cal-nav { display: flex; gap: 6px; }
.cal-nav .btn-secondary { padding: 7px 11px; }
.cal-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--color-ink-primary);
    margin: 0;
}
.cal-member-select { max-width: 220px; margin-left: auto; }
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--color-border-rule);
    border: 0.75px solid var(--color-border-rule);
    border-radius: var(--radius-card);
    overflow: hidden;
}
.cal-dow {
    background: var(--color-canvas-secondary);
    padding: 8px 10px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    text-align: left;
}
.cal-cell {
    background: var(--color-surface-card);
    min-height: 96px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cal-empty { background: var(--color-canvas-secondary); }
.cal-day-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-ink-muted);
    margin-bottom: 2px;
}
.cal-today { box-shadow: inset 0 0 0 2px var(--gold); }
.cal-today .cal-day-num { color: var(--gold); }
.cal-event {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 3px 6px;
    border: none;
    border-radius: 5px;
    background: var(--gold-faint);
    color: var(--color-ink-primary);
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}
.cal-event span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event i { font-size: 10px; color: var(--gold); flex-shrink: 0; }
.cal-event:hover { background: var(--gold-pale); color: #2A2210; }
.cal-event.project {
    background: rgba(29, 92, 56, 0.1);
    border-left: 2px solid #1D5C38;
}
.cal-event.project i { color: #1D5C38; }
.cal-event.overdue {
    background: rgba(192, 57, 43, 0.1);
    border-left: 2px solid #c0392b;
}
.cal-event.overdue i { color: #c0392b; }
.cal-event.done { opacity: 0.5; text-decoration: line-through; }
.cal-more { font-size: 9.5px; color: var(--color-ink-muted); padding-left: 4px; }

/* ── CALENDAR VIEW TOGGLE ── */
.cal-view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--color-border-rule);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.cal-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    background: var(--color-surface-card);
    border: none;
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.cal-view-btn:first-child { border-right: 1px solid var(--color-border-rule); }
.cal-view-btn:hover { background: var(--gold-faint); color: var(--color-ink-primary); }
.cal-view-btn.active {
    background: var(--gold-faint);
    color: var(--color-ink-primary);
    font-weight: 600;
}
.cal-view-btn i { font-size: 14px; color: var(--gold); }

/* ── YEAR VIEW GRID ── */
.cal-grid-year {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

/* ── MINI MONTH ── */
.cal-mini-month {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border-rule);
    border-radius: 14px;
    padding: 12px 10px 10px;
    transition: box-shadow 0.15s;
}
.cal-mini-month:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.cal-mini-current {
    border-color: var(--gold-pale);
    box-shadow: 0 0 0 1.5px rgba(200,160,60,0.25);
}

/* Month title / header */
.cal-mini-hd {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 2px 2px 6px;
    border-bottom: 1px solid var(--color-border-rule);
}
.cal-mini-hd:hover { color: var(--gold); }
.cal-mini-expand {
    font-size: 11px;
    color: var(--color-ink-muted);
    opacity: 0;
    transition: opacity 0.12s;
}
.cal-mini-hd:hover .cal-mini-expand { opacity: 1; color: var(--gold); }

/* 7-column grid shared for DOW headers + day cells */
.cal-mini-month {
    display: flex;
    flex-direction: column;
}
.cal-mini-month > *:not(.cal-mini-hd) {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}
/* a bit awkward with flex + inner display:grid — use a wrapper approach */
.cal-mini-hd { display: flex; }  /* override the inner grid */

/* Build the 7-col grid with the cells inline — use CSS grid on the month itself */
.cal-mini-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px 0;
}
.cal-mini-hd {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* DOW headers */
.cal-mini-dow {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-ink-muted);
    text-align: center;
    padding: 2px 0 4px;
}

/* Day cells */
.cal-mini-cell {
    min-height: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 2px;
    position: relative;
}

.cal-mini-day {
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.1s;
}
.cal-mini-day:hover { background: var(--gold-faint); }

.cal-mini-num {
    font-size: 9.5px;
    color: var(--color-ink-secondary);
    line-height: 1;
}
.cal-mini-day:hover .cal-mini-num { color: var(--color-ink-primary); }

/* Today highlight */
.cal-mini-today {
    background: var(--gold-faint);
}
.cal-mini-today .cal-mini-num {
    color: var(--gold);
    font-weight: 700;
}

/* Dot row */
.cal-mini-dots {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 1px;
}
.cal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cal-dot-task    { background: var(--gold); }
.cal-dot-project { background: #27ae60; }
.cal-dot-meeting { background: #2980b9; }

/* ── RESPONSIVE: 3-col below 1100px, 2-col below 700px ── */
@media (max-width: 1100px) {
    .cal-grid-year { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
    .cal-grid-year { grid-template-columns: repeat(2, 1fr); }
}

/* ── REPORTS VIEW ── */
.report-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 0 4px;
}
.report-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 0.75px solid var(--color-border-rule);
    background: var(--color-canvas-secondary);
    font-size: 11px;
    color: var(--color-ink-primary);
}
.report-chip i { color: var(--gold); font-size: 13px; }
.report-chip.warn { border-color: rgba(192, 57, 43, 0.4); }
.report-chip.warn i { color: #c0392b; }
.report-delta { font-size: 12px; font-weight: 700; }
.report-delta.up { color: #1D8C4E; }
.report-delta.down { color: #c0392b; }
.workload-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 6px;
}
.workload-table th {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1.5px solid var(--color-border-rule);
}
.workload-table td {
    padding: 9px 10px;
    border-bottom: 0.5px solid var(--color-border-rule);
    color: var(--color-ink-primary);
}
.wl-member { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.wl-overdue { color: #c0392b; font-weight: 700; }

/* ── DRAWER: weekly progress sparkline ── */
.drawer-burndown {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}
.burndown-svg { width: 100%; height: 56px; display: block; }
.burndown-line {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.8;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.burndown-area { fill: var(--gold-faint); stroke: none; }
.burndown-dot { fill: var(--gold); }
.burndown-hint { font-size: 10px; color: var(--color-ink-muted); }

/* Responsive tweaks */
@media (max-width: 760px) {
    .notif-panel { right: 8px; }
    .cal-cell { min-height: 64px; }
    .cal-event span { display: none; }
    .cal-member-select { margin-left: 0; }
}
