/* ========================================================================
   Matriz RACI — estilos
   Tokens: tools-base.css
   ======================================================================== */

/* ============= LEGENDA ============= */
.raci-legend {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.raci-legend-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.65rem;
}
.raci-legend-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
@media (max-width: 720px) {
    .raci-legend-grid { grid-template-columns: 1fr 1fr; }
}
.raci-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.raci-legend-item strong {
    display: block;
    color: var(--text);
    font-weight: 700;
    font-size: 0.83rem;
    margin-bottom: 1px;
}
.raci-legend-item span {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* ============= TOOLBAR ============= */
.raci-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.95rem 1.1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}
.raci-toolbar-project { flex: 1 1 280px; }
.raci-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.raci-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}
.raci-input {
    width: 100%;
    padding: 0.5rem 0.8rem;
    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);
}
.raci-input:focus { border-color: var(--accent); }

.raci-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}
.raci-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.raci-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.raci-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.raci-btn.primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.raci-btn.danger:hover:not(:disabled) {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.06);
}

/* ============= LAYOUT ============= */
.raci-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 980px) {
    .raci-layout { grid-template-columns: 1fr; }
}

/* ============= TABELA ============= */
.raci-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    overflow-x: auto;
}
.raci-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    min-width: 540px;
    font-size: 0.85rem;
}
.raci-table th,
.raci-table td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 0;
    vertical-align: middle;
    background: transparent;
}
.raci-table thead th {
    background: rgba(255,255,255,0.02);
    border-top: 1px solid var(--border);
}
.raci-table tr:last-child th,
.raci-table tr:last-child td {
    border-bottom: 0;
}

.raci-th-task {
    text-align: left;
    padding: 0.6rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-width: 200px;
    border-left: 1px solid var(--border);
    border-top-left-radius: var(--radius-xs);
}
.raci-th-person {
    min-width: 140px;
    max-width: 180px;
    padding: 0.5rem 0.5rem;
    background: rgba(255,255,255,0.02);
    position: relative;
}
.raci-th-inner {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 1.4rem;
    position: relative;
}
.raci-th-input {
    width: 100%;
    padding: 0.32rem 0.45rem;
    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.82rem;
    font-weight: 600;
    outline: none;
    transition: border-color var(--t);
}
.raci-th-input.raci-th-input-sm {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
}
.raci-th-input:focus { border-color: var(--accent); }
.raci-th-x {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
}
.raci-th-x:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}
.raci-th-x svg {
    width: 11px;
    height: 11px;
}

.raci-th-add {
    width: 38px;
    text-align: center;
    border-right: 1px solid var(--border);
    border-top-right-radius: var(--radius-xs);
}

.raci-th-row {
    text-align: left;
    padding: 0.4rem 0.5rem;
    background: rgba(255,255,255,0.02);
    border-left: 1px solid var(--border);
    min-width: 200px;
}
.raci-th-row-inner {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.raci-row-input {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.55rem;
    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.84rem;
    font-weight: 500;
    outline: none;
    transition: border-color var(--t);
}
.raci-row-input:focus { border-color: var(--accent); }
.raci-row-x {
    width: 22px;
    height: 22px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--t);
}
.raci-row-x:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}
.raci-row-x svg {
    width: 11px;
    height: 11px;
}

.raci-th-row-add {
    text-align: center;
    padding: 0.45rem;
}

.raci-cell {
    width: 80px;
    min-width: 80px;
    padding: 0;
    text-align: center;
}
.raci-cell-pad {
    background: transparent;
    border-right: 1px solid var(--border);
}

.raci-cell-btn {
    width: 100%;
    height: 44px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
    letter-spacing: 0.02em;
}
.raci-cell-btn:hover { background: rgba(255,255,255,0.04); }
.raci-cell-btn.r {
    background: rgba(34, 197, 94, 0.18);
    color: var(--green);
}
.raci-cell-btn.r:hover { background: rgba(34, 197, 94, 0.28); }
.raci-cell-btn.a {
    background: rgba(100, 181, 246, 0.18);
    color: var(--hl-blue);
}
.raci-cell-btn.a:hover { background: rgba(100, 181, 246, 0.28); }
.raci-cell-btn.c {
    background: rgba(255, 235, 59, 0.18);
    color: var(--yellow);
}
.raci-cell-btn.c:hover { background: rgba(255, 235, 59, 0.28); }
.raci-cell-btn.i {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}
.raci-cell-btn.i:hover { background: rgba(255, 255, 255, 0.10); }

/* ============= MINI BTN (+) ============= */
.raci-mini-btn {
    width: 28px;
    height: 28px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px dashed rgba(23, 141, 154, 0.4);
    border-radius: 50%;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
    line-height: 1;
}
.raci-mini-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ============= EMPTY ============= */
.raci-empty {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
}
.raci-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.raci-empty-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.raci-empty-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.raci-hint {
    text-align: center;
    margin-top: 0.85rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
}

.raci-error {
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.9rem;
    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.82rem;
}

/* ============= SIDEBAR ============= */
.raci-side {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.1rem 1.25rem;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.raci-side h3 {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.7rem;
}

.raci-validation {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.raci-validation:last-of-type { border-bottom: 0; padding-bottom: 0; }
.raci-val-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.45rem;
}
.raci-val-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.raci-val-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-xs);
    font-size: 0.76rem;
}
.raci-val-item.warn {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--text-secondary);
}
.raci-val-item.info {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.raci-val-task {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.raci-val-tag {
    flex-shrink: 0;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--red);
}
.raci-val-ok {
    font-size: 0.76rem;
    color: var(--green);
    font-style: italic;
    padding: 0.2rem 0;
}
.raci-val-empty {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-style: italic;
}

.raci-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.raci-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--t);
}
.raci-action-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.raci-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.raci-action-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}
.raci-action-btn.primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.raci-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.raci-help {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    font-size: 0.74rem;
    color: var(--text-muted);
    font-style: italic;
}

/* legend cell letters share styling with table cells */
.raci-cell-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
}
.raci-cell-letter.r { background: rgba(34, 197, 94, 0.18); color: var(--green); }
.raci-cell-letter.a { background: rgba(100, 181, 246, 0.18); color: var(--hl-blue); }
.raci-cell-letter.c { background: rgba(255, 235, 59, 0.18); color: var(--yellow); }
.raci-cell-letter.i { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
