/**
 * Strategy V2 — Apple-inspired Mindmap Styles
 * Clean, light theme matching ustinov.html design
 */

/* ---- Root & Loading ---- */
.sv2-root { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.sv2-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; color: #6E6E73; }
.sv2-spinner { width: 32px; height: 32px; border: 3px solid #E5E5E5; border-top-color: #5856D6; border-radius: 50%; animation: sv2-spin 0.8s linear infinite; margin-bottom: 16px; }
@keyframes sv2-spin { to { transform: rotate(360deg); } }
.sv2-empty { text-align: center; padding: 80px 20px; }
.sv2-empty h2 { font-size: 22px; font-weight: 600; color: #1D1D1F; margin-bottom: 8px; }
.sv2-empty p { font-size: 15px; color: #6E6E73; margin-bottom: 24px; }
.sv2-empty-msg { text-align: center; padding: 60px 20px; color: #6E6E73; font-size: 15px; }
.sv2-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
.sv2-btn-primary { background: #5856D6; color: #fff; }
.sv2-btn-primary:hover { background: #4845C1; }
.sv2-btn-ghost { background: none; border: 1px dashed #D1D5DB; color: #6E6E73; padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.sv2-btn-ghost:hover { border-color: #5856D6; color: #5856D6; background: rgba(88,86,214,0.04); }

/* ---- Header ---- */
.sv2-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; }
.sv2-header-left { display: flex; align-items: baseline; gap: 12px; }
.sv2-title { font-size: 28px; font-weight: 700; color: #1D1D1F; letter-spacing: -0.02em; }
.sv2-subtitle { font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3em; color: #86868B; }

/* ---- Tabs ---- */
.sv2-tabs { display: flex; gap: 4px; background: #F5F5F7; border-radius: 12px; padding: 4px; }
.sv2-tab { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; background: transparent; color: #6E6E73; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.sv2-tab:hover { color: #1D1D1F; background: rgba(0,0,0,0.03); }
.sv2-tab-active { background: #fff; color: #1D1D1F; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.sv2-tab svg { flex-shrink: 0; }

/* ---- Stats Bar ---- */
.sv2-stats-bar { display: flex; gap: 24px; padding: 16px 24px; background: #FAFAFA; border-radius: 16px; margin-bottom: 24px; border: 1px solid #F0F0F0; }
.sv2-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 80px; }
.sv2-stat-num { font-size: 24px; font-weight: 700; color: #1D1D1F; }
.sv2-stat-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: #86868B; }
.sv2-progress-bar { width: 100%; height: 4px; background: #E5E5E5; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.sv2-progress-fill { height: 100%; background: linear-gradient(90deg, #5856D6, #34C759); border-radius: 2px; transition: width 0.5s ease; }

/* ---- Branch Cards ---- */
.sv2-branches { display: flex; flex-direction: column; gap: 12px; }
.sv2-branch { background: #fff; border-radius: 16px; border: 1px solid #E5E5E5; overflow: hidden; transition: all 0.3s; }
.sv2-branch:hover { border-color: var(--branch-color, #E5E5E5); box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.sv2-branch-expanded { border-color: var(--branch-color, #E5E5E5); box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.sv2-branch-header { display: flex; align-items: center; gap: 16px; padding: 20px 24px; cursor: pointer; user-select: none; }
.sv2-branch-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sv2-branch-info { flex: 1; min-width: 0; }
.sv2-branch-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sv2-branch-title { font-size: 17px; font-weight: 600; color: #1D1D1F; margin: 0; }
.sv2-branch-goal { font-size: 13px; color: #6E6E73; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv2-priority-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.sv2-branch-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 60px; }
.sv2-branch-pct { font-size: 18px; font-weight: 700; color: #1D1D1F; }
.sv2-mini-progress { width: 60px; height: 3px; background: #E5E5E5; border-radius: 2px; overflow: hidden; }
.sv2-mini-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }
.sv2-branch-count { font-size: 11px; color: #86868B; }
.sv2-branch-chevron { font-size: 12px; color: #86868B; flex-shrink: 0; width: 20px; text-align: center; }

/* ---- Branch Body ---- */
.sv2-branch-body { padding: 0 24px 24px; border-top: 1px solid #F0F0F0; animation: sv2-slideDown 0.25s ease; }
@keyframes sv2-slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Subbranch ---- */
.sv2-subbranch { padding: 16px 0; border-bottom: 1px solid #F5F5F7; }
.sv2-subbranch:last-child { border-bottom: none; }
.sv2-sub-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sv2-sub-title { font-size: 15px; font-weight: 600; color: #1D1D1F; margin: 0; }
.sv2-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.sv2-badge-star { background: #FFF3CD; color: #D97706; }
.sv2-badge-decision { background: #EDE9FE; color: #7C3AED; }
.sv2-add-sub { padding: 12px 0 0; }

/* ---- Items ---- */
.sv2-items { display: flex; flex-direction: column; gap: 6px; }
.sv2-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; transition: background 0.15s; position: relative; }
.sv2-item:hover { background: #F9FAFB; }
.sv2-item:hover .sv2-item-delete { opacity: 1; }
.sv2-item-done .sv2-item-text { color: #86868B; text-decoration: line-through; }
.sv2-item-check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid #D1D5DB; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; padding: 0; }
.sv2-item-check:hover { border-color: var(--branch-color, #5856D6); }
.sv2-item-bullet { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sv2-item-text { font-size: 14px; color: #1D1D1F; flex: 1; line-height: 1.5; }
.sv2-item-status { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.sv2-status-done { background: #D1FAE5; color: #065F46; }
.sv2-status-warn { background: #FEF3C7; color: #92400E; }
.sv2-item-deadline { font-size: 11px; color: #6E6E73; white-space: nowrap; flex-shrink: 0; }
.sv2-item-delete { background: none; border: none; color: #D1D5DB; cursor: pointer; font-size: 14px; padding: 2px 6px; opacity: 0; transition: all 0.15s; flex-shrink: 0; }
.sv2-item-delete:hover { color: #EF4444; }
.sv2-add-item { margin-top: 6px; }
.sv2-add-input { width: 100%; padding: 8px 12px; border: 1px dashed #E5E5E5; border-radius: 8px; font-size: 13px; color: #1D1D1F; background: transparent; outline: none; transition: border-color 0.2s; }
.sv2-add-input:focus { border-color: #5856D6; border-style: solid; }
.sv2-add-input::placeholder { color: #C7C7CC; }

/* ---- Roadmap ---- */
.sv2-roadmap-header { margin-bottom: 24px; }
.sv2-roadmap-progress { display: flex; align-items: center; gap: 16px; }
.sv2-roadmap-pct { font-size: 28px; font-weight: 700; color: #1D1D1F; }
.sv2-roadmap-bar { flex: 1; height: 6px; }
.sv2-roadmap-count { font-size: 13px; color: #6E6E73; white-space: nowrap; }
.sv2-roadmap-timeline { position: relative; padding-left: 24px; border-left: 2px solid #E5E5E5; }
.sv2-month { margin-bottom: 32px; position: relative; }
.sv2-month-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; margin-left: -33px; }
.sv2-month-dot { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #D1D5DB; flex-shrink: 0; }
.sv2-month-dot-done { background: #34C759; border-color: #34C759; }
.sv2-month-title { font-size: 17px; font-weight: 600; color: #1D1D1F; margin: 0; }
.sv2-month-badge { font-size: 12px; color: #86868B; background: #F5F5F7; padding: 2px 10px; border-radius: 10px; }
.sv2-month-tasks { display: flex; flex-direction: column; gap: 6px; }
.sv2-roadmap-task { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: #FAFAFA; border: 1px solid #F0F0F0; transition: all 0.15s; }
.sv2-roadmap-task:hover { background: #F5F5F7; border-color: #E5E5E5; }
.sv2-roadmap-task-done { opacity: 0.6; }
.sv2-roadmap-task-done .sv2-roadmap-text { text-decoration: line-through; color: #86868B; }
.sv2-roadmap-goal { border-left: 3px solid #FF3B30; }
.sv2-roadmap-decision { border-left: 3px solid #5856D6; }
.sv2-roadmap-check { width: 18px; height: 18px; border-radius: 5px; border: 2px solid #D1D5DB; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; transition: all 0.15s; }
.sv2-roadmap-text { font-size: 14px; color: #1D1D1F; flex: 1; }
.sv2-roadmap-branch { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.sv2-roadmap-type { font-size: 11px; white-space: nowrap; }
.sv2-type-goal { color: #FF3B30; }
.sv2-type-decision { color: #5856D6; }
.sv2-type-deadline { color: #FF9500; }

/* ---- Goals Tree ---- */
.sv2-goals { display: flex; flex-direction: column; align-items: center; }
.sv2-goal-root { margin-bottom: 0; }
.sv2-goal-root-inner { display: flex; flex-direction: column; align-items: center; padding: 28px 48px; background: linear-gradient(135deg, #FF3B30, #FF6B6B); border-radius: 20px; color: #fff; text-align: center; box-shadow: 0 8px 32px rgba(255,59,48,0.25); }
.sv2-goal-root-icon { font-size: 32px; margin-bottom: 8px; }
.sv2-goal-root-text { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.sv2-goal-root-badge { font-size: 13px; opacity: 0.85; }
.sv2-goal-connector { width: 2px; height: 32px; background: #E5E5E5; }
.sv2-goal-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; width: 100%; }
.sv2-goal-branch { background: #fff; border-radius: 16px; border: 1px solid #E5E5E5; padding: 20px; transition: all 0.2s; border-top: 3px solid var(--gc, #64748B); }
.sv2-goal-branch:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.sv2-goal-branch-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sv2-goal-branch-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sv2-goal-branch-title { font-size: 15px; font-weight: 600; color: #1D1D1F; margin: 0; }
.sv2-goal-branch-desc { font-size: 12px; color: #6E6E73; margin: 2px 0 0; }
.sv2-goal-items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sv2-goal-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #1D1D1F; line-height: 1.4; }
.sv2-goal-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }

/* ---- Dependencies Graph ---- */
.sv2-deps { }
.sv2-deps-legend { display: flex; gap: 24px; padding: 12px 0; margin-bottom: 20px; border-bottom: 1px solid #F0F0F0; }
.sv2-deps-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #6E6E73; }
.sv2-deps-line { display: inline-block; width: 24px; height: 2px; border-radius: 1px; }
.sv2-deps-line-normal { background: #CBD5E1; background-image: repeating-linear-gradient(90deg, #CBD5E1 0, #CBD5E1 6px, transparent 6px, transparent 10px); }
.sv2-deps-line-critical { background: #FF3B30; }
.sv2-deps-node-blocker-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 2px solid #FF3B30; background: #FEE2E2; }
.sv2-deps-graph { position: relative; padding: 20px 0; }
.sv2-deps-row { display: flex; align-items: center; gap: 16px; margin-bottom: 48px; position: relative; z-index: 1; }
.sv2-deps-row:last-of-type { margin-bottom: 0; }
.sv2-deps-row-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #86868B; width: 90px; flex-shrink: 0; text-align: right; }
.sv2-deps-row-nodes { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; justify-content: center; }
.sv2-deps-node { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: #fff; border: 1px solid #E5E5E5; border-radius: 12px; font-size: 13px; font-weight: 500; color: #1D1D1F; transition: all 0.2s; cursor: default; }
.sv2-deps-node:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }
.sv2-deps-node-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sv2-deps-node-label { white-space: nowrap; }
.sv2-deps-goal { background: linear-gradient(135deg, #FF3B30, #FF6B6B); color: #fff; border-color: transparent; font-weight: 600; font-size: 14px; padding: 14px 24px; }
.sv2-deps-goal .sv2-deps-node-dot { background: #fff !important; }
.sv2-deps-blocker { border: 2px dashed #FF3B30; background: #FFF5F5; }
.sv2-deps-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; }

/* Dependency hover highlighting */
.sv2-deps-node-dim { opacity: 0.2; transition: opacity 0.2s; }
.sv2-deps-node-highlight { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 2; transition: all 0.2s; }
.sv2-edge-highlight path { stroke-width: 3 !important; opacity: 1 !important; }
.sv2-edge-highlight polygon { transform: scale(1.3); transform-origin: center; }
.sv2-edge-dim { opacity: 0.08; transition: opacity 0.2s; }
.sv2-edge-highlight:not(.sv2-edge-critical) path { stroke: #5856D6 !important; stroke-dasharray: none !important; }
.sv2-edge-highlight:not(.sv2-edge-critical) polygon { fill: #5856D6 !important; }

/* ---- Branch Actions ---- */
.sv2-branch-actions { display: flex; gap: 8px; padding: 12px 0 8px; }
.sv2-btn-export { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--bc, #5856D6); background: color-mix(in srgb, var(--bc, #5856D6) 6%, white); color: var(--bc, #5856D6); transition: all 0.2s; }
.sv2-btn-export:hover { background: color-mix(in srgb, var(--bc, #5856D6) 12%, white); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.sv2-btn-export:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- Subbranch Actions ---- */
.sv2-sub-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity 0.15s; }
.sv2-subbranch:hover .sv2-sub-actions { opacity: 1; }
.sv2-btn-icon { background: none; border: none; cursor: pointer; font-size: 14px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: #86868B; transition: all 0.15s; }
.sv2-btn-icon:hover { background: #F5F5F7; color: #1D1D1F; }
.sv2-btn-icon-del:hover { background: #FEE2E2; color: #EF4444; }

/* ---- Item Actions ---- */
.sv2-item-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity 0.15s; flex-shrink: 0; }
.sv2-item:hover .sv2-item-actions { opacity: 1; }
.sv2-item-action { background: none; border: none; cursor: pointer; font-size: 12px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 5px; color: #86868B; transition: all 0.15s; }
.sv2-item-action:hover { background: #F5F5F7; color: #5856D6; }
.sv2-item-action-del:hover { background: #FEE2E2; color: #EF4444; }

/* ---- Export Modal ---- */
.sv2-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: sv2-fadeIn 0.2s ease; }
@keyframes sv2-fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sv2-modal { background: #fff; border-radius: 20px; width: 100%; max-width: 680px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: sv2-slideUp 0.25s ease; }
@keyframes sv2-slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.sv2-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #F0F0F0; }
.sv2-modal-header h2 { font-size: 18px; font-weight: 600; color: #1D1D1F; margin: 0; }
.sv2-modal-close { background: none; border: none; font-size: 18px; color: #86868B; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.sv2-modal-close:hover { background: #F5F5F7; color: #1D1D1F; }
.sv2-modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.sv2-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid #F0F0F0; }

/* ---- Export Form ---- */
.sv2-export-field { margin-bottom: 16px; }
.sv2-export-field label { display: block; font-size: 13px; font-weight: 600; color: #1D1D1F; margin-bottom: 6px; }
.sv2-export-input { width: 100%; padding: 10px 14px; border: 1px solid #E5E5E5; border-radius: 10px; font-size: 14px; color: #1D1D1F; outline: none; transition: border-color 0.2s; box-sizing: border-box; font-family: inherit; }
.sv2-export-input:focus { border-color: #5856D6; }

.sv2-export-backlog { display: flex; flex-direction: column; gap: 10px; }
.sv2-export-task { background: #FAFAFA; border: 1px solid #F0F0F0; border-radius: 12px; padding: 14px; transition: all 0.15s; }
.sv2-export-task:hover { border-color: #E5E5E5; }
.sv2-export-task-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sv2-exp-check { width: 16px; height: 16px; accent-color: #5856D6; cursor: pointer; }
.sv2-exp-type, .sv2-exp-priority { padding: 4px 8px; border: 1px solid #E5E5E5; border-radius: 6px; font-size: 12px; background: #fff; color: #475569; cursor: pointer; }
.sv2-exp-task-title { width: 100%; padding: 8px 10px; border: 1px solid #E5E5E5; border-radius: 8px; font-size: 13px; color: #1D1D1F; outline: none; box-sizing: border-box; }
.sv2-exp-task-title:focus { border-color: #5856D6; }

.sv2-exp-subtasks { margin-top: 8px; padding-left: 24px; display: flex; flex-direction: column; gap: 4px; }
.sv2-exp-subtask { display: flex; align-items: center; gap: 6px; }
.sv2-exp-st-check { width: 14px; height: 14px; accent-color: #5856D6; cursor: pointer; }
.sv2-exp-st-text { flex: 1; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; color: #475569; outline: none; background: transparent; }
.sv2-exp-st-text:focus { border-color: #5856D6; background: #fff; }

.sv2-exp-labels { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.sv2-exp-label { font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 10px; background: #EDE9FE; color: #7C3AED; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sv2-header { flex-direction: column; align-items: flex-start; }
    .sv2-tabs { width: 100%; overflow-x: auto; }
    .sv2-stats-bar { flex-wrap: wrap; gap: 16px; }
    .sv2-branch-header { flex-wrap: wrap; padding: 16px; }
    .sv2-branch-goal { white-space: normal; }
    .sv2-deps-row { flex-direction: column; gap: 8px; }
    .sv2-deps-row-label { width: auto; text-align: left; }
    .sv2-goal-branches { grid-template-columns: 1fr; }
}
