/* ════════════════════════════════════════════════════════════════════
   Office & Settings modals — Светлана web agent
   Стили модалок: офис (документы/заметки/календарь) + настройки (память)
   Цветовая схема: совпадает с cockpit (cyan #22d3ee, slate #94a3b8)
   ════════════════════════════════════════════════════════════════════ */

/* ─── Общий каркас модалки ──────────────────────────────────── */

.office-modal,
.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: officeFadeIn 0.2s ease;
}
.office-modal.office-hidden,
.settings-modal.settings-hidden {
    display: none !important;
}
@keyframes officeFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.office-modal-inner,
.settings-modal-inner {
    background: linear-gradient(180deg, rgba(15, 20, 35, 0.98), rgba(10, 12, 24, 0.98));
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 12px;
    width: min(1200px, 95vw);
    height: min(85vh, 800px);
    margin: auto;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(34, 211, 238, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #e2e8f0;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    position: relative;  /* контейнер для абсолютно-позиционированного .office-editor */
}
.settings-modal-inner {
    width: min(720px, 95vw);
    height: min(75vh, 700px);
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(148, 163, 184, 0.1);
}

/* ─── Шапка ─────────────────────────────────────────────────── */

.office-header,
.settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.15);
    background: rgba(34, 211, 238, 0.04);
    flex-shrink: 0;
}
.settings-header {
    border-bottom-color: rgba(148, 163, 184, 0.15);
    background: rgba(148, 163, 184, 0.04);
}
.office-title,
.settings-title {
    font-size: 14px;
    font-weight: 600;
    color: #22d3ee;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-right: auto;
}
.settings-title {
    color: #cbd5e1;
}
.office-close-btn,
.settings-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(34, 211, 238, 0.3);
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: auto;
    order: 2;
}
.office-close-btn:hover,
.settings-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    transform: scale(1.1);
}

/* ─── Табы ──────────────────────────────────────────────────── */

.office-tabs,
.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 0 4px;
}
.office-tab,
.settings-tab {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
}
.office-tab:hover,
.settings-tab:hover {
    color: #94a3b8;
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.2);
}
.office-tab.active,
.settings-tab.active {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.15), inset 0 0 8px rgba(34, 211, 238, 0.05);
}
.office-tab.active svg,
.settings-tab.active svg {
    filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.6));
}
.settings-tab.active {
    color: #cbd5e1;
    background: rgba(203, 213, 225, 0.15);
    border-color: rgba(203, 213, 225, 0.4);
}
.office-stats {
    font-size: 12px;
    color: #64748b;
    padding: 4px 10px;
    background: rgba(34, 211, 238, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(34, 211, 238, 0.1);
}

/* ─── Тело модалки ──────────────────────────────────────────── */

.office-body,
.settings-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.office-pane,
.settings-pane {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    padding: 12px;
    overflow: hidden;
}
.office-pane.active,
.settings-pane.active {
    display: flex;
}
.settings-pane[data-pane="about"] {
    overflow-y: auto;
}
.settings-pane[data-pane="engine"] {
    overflow-y: auto;
    padding: 16px;
}
.settings-pane[data-pane="agent-admin"] {
    overflow-y: auto;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #22d3ee;
    margin-top: 16px;
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.settings-engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}
.settings-engine-badge[data-engine="xiaozhi"] {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}
.settings-engine-badge[data-engine="openai"] {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

/* ─── Тулбар пейна ──────────────────────────────────────────── */

.office-toolbar,
.settings-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.1);
    flex-shrink: 0;
}
.settings-toolbar {
    border-bottom-color: rgba(148, 163, 184, 0.1);
    flex-direction: column;
    align-items: flex-start;
}
.office-spacer,
.settings-spacer {
    flex: 1;
}
.office-btn,
.settings-btn {
    padding: 6px 10px;
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
}
.office-btn:hover,
.settings-btn:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: #22d3ee;
    color: #e2e8f0;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.15);
}
.office-btn-primary,
.settings-btn-primary {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.5);
    color: #22d3ee;
    font-weight: 500;
}
.office-btn-primary:hover,
.settings-btn-primary:hover {
    background: rgba(34, 211, 238, 0.35);
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
    color: #22d3ee;
}
.office-btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.office-btn-icon:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: #22d3ee;
    color: #22d3ee;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.2);
}
.office-btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
.office-btn-icon.neon-cyan svg {
    filter: drop-shadow(0 0 3px rgba(34, 211, 238, 0.4));
}
.office-btn-mini {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid rgba(34, 211, 238, 0.2);
    color: #22d3ee;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.office-btn-mini:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: #22d3ee;
}
.office-search,
.office-input,
.settings-input {
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.office-search {
    width: 180px;
}
.office-search:focus,
.office-input:focus,
.settings-input:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.25);
}
.settings-input:focus {
    border-color: #cbd5e1;
    box-shadow: 0 0 8px rgba(203, 213, 225, 0.2);
}
.office-filter-label {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}
.office-hint,
.settings-hint {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    margin-top: 4px;
}

/* ─── Documents: split view (sidebar + list) ────────────────── */

.office-split {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 12px;
    margin-top: 8px;
}
.office-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(34, 211, 238, 0.1);
    border-radius: 6px;
    overflow-y: auto;
    padding: 8px;
}
.office-folders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px 8px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.1);
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
}
.office-folder-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}
.office-folder-list li {
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.office-folder-list li:hover {
    background: rgba(34, 211, 238, 0.1);
    color: #fff;
}
.office-folder-list li.active {
    background: rgba(34, 211, 238, 0.2);
    color: #22d3ee;
    font-weight: 500;
}
.office-folder-list li .folder-icon { font-size: 14px; }
.office-folder-list li .folder-actions {
    margin-left: auto;
    display: none;
    gap: 2px;
}
.office-folder-list li:hover .folder-actions { display: flex; }
.folder-actions button {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
}
.folder-actions button:hover { color: #ef4444; }
.office-list,
.office-list-wide {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.1);
    border-radius: 6px;
    padding: 8px;
}
.office-list-wide {
    margin-top: 8px;
}

/* ─── List items (документы, заметки, события) ──────────────── */

.office-item {
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(34, 211, 238, 0.04);
    border: 1px solid rgba(34, 211, 238, 0.1);
    margin-bottom: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
    position: relative;
}
.office-item:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.3);
    transform: translateX(2px);
}
.office-item-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.office-item-body { flex: 1; min-width: 0; }
.office-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.office-item-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}
.office-item-actions {
    display: none;
    gap: 4px;
    flex-shrink: 0;
}
.office-item:hover .office-item-actions { display: flex; }
.office-item-actions button {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 4px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}
.office-item-actions button:hover {
    background: rgba(34, 211, 238, 0.2);
    color: #fff;
}
.office-item-actions button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}
.office-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}
.office-trash-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #fca5a5;
}
.office-trash-banner button {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-left: auto;
}
.office-trash-banner button:hover {
    background: rgba(239, 68, 68, 0.2);
}

    /* ─── WYSIWYG editor ────────────────────────────────────────── */

.office-editor {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: linear-gradient(180deg, rgba(15, 20, 35, 0.99), rgba(10, 12, 24, 0.99));
    display: flex;
    flex-direction: column;
}
.office-editor[hidden] { display: none !important; }
.office-editor-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.2);
    background: rgba(34, 211, 238, 0.05);
    flex-shrink: 0;
}
.office-doc-title {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    margin-bottom: 8px;
    outline: none;
    transition: all 0.2s;
}
.office-doc-title:hover,
.office-doc-title:focus {
    border-color: rgba(34, 211, 238, 0.3);
    background: rgba(0, 0, 0, 0.3);
}
.office-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    flex-wrap: wrap;
    overflow: visible;
    scrollbar-width: thin;
    min-height: 34px;
    align-content: flex-start;
    max-height: none;
}
.office-editor-toolbar::-webkit-scrollbar { height: 2px; }
.office-editor-toolbar::-webkit-scrollbar-thumb { background: rgba(34, 211, 238, 0.3); border-radius: 2px; }
.office-tb-btn {
    padding: 3px 6px;
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.12);
    border-radius: 5px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    min-width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    user-select: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.office-tb-btn:hover {
    background: rgba(34, 211, 238, 0.18);
    border-color: rgba(34, 211, 238, 0.4);
    color: #e2e8f0;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.12);
}
.office-tb-btn:active {
    background: rgba(34, 211, 238, 0.25);
    transform: scale(0.95);
}
.office-tb-btn.active {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.5);
    color: #22d3ee;
    box-shadow: inset 0 0 4px rgba(34, 211, 238, 0.15);
}
.office-tb-btn b { font-weight: 700; font-size: 12px; }
.office-tb-btn i { font-style: italic; font-size: 12px; }
.office-tb-btn u { text-decoration: underline; font-size: 12px; }
.office-tb-btn s { text-decoration: line-through; font-size: 11px; }
.office-tb-select {
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.12);
    border-radius: 5px;
    color: #cbd5e1;
    padding: 2px 6px;
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    height: 26px;
    min-width: 55px;
    transition: all 0.15s ease;
}
.office-tb-select:hover {
    border-color: rgba(34, 211, 238, 0.4);
    background: rgba(34, 211, 238, 0.12);
}
.office-tb-select option { background: #0a0c18; color: #e2e8f0; }
.office-tb-color {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 5px;
    padding: 0;
    cursor: pointer;
    background: none;
    vertical-align: middle;
    transition: all 0.15s ease;
}
.office-tb-color:hover {
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 6px rgba(34, 211, 238, 0.15);
}
.office-tb-color::-webkit-color-swatch-wrapper { padding: 1px; }
.office-tb-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.office-tb-sep {
    width: 1px;
    height: 16px;
    background: rgba(34, 211, 238, 0.12);
    margin: 0 3px;
    flex-shrink: 0;
}
/* Toolbar group pill */
.office-tb-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 3px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(34, 211, 238, 0.05);
}
/* Accent: agent/export buttons */
.office-tb-btn-accent {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.3);
    color: #22d3ee;
    font-weight: 500;
}
.office-tb-btn-accent:hover {
    background: rgba(34, 211, 238, 0.25);
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.2);
    color: #22d3ee;
}
/* Danger: delete */
.office-tb-btn-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.06);
}
.office-tb-btn-danger:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}
/* Primary save */
.office-tb-btn-save {
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.3);
    background: rgba(34, 211, 238, 0.1);
    font-weight: 600;
}
.office-tb-btn-save:hover {
    background: rgba(34, 211, 238, 0.25);
    border-color: #22d3ee;
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.25);
}
.office-doc-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    background: rgba(0, 0, 0, 0.2);
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    font-family: 'Georgia', 'Times New Roman', serif;
}
.office-doc-content h1 { font-size: 24px; color: #fff; margin: 12px 0 8px; }
.office-doc-content h2 { font-size: 19px; color: #e2e8f0; margin: 10px 0 6px; }
.office-doc-content h3 { font-size: 16px; color: #cbd5e1; margin: 8px 0 4px; }
.office-doc-content p { margin: 0 0 10px; }
.office-doc-content ul, .office-doc-content ol { padding-left: 28px; margin: 0 0 10px; }
.office-doc-content blockquote {
    border-left: 3px solid #22d3ee;
    padding-left: 12px;
    color: #94a3b8;
    font-style: italic;
    margin: 0 0 10px;
}
.office-doc-content a { color: #22d3ee; }
.office-doc-content:focus { box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.3); }
.office-editor-footer {
    padding: 6px 16px;
    border-top: 1px solid rgba(34, 211, 238, 0.1);
    background: rgba(0, 0, 0, 0.3);
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.office-editor-hints {
    display: flex;
    gap: 10px;
    align-items: center;
}
.hint-item {
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
    padding: 2px 6px;
    border-radius: 4px;
}
.hint-item:hover {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.1);
}
.office-doc-meta.dirty { color: #fbbf24; }
.office-doc-meta.saved { color: #22d3ee; }

/* ─── Zone labels on contenteditable ─────────────────────────── */
.office-zone-labels { display: none; }
.office-doc-content .zone-label {
    position: absolute;
    font-size: 9px;
    color: rgba(148, 163, 184, 0.5);
    background: rgba(10, 12, 24, 0.7);
    padding: 0 6px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    pointer-events: none;
    transition: opacity 0.2s;
    line-height: 16px;
    text-transform: uppercase;
    white-space: nowrap;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}
.office-doc-content .zone-label:hover { opacity: 1; color: rgba(34, 211, 238, 0.8); }

/* ─── Zone panel ─────────────────────────────────────────────── */
.office-zone-panel {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 220px;
    background: linear-gradient(180deg, rgba(15, 20, 35, 0.97), rgba(10, 12, 24, 0.97));
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(34, 211, 238, 0.08);
    display: flex;
    flex-direction: column;
    max-height: 420px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: officeFadeIn 0.15s ease;
}
.office-zone-panel[hidden] { display: none !important; }
.zone-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.15);
    font-size: 11px;
    color: #22d3ee;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.zone-panel-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}
.zone-panel-close:hover { color: #ef4444; background: rgba(239, 68, 68, 0.15); }
.zone-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.zone-panel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    color: #cbd5e1;
    transition: all 0.15s;
    border: 1px solid transparent;
    margin-bottom: 2px;
}
.zone-panel-item:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.2);
    color: #fff;
}
.zone-panel-item.active {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: #22d3ee;
}
.zone-panel-item .zp-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 14px;
}
.zone-panel-item .zp-tag {
    font-size: 9px;
    color: #64748b;
    background: rgba(0,0,0,0.3);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: auto;
    flex-shrink: 0;
    font-family: monospace;
}
.zone-panel-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(34, 211, 238, 0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.zone-panel-input-row {
    display: flex;
    gap: 4px;
    align-items: center;
}
.zone-panel-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 11px;
    padding: 6px 8px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.zone-panel-input:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 6px rgba(34, 211, 238, 0.15);
}
.zone-panel-input::placeholder { color: #64748b; }
.zone-panel-input-row-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 5px;
    color: #22d3ee;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.zone-panel-input-row-btn:hover {
    background: rgba(34, 211, 238, 0.25);
    color: #fff;
    border-color: #22d3ee;
}
.zone-panel-input-row-btn.recording {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
    animation: zoneMicPulse 0.8s ease-in-out infinite;
}
@keyframes zoneMicPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 6px 2px rgba(239, 68, 68, 0.2); }
}
.zone-panel-actions-row {
    display: flex;
    gap: 4px;
}
.zone-panel-footer-btn {
    flex: 1;
    padding: 5px 4px;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 5px;
    color: #cbd5e1;
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    text-align: center;
    white-space: nowrap;
}
.zone-panel-footer-btn:hover {
    background: rgba(34, 211, 238, 0.25);
    color: #fff;
    border-color: #22d3ee;
}
.zone-panel-footer-btn.primary {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.35);
    color: #22d3ee;
}
.zone-panel-footer-btn.primary:hover {
    background: rgba(34, 211, 238, 0.35);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.15);
}
.zone-panel-agent-btn {
    width: 100%;
    padding: 7px 10px;
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 6px;
    color: #22d3ee;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.zone-panel-agent-btn:hover {
    background: rgba(34, 211, 238, 0.3);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.2);
    color: #fff;
}

/* ─── Settings form ─────────────────────────────────────────── */

.settings-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 480px;
}
.settings-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.settings-form-row label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.settings-form .settings-input { width: 100%; }
.settings-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}
.settings-input-group .settings-input {
    flex: 1;
}
.settings-input-select {
    width: 100%;
    cursor: pointer;
}
.settings-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 8px;
    color: #22d3ee;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.settings-btn-icon:hover {
    background: rgba(34, 211, 238, 0.3);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}
.settings-btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 4px;
    margin-top: 8px;
}
.settings-memory-item {
    padding: 12px;
    background: rgba(34, 211, 238, 0.04);
    border: 1px solid rgba(34, 211, 238, 0.15);
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.settings-memory-item.is-default {
    border-style: dashed;
    background: rgba(148, 163, 184, 0.05);
    border-color: rgba(148, 163, 184, 0.2);
}
.settings-memory-item-body { flex: 1; }
.settings-memory-item-name {
    font-size: 12px;
    color: #22d3ee;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.settings-memory-item-value {
    font-size: 14px;
    color: #e2e8f0;
    word-break: break-word;
}
.settings-memory-item-value[contenteditable="true"] {
    outline: none;
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: 4px;
    transition: background 0.2s;
}
.settings-memory-item-value[contenteditable="true"]:focus {
    background: rgba(0, 0, 0, 0.3);
}
.settings-memory-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.settings-memory-actions button {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 4px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}
.settings-memory-actions button:hover {
    background: rgba(34, 211, 238, 0.2);
    color: #fff;
}
.settings-memory-actions button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}
.settings-about {
    padding: 16px;
    line-height: 1.6;
}
.settings-about h3 {
    color: #22d3ee;
    margin: 0 0 12px;
    font-size: 18px;
}
.settings-about p { margin: 6px 0; font-size: 13px; color: #cbd5e1; }
.settings-about code {
    background: rgba(34, 211, 238, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    color: #22d3ee;
}
.settings-about a { color: #22d3ee; }

/* ─── Confirm dialog ────────────────────────────────────────── */

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: officeFadeIn 0.15s;
}
.confirm-overlay[hidden] { display: none; }
.confirm-box {
    background: linear-gradient(180deg, rgba(20, 25, 40, 0.98), rgba(15, 18, 30, 0.98));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 20px 24px;
    min-width: 320px;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(239, 68, 68, 0.2);
}
.confirm-text {
    color: #e2e8f0;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.confirm-btn {
    padding: 7px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}
.confirm-btn-cancel {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
}
.confirm-btn-cancel:hover { background: rgba(148, 163, 184, 0.2); }
.confirm-btn-ok {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
    font-weight: 500;
}
.confirm-btn-ok:hover {
    background: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

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

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 30000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 10px 16px;
    background: rgba(15, 20, 35, 0.95);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    min-width: 240px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastSlideIn 0.2s ease;
}
.toast.success { border-color: rgba(34, 197, 94, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.info { border-color: rgba(34, 211, 238, 0.4); }
@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast.fade-out { animation: toastSlideOut 0.2s ease forwards; }
@keyframes toastSlideOut {
    to { transform: translateX(100%); opacity: 0; }
}

/* ─── Templates compact list ──────────────────────────────────── */

.office-templates-compact {
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px 0;
}
.office-template-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    margin-bottom: 3px;
}
.office-template-item:hover {
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.3);
}
.office-template-item .tpl-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.office-template-item .tpl-name {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 120px;
}
.office-template-item .tpl-desc {
    font-size: 11px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.templates-list-box {
    border-color: rgba(34, 211, 238, 0.3) !important;
}
.templates-list-box .confirm-text {
    color: #22d3ee;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Inline edit (notes / calendar) ────────────────────────── */

.office-edit-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: officeFadeIn 0.15s ease;
}
.office-edit-overlay.office-hidden { display: none !important; }
.office-edit-form {
    background: linear-gradient(180deg, rgba(20, 28, 50, 0.98), rgba(12, 16, 30, 0.98));
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 12px;
    padding: 20px;
    width: min(440px, 90vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(34, 211, 238, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 80vh;
    overflow-y: auto;
}
.office-edit-form h3 {
    font-size: 14px;
    color: #22d3ee;
    margin: 0 0 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.office-edit-form label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.office-edit-form input,
.office-edit-form textarea,
.office-edit-form select {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.office-edit-form input:focus,
.office-edit-form textarea:focus,
.office-edit-form select:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.2);
}
.office-edit-form textarea {
    min-height: 80px;
    resize: vertical;
}
.office-edit-form select option { background: #0a0c18; color: #e2e8f0; }
.office-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}
.office-edit-actions button {
    padding: 7px 16px;
    border-radius: 8px;
    border: 1px solid rgba(34, 211, 238, 0.3);
    background: rgba(34, 211, 238, 0.1);
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.2s;
}
.office-edit-actions button:hover {
    background: rgba(34, 211, 238, 0.2);
    color: #e2e8f0;
}
.office-edit-actions button.primary {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.5);
    color: #22d3ee;
}
.office-edit-actions button.primary:hover {
    background: rgba(34, 211, 238, 0.35);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

/* ─── Settings tabs with icons ───────────────────────────────── */

.settings-tab {
    padding: 6px 8px;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
    border-radius: 8px;
    height: 30px;
    width: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.settings-tab.active {
    color: #cbd5e1;
    background: rgba(203, 213, 225, 0.12);
    border-color: rgba(203, 213, 225, 0.3);
    box-shadow: 0 0 12px rgba(203, 213, 225, 0.1);
}
.settings-tab:hover {
    color: #e2e8f0;
    background: rgba(203, 213, 225, 0.08);
    border-color: rgba(203, 213, 225, 0.15);
}

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

@media (max-width: 768px) {
    .office-modal-inner,
    .settings-modal-inner {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
    .office-tabs,
    .settings-tabs {
        overflow-x: auto;
        flex-shrink: 0;
    }
    .office-split { flex-direction: column; }
    .office-sidebar { width: 100%; max-height: 140px; }
    .office-doc-content { padding: 16px; }
}

/* ─── Chat History in Settings ──────────────────────────── */
.settings-chat-item {
    padding: 10px 12px;
    background: rgba(148, 163, 184, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.settings-chat-item:hover {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(34, 211, 238, 0.3);
}
.settings-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.settings-chat-avatar.ai {
    font-size: 20px;
}
.settings-chat-info {
    flex: 1;
    min-width: 0;
}
.settings-chat-name {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 2px;
}
.settings-chat-preview {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.settings-chat-date {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}
.settings-chat-open-btn {
    padding: 4px 10px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 4px;
    color: #22d3ee;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.settings-chat-open-btn:hover {
    background: rgba(34, 211, 238, 0.2);
}
/* ─── Chat Message Viewer ──────────────────────────────── */
.settings-chat-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.settings-chat-viewer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    flex-shrink: 0;
}
.settings-chat-back-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.settings-chat-back-btn:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #e2e8f0;
}
.settings-chat-viewer-title {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}
.settings-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}
.settings-chat-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    clear: both;
}
.settings-chat-bubble.own {
    float: right;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    color: #e2f2f0;
}
.settings-chat-bubble.other {
    float: left;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}
.settings-chat-bubble-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
    text-align: right;
}
.settings-chat-bubble-sender {
    font-size: 11px;
    font-weight: 600;
    color: #22d3ee;
    margin-bottom: 2px;
}
.settings-empty {
    text-align: center;
    padding: 24px;
    color: #64748b;
    font-size: 13px;
}

/* ─── Agent Progress Panel ─────────────────────────── */
.agent-progress-panel {
    display: none;
    margin: 8px 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 11px;
    line-height: 1.5;
}
.agent-progress-header {
    color: #06b6d4;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(34,211,238,0.15);
}
.agent-progress-list {
    max-height: 300px;
    overflow-y: auto;
}
.ap-item {
    padding: 3px 4px;
    border-radius: 4px;
    margin: 2px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.ap-item.ap-pending {
    color: #64748b;
    opacity: 0.6;
}
.ap-item.ap-processing {
    color: #fbbf24;
    background: rgba(251,191,36,0.08);
}
.ap-item.ap-done {
    color: #4ade80;
    background: rgba(74,222,128,0.06);
}
.ap-item.ap-error {
    color: #f87171;
    background: rgba(248,113,113,0.08);
}
.ap-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ap-tag {
    color: #475569;
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
