@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
    --sidebar-bg:            #0f172a;
    --sidebar-hover:         #1e293b;
    --sidebar-text:          #94a3b8;
    --sidebar-text-hl:       #f1f5f9;
    --sidebar-width:         240px;
    --sidebar-width-mini:    60px;
    --topbar-height:         56px;
    --accent:                #6366f1;
    --accent-light:          #818cf8;
    --accent-dark:           #4f46e5;
    --success:               #10b981;
    --warning:               #f59e0b;
    --danger:                #ef4444;
    --bg:                    #f1f5f9;
    --card-bg:               #ffffff;
    --border:                #e2e8f0;
    --text:                  #1e293b;
    --text-muted:            #64748b;
    --radius:                10px;
    --shadow:                0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:             0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
    --transition:            .22s ease;
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5 { font-weight: 600; color: var(--text); margin-top: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════════════════════ */
.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 300;
    overflow: hidden;           /* important for collapse animation */
    transition: width var(--transition);
    flex-shrink: 0;
}

/* ── Sidebar Header (brand) ─────────────────────────────────────────────── */
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    min-height: var(--topbar-height);
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .3px;
}

.brand-icon {
    font-size: 1.4rem;
    color: var(--accent-light);
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.brand-text {
    transition: opacity var(--transition), width var(--transition);
    white-space: nowrap;
}

.brand-favicon {
    height: 36px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── Sidebar Nav ────────────────────────────────────────────────────────── */
.sidebar-nav {
    padding: .5rem 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar styling */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.nav-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #475569;
    padding: .9rem 1.25rem .2rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition), height var(--transition), padding var(--transition);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: var(--sidebar-text);
    font-size: .855rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hl);
    border-left-color: #334155;
}

.sidebar-nav .nav-link.active {
    background: rgba(99,102,241,.18);
    color: #a5b4fc;
    border-left-color: var(--accent);
}

.sidebar-nav .nav-link .oi {
    font-size: .85rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link-text {
    overflow: hidden;
    transition: opacity var(--transition), width var(--transition), max-width var(--transition);
    max-width: 200px;
}

/* ── Sidebar Collapsed (desktop) ────────────────────────────────────────── */
.app-shell.nav-collapsed .sidebar {
    width: var(--sidebar-width-mini);
}

.app-shell.nav-collapsed .brand-text,
.app-shell.nav-collapsed .nav-link-text,
.app-shell.nav-collapsed .nav-section-label {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    height: 0;
}

.app-shell.nav-collapsed .nav-link {
    justify-content: center;
    padding: .7rem 0;
    gap: 0;
    border-left: none;
    border-right: 3px solid transparent;
    position: relative;
}

.app-shell.nav-collapsed .nav-link.active {
    border-right-color: var(--accent);
}

/* Tooltip on hover when collapsed */
.app-shell.nav-collapsed .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    background: #1e293b;
    color: #f1f5f9;
    font-size: .78rem;
    padding: .3rem .7rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

/* ── Mobile sidebar overlay ─────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 290;
    backdrop-filter: blur(2px);
    transition: opacity .2s;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN WRAPPER
═══════════════════════════════════════════════════════════════════════════ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left var(--transition);
}

.app-shell.nav-collapsed .main-wrapper {
    margin-left: var(--sidebar-width-mini);
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: .75rem; }

.topbar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .95rem;
    transition: background .15s, color .15s;
    padding: 0;
}
.topbar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-liam-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.topbar-for {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .3px;
    text-transform: lowercase;
}

.topbar-sonar-logo {
    height: 28px;
    width: auto;
    border-radius: 4px;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    vertical-align: middle;
}

.topbar-right { display: flex; align-items: center; gap: .75rem; }

.topbar-badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: .22rem .7rem;
    border-radius: 999px;
    letter-spacing: .5px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 500;
}

.topbar-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .78rem;
    padding: .25rem .65rem;
    border-radius: 7px;
    cursor: pointer;
    display: flex; align-items: center; gap: .4rem;
    transition: all .15s;
}
.btn-logout:hover { background: #fee2e2; border-color: var(--danger); color: var(--danger); }

/* ── Page content ───────────────────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 1.75rem;
}

.page-content article { max-width: 1400px; }

/* ── Page header ────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-header h1 { margin: 0; font-size: 1.4rem; line-height: 1.2; }
.page-header .sub { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: .9rem;
    background: transparent;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.card-body { padding: 1.25rem; }
.card-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: transparent; }

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow .2s, transform .2s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    border-radius: 3px 0 0 3px;
}
.stat-card.purple::before { background: var(--accent); }
.stat-card.green::before  { background: var(--success); }
.stat-card.amber::before  { background: var(--warning); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.blue::before   { background: #3b82f6; }
.stat-card.teal::before   { background: #14b8a6; }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.stat-icon.purple  { background: rgba(99,102,241,.12);  color: var(--accent); }
.stat-icon.green   { background: rgba(16,185,129,.12);  color: var(--success); }
.stat-icon.amber   { background: rgba(245,158,11,.12);  color: var(--warning); }
.stat-icon.red     { background: rgba(239,68,68,.12);   color: var(--danger); }
.stat-icon.blue    { background: rgba(59,130,246,.12);  color: #3b82f6; }
.stat-icon.teal    { background: rgba(20,184,166,.12);  color: #14b8a6; }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; margin-top: .1rem; }
.stat-value.sm { font-size: 1.1rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   HOMEPAGE EXTRAS
═══════════════════════════════════════════════════════════════════════════ */
.hero-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    border-radius: 14px;
    padding: 1.75rem 2rem;
    color: #fff;
    margin-bottom: 1.75rem;
    position: relative;
    overflow: hidden;
}
.hero-banner::after {
    content: '♪';
    position: absolute;
    right: 2rem; top: 50%;
    transform: translateY(-50%);
    font-size: 6rem;
    opacity: .08;
    pointer-events: none;
}
.hero-banner h2 { color: #fff; font-size: 1.4rem; margin: 0 0 .3rem; }
.hero-banner p  { color: rgba(255,255,255,.75); margin: 0; font-size: .875rem; }

.progress-bar-custom {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--success), #34d399);
    transition: width .6s ease;
}

.quick-action-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    background: var(--card-bg);
    text-decoration: none;
    font-size: .855rem;
    font-weight: 500;
    transition: all .15s;
}
.quick-action-link:hover {
    background: #f8fafc;
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
    transform: translateX(2px);
}
.quick-action-link .oi {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
}
.qa-purple { background: rgba(99,102,241,.1);  color: var(--accent); }
.qa-teal   { background: rgba(20,184,166,.1);  color: #14b8a6; }
.qa-blue   { background: rgba(59,130,246,.1);  color: #3b82f6; }
.qa-green  { background: rgba(16,185,129,.1);  color: var(--success); }

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .855rem;
}
.activity-item:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════════════ */
.btn { border-radius: 8px; font-weight: 500; font-size: .855rem; transition: all .15s; }
.btn-primary  { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-success  { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-danger   { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-muted);
    background: var(--card-bg);
}
.btn-outline-secondary:hover { background: var(--bg); color: var(--text); border-color: #cbd5e1; }
.btn-link { color: var(--accent); padding: 0; }
.btn-sm { font-size: .78rem; padding: .3rem .75rem; }
.btn:focus, .btn:active:focus { box-shadow: 0 0 0 0.15rem rgba(99,102,241,.3); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════════════════ */
.table { font-size: .855rem; }
.table thead th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .73rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
    padding: .7rem 1rem;
}
.table tbody td { padding: .75rem 1rem; vertical-align: middle; border-color: var(--border); }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════════════════ */
.badge { font-weight: 500; border-radius: 999px; font-size: .71rem; padding: .22rem .65rem; }
.badge.bg-success   { background: rgba(16,185,129,.15) !important;  color: #047857; }
.badge.bg-warning   { background: rgba(245,158,11,.15)  !important; color: #92400e; }
.badge.bg-danger    { background: rgba(239,68,68,.15)   !important; color: #991b1b; }
.badge.bg-primary   { background: rgba(99,102,241,.15)  !important; color: var(--accent-dark); }
.badge.bg-secondary { background: rgba(100,116,139,.12) !important; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════════════════════ */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--border);
    font-size: .855rem;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    background: var(--card-bg);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.15rem rgba(99,102,241,.18);
}
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════════════════ */
.alert { border-radius: var(--radius); border: none; font-size: .855rem; }
.alert-success { background: rgba(16,185,129,.1);  color: #065f46; border: 1px solid rgba(16,185,129,.2); }
.alert-warning { background: rgba(245,158,11,.1);  color: #92400e; border: 1px solid rgba(245,158,11,.2); }
.alert-danger  { background: rgba(239,68,68,.1);   color: #991b1b; border: 1px solid rgba(239,68,68,.2); }
.alert-info    { background: rgba(99,102,241,.1);  color: #3730a3; border: 1px solid rgba(99,102,241,.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════════════════════ */
.modal-content { border-radius: 14px; border: none; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-header  { border-bottom: 1px solid var(--border); padding: 1.1rem 1.5rem; }
.modal-footer  { border-top:    1px solid var(--border); padding: .75rem 1.5rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY — bloqueia a tela inteira durante operações longas
═══════════════════════════════════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.60);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    /* bloqueia qualquer clique por baixo */
    pointer-events: all;
}

.loading-card {
    background: #fff;
    border-radius: 14px;
    padding: 2.5rem 3.5rem;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
    min-width: 260px;
    animation: loading-pop .18s ease-out;
}

@keyframes loading-pop {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.loading-spinner {
    width: 2.8rem;
    height: 2.8rem;
    color: var(--accent);
    margin-bottom: .75rem;
}

.loading-message {
    color: var(--text-muted);
    font-size: .88rem;
    font-weight: 500;
    letter-spacing: .01em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════════════════ */
.login-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* decorative circles */
.login-shell::before, .login-shell::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: .07;
    background: #6366f1;
    pointer-events: none;
}
.login-shell::before { width: 500px; height: 500px; top: -150px; right: -100px; }
.login-shell::after  { width: 350px; height: 350px; bottom: -80px; left: -80px; }

.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0,0,0,.35);
    position: relative;
    z-index: 1;
    animation: loginSlide .35s ease;
}

@keyframes loginSlide {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-liam-logo {
    width: 180px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto .6rem;
}
.login-logo .logo-symbol {
    font-size: 2.8rem;
    line-height: 1;
    display: inline-flex;
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 18px;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: .75rem;
    box-shadow: 0 8px 20px rgba(99,102,241,.35);
}
.login-logo .logo-title  { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0; }
.login-logo .logo-sub    { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

.login-card .form-control {
    padding: .65rem .9rem;
    font-size: .9rem;
}
.login-card .form-label { font-size: .83rem; font-weight: 600; }

.btn-login {
    width: 100%;
    padding: .75rem;
    font-size: .95rem;
    font-weight: 600;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.btn-login:hover  { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,.4); }
.btn-login:active { transform: translateY(0); }

.login-error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.25);
    color: #991b1b;
    border-radius: 8px;
    padding: .6rem 1rem;
    font-size: .84rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Campo de busca ─────────────────────────────────────────────────────── */
.search-wrapper {
    position: relative;
    max-width: 340px;
}
.search-wrapper .search-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .78rem;
    pointer-events: none;
    z-index: 2;
}
.search-wrapper .search-clear {
    position: absolute;
    right: .6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: .1rem .3rem;
    font-size: .75rem;
    border-radius: 4px;
    line-height: 1;
    z-index: 2;
    transition: color .15s, background .15s;
}
.search-wrapper .search-clear:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.search-input {
    padding-left: 2.15rem !important;
    padding-right: 2rem !important;
    border-radius: 8px !important;
    border: 1.5px solid var(--border) !important;
    font-size: .855rem !important;
    height: 36px !important;
    transition: border-color .15s, box-shadow .15s !important;
    background: white !important;
}
.search-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12) !important;
    outline: none !important;
}

/* ── Cabeçalho ordenável ────────────────────────────────────────────────── */
.th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.th-sort:hover { color: var(--accent); }
.th-sort:hover .sort-icon { opacity: .7; }

.sort-icon {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-left: 5px;
    vertical-align: middle;
    opacity: .25;
    line-height: 1;
    font-size: .6rem;
    gap: 1px;
    transition: opacity .15s;
}
.sort-icon.asc  .arr-up   { opacity: 1; color: var(--accent); }
.sort-icon.asc  .arr-down { opacity: .2; }
.sort-icon.desc .arr-down { opacity: 1; color: var(--accent); }
.sort-icon.desc .arr-up   { opacity: .2; }
.sort-icon.asc, .sort-icon.desc { opacity: 1; }

/* ── Botões ícone (tabelas) ─────────────────────────────────────────────── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: .78rem;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.btn-icon:hover { text-decoration: none; }

.btn-icon-edit:hover {
    background: rgba(99,102,241,.1);
    border-color: rgba(99,102,241,.3);
    color: var(--accent);
}
.btn-icon-del:hover {
    background: rgba(239,68,68,.1);
    border-color: rgba(239,68,68,.3);
    color: var(--danger);
}

/* ── Mono (ISRC, CPF) ───────────────────────────────────────────────────── */
.mono {
    font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    font-size: .82rem;
    letter-spacing: .3px;
}

/* ── Badge percentual ───────────────────────────────────────────────────── */
.pct-badge {
    background: rgba(99,102,241,.1);
    color: var(--accent-dark);
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    padding: .18rem .6rem;
    display: inline-block;
}

/* ── Upload drop zone ───────────────────────────────────────────────────── */
.comprovante-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border: 1.5px dashed var(--border);
    border-radius: 9px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: .84rem;
    gap: .4rem;
    background: #fafbfc;
}
.comprovante-drop-zone:hover {
    border-color: var(--accent);
    background: rgba(99,102,241,.04);
}

.comprovante-preview {
    padding: .75rem 1rem;
    background: rgba(16,185,129,.06);
    border: 1.5px solid rgba(16,185,129,.25);
    border-radius: 9px;
}

/* ── Auth checking overlay ──────────────────────────────────────────────── */
.auth-checking {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-muted);
    font-size: .9rem;
    gap: .75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISC
═══════════════════════════════════════════════════════════════════════════ */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: .8rem; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

#blazor-error-ui {
    background: #fef9c3;
    border-top: 1px solid #fbbf24;
    bottom: 0; left: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
    display: none;
    padding: .65rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: .84rem;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .55rem; }

.blazor-error-boundary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 1rem 1rem 1rem 3.5rem;
    color: #991b1b;
}
.blazor-error-boundary::after { content: "Ocorreu um erro."; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        transition: transform var(--transition);
    }

    .app-shell.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.mobile-nav-open .sidebar-overlay {
        display: block;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .topbar-title { display: none; }
    .page-content { padding: 1.25rem; }
}
