﻿/* ============================================
   안전보건마법사 프리미엄 CSS
   ============================================ */

:root {
    --sw-primary: #0ea5e9;
    --sw-primary-dark: #0284c7;
    --sw-secondary: #8b5cf6;
    --sw-success: #10b981;
    --sw-warning: #f59e0b;
    --sw-danger: #ef4444;
    --sw-bg-dark: #0f172a;
    --sw-bg-card: #1e293b;
    --sw-bg-light: #f8fafc;
    --sw-text-light: #f1f5f9;
    --sw-text-muted: #94a3b8;
    --sw-border: rgba(255, 255, 255, 0.1);

    /* Document Specific Variables */
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --text-dark: #1e293b;
    --text-secondary: #64748b;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --control-bg: #fff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Main Container */
.sw-main {
    min-height: 100vh;
    background: var(--sw-bg-light);
}

/* Hero Section */
.sw-hero {
    position: relative;
    padding: 140px 20px 80px;
    text-align: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    overflow: hidden;
}

.sw-hero__bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.sw-hero__inner {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    z-index: 1;
}

.sw-badge {
    display: inline-block;
    background: rgba(14, 165, 233, 0.2);
    color: var(--sw-primary);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.sw-hero__title {
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.sw-hero__desc {
    font-size: 1.15rem;
    color: var(--sw-text-muted);
    line-height: 1.8;
}

/* Content Section */
.sw-content {
    padding: 60px 20px 100px;
}

.sw-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Action Cards Grid */
.sw-action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: -80px;
    position: relative;
    z-index: 10;
}

@media (max-width: 860px) {
    .sw-action-cards {
        grid-template-columns: 1fr;
        margin-top: -60px;
    }
}

.sw-card {
    display: block;
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    text-decoration: none;
}

.sw-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.sw-card--example:hover {
    border-color: var(--sw-primary);
}

.sw-card--create:hover {
    border-color: var(--sw-secondary);
}

.sw-card__icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 24px;
}

.sw-card--example .sw-card__icon {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: var(--sw-primary-dark);
}

.sw-card--create .sw-card__icon {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: var(--sw-secondary);
}

.sw-card__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.sw-card__desc {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.sw-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.sw-card__features li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    font-size: 0.9rem;
    padding: 6px 0;
}

.sw-card__features li i {
    color: var(--sw-success);
    font-size: 0.8rem;
}

.sw-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: gap 0.3s;
}

.sw-card--example .sw-card__cta {
    color: var(--sw-primary);
}

.sw-card--create .sw-card__cta {
    color: var(--sw-secondary);
}

.sw-card:hover .sw-card__cta {
    gap: 12px;
}

/* Reports Section */
.sw-reports-section {
    margin-top: 60px;
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
}

.sw-reports__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.sw-section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sw-section-title i {
    color: var(--sw-primary);
}

.sw-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.sw-btn--outline {
    background: transparent;
    color: var(--sw-primary);
    border: 1px solid var(--sw-primary);
}

.sw-btn--outline:hover {
    background: var(--sw-primary);
    color: #fff;
}

.sw-btn--primary {
    background: var(--sw-primary);
    color: #fff;
}

.sw-btn--primary:hover {
    background: var(--sw-primary-dark);
}

/* Report Cards Grid */
.sw-reports__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.sw-report-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.sw-report-card:hover {
    border-color: var(--sw-primary);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.1);
}

.sw-report-card__header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sw-report-card__type,
.sw-report-card__status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sw-report-card__type--example {
    background: #e0f2fe;
    color: #0284c7;
}

.sw-report-card__type--custom {
    background: #ede9fe;
    color: #7c3aed;
}

.sw-report-card__status--draft {
    background: #fef3c7;
    color: #92400e;
}

.sw-report-card__status--completed {
    background: #d1fae5;
    color: #065f46;
}

.sw-report-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.sw-report-card__business {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 4px;
}

.sw-report-card__date {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 16px;
}

.sw-report-card__actions {
    display: flex;
    gap: 8px;
}

.sw-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #64748b;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.sw-icon-btn:hover {
    background: var(--sw-primary);
    color: #fff;
}

/* Empty State */
.sw-reports__empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.sw-reports__empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.sw-reports__empty p {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #64748b;
}

.sw-reports__empty span {
    font-size: 0.9rem;
}

/* Guide Section */
.sw-guide-section {
    margin-top: 60px;
}

.sw-guide__content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.sw-guide__item {
    display: flex;
    gap: 16px;
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.sw-guide__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sw-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.sw-guide__text h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.sw-guide__text p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .sw-hero {
        padding: 80px 20px 60px;
    }

    .sw-hero__title {
        font-size: 2.2rem;
    }

    .sw-card {
        padding: 30px;
    }

    .sw-reports-section {
        padding: 24px;
    }

    .sw-reports__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* Back Link Style */
.sw-back-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #1e3a8a;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 30px;
    padding: 12px 24px 12px 16px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.08);
}

.sw-back-link:hover {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    transform: translateX(-4px);
    box-shadow: 0 4px 16px rgba(30, 58, 138, 0.15);
    text-decoration: none;
    color: #1e3a8a;
}

.sw-back-link i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #1e3a8a;
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: transform 0.3s;
}

.sw-back-link:hover i {
    transform: translateX(-3px);
}

/* ==========================================================================
   DOCUMENT & EDITOR STYLES (Migrated from example_modal_view.html)
   ========================================================================== */

/* Edit Mode Document Sheet Effect */
#docForm {
    background: #fff;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    max-width: 1000px;
    margin: 0 auto;
}

/* Edit Mode Toolbar */
.edit-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.edit-toolbar h1 {
    color: #fff;
    font-size: 1.25rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.btn-toolbar {
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-toolbar:active {
    transform: translateY(1px);
}

.btn-edit {
    background: var(--primary-color);
    color: #fff;
}

.btn-edit:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-save {
    background: #10b981;
    color: #fff;
}

.btn-save:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-cancel {
    background: #475569;
    color: #fff;
}

.btn-cancel:hover {
    background: #334155;
}

/* View Mode Styling */
.view-mode #docForm {
    box-shadow: none;
    padding: 20px 0;
    background: transparent;
}

.view-mode .form-input,
.view-mode .form-select,
.view-mode .form-textarea,
.view-mode input[type="text"],
.view-mode textarea {
    border: 1px solid transparent !important;
    background: transparent !important;
    resize: none;
    padding: 6px 0;
    box-shadow: none !important;
    pointer-events: none;
    color: var(--text-dark) !important;
}

.view-mode .btn-add-row,
.view-mode .row-controls,
.view-mode .btn-delete-row,
.view-mode .action-bar,
.view-mode .btn-outline-danger {
    display: none !important;
}

/* Hide Management Column in View Mode - uses explicit class, NOT :last-child */
.view-mode .col-management {
    display: none !important;
}

.view-mode .form-table th,
.view-mode .form-table td {
    border-color: #e2e8f0;
}

/* Smart Row Controls */
.row-controls {
    display: flex;
    gap: 3px;
    justify-content: center;
    align-items: center;
    opacity: 0.1;
    /* Extra subtle, only shows on hover */
    transition: opacity 0.2s ease;
}

tr:hover .row-controls,
.input-group:hover .row-controls {
    opacity: 1;
}

.btn-control {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--control-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-control:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-delete-row {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffe4e6;
    color: var(--danger-color);
    border: 1px solid #fda4af;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 4px;
    transition: all 0.2s;
}

.btn-delete-row:hover {
    background: var(--danger-color);
    color: #fff;
    border-color: var(--danger-color);
    transform: scale(1.1);
}

/* Input Styling */
.form-input,
.form-select,
.form-textarea,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #1e293b;
    resize: vertical;
    transition: all 0.2s;
    line-height: 1.5;
}

textarea.auto-resize {
    resize: none;
    overflow-y: hidden;
    min-height: 38px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table Styling */
.form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.form-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    background: #fff;
    transition: background 0.1s;
}

.form-table tr:last-child td {
    border-bottom: none;
}

.form-table tr:hover td {
    background: #f8fafc;
}

/* Add Row Button */
.btn-add-row {
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 2px dashed #cbd5e1;
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-add-row:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eff6ff;
}

/* Titles */
.doc-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.doc-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 30px 0 15px;
    display: flex;
    align-items: center;
}

/* Visual Tweaks for specific tables */
.risk-table th,
#goalsTable th,
#emergencyTable th,
#budgetTable th {
    text-align: center;
}

/* Action Bar for Save Buttons at bottom */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

/* Organization Chart Editor */
.org-chart-editor {
    display: flex;
    justify-content: center;
    padding: 40px 0;
    overflow-x: auto;
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 30px;
}

.org-tree-editor,
.org-tree-editor ul,
.org-tree-editor li {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.org-tree-editor {
    display: table;
    margin: 0 auto;
}

.org-tree-editor ul {
    display: flex;
    justify-content: center;
    padding-top: 20px;
}

.org-tree-editor li {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 20px 10px 0 10px;
}

/* Connectors */
.org-tree-editor li::before,
.org-tree-editor li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #cbd5e1;
    width: 50%;
    height: 20px;
}

.org-tree-editor li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #cbd5e1;
}

.org-tree-editor li:only-child::after,
.org-tree-editor li:only-child::before {
    display: none;
}

.org-tree-editor li:only-child {
    padding-top: 0;
}

.org-tree-editor li:first-child::before,
.org-tree-editor li:last-child::after {
    border: 0 none;
}

.org-tree-editor li:last-child::before {
    border-right: 2px solid #cbd5e1;
    border-radius: 0 5px 0 0;
}

.org-tree-editor li:first-child::after {
    border-radius: 5px 0 0 0;
}

.org-tree-editor ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #cbd5e1;
    width: 0;
    height: 20px;
    transform: translateX(-50%);
}

.org-node-editor {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    position: relative;
    z-index: 10;
}

.org-node-editor.level-1 {
    border-top: 4px solid #3b82f6;
}

.org-node-editor.level-2 {
    border-top: 4px solid #22c55e;
}

.org-node-editor.level-3 {
    border-top: 4px solid #f59e0b;
}

.org-role-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.org-input {
    text-align: center;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-weight: 600;
    font-size: 1rem;
}

.org-input:focus {
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===================================================================
   ORG CHART - Premium Styles (Shared across all templates)
   Compatible with OrgChartManager: chart-hierarchical, staff-container,
   normal-list, org-node classes
   =================================================================== */

/* Wrapper */
.org-chart-wrapper {
    margin-bottom: 30px;
    padding: 0;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: auto;
}

body.edit-mode .org-chart-wrapper {
    resize: none !important;
}

/* Container */
.org-chart-container {
    width: 100%;
    overflow: auto;
    padding: 0;
    min-height: 250px;
    position: relative;
    background: transparent !important;
    border: none !important;
}

.org-chart-container::-webkit-scrollbar {
    height: 8px;
}

.org-chart-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.org-chart-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Canvas centering */
.org-chart-canvas {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: min-content;
}

/* Root ul centering: inline-flex allows the parent flexbox to center the tree */
.org-chart-canvas>ul {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Node Card Styles */
.org-node {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    width: 200px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    position: relative;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 5;
}

.org-node:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.org-node .node-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.org-node .node-text {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.node-role {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    border: none !important;
    background: transparent !important;
    text-align: center;
    width: 100%;
}

.node-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    border: 1px solid transparent !important;
    background: transparent !important;
    text-align: center;
    width: 100%;
    padding: 2px;
    border-radius: 4px;
}

.node-dept {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-align: center;
    width: 100%;
    padding: 2px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 2px;
}

.node-name-input {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    width: 100%;
    padding: 2px;
}

.edit-mode .node-name:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

/* Level Color Overrides */
.org-node.level-1 {
    border-top: 4px solid #3b82f6;
}

.org-node.level-1 .node-icon {
    background: #eff6ff;
    color: #3b82f6;
}

.org-node.level-2 {
    border-top: 4px solid #10b981;
}

.org-node.level-2 .node-icon {
    background: #ecfdf5;
    color: #10b981;
}

/* Staff (Pink) Override */
.node-staff .org-node,
.org-node.node-staff {
    border-top-color: #ec4899 !important;
}

.node-staff .node-icon,
.org-node.node-staff .node-icon {
    background: #fdf2f8 !important;
    color: #ec4899 !important;
}

.org-node.level-3 {
    border-top: 4px solid #3b82f6;
}

.org-node.level-3 .node-icon {
    background: #eff6ff;
    color: #3b82f6;
}

.org-node.level-4 {
    border-top: 1px solid #cbd5e1;
}

.org-node.level-4 .node-icon {
    background: #f8fafc;
    color: #64748b;
}

/* === Hierarchical Connectors === */
.chart-hierarchical ul {
    display: flex;
    justify-content: center;
    padding-top: 15px;
    position: relative;
    list-style: none;
    margin: 0;
    padding-left: 0;
}

/* Override: Root ul must be inline-flex for centering */
.chart-hierarchical>ul {
    display: inline-flex !important;
}

.chart-hierarchical li {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 25px 10px 0 10px;
}

.chart-hierarchical li::before,
.chart-hierarchical li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #cbd5e1;
    width: 50%;
    height: 25px;
}

.chart-hierarchical li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #cbd5e1;
}

.chart-hierarchical li:only-child::after,
.chart-hierarchical li:only-child::before {
    display: none;
}

.chart-hierarchical li:only-child {
    padding-top: 0;
}

.chart-hierarchical li:first-child::before,
.chart-hierarchical li:last-child::after {
    border: 0 none;
}

.chart-hierarchical li:last-child::before {
    border-right: 2px solid #cbd5e1;
    border-radius: 0 5px 0 0;
}

.chart-hierarchical li:first-child::after {
    border-radius: 5px 0 0 0;
}

.chart-hierarchical ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #cbd5e1;
    width: 0;
    height: 25px;
    transform: translateX(-50%);
}

/* [SVG 전환] SVG 커넥터를 사용하는 OrgChartManager 영역에서만 CSS 커넥터 숨김 */
.svg-connectors .chart-hierarchical li::before,
.svg-connectors .chart-hierarchical li::after,
.svg-connectors .chart-hierarchical ul ul::before {
    display: none !important;
}

.svg-connectors .chart-hierarchical li:only-child {
    padding-top: 0;
}

/* === Grid Layout: CEO + Staff + Departments === */

/* CEO li → Flex (Steam-centric model handled by premium.css) */
.chart-hierarchical>ul>li {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    position: relative;
}

/* CEO card: col 1, row 1 */
.chart-hierarchical>ul>li>.org-node {
    grid-column: 1;
    grid-row: 1;
}

/* Staff Container: col 2, row 1 */
.staff-container.side-layout {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 !important;
    list-style: none;
    margin: 0;
    align-self: center;
}

/* Remove hierarchical connectors from staff container */
.staff-container.side-layout::before {
    display: none !important;
}

.staff-container.side-layout>li {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.staff-container.side-layout>li::before,
.staff-container.side-layout>li::after {
    display: none !important;
}

/* Staff node width: auto for long names */
.staff-container.side-layout .org-node {
    width: auto;
    min-width: 180px;
    max-width: 250px;
}

/* CEO → Staff horizontal connector */
.staff-container.side-layout::after {
    content: '';
    position: absolute;
    left: -50px;
    top: 50%;
    width: 50px;
    height: 2px;
    background: #cbd5e1;
    display: block !important;
}

/* Normal List (departments): col 1, row 2 */
.normal-list {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    justify-content: center;
    padding-top: 25px;
    position: relative;
    list-style: none;
    margin: 0;
    padding-left: 0;
}

/* CEO → Department vertical connector */
.normal-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #cbd5e1;
    width: 0;
    height: 25px;
    transform: translateX(-50%);
}

.normal-list>li {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 25px 15px 0 15px;
}

/* Department horizontal + vertical branch connectors */
.normal-list>li::before,
.normal-list>li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #cbd5e1;
    width: 50%;
    height: 25px;
}

.normal-list>li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #cbd5e1;
}

.normal-list>li:only-child::after,
.normal-list>li:only-child::before {
    display: none;
}

.normal-list>li:only-child {
    padding-top: 25px;
}

/* Keep vertical connector for only-child */
.normal-list>li:only-child::after {
    display: block !important;
    border-top: none;
    border-left: 2px solid #cbd5e1;
    left: 50%;
    width: 0;
}

.normal-list>li:first-child::before,
.normal-list>li:last-child::after {
    border: 0 none;
}

.normal-list>li:last-child::before {
    border-right: 2px solid #cbd5e1;
    border-radius: 0 5px 0 0;
}

.normal-list>li:first-child::after {
    border-radius: 5px 0 0 0;
}

/* [SVG 전환] SVG 커넥터를 사용하는 OrgChartManager 영역에서만 CSS 커넥터 숨김 */
.svg-connectors .normal-list::before,
.svg-connectors .normal-list>li::before,
.svg-connectors .normal-list>li::after {
    display: none !important;
}

/* Node Controls (edit mode) */
.node-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    pointer-events: none;
    z-index: 100;
}

.edit-mode .org-node .node-controls {
    display: block;
    /* Always show in edit mode */
}

.btn-node-add,
.btn-node-del {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    position: absolute;
    top: -10px;
    pointer-events: auto;
}

.btn-node-add {
    background: #10b981;
    color: #fff;
    left: -10px;
}

.btn-node-add:hover {
    background: #059669;
    transform: scale(1.1);
}

.btn-node-del {
    background: #ef4444;
    color: #fff;
    right: -10px;
}

.btn-node-del:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.btn-node-action {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
}

.btn-node-action:hover {
    background: #f1f5f9;
    color: #3b82f6;
}

.btn-node-action.delete:hover {
    color: #ef4444;
}

/* Circular chart layout */
.chart-circular .org-chart-canvas {
    align-items: center;
    min-height: 650px;
}

/* Flat chart layout */
.chart-flat .org-chart-canvas,
.chart-flat .chart-flat {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 450px !important;
}

.chart-flat #orgChartCanvas>ul,
.chart-flat #customOrgChartCanvas>ul {
    padding-left: 0 !important;
    display: inline-flex !important;
    flex-direction: column !important;
    margin: 0 auto !important;
}

.chart-flat .org-node {
    margin: 0 !important;
}

/* ===== Org Layout Choice Cards (Shared) ===== */
.org-layout-options {
    display: flex !important;
    justify-content: center;
    gap: 16px;
    margin: 40px 0;
    flex-wrap: nowrap;
}

.org-layout-card {
    flex: 1;
    min-width: 120px;
    max-width: 240px;
    background: #ffffff;
    border: 2px solid #f1f5f9;
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    overflow: visible;
}

.org-layout-card:hover {
    border-color: #93c5fd;
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.1), 0 10px 10px -5px rgba(59, 130, 246, 0.04);
}

.org-layout-card:hover .layout-svg-icon {
    transform: scale(1.1);
}

.org-layout-card.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.15), 0 10px 10px -5px rgba(59, 130, 246, 0.05);
}

.org-layout-card.active .layout-svg-icon rect,
.org-layout-card.active .layout-svg-icon circle,
.org-layout-card.active .layout-svg-icon path {
    stroke: #3b82f6;
    fill-opacity: 0.15;
}

.org-layout-card .layout-svg-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    transition: all 0.4s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.org-layout-card .layout-name {
    font-weight: 800;
    color: #334155;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

/* Nudge Selection Check */
.org-layout-card .selection-check {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    background: #3b82f6;
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0;
    transform: translate(10px, -10px) rotate(15deg) scale(0.5);
    transition: all 0.5s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    box-shadow: 4px 6px 15px rgba(59, 130, 246, 0.4);
    z-index: 10;
}

.org-layout-card.active .selection-check {
    opacity: 1;
    transform: translate(0, 0) rotate(0) scale(1);
    animation: nudgeBounce 0.6s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

@keyframes nudgeBounce {
    0% {
        transform: scale(0.5);
    }

    60% {
        transform: scale(1.15);
    }

    80% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

/* Print Specific Styles */
@media print {

    /* Global Reset for Print */
    *,
    *::before,
    *::after {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        margin: 0;
        padding: 0;
        background: white !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide UI Elements */
    .edit-toolbar,
    .btn-add-row,
    .row-controls,
    .action-bar,
    .sw-back-link,
    .sw-btn,
    .btn,
    header.main-header,
    .sw-hero,
    .sw-action-cards {
        display: none !important;
    }

    /* Hide Management Column in Print - uses explicit class, NOT :last-child */
    .col-management {
        display: none !important;
    }

    /* Layout Adjustments */
    .sw-main,
    .sw-content,
    .sw-container,
    .sw-reports-section,
    .view-mode #docForm,
    #docForm {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
        display: block !important;
        /* Ensure visibility */
    }

    /* Typography & Tables */
    h1,
    h2,
    h3,
    h4,
    .doc-title,
    .doc-subtitle {
        color: #000 !important;
        page-break-after: avoid;
    }

    .doc-section {
        border-bottom: 2px solid #eee;
        margin-bottom: 20px;
    }

    table,
    tr,
    td,
    th {
        page-break-inside: avoid;
        border-color: #000 !important;
    }

    /* Form Inputs & Textareas */
    .form-input,
    .form-select,
    .form-textarea,
    textarea,
    input {
        border: none !important;
        padding: 4px 0 !important;
        background: transparent !important;
        color: #000 !important;
        width: 100% !important;
        resize: none !important;
    }

    /* specific highlighting for headers */
    .bg-light {
        background-color: #f0f0f0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ===== 전역 스크롤바 제거 ===== */
    *::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    * {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }

    /* ===== 조직도 인쇄 최적화 ===== */
    .org-chart-controls,
    .org-chart-container .btn-group,
    .layout-btn,
    .cover-edit-hint,
    .logo-edit-controls {
        display: none !important;
    }

    .org-chart-container,
    #orgChartSection {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #orgChartCanvas {
        overflow: visible !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        min-height: auto !important;
        width: 100% !important;
    }

    /* ===== Overflow 제거 (전역) ===== */
    body,
    html,
    .sw-main,
    .sw-content,
    .sw-container {
        overflow: visible !important;
    }

    /* ===== 편집 모드 인쇄 시 cover-edit-input 정리 ===== */
    .cover-edit-input {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    /* ===== 노드 이미지 선택 버튼 숨김 ===== */
    .node-image-btn,
    .node-image-placeholder {
        display: none !important;
    }
}