@charset "utf-8";

/* ==========================================================================
   EXTRANET REDESIGN 2026
   Design system override for Bootstrap 3 → modern SaaS aesthetic
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
    --accent: #D94F4F;
    --accent-light: #FDF0F0;
    --accent-hover: #C43B3B;
    --accent-rgb: 217, 79, 79;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;

    --border-color: #e2e8f0;
    --border-color-strong: #cbd5e1;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);

    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);

    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    --navbar-height: 56px;
    --tabbar-height: 60px;
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESETS & BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family) !important;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-family) !important;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-top: 0;
}

h1, .h1 { font-size: 28px; }
h2, .h2 { font-size: 22px; }
h3, .h3 { font-size: 18px; }
h4, .h4 { font-size: 15px; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover,
a:focus {
    color: var(--accent-hover);
    text-decoration: none;
}

label {
    font-weight: 500 !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

::selection {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Thin scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color-strong);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   3. SPLASH / LOADING SCREEN
   -------------------------------------------------------------------------- */
.splash {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-secondary);
    margin: 0 !important;
}

.splash-content {
    text-align: center;
}

.splash-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 20px;
}

.splash-brand {
    font-family: var(--font-family);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Legacy splash overrides */
.splash .message,
.splash .fa-spinner {
    display: none !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   4. APP SHELL & NAVIGATION
   -------------------------------------------------------------------------- */
.app-shell {
    min-height: 100vh;
}

/* --- Top Navbar --- */
.app-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--accent);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.app-navbar .navbar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

.app-navbar .navbar-brand {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff !important;
    text-decoration: none;
    margin-right: 32px;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.app-navbar .navbar-brand:hover {
    color: #ffffff !important;
}

/* Desktop nav items */
.app-navbar .desktop-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
    flex: 1;
}

.app-navbar .desktop-nav > li {
    position: relative;
}

.app-navbar .desktop-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    border: none;
    background: none;
}
.app-navbar .desktop-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.app-navbar .desktop-nav > li.active > .nav-link {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}
.app-navbar .desktop-nav > li.active > .nav-link i {
    color: #ffffff;
}

.app-navbar .dropdown-arrow {
    font-size: 10px;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.6);
}

/* Desktop dropdown menu */
.app-navbar .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    margin-top: 4px;
    min-width: 180px;
}
.app-navbar .dropdown-menu > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.app-navbar .dropdown-menu > li > a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.app-navbar .dropdown-menu > li.active > a {
    background: var(--accent-light);
    color: var(--accent);
}

/* Sign out button */
.app-navbar .nav-right {
    margin-left: auto;
}

.btn-signout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
}
.btn-signout:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

/* --- Mobile Bottom Tab Bar (deprecated, replaced by hamburger menu) --- */
.mobile-tabbar {
    display: none !important;
}

/* --- App Content --- */
.app-content {
    padding-top: calc(var(--navbar-height) + 24px);
    padding-bottom: 40px;
    min-height: 100vh;
    max-width: 1320px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* --- Responsive Navigation --- */
@media (max-width: 767px) {
    :root {
        --navbar-height: 44px;
    }
    .app-navbar .desktop-nav {
        display: none !important;
    }
    .signout-label {
        display: none;
    }
    .btn-signout {
        padding: 8px;
        border: none;
        color: rgba(255, 255, 255, 0.85);
    }
    .app-content {
        padding-top: calc(var(--navbar-height) + 12px);
        padding-bottom: 40px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .app-navbar .navbar-brand {
        font-size: 15px;
        margin-right: auto;
    }
}

/* --------------------------------------------------------------------------
   5. BOOTSTRAP OVERRIDES: Navbar (legacy classes in case old shell renders)
   -------------------------------------------------------------------------- */
.navbar {
    border: none !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    min-height: var(--navbar-height) !important;
    background: var(--accent) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}
.navbar-default {
    background-color: var(--accent) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}
.navbar-brand {
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    height: var(--navbar-height) !important;
    line-height: var(--navbar-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
.navbar-default .navbar-nav > li > a {
    color: rgba(255, 255, 255, 0.75) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.navbar-default .navbar-nav > li > a:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}
.navbar-toggle {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: var(--radius-sm) !important;
    margin-top: 12px !important;
}
.navbar-toggle .icon-bar {
    background-color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   6. CARDS (replaces Bootstrap panels)
   -------------------------------------------------------------------------- */
.card,
.panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.panel-default,
.panel-info,
.panel-danger,
.panel-warning,
.panel-success,
.panel-primary {
    border-color: var(--border-color);
}

.card-header,
.panel-heading {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid var(--accent);
    letter-spacing: -0.01em;
}

.panel-default > .panel-heading {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    border-left: 3px solid var(--accent);
}
.panel-danger > .panel-heading {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    border-left: 3px solid var(--accent);
}
.panel-info > .panel-heading {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    border-left: 3px solid var(--info);
}
.panel-success > .panel-heading {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    border-left: 3px solid var(--success);
}
.panel-warning > .panel-heading {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    border-left: 3px solid var(--warning);
}

.card-body,
.panel-body {
    padding: 20px;
}

.card-footer,
.panel-footer {
    padding: 12px 20px;
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-color);
    border-color: var(--border-color) !important;
}

.card-accent,
.panel-danger {
    border-color: var(--border-color);
}

/* --------------------------------------------------------------------------
   7. TABLES
   -------------------------------------------------------------------------- */
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 13px;
}

.table > thead > tr > th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color) !important;
    border-top: none !important;
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color) !important;
    vertical-align: middle;
    color: var(--text-primary);
}

.table > tbody > tr:first-child > td {
    border-top: none !important;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: transparent;
}
.table-striped > tbody > tr:nth-of-type(even) {
    background-color: var(--bg-secondary);
}

.table-hover > tbody > tr:hover {
    background-color: var(--bg-tertiary) !important;
}

.table > tbody > tr.success > td {
    background-color: var(--success-light) !important;
}
.table > tbody > tr.danger > td {
    background-color: var(--danger-light) !important;
}

/* --------------------------------------------------------------------------
   8. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
    font-family: var(--font-family) !important;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, color 0.15s ease;
    padding: 8px 16px;
    border: 1px solid transparent;
    transition: all var(--transition);
    cursor: pointer;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: none;
}

.btn:active {
    transform: scale(0.94);
}

.btn:focus,
.btn:active:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.btn-primary,
.btn-danger {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-danger:hover,
.btn-danger:focus {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
    color: #fff !important;
}

.btn-success {
    background-color: var(--success) !important;
    border-color: var(--success) !important;
    color: #fff !important;
}
.btn-success:hover {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

.btn-info {
    background-color: var(--accent-light) !important;
    border-color: var(--accent-light) !important;
    color: var(--accent) !important;
}
.btn-info:hover {
    background-color: #FFE0DE !important;
}

.btn-default {
    background-color: var(--bg-primary);
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}
.btn-default:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color-strong) !important;
    color: var(--text-primary) !important;
}

/* Override btn-default text color when combined with btn-primary (Durandal dialogs) */
.btn-default.btn-primary,
.btn-default.btn-danger {
    color: #fff !important;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: var(--radius);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn[disabled],
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   9. FORMS
   -------------------------------------------------------------------------- */
.form-control {
    font-family: var(--font-family) !important;
    height: 42px;
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-sm);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-control.input-lg {
    height: 48px;
    padding: 10px 16px;
    font-size: 15px;
    border-radius: var(--radius);
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

select.form-control {
    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 fill='%2364748b' d='M6 8.825a.5.5 0 01-.354-.146l-3.5-3.5a.5.5 0 01.708-.708L6 7.618l3.146-3.147a.5.5 0 01.708.708l-3.5 3.5A.5.5 0 016 8.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-group {
    margin-bottom: 16px;
}

.form-horizontal .form-group {
    margin-bottom: 12px;
}

.input-group {
    border-radius: var(--radius-sm);
}

.input-group .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group-btn:last-child > .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    height: 42px;
}

.input-group-btn .btn {
    height: 42px;
}

.input-group .dropdown-toggle {
    height: 42px;
}

.has-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

.validationMessage {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

.checkbox label,
.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* Condensed form variant */
.form-condensed label {
    font-size: 11px !important;
    margin-bottom: 2px;
}
.form-condensed input,
.form-condensed select,
.form-condensed textarea {
    height: 34px;
    padding: 4px 10px;
    font-size: 12px;
}
.form-condensed select {
    padding: 4px 28px 4px 10px;
}
.form-condensed textarea {
    height: 60px;
}
.form-condensed .panel-heading {
    padding: 10px 16px !important;
}

/* --------------------------------------------------------------------------
   10. TABS
   -------------------------------------------------------------------------- */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tabs > li {
    margin-bottom: -1px;
    flex-shrink: 0;
}

.nav-tabs > li > a {
    padding: 12px 18px;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    transition: all var(--transition);
    background: transparent !important;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-tabs > li > a:hover {
    color: var(--text-primary);
    background: transparent !important;
    border-color: transparent !important;
    border-bottom-color: var(--border-color-strong) !important;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: var(--accent) !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid var(--accent) !important;
}

.nav-tabs > li > a .fa-refresh {
    font-size: 11px;
    opacity: 0.5;
    transition: opacity var(--transition);
}
.nav-tabs > li > a .fa-refresh:hover {
    opacity: 1;
}

/* Tab content */
.tab-content > .tab-pane {
    padding: 20px 0;
}

/* --------------------------------------------------------------------------
   11. BADGES & PILLS
   -------------------------------------------------------------------------- */
.badge {
    font-family: var(--font-family);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge-new {
    background-color: var(--success-light);
    color: var(--success);
}
.status-badge-finished {
    background-color: var(--danger-light);
    color: var(--danger);
}
.status-badge-active {
    background-color: var(--accent-light);
    color: var(--accent);
}

/* Inline status indicators (whitelabel table) */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    font-size: 11px;
}
.status-badge.status-success {
    background-color: var(--success-light);
    color: var(--success);
}
.status-badge.status-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* Chip component */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
}

/* Date chip */
.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   12. ALERTS
   -------------------------------------------------------------------------- */
.alert {
    border-radius: var(--radius);
    padding: 14px 18px;
    border: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border-left: 3px solid var(--success);
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border-left: 3px solid var(--danger);
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400e;
    border-left: 3px solid var(--warning);
}

.alert-info {
    background-color: var(--info-light);
    color: #1e40af;
    border-left: 3px solid var(--info);
}

/* --------------------------------------------------------------------------
   13. MODALS
   -------------------------------------------------------------------------- */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header .close {
    margin: 0;
    padding: 4px 8px;
    opacity: 0.5;
    font-size: 18px;
    order: 2;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.modal-autoheight {
    min-height: 200px;
    height: calc(100vh - 300px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-dialog {
    margin: 30px auto;
    max-height: calc(100vh - 60px);
}

/* --------------------------------------------------------------------------
   14. PAGINATION
   -------------------------------------------------------------------------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
}

.pagination-bar .pagination-info {
    font-size: 12px;
    color: var(--text-tertiary);
}

.pagination-bar .btn-group {
    display: flex;
    gap: 4px;
}

/* Legacy panel-footer pagination */
.panel-footer .tr {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-footer .btn-group .btn {
    border-radius: var(--radius-sm);
    margin: 0 2px;
}

/* --------------------------------------------------------------------------
   15. GRID / ARTICLE LIST ITEMS
   -------------------------------------------------------------------------- */
.grid > article,
.item-list > article {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition);
    line-height: 1.5;
}

.grid > article:last-child,
.item-list > article:last-child {
    border-bottom: none;
}

.grid > article:first-child {
    border-top: none;
}

.grid-hovered > article:hover,
.item-list > article:hover {
    background-color: var(--bg-secondary);
}

.grid .active,
.grid-striped > article:nth-child(even) {
    background-color: var(--bg-secondary) !important;
}

/* --------------------------------------------------------------------------
   16. FILE GALLERY
   -------------------------------------------------------------------------- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 16px 0;
}

.file-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}

.file-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.file-card .file-thumb {
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    cursor: pointer;
    overflow: hidden;
}

.file-card .file-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-card .file-thumb h1 {
    font-size: 32px;
    color: var(--text-tertiary);
    margin: 0;
}

.file-card .file-info {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
}

.file-card .file-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card .file-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
}

.file-card .file-actions {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Legacy storage-container override */
.storage-container > ul {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 0;
    list-style: none;
}

.storage-container > ul > li {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: hidden;
    transition: all var(--transition);
}

.storage-container > ul > li:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.storage-container > ul > li .file-thumb {
    background: var(--bg-secondary);
    width: 100% !important;
    height: 160px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.storage-container > ul > li .file-thumb > img {
    max-width: 100% !important;
    max-height: 160px !important;
    object-fit: contain;
}

.storage-container > ul > li > header {
    padding: 8px 12px;
    height: auto !important;
}

.storage-container > ul > li > header.file-name small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    cursor: default;
}

.storage-container > ul > li > footer {
    padding: 6px 12px 10px;
    height: auto !important;
    color: var(--text-tertiary);
    font-size: 11px;
}

.storage-container > ul > li .btn-group-vertical {
    width: 32px !important;
    height: auto !important;
    border: none !important;
    background: var(--bg-secondary);
}

/* --------------------------------------------------------------------------
   17. LOADING SPINNER
   -------------------------------------------------------------------------- */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px 0;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* --------------------------------------------------------------------------
   18. EMPTY STATES
   -------------------------------------------------------------------------- */
.empty-state,
.alert-warning.text-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px dashed var(--border-color);
}

.empty-state i,
.alert-warning.text-center i {
    font-size: 32px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.empty-state span,
.empty-state p,
.alert-warning.text-center span {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* --------------------------------------------------------------------------
   19. SEARCH BARS
   -------------------------------------------------------------------------- */
.search-bar,
.well {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 12px 16px !important;
    margin-bottom: 20px;
}

.search-bar .input-group .form-control,
.well .input-group .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.search-bar .input-group .btn,
.well .input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --------------------------------------------------------------------------
   20. CONTACT CARDS
   -------------------------------------------------------------------------- */
/* Equal-height contact card rows */
.row[data-bind*="foreach: tabs"] {
    display: flex;
    flex-wrap: wrap;
}
.row[data-bind*="foreach: tabs"] > [class*="col-"] {
    display: flex;
}

.contact-card,
.thumbnail {
    background: var(--bg-primary);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    padding: 20px !important;
    height: auto !important;
    overflow: visible !important;
    transition: all var(--transition);
    width: 100%;
}

.contact-card:hover,
.thumbnail:hover {
    box-shadow: var(--shadow-md);
}

.contact-card .contact-avatar,
.thumbnail .fa-3x {
    font-size: 28px !important;
    color: var(--accent);
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    border-radius: var(--radius);
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------------------------------
   21. LOGIN PAGE
   -------------------------------------------------------------------------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-secondary);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.login-form .form-field {
    margin-bottom: 20px;
}

.login-form .form-field label {
    display: block;
    margin-bottom: 6px;
}

.login-form .form-field input {
    width: 100%;
    height: 48px;
    padding: 10px 16px;
    font-family: var(--font-family);
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-sm);
}

.login-form .form-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.login-form .form-field input::placeholder {
    color: var(--text-tertiary);
}

.login-form .checkbox-field {
    margin-bottom: 24px;
}

.login-form .btn-primary {
    width: 100%;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius);
    justify-content: center;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-tertiary);
}

.login-footer small {
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   22. DROPDOWNS
   -------------------------------------------------------------------------- */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
}

.dropdown-menu > li > a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all var(--transition);
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-menu .divider {
    margin: 4px 0;
    background-color: var(--border-color);
}

/* --------------------------------------------------------------------------
   23. TOASTS (toastr overrides)
   -------------------------------------------------------------------------- */
.toast-success {
    background-color: var(--success) !important;
}
.toast-error {
    background-color: var(--danger) !important;
}
.toast-warning {
    background-color: var(--warning) !important;
}
.toast-info {
    background-color: var(--accent) !important;
}

#toast-container > div {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: var(--font-family) !important;
}

/* --------------------------------------------------------------------------
   24. MISC UTILITY OVERRIDES
   -------------------------------------------------------------------------- */

/* Container */
.container-fluid {
    max-width: 1320px;
}

/* Page host (legacy support) */
.page-host {
    position: relative;
    top: calc(var(--navbar-height) + 16px);
    padding: 0 20px;
    max-width: 1320px;
    margin: 0 auto;
}

@media (max-width: 767px) {
    .page-host {
        top: calc(var(--navbar-height) + 12px);
        padding: 0 16px;
        padding-bottom: 40px;
    }
}

/* Text colors */
.text-danger {
    color: var(--accent) !important;
}
.text-success {
    color: var(--success) !important;
}
.text-warning {
    color: var(--warning) !important;
}
.text-info {
    color: var(--info) !important;
}
.text-muted {
    color: var(--text-tertiary) !important;
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

/* Spacing helpers */
.m-t { margin-top: 16px; }
.m-b { margin-bottom: 16px; }
.m-l { margin-left: 16px; }
.m-r { margin-right: 16px; }
.m-n { margin: 0; }
.p { padding: 16px; }
.p-n { padding: 0; }

/* Jumbotron */
.jumbotron {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 40px;
}

/* Legend */
legend {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

/* iframe */
.iframe-container,
.iframe-wrapper {
    width: 100%;
    border: none;
    border-radius: var(--radius);
}

/* Image responsive */
.img-responsive {
    border-radius: var(--radius);
}

/* Content display */
.content-html {
    padding: 0;
    background-color: var(--bg-primary);
    border: none;
    min-height: 200px;
}
.content-html .message-iframe {
    display: block;
    width: 100%;
    min-height: 200px;
}
.content-plain {
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
}

/* AssignedTo separator */
.assignedTo .value-wrapper:after {
    content: " \B7 ";
    font-weight: bold;
    color: var(--text-tertiary);
}
.assignedTo .value-wrapper:last-child:after {
    content: none;
}

/* Profile image centering (replace deprecated <center>) */
.avatar-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal image centering (replace deprecated <center>) */
.modal-image-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page subtitle */
.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   25. ENTITY COLORS (Apple-inspired)
   -------------------------------------------------------------------------- */
:root {
    --color-contact: #00C7BE;
    --color-message: #32ADE6;
    --color-note: #FFCC00;
    --color-project: #FF453A;
    --color-storage: #BF5AF2;
    --color-task: #FF9F0A;

    --color-contact-light: #e6faf9;
    --color-message-light: #e8f4fd;
    --color-note-light: #fff9e0;
    --color-project-light: #fff1f0;
    --color-storage-light: #f5e8ff;
    --color-task-light: #fff4e0;
}

/* --------------------------------------------------------------------------
   26. TIMELINE
   -------------------------------------------------------------------------- */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    overflow: hidden;
    transition: all var(--transition);
    margin-bottom: 8px;
}

.timeline-item:hover {
    box-shadow: var(--shadow-sm);
}

.timeline-item.cursor-pointer:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.timeline-color {
    width: 4px;
    flex-shrink: 0;
}

.timeline-body {
    flex: 1;
    padding: 14px 16px;
    min-width: 0;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.timeline-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.timeline-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.timeline-dot {
    color: var(--text-tertiary);
}

.timeline-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.timeline-content strong {
    font-weight: 500;
}
.timeline-content .btn {
    pointer-events: none;
}

/* Entity-specific colors */
.timeline-contact .timeline-color { background: var(--color-contact); }
.timeline-message .timeline-color { background: var(--color-message); }
.timeline-note .timeline-color    { background: var(--color-note); }
.timeline-project .timeline-color { background: var(--color-project); }
.timeline-storage .timeline-color { background: var(--color-storage); }
.timeline-task .timeline-color    { background: var(--color-task); }

.timeline-type-contact { background: var(--color-contact-light); color: #00A8A0; }
.timeline-type-message { background: var(--color-message-light); color: #1E94CC; }
.timeline-type-note    { background: var(--color-note-light); color: #B38F00; }
.timeline-type-project { background: var(--color-project-light); color: #E03028; }
.timeline-type-storage { background: var(--color-storage-light); color: #A645D6; }
.timeline-type-task    { background: var(--color-task-light); color: #CC7F00; }

/* --------------------------------------------------------------------------
   27. HAMBURGER MENU (Mobile)
   -------------------------------------------------------------------------- */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 8px 6px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-right: 12px;
    transition: background var(--transition);
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger-icon {
    display: block;
    width: 100%;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animate to X when active */
.hamburger-btn.active .hamburger-icon:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger-btn.active .hamburger-icon:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.active .hamburger-icon:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile nav dropdown menu */
.mobile-nav-menu {
    display: none;
    flex-direction: column;
    background: var(--accent);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-nav-menu.open {
    max-height: 400px;
    padding: 8px 20px 12px;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.mobile-nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    text-decoration: none;
}

.mobile-nav-item.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.mobile-nav-child {
    padding-left: 38px;
    font-size: 13px;
}
.mobile-nav-header {
    cursor: default;
    opacity: 0.6;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 16px;
    padding-bottom: 4px;
}
.mobile-nav-header:hover {
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 767px) {
    .hamburger-btn {
        display: flex;
    }
    .mobile-nav-menu {
        display: flex;
    }
}

/* --------------------------------------------------------------------------
   28. RESPONSIVE FINE-TUNING
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .card,
    .panel {
        border-radius: var(--radius);
    }

    .card-body,
    .panel-body {
        padding: 16px;
    }

    .card-header,
    .panel-heading {
        padding: 12px 16px;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .nav-tabs > li > a {
        padding: 10px 14px;
        font-size: 12px;
    }

    .login-card {
        padding: 28px 24px;
    }

    .storage-container > ul {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 12px;
    }

    h1, .h1 { font-size: 22px; }
    h2, .h2 { font-size: 18px; }
    h3, .h3 { font-size: 16px; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .storage-container > ul {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    }
}

/* --------------------------------------------------------------------------
   29. DETAIL FIELDS GRID (equal-height rows on dossier tab)
   -------------------------------------------------------------------------- */
.detail-fields-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.detail-field {
    padding: 12px 4px;
    border-bottom: 1px solid var(--border-color);
    min-height: 0;
}

.detail-field:nth-last-child(-n+3) {
    border-bottom: none;
}

@media (max-width: 991px) {
    .detail-fields-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .detail-field:nth-last-child(-n+3) {
        border-bottom: 1px solid var(--border-color);
    }
    .detail-field:nth-last-child(-n+2) {
        border-bottom: none;
    }
}

@media (max-width: 767px) {
    .detail-fields-grid {
        grid-template-columns: 1fr;
    }
    .detail-field:nth-last-child(-n+2) {
        border-bottom: 1px solid var(--border-color);
    }
    .detail-field:last-child {
        border-bottom: none;
    }
}

/* --------------------------------------------------------------------------
   30. MESSAGE MODAL (maximized content height)
   -------------------------------------------------------------------------- */
.message-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.message-modal-body {
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
    padding-top: 12px;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.message-modal-iframe {
    width: 100%;
    min-height: calc(100vh - 440px);
    border: none;
}

.message-modal-iframe.content-html {
    min-height: 200px;
}

.message-modal-iframe.content-html .message-iframe {
    min-height: calc(100vh - 440px);
}

/* --------------------------------------------------------------------------
   31. DOWNLOAD BUTTON (prevent height shift)
   -------------------------------------------------------------------------- */
.timeline-item .btn {
    transform: none !important;
}

/* --------------------------------------------------------------------------
   32. PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {
    .app-navbar,
    .mobile-tabbar,
    .mobile-nav-menu,
    .btn-signout,
    .search-bar,
    .well {
        display: none !important;
    }

    .app-content {
        padding-top: 0 !important;
    }

    .card,
    .panel {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
