/* ============================================================
   NUP Institutional Policies Repository
   Swiss-Institutional Minimalism
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Core palette */
    --ink: #0f172a;
    --ink-light: #334155;
    --ink-muted: #64748b;
    --ink-faint: #94a3b8;
    --surface: #ffffff;
    --surface-raised: #f8fafc;
    --surface-sunken: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Accent */
    --accent: #1e40af;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --accent-subtle: #eff6ff;

    /* Semantic */
    --success: #059669;
    --success-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0284c7;
    --info-light: #e0f2fe;
    --warning: #d97706;
    --warning-light: #fef3c7;

    /* Layout */
    --sidebar-width: 240px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.non-authenticated {
    background: var(--surface-sunken);
}

/* ---- Fade-in animation ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.main-content > *,
.minimal-content > .content-wrapper > * {
    animation: fadeUp 0.4s var(--ease) both;
}

/* ============================================================
   PUBLIC LAYOUT (Non-Admin / Non-Authenticated)
   ============================================================ */

.minimal-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.minimal-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 48px;
    height: 72px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.header-logo {
    height: 44px;
    width: 44px;
    object-fit: contain;
    position: static;
    flex-shrink: 0;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.header-actions {
    position: static;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.signin-link {
    background: var(--ink);
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    letter-spacing: 0.01em;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
}

.signin-link:hover {
    background: var(--ink-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: white;
}

.signin-link.ms-2 {
    background: var(--accent);
}
.signin-link.ms-2:hover {
    background: var(--accent-hover);
}

.user-display {
    color: var(--ink-muted);
    font-size: 13px;
    font-weight: 500;
}

.minimal-content {
    flex: 1;
    padding: 48px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.content-wrapper {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.minimal-footer {
    border-top: 1px solid var(--border);
    padding: 24px 48px;
    text-align: center;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.minimal-footer p { margin: 0; }

/* ---- Public Search ---- */
.minimal-search-bar {
    margin-bottom: 28px;
}

.search-form-stacked {
    max-width: 720px;
    margin: 0 auto;
}

.search-row {
    margin-bottom: 14px;
}

.minimal-search-input {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: all var(--duration) var(--ease);
}

.minimal-search-input::placeholder {
    color: var(--ink-faint);
}

.minimal-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.minimal-filter-select {
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    min-width: 180px;
    max-width: 300px;
    flex: 1;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.minimal-filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---- Public Table ---- */
.minimal-table-container {
    width: 100%;
}

.table-minimal {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--surface);
}

.table-minimal thead {
    border-bottom: 2px solid var(--ink);
}

.table-minimal th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.table-minimal tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--duration) var(--ease);
}

.table-minimal td {
    padding: 14px 16px;
    color: var(--ink);
    vertical-align: middle;
}

.table-minimal tbody tr:hover {
    background: var(--surface-raised);
}

/* ============================================================
   ADMIN LAYOUT (Sidebar + Content)
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--surface-raised);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
}

.sidebar-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all var(--duration) var(--ease);
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-link:hover {
    color: var(--ink);
    background: var(--surface-sunken);
}

.sidebar-link.active {
    color: var(--ink);
    background: var(--surface-sunken);
    font-weight: 500;
    border-left-color: var(--accent);
}

.sidebar-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 14px;
    color: var(--ink-faint);
}

.sidebar-link.active i {
    color: var(--accent);
}

.sidebar-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

.user-info {
    padding: 8px 0;
    color: var(--ink-muted);
    font-size: 12px;
    text-align: center;
}

.user-info i {
    font-size: 22px;
    display: block;
    margin-bottom: 6px;
    color: var(--ink-faint);
}

.user-name {
    display: block;
    font-size: 12px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .sidebar-link {
    padding: 8px 0;
    margin: 4px 0 0;
    border-left: none;
    justify-content: center;
    font-size: 13px;
}

.sidebar-footer .sidebar-link:hover {
    background: transparent;
    color: var(--ink);
}

.sidebar-footer .btn.btn-link {
    color: var(--ink-muted) !important;
    text-decoration: none !important;
    font-family: inherit;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color var(--duration) var(--ease);
}

.sidebar-footer .btn.btn-link:hover {
    color: var(--ink) !important;
}

/* ---- Main Content Area ---- */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface-sunken);
}

.top-bar {
    background: var(--surface);
    padding: 0 32px;
    height: 56px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

#menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--ink);
    cursor: pointer;
    padding: 4px;
    margin-right: 12px;
}

.top-bar-title h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-muted);
    margin: 0;
    letter-spacing: 0.01em;
}

.main-content {
    flex: 1;
    padding: 32px;
}

.content-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--ink-faint);
    background: var(--surface);
}

/* ---- Admin Search Section ---- */
.search-section {
    background: var(--surface);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.search-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: all var(--duration) var(--ease);
}

.search-input::placeholder {
    color: var(--ink-faint);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.filter-select {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    min-width: 160px;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---- Buttons ---- */
.btn-modern {
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn-primary-modern {
    background: var(--accent);
    color: white;
}

.btn-primary-modern:hover {
    background: var(--accent-hover);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success-modern {
    background: var(--success);
    color: white;
}

.btn-success-modern:hover {
    background: #047857;
    text-decoration: none;
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---- Content Card (Admin Table Container) ---- */
.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

/* ---- Admin Table ---- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-modern thead {
    border-bottom: none;
    background: var(--surface-raised);
}

.table-modern th {
    text-align: left;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border);
}

.table-modern tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--duration) var(--ease);
}

.table-modern tbody tr:last-child {
    border-bottom: none;
}

.table-modern tbody tr:hover {
    background: var(--accent-subtle);
}

.table-modern td {
    padding: 14px 20px;
    color: var(--ink);
    vertical-align: middle;
}

/* ---- Shared Table Elements ---- */
.department-header {
    background: var(--surface-sunken) !important;
    font-weight: 600;
}

.department-header td {
    padding: 10px 20px !important;
    color: var(--ink-light) !important;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600 !important;
}

.code-cell {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace;
    font-size: 12.5px;
    color: var(--ink-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.type-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--surface-sunken);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
    border: 1px solid var(--border);
}

.download-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--duration) var(--ease);
}

.download-link:hover {
    color: var(--accent-hover);
}

.download-link.disabled-link {
    color: var(--ink-faint);
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Status Badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.status-new {
    background: var(--success-light);
    color: var(--success);
}

.status-revised {
    background: var(--info-light);
    color: var(--info);
}

.status-badge i {
    font-size: 10px;
}

/* ---- Action Buttons (Table) ---- */
.action-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.btn-action {
    padding: 6px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--ink-faint);
    transition: all var(--duration) var(--ease);
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background: var(--surface-sunken);
}

.btn-edit:hover {
    color: var(--accent);
}

.btn-delete:hover {
    color: var(--danger);
}

.btn-share {
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--ink-faint);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-share:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

/* ---- Mobile Card Layout ---- */
.mobile-cards {
    display: none;
}

.mobile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 12px;
    transition: box-shadow var(--duration) var(--ease);
}

.mobile-card:hover {
    box-shadow: var(--shadow-md);
}

.mobile-card-header {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.mobile-card-label {
    color: var(--ink-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mobile-card-value {
    color: var(--ink);
    text-align: right;
    font-weight: 500;
}

.mobile-card-actions {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mobile-card-actions a,
.mobile-card-actions button {
    flex: 1;
    text-align: center;
    padding: 9px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    min-width: 100px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--ink-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.2;
    color: var(--ink-faint);
}

.empty-state h5 {
    color: var(--ink);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    margin-bottom: 24px;
    color: var(--ink-muted);
    font-size: 14px;
}

/* ============================================================
   FORMS (Create / Edit / Delete / Login)
   ============================================================ */

h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.form-group {
    margin-bottom: 0;
}

.control-label,
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-light);
    margin-bottom: 6px;
    display: block;
    letter-spacing: 0.01em;
}

.form-control,
.form-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: all var(--duration) var(--ease);
    width: 100%;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
    color: var(--ink-faint);
}

.text-danger {
    color: var(--danger) !important;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    display: block;
}

.form-text.text-muted {
    color: var(--ink-faint) !important;
    font-size: 12px;
    margin-top: 6px;
}

/* ---- Standard Buttons ---- */
.btn {
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--accent) !important;
    color: white !important;
    border: none !important;
}

.btn-primary:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--success) !important;
    color: white !important;
    border: none !important;
}

.btn-success:hover {
    background: #047857 !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--surface-sunken) !important;
    color: var(--ink-light) !important;
    border: 1px solid var(--border) !important;
}

.btn-secondary:hover {
    background: var(--surface-raised) !important;
    border-color: var(--border-strong) !important;
}

.btn-danger {
    background: var(--danger) !important;
    color: white !important;
    border: none !important;
}

.btn-danger:hover {
    background: #b91c1c !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-warning {
    background: var(--warning) !important;
    color: white !important;
    border: none !important;
}

.btn-warning:hover {
    background: #b45309 !important;
}

.btn-outline-primary {
    background: transparent !important;
    color: var(--accent) !important;
    border: 1px solid var(--accent) !important;
}

.btn-outline-primary:hover {
    background: var(--accent) !important;
    color: white !important;
}

/* ---- Cards (Edit view status flags) ---- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-header {
    background: var(--surface-raised);
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

.card-header i {
    margin-right: 8px;
    color: var(--ink-muted);
}

.card-body {
    padding: 18px;
}

.card.shadow {
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-body .text-center img {
    opacity: 0.85;
}

.card-body .text-center h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
}

/* ---- Alerts ---- */
.alert {
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: none;
    padding: 10px 14px;
}

.alert-success {
    background: var(--success-light) !important;
    color: var(--success) !important;
}

.alert-secondary {
    background: var(--surface-sunken) !important;
    color: var(--ink-muted) !important;
}

.alert-info {
    background: var(--info-light) !important;
    color: var(--info) !important;
}

.alert-warning {
    background: var(--warning-light) !important;
    color: var(--warning) !important;
}

.alert-danger {
    background: var(--danger-light) !important;
    color: var(--danger) !important;
}

/* ---- Outlined buttons for flag controls ---- */
.btn-outline-success {
    color: var(--success);
    border: 1px solid var(--success);
    background: transparent;
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-outline-success:hover {
    background: var(--success);
    color: white;
}

.btn-outline-info {
    color: var(--info);
    border: 1px solid var(--info);
    background: transparent;
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-outline-info:hover {
    background: var(--info);
    color: white;
}

.btn-outline-secondary {
    color: var(--ink-muted);
    border: 1px solid var(--border-strong);
    background: transparent;
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-outline-secondary:hover {
    background: var(--ink-muted);
    color: white;
    border-color: var(--ink-muted);
}

/* ---- Delete page ---- */
dl.row dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 16px;
}

dl.row dd {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    padding: 10px 16px;
}

/* ---- Input Group (Login) ---- */
.input-group-text {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-right: none;
    color: var(--ink-muted);
    font-size: 14px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .form-control {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ---- Notification Bell ---- */
.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    font-size: 16px;
}

.notification-bell:hover {
    color: var(--ink);
    background: var(--surface-sunken);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ---- Copy Toast Notification ---- */
.copy-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--ink);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    letter-spacing: 0.01em;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.copy-toast i {
    color: #34d399;
    font-size: 14px;
}

/* ---- Sidebar Overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 199;
    backdrop-filter: blur(4px);
}

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted { color: var(--ink-faint) !important; }
.fw-bold { font-weight: 600 !important; }
.search-hint { color: var(--ink-faint); font-size: 12px; }
.minimal-search { margin-bottom: 20px; text-align: right; }
.search-form { display: flex; max-width: 400px; margin: 0 auto; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ---- Desktop (> 1024px) ---- */
@media (min-width: 1025px) {
    .filter-row { justify-content: center; }
    .minimal-filter-select { flex: 0 1 auto; min-width: 200px; max-width: 350px; }
}

/* ---- Tablet (769px – 1024px) ---- */
@media (max-width: 1024px) {
    .minimal-content { padding: 32px 24px; }
    .minimal-header { padding: 0 24px; }
    .main-content { padding: 24px 20px; }
    .top-bar { padding: 0 20px; }

    .search-controls {
        flex-wrap: wrap;
    }

    .search-input { flex: 1 1 100%; }
    .filter-select { flex: 1 1 calc(50% - 5px); min-width: 140px; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-row { justify-content: center; }
    .minimal-filter-select { flex: 0 1 auto; min-width: 180px; max-width: 300px; }
}

/* ---- Mobile (≤ 768px) ---- */
@media (max-width: 768px) {
    /* Sidebar toggle */
    .sidebar-overlay { display: block; }

    #menu-toggle {
        display: flex;
    }

    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        transition: margin-left 0.3s var(--ease);
        box-shadow: 4px 0 24px rgba(15, 23, 42, 0.2);
    }

    .sidebar.active {
        margin-left: 0;
    }

    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    /* Layout spacing */
    .main-content { padding: 20px 16px; }
    .minimal-content { padding: 20px 16px; }
    .top-bar { padding: 0 16px; height: 48px; }
    .top-bar-title h4 { font-size: 13px; }
    .minimal-footer, .content-footer { padding: 16px; font-size: 11px; }

    /* Header responsive - wrap to two lines */
    .minimal-header {
        height: auto;
        padding: 12px 16px;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 0;
    }

    .header-logo {
        height: 32px;
        width: 32px;
    }

    .header-title {
        position: static;
        transform: none;
        white-space: normal;
        text-align: center;
        font-size: 12px;
        line-height: 1.4;
        order: 3;
        width: 100%;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }

    .header-actions {
        position: static;
        margin-left: auto;
    }

    .signin-link { padding: 7px 14px; font-size: 12px; }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Search controls */
    .search-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-input, .filter-select { width: 100%; min-width: 0; }
    .search-form-stacked { max-width: 100%; }
    .filter-row { flex-direction: column; align-items: stretch; }
    .minimal-filter-select { width: 100%; max-width: 100%; min-width: 0; }

    /* Tables - scrollable on tablet-sized phones */
    .table-responsive { margin: 0; }

    .table-minimal, .table-modern {
        min-width: 540px;
        white-space: normal;
    }

    .table-minimal th, .table-modern th {
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 10px;
    }

    .table-minimal td, .table-modern td {
        padding: 12px;
        font-size: 13px;
        word-break: break-word;
    }

    .content-card { border-radius: var(--radius-sm); }
    .content-wrapper { padding: 20px; border-radius: var(--radius-md); }

    /* Buttons */
    .btn-modern {
        padding: 10px 16px;
        font-size: 14px;
    }

    .action-buttons { flex-wrap: wrap; }

    /* Forms - prevent iOS zoom on focus */
    .form-control, .form-select,
    input[type="text"], input[type="email"],
    input[type="password"], input[type="file"],
    textarea, select {
        font-size: 16px;
        max-width: 100%;
    }

    /* Columns full-width */
    .col-md-4, .col-md-5, .col-md-6, .col-md-8 {
        max-width: 100%;
        flex: 0 0 100%;
    }

    .empty-state { padding: 48px 16px; }
    .empty-state i { font-size: 36px; }
    .status-badge { font-size: 10px; padding: 3px 8px; }

    /* DL rows in detail cards */
    dl.row dt { padding: 8px 16px 2px; }
    dl.row dd { padding: 2px 16px 8px; }
}

/* ---- Small phone (≤ 576px) ---- */
@media (max-width: 576px) {
    /* Switch tables to card layout */
    .table-responsive { display: none; }
    .mobile-cards { display: block; }

    .header-title { font-size: 11px; }
    .top-bar-title h4 { font-size: 11px; }
    .sidebar { width: 220px; }
    .sidebar-title { font-size: 14px; }
    .sidebar-link { font-size: 13px; padding: 8px 20px; }

    .minimal-content { padding: 16px 12px; }
    .content-wrapper { padding: 16px; }
    .main-content { padding: 16px 12px; }

    /* Stack login buttons vertically */
    .header-actions .btn-group {
        flex-direction: column;
        gap: 4px !important;
    }

    .signin-link { padding: 6px 12px; font-size: 11px; }

    /* Forms should fill width */
    .form-group > div[style*="display: flex"] {
        flex-direction: column;
    }

    /* DL detail cards: stack label/value */
    dl.row dt {
        padding: 10px 16px 0;
        font-size: 11px;
    }

    dl.row dd {
        padding: 4px 16px 10px;
    }

    /* Alert layout */
    .alert {
        font-size: 13px;
    }

    /* Mobile card improvements */
    .mobile-card { padding: 14px; }
    .mobile-card-header { font-size: 14px; }
    .mobile-card-actions {
        flex-direction: column;
    }
    .mobile-card-actions a,
    .mobile-card-actions button {
        min-width: 0;
    }
}

/* ---- Very small phone (≤ 380px) ---- */
@media (max-width: 380px) {
    .header-logo { height: 28px; width: 28px; }
    .header-title { font-size: 11px; }
    .minimal-header { height: 56px; }
    .signin-link { padding: 6px 10px; font-size: 11px; }
    .sidebar { width: 200px; }
}

/* ---- Landscape on mobile ---- */
@media (max-width: 768px) and (orientation: landscape) {
    .minimal-header { height: 48px; }
    .header-logo { height: 28px; width: 28px; }
    .header-title { font-size: 13px; }
}

/* ============================================================
   BOOTSTRAP TABLE OVERRIDES (fallback for any remaining .table usage)
   ============================================================ */

.table {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table > thead > tr > th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
}

.table > tbody > tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--duration) var(--ease);
}

.table > tbody > tr:last-child {
    border-bottom: none;
}

.table > tbody > tr > td {
    padding: 13px 16px;
    vertical-align: middle;
    color: var(--ink);
    border: none;
}

.table > tbody > tr:hover > td {
    background-color: var(--accent-subtle);
}

/* Badge overrides */
.badge {
    font-family: inherit;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 20px;
}

.badge.bg-info {
    background: var(--info-light) !important;
    color: var(--info) !important;
}

.badge.bg-success {
    background: var(--success-light) !important;
    color: var(--success) !important;
}

.badge.bg-danger {
    background: var(--danger-light) !important;
    color: var(--danger) !important;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    margin-bottom: 0;
}

.btn-outline-primary {
    color: var(--accent) !important;
    border-color: var(--border-strong) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
}

.btn-outline-warning {
    color: var(--warning) !important;
    border-color: var(--border-strong) !important;
    background: transparent !important;
}

.btn-outline-warning:hover {
    background: var(--warning) !important;
    color: white !important;
    border-color: var(--warning) !important;
}

.btn-outline-danger {
    color: var(--danger) !important;
    border-color: var(--border-strong) !important;
    background: transparent !important;
}

.btn-outline-danger:hover {
    background: var(--danger) !important;
    color: white !important;
    border-color: var(--danger) !important;
}

/* Alert dismiss button */
.btn-close {
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* Form read-only fields */
.form-control[readonly] {
    background: var(--surface-sunken);
    color: var(--ink-muted);
    cursor: not-allowed;
}

/* ---- Scrollbar refinement (Webkit) ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-faint);
}

/* ---- Selection ---- */
::selection {
    background: var(--accent-light);
    color: var(--ink);
}
