body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #1f2937;
    background:
        radial-gradient(circle at top left, rgba(27, 94, 32, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.10), transparent 24%),
        linear-gradient(180deg, #f7fafc 0%, #eef4f7 100%);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 20px 48px;
    overflow-x: hidden;
}

h1 {
    margin: 0 0 24px;
    text-align: center;
    color: #0f172a;
    letter-spacing: 0.02em;
}

h2 {
    margin: 0 0 14px;
    color: #0f172a;
}

.panel {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    padding: 24px;
}

#inputArea {
    margin-bottom: 18px;
}

.section-heading {
    margin-top: 18px;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin-bottom: 6px;
}

.section-heading p {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
}

#inputArea label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: #334155;
}

#projectName,
.task-table input,
.task-table select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    padding: 10px 12px;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#projectName:focus,
.task-table input:focus,
.task-table select:focus {
    outline: none;
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: #fff;
    max-width: 100%;
    min-width: 0;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.task-table th,
.task-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px;
    vertical-align: middle;
}

.task-table th {
    text-align: left;
    font-size: 0.88rem;
    color: #475569;
    background: #f8fafc;
}

.task-table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.task-table td:last-child,
.task-table th:last-child {
    text-align: center;
    width: 90px;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 700;
}

.controls {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

button {
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    padding: 11px 18px;
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

#generateBtn,
.secondary-btn {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #fff;
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.22);
}

#generateBtn:hover,
.secondary-btn:hover {
    background: linear-gradient(135deg, #0f6b64, #0f4f4b);
}

#clearBtn,
.ghost-btn,
.row-delete-btn {
    background: #e2e8f0;
    color: #0f172a;
}

#clearBtn:hover,
.ghost-btn:hover,
.row-delete-btn:hover {
    background: #cbd5e1;
}

#errorMessage {
    display: none;
    margin: 18px 0;
    padding: 12px 14px;
    border-radius: 14px;
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

#outputArea {
    margin-top: 18px;
}

.output-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.output-card {
    background: rgba(255, 255, 255, 0.88);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 20px;
    min-width: 0;
}

.wbs-output,
.gantt-output {
    min-height: 120px;
    min-width: 0;
}

.empty-state {
    margin: 0;
    color: #64748b;
}

.wbs-tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.wbs-tree ul {
    list-style: none;
    padding-left: 18px;
    margin: 10px 0 0;
}

.task-item {
    margin-bottom: 12px;
    padding: 14px 14px 12px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.task-name {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.task-meta,
.task-assignee {
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.5;
}

.task-assignee {
    margin-top: 4px;
}

.gantt-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    color: #334155;
    font-size: 0.92rem;
}

.gantt-scroll {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    max-width: 100%;
    min-width: 0;
}

.gantt-chart {
    --label-width: 280px;
    width: max-content;
    min-width: calc(var(--label-width) + var(--chart-width, 960px));
}

.gantt-header,
.gantt-row {
    display: grid;
    grid-template-columns: var(--label-width) 1fr;
}

.gantt-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.gantt-label-spacer {
    border-right: 1px solid #e2e8f0;
    min-height: 42px;
}

.gantt-timeline {
    display: flex;
}

.gantt-header-row {
    display: flex;
    width: 100%;
}

.gantt-day {
    flex: 0 0 auto;
    box-sizing: border-box;
    height: 42px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    color: #475569;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.gantt-day:last-child {
    border-right: 1px solid #e2e8f0;
}

.gantt-row {
    border-bottom: 1px solid #eef2f7;
    align-items: stretch;
}

.gantt-row:last-child {
    border-bottom: none;
}

.gantt-label {
    padding: 12px 14px;
    border-right: 1px solid #e2e8f0;
    background: #fff;
}

.gantt-label.depth-1 {
    padding-left: 24px;
}

.gantt-label.depth-2 {
    padding-left: 34px;
}

.gantt-label.depth-3 {
    padding-left: 44px;
}

.gantt-task-name {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.gantt-task-sub {
    font-size: 0.82rem;
    color: #64748b;
}

.gantt-track {
    position: relative;
    min-height: 56px;
    background-image: repeating-linear-gradient(
        to right,
        rgba(148, 163, 184, 0.18) 0,
        rgba(148, 163, 184, 0.18) 1px,
        transparent 1px,
        transparent var(--day-width, 32px)
    );
    background-color: #fff;
}

.gantt-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    box-shadow: 0 10px 18px rgba(15, 118, 110, 0.18);
    overflow: hidden;
    white-space: nowrap;
}

.gantt-bar.depth-1 {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}

.gantt-bar.depth-2 {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.gantt-bar.depth-3 {
    background: linear-gradient(135deg, #b45309, #f59e0b);
}

.gantt-bar-text {
    font-size: 0.78rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-bar-date {
    font-size: 0.72rem;
    opacity: 0.9;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .container {
        padding: 20px 12px 32px;
    }

    .panel {
        padding: 16px;
        border-radius: 16px;
    }

    .controls,
    .table-toolbar {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .gantt-chart {
        --label-width: 220px;
    }
}
