:root {
    --brand-blue: #1b5fad;
    --brand-blue-dark: #134a87;
    --brand-blue-light: #eaf2fc;
    --bg-gray: #f4f6f9;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg-gray);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1f2937;
}

a { color: var(--brand-blue); }

/* ---------- Auth ---------- */
.auth-body { background: linear-gradient(135deg, var(--brand-blue) 0%, #0e3a6b 100%); }
.auth-card { max-width: 440px; width: 100%; border-radius: 16px; }
.auth-logo { font-size: 2.5rem; color: var(--brand-blue); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1040;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #eef0f3;
}
.sidebar-brand a { text-decoration: none; color: var(--brand-blue-dark); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.sidebar-brand i { font-size: 1.3rem; }

.sidebar-nav { padding: .75rem .5rem; overflow-y: auto; flex: 1; }
.sidebar-nav .nav-heading { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: #9ca3af; margin: 1rem .75rem .25rem; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .75rem; border-radius: 8px;
    color: #374151; font-size: .9rem; margin-bottom: .1rem;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; color: #6b7280; }
.sidebar-nav .nav-link:hover { background: var(--brand-blue-light); color: var(--brand-blue-dark); }
.sidebar-nav .nav-link.active { background: var(--brand-blue); color: #fff; }
.sidebar-nav .nav-link.active i { color: #fff; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }

.app-main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.app-header {
    background: #fff; border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; gap: 1rem;
    padding: .65rem 1.25rem; position: sticky; top: 0; z-index: 1020;
}
.app-search { position: relative; max-width: 420px; }
.app-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.app-search input { padding-left: 2.25rem; background: var(--bg-gray); border: 1px solid transparent; }
.app-header-actions { display: flex; align-items: center; gap: .5rem; }

.avatar-circle, .avatar-circle-sm {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-blue); color: #fff; border-radius: 50%;
    font-weight: 600;
}
.avatar-circle { width: 32px; height: 32px; }
.avatar-circle-sm { width: 26px; height: 26px; font-size: .75rem; }

.notif-badge { position: absolute; top: -4px; right: -4px; font-size: .6rem; }
.notif-dropdown { width: 320px; max-height: 400px; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { display: block; padding: .6rem .9rem; border-bottom: 1px solid #f1f3f5; text-decoration: none; color: inherit; }
.notif-item.unread { background: var(--brand-blue-light); }

.app-content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; font-size: .8rem; color: #9ca3af; text-align: center; }

.page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }

.app-breadcrumb { background: transparent; padding: 0; margin-bottom: 1rem; font-size: .85rem; }

/* ---------- Cards / stats ---------- */
.card { border-radius: 12px; }
.stat-card { background: #fff; border-radius: 12px; padding: 1.1rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); height: 100%; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: .5rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #111827; }
.stat-label { font-size: .8rem; color: #6b7280; }

.badge-soft-primary { background: var(--brand-blue-light); color: var(--brand-blue-dark); }
.badge-soft-success { background: #e6f6ec; color: #1a7a3c; }
.badge-soft-warning { background: #fff5e0; color: #966a06; }
.badge-soft-danger { background: #fdecec; color: #b3261e; }
.badge-soft-secondary { background: #eef0f3; color: #4b5563; }

/* ---------- IPS logos ---------- */
.ips-logo-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.ips-logo-placeholder { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-blue-light); color: var(--brand-blue); border-radius: 6px; }
.ips-logo-md { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.ips-logo-placeholder-lg { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-blue-light); color: var(--brand-blue); border-radius: 10px; font-size: 1.4rem; }

/* ---------- Folders / documents ---------- */
.folder-card {
    display: flex; flex-direction: column; align-items: center; gap: .4rem;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 1rem .5rem; text-decoration: none; color: #374151; text-align: center;
    transition: box-shadow .15s ease;
}
.folder-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); color: var(--brand-blue-dark); }
.folder-card i { font-size: 1.8rem; color: #f5b301; }

.folder-card-wrapper { position: relative; }
.folder-card-menu { position: absolute; top: .35rem; right: .35rem; }
.folder-card-menu .btn { padding: .1rem .4rem; line-height: 1.4; box-shadow: none; }

.upload-dropzone {
    border: 2px dashed #cbd5e1; border-radius: 12px; padding: 1.5rem;
    text-align: center; color: #6b7280; background: #fff;
    transition: border-color .15s ease, background .15s ease;
}
.upload-dropzone.dragover { border-color: var(--brand-blue); background: var(--brand-blue-light); }

.doc-preview-embed { width: 100%; height: 520px; border: none; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .sidebar-overlay.show { display: block; }
}
