/* ═══════════════════════════════════════════
   Workflow View Styles
   ═══════════════════════════════════════════ */

.wf-view {
    padding: 16px;
    font-family: inherit;
    min-height: 400px;
}

/* ── Tab Nav ──────────────────────────────── */
.wf-tabnav {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.wf-tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #64748b;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: all .15s;
    font-family: inherit;
}

.wf-tab-btn:hover { background: #f1f5f9; color: #334155; }
.wf-tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 700; background: #eff6ff; }

/* ── Status Grid ──────────────────────────── */
.wf-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.wf-project-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .15s;
}

.wf-project-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.wf-card--no-wf { background: #f8fafc; border-style: dashed; }

.wf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.wf-card-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.wf-card-subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ── Progress ─────────────────────────────── */
.wf-progress-bar {
    background: #e2e8f0;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.wf-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 8px;
    transition: width .4s ease;
    min-width: 2px;
}

.wf-progress-label { font-size: 11px; color: #64748b; margin-bottom: 10px; }

/* ── Stages Strip ─────────────────────────── */
.wf-stages-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.wf-stage-pill {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.wf-stage--done    { background: #d1fae5; color: #065f46; }
.wf-stage--active  { background: #dbeafe; color: #1d4ed8; border: 2px solid #3b82f6; }
.wf-stage--pending { background: #f1f5f9; color: #94a3b8; }

/* ── Current Stage ────────────────────────── */
.wf-current-stage {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.wf-stage-name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #1e293b;
}

.wf-stage-progress {
    margin-right: auto;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

/* ── Tasks ────────────────────────────────── */
.wf-tasks-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.wf-task-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
}

.wf-task-row.wf-task--done { opacity: .6; text-decoration: line-through; }
.wf-task-icon { font-size: 14px; flex-shrink: 0; }
.wf-task-title { flex: 1; color: #334155; }

.wf-advance-row { text-align: left; margin-top: 8px; }

.wf-no-workflow {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
}

/* ── Buttons ──────────────────────────────── */
.wf-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #334155;
    transition: all .15s;
}

.wf-btn:hover { background: #f1f5f9; }
.wf-btn--primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.wf-btn--primary:hover { background: #1d4ed8; }
.wf-btn--danger { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.wf-btn--danger:hover { background: #fecaca; }

.wf-btn-sm {
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
    color: #334155;
    transition: all .15s;
}
.wf-btn-sm:hover { background: #f1f5f9; }
.wf-btn-sm.wf-btn--primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.wf-btn-sm.wf-btn--primary:hover { background: #1d4ed8; }
.wf-btn-sm.wf-btn--danger { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.wf-btn-ghost {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
}
.wf-btn-ghost:hover { background: #f1f5f9; }

/* ── Table ────────────────────────────────── */
.wf-table-wrap { overflow-x: auto; }

.wf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.wf-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: right;
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.wf-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.wf-table tr:hover td { background: #f8fafc; }

/* ── Badges ───────────────────────────────── */
.wf-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.wf-badge--green { background: #d1fae5; color: #065f46; }
.wf-badge--gray  { background: #f1f5f9; color: #94a3b8; }

/* ── Assign Row ───────────────────────────── */
.wf-assign-row { display: flex; gap: 6px; align-items: center; }

.wf-select {
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #334155;
    min-width: 160px;
}

/* ── Templates Layout ─────────────────────── */
.wf-tpl-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    min-height: 500px;
}

@media (max-width: 640px) {
    .wf-tpl-layout { grid-template-columns: 1fr; }
}

.wf-tpl-sidebar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.wf-tpl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
}

.wf-tpl-list { list-style: none; padding: 0; margin: 0; }

.wf-tpl-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}

.wf-tpl-item:hover { background: #eff6ff; }
.wf-tpl-item.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.wf-tpl-meta { font-size: 11px; color: #94a3b8; }

.wf-empty-li { padding: 16px 12px; color: #94a3b8; font-size: 13px; }

/* ── Template Detail ──────────────────────── */
.wf-tpl-detail {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
}

.wf-tpl-detail-view {}

.wf-tpl-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.wf-tpl-icon { font-size: 22px; margin-left: 6px; }
.wf-tpl-name { font-size: 16px; font-weight: 700; color: #1e293b; }
.wf-tpl-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.wf-tpl-desc { color: #64748b; font-size: 13px; margin-bottom: 14px; }

/* ── Stage Boxes ──────────────────────────── */
.wf-stages-list { display: flex; flex-direction: column; gap: 12px; }

.wf-stage-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.wf-stage-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.wf-stage-order { font-size: 11px; color: #94a3b8; font-weight: 400; }

.wf-stage-tasks { padding: 10px 14px; display: flex; flex-direction: column; gap: 5px; }

.wf-tpl-task {
    font-size: 13px;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wf-task-desc { color: #94a3b8; padding-right: 20px; }

/* ── Form Card ────────────────────────────── */
.wf-form-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-top: 16px;
}

.wf-form-card h3, .wf-form-card h4 {
    margin: 0 0 16px;
    color: #1e293b;
    font-size: 15px;
}

.wf-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.wf-form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #475569; }
.wf-full-col { grid-column: 1 / -1; }

.wf-input {
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    transition: border-color .15s;
    width: 100%;
    box-sizing: border-box;
}

.wf-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px #bfdbfe55; }

textarea.wf-input { resize: vertical; }
input[type="color"].wf-input { padding: 3px; height: 36px; }

.wf-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Stage Form ───────────────────────────── */
.wf-stage-form { border-top: 3px solid #3b82f6; }

.wf-stage-tasks-edit {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wf-task-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wf-task-edit-row .wf-input { flex: 1; }

.wf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #475569;
    white-space: nowrap;
    cursor: pointer;
}

/* ── History ──────────────────────────────── */
.wf-history-wrap { display: flex; flex-direction: column; gap: 16px; }

.wf-history-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wf-history-selector label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; }

.wf-action-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.wf-action-advance  { background: #d1fae5; color: #065f46; }
.wf-action-create   { background: #dbeafe; color: #1d4ed8; }
.wf-action-complete { background: #fef3c7; color: #92400e; }
.wf-action-start_stage { background: #ede9fe; color: #5b21b6; }

/* ── Toast ────────────────────────────────── */
.wf-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    animation: wf-fade-in .2s ease;
    max-width: 320px;
}

.wf-toast--success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.wf-toast--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.wf-toast--info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

@keyframes wf-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── States ───────────────────────────────── */
.wf-loading { padding: 40px; text-align: center; color: #64748b; font-size: 14px; }
.wf-error   { padding: 20px; color: #dc2626; background: #fee2e2; border-radius: 8px; font-size: 13px; }
.wf-empty   { padding: 40px; text-align: center; color: #94a3b8; font-size: 14px; }
.wf-empty-tasks { color: #94a3b8; font-size: 12px; padding: 4px 0; }
