*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f8f9fb; color: #1e293b; line-height: 1.6; min-height: 100vh; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.app-body { display: flex; min-height: 100vh; }

.sidebar { width: 230px; background: #fff; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-logo { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid #e2e8f0; }
.sidebar-logo a { font-weight: 700; font-size: 1.05rem; color: #0f172a; text-decoration: none; }
.sidebar-logo a:hover { color: #2563eb; text-decoration: none; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.sidebar-link { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 1.25rem; font-size: 0.875rem; color: #475569; text-decoration: none; border-left: 3px solid transparent; transition: all 0.15s; }
.sidebar-link:hover { background: #f1f5f9; color: #1e293b; text-decoration: none; }
.sidebar-link.active { background: #eff6ff; color: #2563eb; border-left-color: #2563eb; font-weight: 500; }
.sidebar-icon { font-size: 1rem; width: 1.25rem; text-align: center; }
.sidebar-footer { padding: 0.75rem 1.25rem; border-top: 1px solid #e2e8f0; }
.sidebar-user { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.sidebar-username { font-size: 0.8rem; color: #475569; font-weight: 500; }
.sidebar-logout { width: 100%; text-align: center; }

.main-with-sidebar { flex: 1; margin-left: 230px; padding: 1.5rem 2rem; min-height: 100vh; }
.main { padding: 2rem 1.5rem; }
.container { max-width: 1100px; margin: 0 auto; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: #0f172a; }
.page-header p { color: #64748b; font-size: 0.9rem; }

.card { background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 0.875rem 1.25rem; border-bottom: 1px solid #e2e8f0; background: #fafbfc; }
.card-header h2 { font-size: 0.95rem; font-weight: 600; color: #0f172a; }
.card-body { padding: 1.25rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; padding: 1rem; text-align: center; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: #2563eb; }
.stat-label { font-size: 0.8rem; color: #64748b; margin-top: 0.125rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.mobile-header { display: none; }
.sidebar-overlay { display: none; }
@media (max-width: 768px) {
    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 99; }
    .mobile-menu-btn { background: none; border: 1px solid #d1d5db; border-radius: 6px; padding: 0.25rem 0.5rem; font-size: 1.2rem; cursor: pointer; color: #374151; }
    .mobile-title { font-weight: 600; font-size: 0.95rem; color: #0f172a; }
    .sidebar { display: none; position: fixed; z-index: 200; }
    .sidebar.sidebar-open { display: flex; }
    .sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 199; }
    .sidebar.sidebar-open ~ .sidebar-overlay { display: block; background: rgba(0,0,0,0.2); }
    .main-with-sidebar { margin-left: 0; padding-top: 0; }
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.625rem 0.875rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
.table th { font-weight: 600; color: #475569; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.025em; background: #fafbfc; }
.table td { font-size: 0.875rem; }
.table tr:hover { background: #f8fafc; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.4375rem 0.875rem; border-radius: 6px; font-size: 0.8125rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; text-decoration: none !important; gap: 0.375rem; white-space: nowrap; }
.btn:hover { opacity: 0.9; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: #fff; border-color: #d1d5db; color: #374151; }
.btn-outline:hover { background: #f3f4f6; border-color: #9ca3af; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-xs { padding: 0.125rem 0.375rem; font-size: 0.7rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 0.25rem; border: none; background: none; cursor: pointer; color: #64748b; font-size: 1rem; }
.btn-icon:hover { color: #2563eb; }

.form-group { margin-bottom: 0.875rem; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 500; color: #374151; margin-bottom: 0.25rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.4375rem 0.625rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.8125rem; background: #fff; color: #1e293b; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1); }
.form-group small { display: block; margin-top: 0.125rem; color: #9ca3af; font-size: 0.75rem; }
.form-inline { display: inline; }

.form-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }

.filter-bar { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; align-items: flex-end; flex-wrap: wrap; padding: 1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; }
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-group label { font-size: 0.75rem; color: #64748b; }
.filter-bar input, .filter-bar select { padding: 0.375rem 0.5rem; font-size: 0.8125rem; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; }
.filter-bar input { min-width: 140px; }

.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 500; background: #e2e8f0; color: #475569; }
.badge-super_admin { background: #fef3c7; color: #92400e; }
.badge-manager { background: #dbeafe; color: #1e40af; }
.badge-external { background: #e0e7ff; color: #3730a3; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-public { background: #dcfce7; color: #166534; }
.badge-password { background: #fef3c7; color: #92400e; }
.badge-login { background: #dbeafe; color: #1e40af; }
.badge-private { background: #e2e8f0; color: #475569; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #166534; }

.alert { padding: 0.625rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.8125rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

.breadcrumbs { display: flex; align-items: center; gap: 0.375rem; margin-bottom: 1rem; font-size: 0.85rem; }
.breadcrumb-sep { color: #9ca3af; }
.breadcrumb-current { color: #1e293b; font-weight: 500; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.875rem; margin-bottom: 1.5rem; }
.folder-card { display: flex; flex-direction: column; align-items: center; padding: 1rem 0.75rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; text-decoration: none !important; color: inherit; transition: all 0.15s; }
.folder-card:hover { border-color: #2563eb; background: #f0f6ff; }
.folder-icon { font-size: 1.75rem; margin-bottom: 0.375rem; }
.folder-name { font-weight: 500; font-size: 0.85rem; text-align: center; }
.folder-meta { font-size: 0.7rem; color: #9ca3af; margin-top: 0.125rem; text-align: center; }

.detail-row { display: flex; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.875rem; }
.detail-label { font-weight: 500; color: #64748b; min-width: 110px; font-size: 0.8125rem; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 1.25rem 0; }

.empty-state { text-align: center; color: #9ca3af; padding: 2rem; font-size: 0.875rem; }
.empty-state-box { text-align: center; padding: 2.5rem 2rem; background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; }
.empty-state-box p { color: #9ca3af; margin-bottom: 0.75rem; font-size: 0.875rem; }

.inline-form { display: inline; }
.action-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.actions-cell { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }

.text-muted { color: #64748b; }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.7rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.ml-2 { margin-left: 0.5rem; }
.section-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.75rem; margin-top: 1.25rem; color: #0f172a; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f0f4f8; }
.login-container { width: 100%; max-width: 380px; padding: 1rem; }
.login-card { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 16px rgba(0,0,0,0.06); border: 1px solid #e2e8f0; }
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h1 { font-size: 1.4rem; color: #0f172a; }
.login-header p { color: #64748b; font-size: 0.85rem; }

.share-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f8f9fb; }
.share-container { width: 100%; max-width: 480px; padding: 1rem; }
.share-wide { max-width: 800px; }
.share-card { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 12px rgba(0,0,0,0.04); border: 1px solid #e2e8f0; }
.share-card h1 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.share-meta { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }

.link-box { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.625rem; background: #f8f9fb; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 0.75rem; word-break: break-all; }
.link-box code { flex: 1; font-family: monospace; color: #475569; }

.table-compact th, .table-compact td { padding: 0.375rem 0.625rem; }
.table-compact td { font-size: 0.8125rem; vertical-align: middle; }
.link-actions-compact { display: flex; gap: 0.25rem; align-items: center; }
.actions-compact { display: flex; gap: 0.2rem; align-items: center; flex-wrap: nowrap; }
.actions-compact .inline-form { display: inline; }
.target-name { font-size: 0.8rem; color: #1e293b; margin-left: 0.25rem; }
.text-nowrap { white-space: nowrap; }

.checkbox-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.875rem; }
.checkbox-row label { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; font-weight: 400; color: #374151; cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: auto; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 1.5rem; max-width: 500px; width: 90%; box-shadow: 0 8px 30px rgba(0,0,0,0.12); border: 1px solid #e2e8f0; }
.modal h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #0f172a; }
