/* ===== Layout ===== */
.w-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}
@media (max-width: 1100px) {
    .w-layout { grid-template-columns: 1fr; }
}

/* ===== Plan card ===== */
.w-plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

/* ===== Toolbar ===== */
.w-toolbar {
    display: flex; flex-wrap: wrap;
    align-items: center; gap: 0.5rem;
    margin-bottom: 1rem;
}
.w-tool-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t);
}
.w-tool-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.w-tool-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}
.w-tool-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}
.w-tool-btn.danger:hover {
    color: var(--red);
    border-color: rgba(239,68,68,0.4);
    background: rgba(239,68,68,0.06);
}
.w-tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.w-filters {
    margin-left: auto;
    display: flex; gap: 0.4rem;
    flex-wrap: wrap;
}

/* ===== Empty ===== */
.w-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.w-empty-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }
.w-empty-text { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.25rem; max-width: 540px; margin-left: auto; margin-right: auto; }
.w-empty-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.65rem 1.4rem;
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    border-radius: var(--radius-xs);
    font-size: 0.9rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}
.w-empty-btn:hover { background: var(--accent-hover); }

/* ===== Form primitives ===== */
.w-field { margin-bottom: 1rem; }
.w-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 500;
}
.w-input, .w-textarea, .w-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--t);
}
.w-input:focus, .w-textarea:focus, .w-select:focus { border-color: var(--accent); }
.w-textarea { min-height: 60px; resize: vertical; line-height: 1.5; }
.w-select option { background: #1a1a1a; color: var(--text); }

.w-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.w-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; }
@media (max-width: 600px) {
    .w-row-2, .w-row-3 { grid-template-columns: 1fr; }
}

/* ===== Tabela ===== */
.w-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    overflow-x: auto;
}
.w-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
    min-width: 1100px;
}
.w-table thead th {
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    text-align: left;
    padding: 0.55rem 0.5rem;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.w-table tbody tr {
    border-bottom: 1px solid var(--border);
}
.w-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.w-table tbody td {
    padding: 0.35rem 0.4rem;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.w-table tbody td:nth-child(1) { width: 13%; }
.w-table tbody td:nth-child(2) { width: 14%; }
.w-table tbody td:nth-child(3) { width: 9%; }
.w-table tbody td:nth-child(4) { width: 8%; }
.w-table tbody td:nth-child(5) { width: 9%; }
.w-table tbody td:nth-child(6) { width: 14%; }
.w-table tbody td:nth-child(7) { width: 8%; }
.w-table tbody td:nth-child(8) { width: 9%; }
.w-table tbody td:nth-child(9) { width: 10%; }
.w-table tbody td:nth-child(10) { width: 4%; }

.w-cell {
    width: 100%;
    padding: 0.4rem 0.55rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: border-color var(--t), background var(--t);
}
.w-cell:hover { border-color: var(--border); }
.w-cell:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.05);
}
.w-cell-multi { resize: vertical; min-height: 56px; line-height: 1.4; }
.w-cell-select { padding-right: 1.2rem; }

/* highlight rows by priority */
.w-table tbody tr.w-pri-high td:first-child { border-left: 3px solid var(--red); }
.w-table tbody tr.w-pri-medium td:first-child { border-left: 3px solid var(--hl-orange); }
.w-table tbody tr.w-pri-low td:first-child { border-left: 3px solid var(--text-muted); }
.w-table tbody tr.w-st-done { opacity: 0.65; }
.w-table tbody tr.w-st-cancelled { opacity: 0.4; text-decoration: line-through; }

/* ===== Cards (mobile) ===== */
.w-cards { display: none; }
@media (max-width: 900px) {
    .w-table-wrap { display: none; }
    .w-cards { display: block; }
}
.w-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    margin-bottom: 0.85rem;
}
.w-card.w-pri-high { border-left: 4px solid var(--red); }
.w-card.w-pri-medium { border-left: 4px solid var(--hl-orange); }
.w-card.w-pri-low { border-left: 4px solid var(--text-muted); }
.w-card.w-st-done { opacity: 0.7; }
.w-card.w-st-cancelled { opacity: 0.45; }
.w-card-head {
    display: flex; align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

/* ===== Badges ===== */
.w-status-badge, .w-priority-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}
.w-status-badge.st-pending { background: rgba(255,255,255,0.06); color: var(--text-muted); border-color: var(--border); }
.w-status-badge.st-in_progress { background: rgba(100,181,246,0.12); color: var(--hl-blue); border-color: rgba(100,181,246,0.3); }
.w-status-badge.st-done { background: rgba(34,197,94,0.12); color: var(--green); border-color: rgba(34,197,94,0.3); }
.w-status-badge.st-cancelled { background: rgba(239,68,68,0.12); color: var(--red); border-color: rgba(239,68,68,0.3); }

.w-priority-badge.pri-high { background: rgba(239,68,68,0.12); color: var(--red); border-color: rgba(239,68,68,0.3); }
.w-priority-badge.pri-medium { background: rgba(255,183,77,0.12); color: var(--hl-orange); border-color: rgba(255,183,77,0.3); }
.w-priority-badge.pri-low { background: rgba(255,255,255,0.04); color: var(--text-muted); border-color: var(--border); }

.w-mini-btn {
    display: inline-flex; align-items: center;
    padding: 0.3rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t);
    margin-left: auto;
}
.w-mini-btn:hover { color: var(--accent); border-color: var(--accent); }
.w-mini-btn.danger:hover {
    color: var(--red);
    border-color: rgba(239,68,68,0.4);
}

/* ===== Sidebar ===== */
.w-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
}
@media (max-width: 1100px) {
    .w-sidebar { position: static; }
}
.w-sidebar-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
    margin-bottom: 0.85rem;
}
.w-stat {
    display: flex; justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.w-stat:last-of-type { border-bottom: none; }
.w-stat-label { color: var(--text-secondary); }
.w-stat-value { font-weight: 700; color: var(--text); font-size: 1rem; }
.w-stat-value.accent { color: var(--accent); }

.w-dist {
    display: flex; flex-direction: column;
    gap: 0.4rem;
}
.w-dist-item {
    display: flex; align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
}
.w-dist-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
}
.w-dist-item.st-pending .w-dist-dot { background: var(--text-muted); }
.w-dist-item.st-in_progress .w-dist-dot { background: var(--hl-blue); }
.w-dist-item.st-done .w-dist-dot { background: var(--green); }
.w-dist-item.st-cancelled .w-dist-dot { background: var(--red); }
.w-dist-item.pri-high .w-dist-dot { background: var(--red); }
.w-dist-item.pri-medium .w-dist-dot { background: var(--hl-orange); }
.w-dist-item.pri-low .w-dist-dot { background: var(--text-muted); }
.w-dist-label { flex: 1; color: var(--text-secondary); }
.w-dist-num { font-weight: 700; color: var(--text); }

.w-sidebar-actions {
    display: flex; flex-direction: column;
    gap: 0.4rem;
}
.w-side-btn {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--t);
    text-align: left;
}
.w-side-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.w-side-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}
.w-side-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}
.w-side-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.w-side-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.w-sidebar-help {
    color: var(--text-muted);
    font-size: 0.74rem;
    margin-top: 0.6rem;
    font-style: italic;
}

/* ===== Error ===== */
.w-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-xs);
    color: var(--red);
    font-size: 0.85rem;
}
