/*
 * ISP Platform — Shared Components V2
 * Namespaced with ui-* to avoid legacy collisions while pages migrate.
 */

.ui-stack { display:grid; gap:var(--space-4,16px); }
.ui-stack-sm { display:grid; gap:var(--space-2,8px); }
.ui-stack-lg { display:grid; gap:var(--space-6,24px); }

.ui-row {
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.ui-row-between {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
}

.ui-card {
    background:var(--theme-surface);
    border:1px solid var(--theme-border);
    border-radius:var(--theme-radius-card);
    box-shadow:var(--theme-shadow-card);
}

.ui-card-body { padding:18px; }
.ui-card-compact { padding:12px 14px; }

.ui-section-title {
    margin:0 0 10px;
    color:var(--theme-text-strong);
    font-size:1rem;
    font-weight:800;
}

.ui-muted { color:var(--theme-muted); }
.ui-danger-text { color:var(--theme-danger); }
.ui-success-text { color:var(--theme-success); }

.ui-field {
    display:grid;
    gap:7px;
}

.ui-field > label,
.ui-field-label {
    color:var(--theme-text-strong);
    font-weight:700;
}

.ui-input,
.ui-select,
.ui-textarea {
    width:100%;
    min-height:44px;
    padding:9px 12px;
    border:1px solid var(--theme-border-strong);
    border-radius:var(--theme-radius-control);
    background:var(--theme-surface);
    color:var(--theme-text);
    outline:0;
}

.ui-textarea { min-height:110px; resize:vertical; }

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus {
    border-color:var(--theme-primary);
    box-shadow:0 0 0 4px color-mix(in srgb,var(--theme-primary) 12%,transparent);
}

.ui-btn {
    min-height:42px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:9px 15px;
    border:1px solid var(--theme-border-strong);
    border-radius:var(--theme-radius-control);
    background:var(--theme-surface);
    color:var(--theme-text-strong);
    text-decoration:none;
    font-weight:800;
    line-height:1.2;
}

.ui-btn:hover { border-color:var(--theme-primary); }

.ui-btn-primary {
    border-color:var(--theme-primary);
    background:var(--theme-primary);
    color:#fff;
}

.ui-btn-primary:hover {
    border-color:var(--theme-primary-hover);
    background:var(--theme-primary-hover);
}

.ui-btn-danger {
    border-color:color-mix(in srgb,var(--theme-danger) 38%,var(--theme-border));
    background:color-mix(in srgb,var(--theme-danger) 8%,var(--theme-surface));
    color:var(--theme-danger);
}

.ui-btn-ghost {
    border-color:transparent;
    background:transparent;
}

.ui-badge {
    display:inline-flex;
    align-items:center;
    min-height:26px;
    padding:3px 9px;
    border:1px solid var(--theme-border);
    border-radius:999px;
    background:var(--theme-surface-soft);
    color:var(--theme-muted);
    font-size:.82rem;
    font-weight:800;
}

.ui-badge-success {
    border-color:color-mix(in srgb,var(--theme-success) 28%,var(--theme-border));
    background:color-mix(in srgb,var(--theme-success) 8%,var(--theme-surface));
    color:var(--theme-success);
}

.ui-badge-danger {
    border-color:color-mix(in srgb,var(--theme-danger) 28%,var(--theme-border));
    background:color-mix(in srgb,var(--theme-danger) 8%,var(--theme-surface));
    color:var(--theme-danger);
}

.ui-table-wrap {
    width:100%;
    overflow:auto;
    border:1px solid var(--theme-border);
    border-radius:var(--theme-radius-card);
    background:var(--theme-surface);
}

.ui-table {
    width:100%;
    border-collapse:collapse;
}

.ui-table th,
.ui-table td {
    padding:11px 12px;
    border-bottom:1px solid var(--theme-border);
    text-align:right;
    vertical-align:middle;
}

.ui-table th {
    background:var(--theme-surface-soft);
    color:var(--theme-muted);
    font-size:.84rem;
    font-weight:800;
}

.ui-table tr:last-child td { border-bottom:0; }

.ui-alert {
    padding:12px 14px;
    border:1px solid var(--theme-border);
    border-radius:var(--theme-radius-control);
    background:var(--theme-surface-soft);
}

.ui-alert-success {
    border-color:color-mix(in srgb,var(--theme-success) 28%,var(--theme-border));
    background:color-mix(in srgb,var(--theme-success) 7%,var(--theme-surface));
}

.ui-alert-danger {
    border-color:color-mix(in srgb,var(--theme-danger) 28%,var(--theme-border));
    background:color-mix(in srgb,var(--theme-danger) 7%,var(--theme-surface));
}

.ui-actions {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

@media (max-width:700px) {
    .ui-card-body { padding:14px; }
    .ui-actions > .ui-btn { flex:1 1 auto; }
}
