/* =====================================================
   Forma A — Main Stylesheet
   ===================================================== */

:root {
    --brand-dark: #0f172a;
    --brand-primary: #2563eb;
    --brand-success: #16a34a;
    --brand-danger: #dc2626;
    --brand-warning: #d97706;
    --brand-muted: #64748b;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

/* ---- Base ---- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
    color: var(--text);
    background: #f1f5f9;
    line-height: 1.5;
}

/* ---- Navbar ---- */
.navbar {
    box-shadow: 0 1px 0 rgba(255,255,255,.08);
    min-height: 56px;
}

.brand-icon {
    font-size: 1.2rem;
    opacity: 0.9;
}

.navbar-brand {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.navbar .nav-link {
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 0.3rem;
    transition: background 0.15s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255,255,255,.12);
}

.navbar .nav-link.active {
    color: #fff !important;
}

/* ---- Language Switcher ---- */
.lang-switcher {
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 0.4rem;
    padding: 2px;
    background: rgba(255,255,255,.06);
}

.lang-btn {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 0.3rem;
    border: none;
    color: rgba(255,255,255,.6);
    background: transparent;
    transition: all 0.15s;
    line-height: 1.6;
}

.lang-btn:hover {
    color: #fff;
    background: rgba(255,255,255,.15);
}

.lang-btn--active {
    color: #fff !important;
    background: rgba(255,255,255,.25) !important;
}

/* ---- User Avatar ---- */
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---- Role badges ---- */
.role-badge-admin    { background: #7c3aed !important; color: #fff; font-size: 0.65rem; }
.role-badge-operator { background: #0369a1 !important; color: #fff; font-size: 0.65rem; }
.role-badge-manager  { background: #065f46 !important; color: #fff; font-size: 0.65rem; }
.role-badge-auditor  { background: #92400e !important; color: #fff; font-size: 0.65rem; }

/* ---- Cards ---- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--surface);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ---- Tables ---- */
.table {
    font-size: 0.82rem;
}

.table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    padding: 0.6rem 0.75rem;
}

.table td {
    vertical-align: middle;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

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

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Badges ---- */
.badge {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.3em 0.55em;
    border-radius: 0.3rem;
}

/* Status badges */
.badge-status-draft     { background: #e2e8f0; color: #475569; }
.badge-status-approved  { background: #dcfce7; color: #166534; }
.badge-status-cancelled { background: #fee2e2; color: #991b1b; }
.badge-status-exported  { background: #dbeafe; color: #1e40af; }

/* ---- Buttons ---- */
.btn {
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 0.4rem;
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
}

/* ---- Form controls ---- */
.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    font-size: 0.85rem;
    border-color: var(--border);
    border-radius: 0.4rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ---- Code ---- */
code {
    font-size: 0.78rem;
    color: #be185d;
    background: #fdf2f8;
    padding: 0.1em 0.4em;
    border-radius: 0.25rem;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* ---- Alerts ---- */
.alert {
    font-size: 0.85rem;
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow);
}

/* ---- Pagination ---- */
.page-link {
    font-size: 0.78rem;
    border-color: var(--border);
}

/* ---- Dropdown ---- */
.dropdown-menu {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    font-size: 0.82rem;
}

.dropdown-item {
    padding: 0.45rem 1rem;
    border-radius: 0.3rem;
    margin: 1px 4px;
}

/* ---- DL rows ---- */
dl.row dt {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

dl.row dd {
    font-size: 0.875rem;
}

/* ---- Act Items table ---- */
.act-items-table th {
    background: #1e3a5f;
    color: #fff;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.act-items-table tr.has-value {
    background: #f0fdf4;
}

/* ---- Section header inside tables ---- */
.section-row-header td {
    background: #eff6ff;
    font-weight: 700;
    font-size: 0.78rem;
    color: #1e40af;
    border-left: 3px solid #2563eb;
    padding: 6px 10px;
}

/* ---- Status history ---- */
.status-history-row {
    font-size: 0.78rem;
}

/* ---- Print ---- */
@media print {
    .print-hide { display: none !important; }
    .navbar    { display: none !important; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .table-responsive table { font-size: 0.75rem; }
    .container-fluid { padding: 1rem; }
}
