:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 260px;
    --font-family: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}
.screen.active {
    display: flex;
}

/* Login Screen */
#login-screen {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    animation: slideUp 0.6s ease-out;
}

.login-card .logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-card h2 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.role-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-role {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.2rem;
    border-radius: 16px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.btn-role i {
    font-size: 1.8rem;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.8rem;
    border-radius: 12px;
}

.btn-role div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.btn-role span {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-role small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-role:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    background: rgba(30, 41, 59, 0.9);
}

/* App Screen & Horizontal Topbar Layout */
#app-screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-dark);
}
#app-screen.active {
    display: flex;
}

/* Modern Top Navigation Bar */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1050;
    width: 100%;
    min-height: 58px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.85rem;
    box-sizing: border-box;
    gap: 0.5rem;
}

/* Brand & Company Section */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(30, 41, 59, 0.7);
    color: var(--text-main);
    font-size: 1.35rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.topbar-brand .logo {
    color: var(--primary);
    font-size: 1.08rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    cursor: pointer;
}

.topbar-brand .company-selector {
    padding: 0;
    margin: 0;
    min-width: 115px;
    max-width: 185px;
}

.topbar-brand .company-selector select {
    width: 100%;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.32rem 0.5rem;
    border-radius: 8px;
    outline: none;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.topbar-brand .company-selector select:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

/* Mobile Slide-Over Backdrop & Header (Hidden on Desktop) */
.mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.68);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.mobile-nav-backdrop.active {
    display: block;
    opacity: 1;
}

.mobile-drawer-header {
    display: none;
}

/* Navigation Links (Horizontal Menu on Desktop) */
.topbar-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow-x: auto;
    padding: 6px 0.25rem;
}

.topbar-nav::-webkit-scrollbar {
    height: 0px;
    display: none;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.22rem;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.nav-links li {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.nav-links li a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.35rem 0.52rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links li a i {
    font-size: 1.02rem;
}

.nav-links li:hover a {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

.nav-links li.active a {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.nav-links li .badge {
    background: var(--danger);
    color: white;
    padding: 0.08rem 0.34rem;
    border-radius: 10px;
    font-size: 0.64rem;
    font-weight: 700;
    margin-left: 0.2rem;
    display: inline-block;
}

.nav-links li .badge.nav-unread-bubble {
    position: absolute;
    top: -5px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45), 0 0 0 2px #0f172a;
    pointer-events: none;
    z-index: 3;
}

/* Right Controls (Search + Idle Timer + Compact Profile Dropdown) */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 18px;
    padding: 0.28rem 0.58rem;
    border: 1px solid var(--border);
    width: 118px;
    transition: all 0.22s ease;
}

.search-box:focus-within {
    width: 175px;
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-box i {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    padding-left: 0.4rem;
    width: 100%;
    font-size: 0.78rem;
}

/* Compact Profile Dropdown */
.profile-dropdown-wrapper {
    position: relative;
}

.profile-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.24rem 0.52rem 0.24rem 0.28rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.profile-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(59, 130, 246, 0.4);
}

.profile-trigger-name {
    font-size: 0.78rem;
    font-weight: 600;
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-chevron {
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.profile-dropdown-wrapper.open .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 310px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.65);
    padding: 0.85rem;
    z-index: 1200;
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-dropdown-wrapper.open .profile-dropdown-menu {
    display: flex;
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.76rem;
    color: white;
    flex-shrink: 0;
}

.avatar.avatar-lg {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.name-job {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.profile_name {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.job {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.profile-dropdown-credit-section {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-dropdown-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.profile-dropdown-item i {
    font-size: 1.1rem;
    color: var(--primary);
}

.profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.profile-dropdown-logout {
    color: #f87171;
}

.profile-dropdown-logout i {
    color: #ef4444;
}

.profile-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* Responsive Breakpoints: Compact Laptop & Mobile Hamburger Slide-Over Drawer */
@media (max-width: 1360px) {
    .profile-trigger-name {
        display: none;
    }
    .search-box {
        width: 100px;
    }
    .search-box:focus-within {
        width: 150px;
    }
    .topbar-brand .company-selector {
        max-width: 150px;
    }
    .nav-links li a {
        padding: 0.32rem 0.44rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 1120px) {
    .app-topbar {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: #0f172a;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .topbar-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        width: 285px !important;
        max-width: 84vw !important;
        background: #0f172a !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-top: none !important;
        box-shadow: 12px 0 32px rgba(0, 0, 0, 0.65);
        z-index: 1060 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        padding: 1rem !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transform: translateX(-105%);
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .topbar-nav.mobile-open {
        transform: translateX(0);
    }

    .mobile-drawer-header {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding-bottom: 0.85rem;
        margin-bottom: 0.65rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        flex-shrink: 0;
    }

    .mobile-drawer-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .mobile-drawer-top .logo {
        color: var(--primary);
        font-size: 1.12rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .mobile-drawer-close {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-muted);
        font-size: 1.35rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .mobile-drawer-controls {
        display: flex;
        flex-direction: column;
        gap: 0.55rem;
    }

    .mobile-company-selector select {
        width: 100%;
        background: rgba(30, 41, 59, 0.9);
        border: 1px solid var(--border);
        color: var(--text-main);
        padding: 0.5rem 0.65rem;
        border-radius: 8px;
        font-size: 0.82rem;
    }

    .mobile-search-box {
        display: flex;
        align-items: center;
        background: rgba(30, 41, 59, 0.8);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 0.45rem 0.65rem;
    }

    .mobile-search-box i {
        color: var(--text-muted);
        font-size: 1rem;
    }

    .mobile-search-box input {
        background: transparent;
        border: none;
        outline: none;
        color: var(--text-main);
        padding-left: 0.45rem;
        width: 100%;
        font-size: 0.82rem;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        width: 100%;
        flex-shrink: 0;
    }

    .nav-links li {
        width: 100%;
        flex-shrink: 0;
    }

    .nav-links li a {
        display: flex;
        width: 100%;
        padding: 0.68rem 0.85rem;
        font-size: 0.88rem;
        gap: 0.65rem;
        border-radius: 10px;
        box-sizing: border-box;
    }

    .nav-links li a i {
        font-size: 1.2rem;
    }

    .nav-links li .badge.nav-unread-bubble {
        position: static;
        margin-left: auto;
    }

    .nav-links li .badge {
        margin-left: auto;
    }
}

@media (max-width: 680px) {
    .topbar-brand .company-selector {
        display: none;
    }
    .topbar-right .search-box {
        display: none;
    }
    .app-topbar {
        padding: 0 0.65rem;
    }
    .profile-dropdown-menu {
        width: min(300px, calc(100vw - 1.5rem));
    }
}

/* Full Width Main Content Section */
.home-section {
    position: relative;
    background: var(--bg-dark);
    min-height: calc(100vh - 64px);
    left: 0 !important;
    width: 100% !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.notification {
    position: relative;
    cursor: pointer;
}

.notification i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.notification .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
}

.main-content {
    padding: 2rem;
    animation: fadeIn 0.4s ease-out;
}

.view-header {
    margin-bottom: 2rem;
}

.view-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.view-header p {
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Dashboard Stats & Command Center */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dash-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.dash-company-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.dash-quick-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dash-integrations-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border);
    padding: 0.25rem 0.35rem;
    border-radius: 10px;
    flex-wrap: wrap;
}

.dash-int-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0 0.4rem 0 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    margin-right: 0.1rem;
    white-space: nowrap;
}

.dash-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.36rem 0.7rem;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    white-space: nowrap;
}

.dash-action-btn i {
    font-size: 0.98rem;
}

.dash-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.dash-action-btn.primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: #3b82f6;
    color: #fff;
}

.dash-action-btn.emerald {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.38);
    color: #34d399;
}

.dash-action-btn.indigo {
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.38);
    color: #a5b4fc;
}

.dash-alerts-strip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.15rem;
}

.dash-alert-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.85rem;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dash-alert-pill:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 1200px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    }
}

/* Read / Unread Filter Bar & Row Visualization */
.list-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.list-header-left {
    min-width: 0;
    flex: 1 1 420px;
}

.list-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 1100px) {
    .list-header-row {
        flex-wrap: wrap;
    }
}

.read-filter-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border);
    padding: 0.2rem;
    border-radius: 9px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.read-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.24rem 0.58rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.read-filter-chip:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.read-filter-chip.active,
.read-filter-chip.active-all,
.read-filter-chip.active-read {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.45);
}

.read-filter-chip.active-unread,
.read-filter-chip.unread-chip.active {
    background: rgba(59, 130, 246, 0.26);
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.65);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.read-filter-chip .chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.05rem 0.38rem;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.read-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.18s ease;
}

.read-toggle-btn.unread {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
}

.read-toggle-btn.unread:hover {
    background: rgba(59, 130, 246, 0.28);
    transform: scale(1.08);
}

.read-toggle-btn.read {
    color: var(--text-muted);
    opacity: 0.55;
}

.read-toggle-btn.read:hover {
    opacity: 1;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

tr.doc-row.unread-row {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.13) 0%, rgba(59, 130, 246, 0.04) 100%) !important;
    font-weight: 700;
}

tr.doc-row.unread-row td:first-child {
    box-shadow: inset 4px 0 0 #3b82f6;
}

tr.doc-row.read-row {
    opacity: 0.88;
}

.dash-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.dash-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0.85;
}

.dash-kpi-card.kpi-blue::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.dash-kpi-card.kpi-green::before { background: linear-gradient(90deg, #059669, #34d399); }
.dash-kpi-card.kpi-amber::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.dash-kpi-card.kpi-purple::before { background: linear-gradient(90deg, #7c3aed, #c084fc); }
.dash-kpi-card.kpi-cyan::before { background: linear-gradient(90deg, #0891b2, #38bdf8); }

.dash-kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.kpi-compact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.kpi-compact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.kpi-compact-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.22rem;
    flex-shrink: 0;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.kpi-icon.blue { background: rgba(59, 130, 246, 0.14); color: #60a5fa; }
.kpi-icon.green { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.kpi-icon.amber { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.kpi-icon.purple { background: rgba(168, 85, 247, 0.14); color: #c084fc; }
.kpi-icon.cyan { background: rgba(6, 182, 212, 0.14); color: #38bdf8; }

.kpi-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.48rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
    white-space: nowrap;
}

.kpi-badge.green { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.kpi-badge.amber { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.kpi-badge.purple { background: rgba(168, 85, 247, 0.14); color: #c084fc; }
.kpi-badge.cyan { background: rgba(6, 182, 212, 0.14); color: #38bdf8; }
.kpi-badge.danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.kpi-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.kpi-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.15rem;
    margin-bottom: 1.25rem;
}

.dash-analytics-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.15rem;
}

@media (max-width: 1180px) {
    .dash-dual-grid,
    .dash-analytics-grid {
        grid-template-columns: 1fr;
    }
}

.dash-panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dash-panel-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.35);
}

.dash-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dash-panel-title h3 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-main);
}

.panel-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}
.panel-dot.blue { background: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
.panel-dot.green { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }

.panel-count-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}
.panel-count-pill.green {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.dash-link-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.28rem 0.65rem;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
}

.dash-link-btn:hover {
    color: var(--text-main);
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
}

.dash-table-wrap {
    overflow-x: auto;
}

.dash-mini-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.dash-mini-table th {
    padding: 0.55rem 0.7rem;
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.22);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.dash-mini-table td {
    padding: 0.58rem 0.7rem;
    font-size: 0.81rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.dash-mini-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.dash-mini-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08) !important;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.icon-box.primary { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.icon-box.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.icon-box.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-info h2 {
    font-size: 1.8rem;
    margin-top: 0.3rem;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

table {
    width: 100%;
    border-collapse: collapse;
}

#list-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    min-width: 1040px;
}

#list-table th,
#list-table td {
    box-sizing: border-box;
    overflow: hidden;
}

th, td {
    padding: 0.7rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(15, 23, 42, 0.45);
    white-space: nowrap;
}

td {
    font-size: 0.87rem;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Document Table Column Widths & Alignments (Deterministic Fixed Layout) */
.col-date {
    width: 98px !important;
    min-width: 98px !important;
    max-width: 98px !important;
    white-space: nowrap;
    font-size: 0.82rem;
    text-align: left;
}
.col-id {
    width: 185px !important;
    min-width: 175px !important;
    max-width: 185px !important;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    font-size: 0.83rem;
}
.col-recipient {
    width: 24% !important;
    min-width: 200px !important;
    overflow: hidden;
}
.col-title {
    /* Auto flexible: fills remaining width deterministically in table-layout: fixed */
    width: auto !important;
    min-width: 220px !important;
    overflow: hidden;
}
.col-creator {
    width: 145px !important;
    min-width: 130px !important;
    max-width: 145px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
}
.col-method {
    width: 132px !important;
    min-width: 125px !important;
    max-width: 132px !important;
    text-align: center !important;
    white-space: nowrap;
    overflow: hidden;
}
.col-status {
    width: 102px !important;
    min-width: 96px !important;
    max-width: 102px !important;
    text-align: center !important;
    white-space: nowrap;
    overflow: hidden;
}
.col-action {
    width: 145px !important;
    min-width: 135px !important;
    max-width: 145px !important;
    text-align: center !important;
    white-space: nowrap;
}

.doc-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.34;
}

/* Sortable column header hover */
#list-table thead th[onclick]:hover {
    background: rgba(255,255,255,0.08);
    color: var(--primary);
    transition: background 0.15s;
}

/* Document Table Rows */
tr.doc-row {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
tr.doc-row:hover {
    background: rgba(59, 130, 246, 0.08) !important;
}
tr.doc-row.active-row {
    background: rgba(59, 130, 246, 0.16) !important;
    box-shadow: inset 4px 0 0 var(--primary) !important;
}
tr.doc-row.active-row td {
    color: var(--text-main);
}

/* Dashboard table row hover */
#dashboard-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}
#dashboard-table tbody tr:hover {
    background: rgba(255,255,255,0.06);
}


.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-approved { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-rejected { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.status-draft { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* Create Document - Resizable Split-Pane Layout */
.create-doc-container {
    display: flex;
    align-items: flex-start;
    width: 100%;
    position: relative;
    gap: 0;
}

.create-pane-left {
    flex: 0 0 calc(var(--left-pane-pct, 50%) - 9px);
    width: calc(var(--left-pane-pct, 50%) - 9px);
    min-width: 320px;
    transition: flex-basis 0.18s ease, width 0.18s ease;
    box-sizing: border-box;
}

.create-pane-right {
    flex: 1 1 0%;
    min-width: 280px;
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    position: sticky;
    top: 1rem;
    box-sizing: border-box;
    transition: opacity 0.18s ease;
}

body.is-resizing-panes,
body.is-resizing-panes * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.is-resizing-panes .create-pane-left,
body.is-resizing-panes .create-pane-right {
    transition: none !important;
}

body.is-resizing-panes iframe {
    pointer-events: none !important;
}

.create-doc-container.full-editor-mode .create-pane-left {
    flex: 1 1 100% !important;
    width: 100% !important;
}

.create-doc-container.full-editor-mode .create-pane-splitter,
.create-doc-container.full-editor-mode .create-pane-right {
    display: none !important;
}

/* Draggable Splitter Bar */
.create-pane-splitter {
    flex: 0 0 18px;
    width: 18px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    position: relative;
    z-index: 15;
    user-select: none;
    margin: 0 2px;
}

.create-pane-splitter .splitter-line {
    width: 2px;
    flex: 1;
    background: var(--border);
    border-radius: 2px;
    transition: background 0.2s ease, width 0.2s ease;
}

.create-pane-splitter .splitter-grip {
    width: 22px;
    height: 44px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    margin: 6px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    position: sticky;
    top: 48vh;
}

.create-pane-splitter:hover .splitter-line,
body.is-resizing-panes .create-pane-splitter .splitter-line {
    background: var(--primary);
    width: 3px;
}

.create-pane-splitter:hover .splitter-grip,
body.is-resizing-panes .create-pane-splitter .splitter-grip {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
}

/* Split Layout Toolbar in View Header */
.split-layout-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.35rem 0.5rem;
    border-radius: 12px;
}

.split-toolbar-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0 0.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.split-preset-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.18s ease;
}

.split-preset-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.split-preset-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

/* Pane Top Header Bar */
.pane-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1.15rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.pane-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--text-main);
}

.pane-header-title i {
    color: var(--primary);
    font-size: 1.15rem;
}

.pane-width-badge {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Preview Zoom Controls & Scaled Stage */
.preview-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--border);
    padding: 0.2rem;
    border-radius: 8px;
}

.zoom-ctrl-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.28rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.15s ease;
}

.zoom-ctrl-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.07);
}

.zoom-ctrl-btn.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

.zoom-level-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 44px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
}

.zoom-level-label:hover {
    background: rgba(255, 255, 255, 0.06);
}

.document-preview-viewport {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #c8cdd6;
    border-radius: 10px;
    min-height: 600px;
    max-height: calc(100vh - 130px);
    display: block;
    padding: 12px 0;
    box-sizing: border-box;
}

.document-preview-stage {
    position: relative;
    width: 850px;
    margin: 0 auto;
    display: block;
    transform-origin: top left;
}

@media (max-width: 1024px) {
    .create-doc-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    .create-pane-left,
    .create-pane-right {
        flex: 1 1 100% !important;
        width: 100% !important;
        position: static !important;
    }
    .create-pane-splitter,
    .split-layout-toolbar {
        display: none !important;
    }
}

form {
    background: var(--bg-card);
    padding: 1.5rem 1.75rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* Modern Create Document Left Pane Styling */
form.create-modern-form {
    padding: 0.95rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.create-docno-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.create-section-card {
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    transition: border-color 0.2s ease;
}

.create-section-card:hover {
    border-color: rgba(59, 130, 246, 0.22);
}

.create-grid-3-top {
    display: grid;
    grid-template-columns: 1.25fr 0.9fr 1.15fr;
    gap: 0.6rem;
}

.create-grid-recipient {
    display: grid;
    grid-template-columns: 1.45fr 1fr 0.95fr;
    gap: 0.5rem;
}

.create-grid-subject {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 0.6rem;
    align-items: end;
}

.create-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

@media (max-width: 760px) {
    .create-grid-3-top,
    .create-grid-recipient,
    .create-grid-subject,
    .create-grid-2 {
        grid-template-columns: 1fr;
    }
}

.create-recipient-toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}

.create-recipient-toolbar select {
    flex: 1;
    min-width: 0;
    width: auto !important;
    padding: 0.38rem 0.65rem !important;
    font-size: 0.8rem !important;
    border-radius: 7px !important;
    background: rgba(168, 85, 247, 0.1) !important;
    border: 1px solid rgba(168, 85, 247, 0.32) !important;
    color: #e9d5ff !important;
    cursor: pointer;
    font-weight: 500;
}

.create-recipient-toolbar select:focus {
    border-color: #a855f7 !important;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.18) !important;
}

.doc-selected-files-box {
    box-sizing: border-box;
    position: relative;
}

.create-field label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.26rem;
    color: #cbd5e1;
    font-size: 0.76rem;
    font-weight: 600;
}

.create-field label i {
    color: var(--primary);
    font-size: 0.88rem;
}

.create-field .field-hint {
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.create-field .field-hint code {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 700;
}

.req-pill {
    font-size: 0.63rem;
    font-weight: 700;
    padding: 0.05rem 0.38rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
    margin-left: auto;
}

.create-field input,
.create-field select,
.create-field textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.44rem 0.68rem;
    border-radius: 7px;
    outline: none;
    font-size: 0.83rem;
    transition: all 0.18s ease;
    box-sizing: border-box;
}

.create-field input:focus,
.create-field select:focus,
.create-field textarea:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.16);
}

.create-field.highlight-required input,
#field-wrap-kep.highlight-required input,
#field-wrap-email.highlight-required input {
    border-color: rgba(59, 130, 246, 0.65);
    background: rgba(37, 99, 235, 0.09);
}

/* Segmented Delivery Method Pills */
.delivery-method-pills {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.42rem;
}

@media (max-width: 720px) {
    .delivery-method-pills {
        grid-template-columns: repeat(2, 1fr);
    }
}

.delivery-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    padding: 0.48rem 0.35rem;
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delivery-pill i {
    font-size: 1.1rem;
    transition: transform 0.18s ease;
}

.delivery-pill:hover {
    color: var(--text-main);
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.08);
}

.delivery-pill.active {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.12) 100%);
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.22);
}

.delivery-pill.active i {
    color: #60a5fa;
    transform: scale(1.08);
}

.delivery-pill[data-method="kep"].active,
.delivery-pill[data-method="kep_eyp"].active {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.24) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.22);
}

.delivery-pill[data-method="kep"].active i,
.delivery-pill[data-method="kep_eyp"].active i {
    color: #34d399;
}

/* Contact & DETSIS Bar */
.create-contact-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.create-contact-bar select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.35);
    background: rgba(168, 85, 247, 0.07);
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.create-contact-bar select:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.create-detsis-btn {
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.45);
    background: rgba(37, 99, 235, 0.14);
    color: #60a5fa;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.create-detsis-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

.create-mini-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    transition: all 0.15s ease;
}

.create-mini-btn:hover {
    color: var(--text-main);
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
}

.create-quick-ref-select {
    width: auto !important;
    max-width: 245px;
    padding: 0.22rem 0.55rem !important;
    font-size: 0.74rem !important;
    border-radius: 6px !important;
    background: rgba(59, 130, 246, 0.1) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    color: #93c5fd !important;
    cursor: pointer;
}

/* Quick Phrase Chips */
.quick-phrase-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.phrase-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.phrase-chip {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    font-size: 0.71rem;
    font-weight: 600;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.phrase-chip:hover {
    background: rgba(16, 185, 129, 0.24);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Attachment Dropzone */
.create-dropzone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border: 1px dashed rgba(59, 130, 246, 0.45);
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.06);
    cursor: pointer;
    transition: all 0.18s ease;
    flex: 1;
}

.create-dropzone:hover {
    background: rgba(37, 99, 235, 0.12);
    border-color: #60a5fa;
}

.dropzone-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.create-allowed-users-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
    min-height: 38px;
    align-items: center;
}

/* Sticky Action Bar at bottom of form */
.create-sticky-actions {
    position: sticky;
    bottom: 0.5rem;
    z-index: 12;
    margin-top: 0.25rem !important;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    display: flex;
    justify-content: space-between !important;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    outline: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

select option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.editor-toolbar {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.editor-toolbar button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.editor-toolbar button:hover {
    background: var(--border);
    color: var(--text-main);
}

.form-group textarea {
    border-radius: 0 0 10px 10px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-action {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-size: 0.85rem;
    transition: var(--transition);
}
.btn-action:hover {
    background: var(--primary);
    color: white;
}
.btn-approve { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.btn-approve:hover { background: var(--success); color: white; }
.btn-reject { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-reject:hover { background: var(--danger); color: white; }
.btn-danger { background: #ef4444; color: white; border: none; }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

/* Document Preview / Letterhead */
.document-preview-wrapper {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.document-preview-wrapper h3 {
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

#document-preview-frame {
    width: 100%;
    min-height: 700px;
    border: none;
    border-radius: 8px;
    background: #d1d5db;
}

.letterhead-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.letterhead-header img {
    height: 60px;
    margin-right: 1.5rem;
}

.lh-company-info h2 {
    font-family: var(--font-family);
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 0.2rem;
}

.lh-company-info p {
    font-family: var(--font-family);
    font-size: 0.85rem;
    color: #666;
}

.lh-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.lh-title {
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

/* Custom Letterhead Footer Positioning Classes */
.antet-footer.fixed {
    position: absolute !important;
    bottom: 8px !important; /* Pushed further down as requested */
    left: 20px !important;
    right: 20px !important;
}
.antet-footer.relative {
    position: relative !important;
    bottom: auto !important;
    margin-top: 30px !important;
    padding-top: 10px !important;
}

.lh-content {
    line-height: 1.6;
    margin-bottom: 4rem;
    min-height: 200px;
    white-space: pre-wrap;
}

.lh-footer {
    display: flex;
    justify-content: flex-end;
}

.lh-signature {
    text-align: center;
}

.lh-signature p:first-child {
    font-weight: bold;
    margin-bottom: 0.2rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    width: 95%;
    max-width: 1280px;
    max-height: 92vh;
    border-radius: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header h2 {
    font-size: 1.2rem;
}

.modal-header i {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-header i:hover {
    color: var(--danger);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-dark);
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Rich Text Editor */
.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #1a2540;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.rich-editor-toolbar button {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 4px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: var(--transition);
    white-space: nowrap;
}

.rich-editor-toolbar button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.rich-editor-toolbar select {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 4px 6px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    width: auto;
}

.rich-editor-toolbar .sep {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
    display: inline-block;
}

.rich-editor-body {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    padding: 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
}

.rich-editor-body:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.rich-editor-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
}

.rich-editor-body table td,
.rich-editor-body table th {
    border: 1px solid #334155;
    padding: 6px 10px;
    min-width: 60px;
}

.rich-editor-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Jodit Editor - force white background and dark text */
.jodit-wysiwyg,
.jodit-wysiwyg p,
.jodit-wysiwyg div,
.jodit-wysiwyg span {
    color: #1a1a1a !important;
}

.jodit-container {
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    overflow: hidden;
}

.jodit-container:not(.jodit_inline) .jodit-wysiwyg {
    background: #ffffff !important;
    color: #1a1a1a !important;
    min-height: 320px !important;
    font-family: 'Times New Roman', serif !important;
    font-size: 14px !important;
    padding: 16px !important;
    text-align: justify;
}

.jodit-wysiwyg p:not([style*="text-align"]),
.jodit-content-area p:not([style*="text-align"]) {
    text-align: justify;
}

/* Resmi yazı editörü ve canlı önizlemede tablo kenar çizgileri (PDF ile birebir) */
.jodit-wysiwyg table,
.jodit-content-area table,
.doc-content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.jodit-wysiwyg table:not([border="0"]):not([style*="border: 0"]):not([style*="border:0"]):not([style*="border: none"]):not([style*="border:none"]):not([style*="border-style: none"]):not([style*="border-style:none"]) th,
.jodit-wysiwyg table:not([border="0"]):not([style*="border: 0"]):not([style*="border:0"]):not([style*="border: none"]):not([style*="border:none"]):not([style*="border-style: none"]):not([style*="border-style:none"]) td,
.jodit-content-area table:not([border="0"]):not([style*="border: 0"]):not([style*="border:0"]):not([style*="border: none"]):not([style*="border:none"]):not([style*="border-style: none"]):not([style*="border-style:none"]) th,
.jodit-content-area table:not([border="0"]):not([style*="border: 0"]):not([style*="border:0"]):not([style*="border: none"]):not([style*="border:none"]):not([style*="border-style: none"]):not([style*="border-style:none"]) td,
.doc-content-body table:not([border="0"]):not([style*="border: 0"]):not([style*="border:0"]):not([style*="border: none"]):not([style*="border:none"]):not([style*="border-style: none"]):not([style*="border-style:none"]) th,
.doc-content-body table:not([border="0"]):not([style*="border: 0"]):not([style*="border:0"]):not([style*="border: none"]):not([style*="border:none"]):not([style*="border-style: none"]):not([style*="border-style:none"]) td {
    border: 1px solid #000000 !important;
    padding: 6px 8px;
}

.doc-content-body table[border="0"] th, .doc-content-body table[border="0"] td,
.doc-content-body table[style*="border: 0"] th, .doc-content-body table[style*="border: 0"] td,
.doc-content-body table[style*="border:0"] th, .doc-content-body table[style*="border:0"] td,
.doc-content-body table[style*="border: none"] th, .doc-content-body table[style*="border: none"] td,
.doc-content-body table[style*="border:none"] th, .doc-content-body table[style*="border:none"] td,
.doc-content-body table[style*="border-style: none"] th, .doc-content-body table[style*="border-style: none"] td,
.doc-content-body table[style*="border-style:none"] th, .doc-content-body table[style*="border-style:none"] td {
    border: none !important;
}

/* Toolbar background */
.jodit-toolbar__box,
.jodit-ui-group,
.jodit-toolbar-editor-collection {
    background: #1e2d4a !important;
}

/* All toolbar icons and buttons → white */
.jodit-toolbar-button__button,
.jodit-toolbar-button__button svg,
.jodit-toolbar-button__button .jodit-icon,
.jodit-toolbar-button svg path,
.jodit-toolbar-button svg {
    color: #e2e8f0 !important;
    fill: #e2e8f0 !important;
    stroke: #e2e8f0 !important;
}

/* Separator line */
.jodit-toolbar__box .jodit-ui-separator {
    background: rgba(255,255,255,0.15) !important;
}

/* Hover state */
.jodit-toolbar-button__button:hover {
    background: rgba(59,130,246,0.25) !important;
    border-radius: 4px;
}

/* Active/pressed state */
.jodit-toolbar-button_activated .jodit-toolbar-button__button {
    background: rgba(59,130,246,0.4) !important;
}

/* Bottom status bar */
.jodit-status-bar {
    background: #1e2d4a !important;
    color: #94a3b8 !important;
    border-top: 1px solid var(--border) !important;
}
.jodit-status-bar a {
    color: #64748b !important;
}

/* Jodit Dropdowns, Popups, and Options contrast overrides */
.jodit-popup,
.jodit-dropdown,
.jodit-dropdown-menu,
.jodit-dropdown__list,
.jodit-dropdown-container,
.jodit-ui-popover,
.jodit-popover,
.jodit-popup-container,
.jodit-popup__content,
.jodit-ui-popup,
.jodit-toolbar-editor-collection__dropdown,
.jodit-toolbar-editor-collection__dropdown .jodit-ui-button,
.jodit-toolbar-editor-collection__dropdown .jodit-ui-button__text {
    background: #1e2d4a !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5) !important;
    color: #e2e8f0 !important;
}

.jodit-dropdown__list-item,
.jodit-dropdown-item,
.jodit-dropdown-button,
.jodit-dropdown__item,
.jodit-ui-button {
    background: transparent !important;
    color: #e2e8f0 !important;
}

.jodit-dropdown__list-item:hover,
.jodit-dropdown-item:hover,
.jodit-dropdown-button:hover,
.jodit-dropdown__item:hover,
.jodit-ui-button:hover {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #ffffff !important;
}

/* Jodit Button Variants Contrast Overrides (Prevents transparent action buttons inside forms) */
.jodit-ui-button_variant_primary,
.jodit-ui-button-variants_variant_primary {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    border: 1px solid var(--primary) !important;
}
.jodit-ui-button_variant_primary:hover,
.jodit-ui-button-variants_variant_primary:hover {
    background-color: var(--primary-hover) !important;
    color: #ffffff !important;
    border-color: var(--primary-hover) !important;
}

.jodit-ui-button_variant_success,
.jodit-ui-button-variants_variant_success {
    background-color: var(--success) !important;
    color: #ffffff !important;
    border: 1px solid var(--success) !important;
}
.jodit-ui-button_variant_success:hover,
.jodit-ui-button-variants_variant_success:hover {
    background-color: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

.jodit-ui-button_variant_danger,
.jodit-ui-button-variants_variant_danger {
    background-color: var(--danger) !important;
    color: #ffffff !important;
    border: 1px solid var(--danger) !important;
}
.jodit-ui-button_variant_danger:hover,
.jodit-ui-button-variants_variant_danger:hover {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

.jodit-ui-button_variant_secondary,
.jodit-ui-button-variants_variant_secondary {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.jodit-ui-button_variant_secondary:hover,
.jodit-ui-button-variants_variant_secondary:hover {
    background-color: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}

/* Table Creator selector cells inside popups */
.jodit-form__inserter .jodit-form__table-creator-box .jodit-form__container>div>span {
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    box-sizing: border-box !important;
    transition: all 0.15s ease !important;
}
/* Hovered cells inside the table creator */
.jodit-form__inserter .jodit-form__table-creator-box .jodit-form__container>div>span.jodit_hovered {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 6px var(--primary) !important;
}

/* Jodit Tabs & Popup Buttons Custom Premium Styling */
.jodit-tabs .jodit-tabs__buttons {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 4px !important;
    display: flex !important;
}

.jodit-tabs .jodit-tabs__buttons .jodit-ui-button {
    color: var(--text-muted) !important;
    background: transparent !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    border: none !important;
}
.jodit-tabs .jodit-tabs__buttons .jodit-ui-button svg {
    fill: var(--text-muted) !important;
}
.jodit-tabs .jodit-tabs__buttons .jodit-ui-button:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}
.jodit-tabs .jodit-tabs__buttons .jodit-ui-button:hover svg {
    fill: #ffffff !important;
}
.jodit-tabs .jodit-tabs__buttons .jodit-ui-button[aria-pressed="true"] {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}
.jodit-tabs .jodit-tabs__buttons .jodit-ui-button[aria-pressed="true"] svg {
    fill: #ffffff !important;
}

/* Fix text and label visibility inside popups and forms */
.jodit-popup label,
.jodit-popup span,
.jodit-popup div,
.jodit-ui-form label,
.jodit-ui-form span,
.jodit-ui-form div {
    color: #e2e8f0 !important;
}

.jodit-ui-form input,
.jodit-ui-form textarea,
.jodit-ui-form select,
.jodit-ui-input,
.jodit-ui-input__input,
.jodit-ui-form__input,
.jodit-ui-select,
.jodit-ui-textarea {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid var(--border) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
}
.jodit-ui-input:focus-within,
.jodit-ui-input__input:focus,
.jodit-ui-select:focus,
.jodit-ui-textarea:focus {
    border-color: var(--primary) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    outline: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Mobile-Only Helper Toolbars (Hidden on Desktop) */
.mobile-list-toolbar,
.mobile-split-tabs,
.modal-mobile-tabs {
    display: none;
}

.modal-mobile-section {
    display: block;
}

/* Active Document Quick Action Bar inside Preview Modal */
.doc-viewer-quickbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.65rem;
    padding: 0.45rem 0.8rem;
    background: rgba(15, 23, 42, 0.94);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.doc-viewer-quickbar-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 130px;
    flex: 1 1 160px;
}

.doc-viewer-quickbar-title i {
    color: var(--primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.doc-viewer-quickbar-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-viewer-quickbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.doc-viewer-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    background: rgba(30, 41, 59, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 0.14rem;
    border-radius: 7px;
}

.modal-preview-viewport {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #334155;
    position: relative;
    display: block;
    box-sizing: border-box;
}

.modal-preview-stage {
    position: relative;
    margin: 0 auto;
    overflow: hidden;
    transform-origin: top left;
}

.docx-ebys-preview-wrapper {
    background: #334155 !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.doc-quickbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    transition: all 0.18s ease;
    white-space: nowrap;
}

.doc-quickbar-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    color: #fff;
}

.doc-quickbar-btn.primary {
    background: rgba(37, 99, 235, 0.22);
    border-color: rgba(59, 130, 246, 0.45);
    color: #93c5fd;
}

.doc-quickbar-btn.primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Mobile & Tablet Responsive CSS Styles */
@media (max-width: 1024px) {
    #app-screen {
        flex-direction: column;
    }
    .search-box {
        width: 170px;
    }
    .main-content {
        padding: 1rem !important;
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Mobile Mode Switcher Tabs for Create Document & Incoming Registration */
    .mobile-split-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
        background: rgba(15, 23, 42, 0.85);
        border: 1px solid var(--border);
        padding: 0.32rem;
        border-radius: 11px;
        margin-bottom: 0.85rem;
    }

    .mobile-split-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        padding: 0.55rem 0.65rem;
        border-radius: 8px;
        border: 1px solid transparent;
        background: transparent;
        color: var(--text-muted);
        font-size: 0.82rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-split-tab i {
        font-size: 1.05rem;
    }

    .mobile-split-tab.active {
        background: rgba(59, 130, 246, 0.2);
        border-color: rgba(59, 130, 246, 0.45);
        color: #ffffff;
        box-shadow: 0 2px 10px rgba(59, 130, 246, 0.18);
    }

    #create-doc-split-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }

    #create-doc-split-container .create-pane-left {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    #create-doc-split-container .create-pane-right {
        display: none !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    #create-doc-split-container.mobile-preview-active .create-pane-left {
        display: none !important;
    }

    #create-doc-split-container.mobile-preview-active .create-pane-right {
        display: flex !important;
    }

    #inc-layout-grid {
        grid-template-columns: 1fr !important;
    }

    #inc-layout-grid #register-incoming-form {
        display: flex !important;
    }

    #inc-layout-grid #inc-preview-pane {
        display: none !important;
    }

    #inc-layout-grid.mobile-preview-active #register-incoming-form {
        display: none !important;
    }

    #inc-layout-grid.mobile-preview-active #inc-preview-pane {
        display: flex !important;
    }

    .document-preview-wrapper {
        width: 100% !important;
        overflow-x: hidden !important;
        padding: 0.75rem !important;
    }

    .table-container {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .modal {
        width: 96% !important;
        max-width: 96% !important;
        margin: 8px auto !important;
        height: auto !important;
        max-height: 95vh !important;
    }
    
    /* Interactive Multi-Attachment Sidebar Adaptation (Both class and legacy inline selector) */
    .doc-modal-split-layout,
    .modal-body > div[style*="display: flex"] {
        flex-direction: column !important;
        height: auto !important;
        gap: 0 !important;
    }
    .doc-modal-files-sidebar,
    .modal-body > div[style*="display: flex"] > div[style*="width: 250px"],
    .modal-body > div[style*="display: flex"] > div[style*="width: 270px"],
    .modal-body > div[style*="display: flex"] > div[style*="width: 280px"] {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border) !important;
        height: auto !important;
        max-height: 105px !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
        padding: 0.55rem !important;
        gap: 0.45rem !important;
    }
    .doc-modal-files-sidebar > h4 {
        display: none !important;
    }
    .doc-modal-files-sidebar .attachment-item,
    .modal-body > div[style*="display: flex"] .attachment-item {
        flex: 0 0 205px !important;
        padding: 0.45rem 0.65rem !important;
    }
    .doc-modal-viewer-pane,
    .modal-body > div[style*="display: flex"] > div[style*="flex: 1"] {
        height: 62vh !important;
        min-height: 360px !important;
        width: 100% !important;
    }
}

/* ========================================= */
/* MOBIL GORUNUM & TABLO FILTRELEME SINIFLARI */
/* ========================================= */

.filter-row th {
    padding: 0.38rem 0.45rem !important;
    background: rgba(15, 23, 42, 0.4);
}
.filter-row input, .filter-row select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.38rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.75);
    color: var(--text-main);
    font-size: 0.78rem;
    outline: none;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}
.filter-row select option {
    background: #0f172a;
    color: var(--text-main);
}
.filter-row input:focus, .filter-row select:focus {
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.95);
}

@media (max-width: 768px) {
    .app-topbar {
        padding: 0.45rem 0.65rem;
    }
    
    .topbar-brand .logo span {
        display: none;
    }
    
    .topbar-brand .company-selector {
        max-width: 140px;
    }
    
    .search-box {
        width: 130px;
    }
    
    .profile-details .name-job {
        display: none;
    }

    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
        padding: 0.75rem !important;
    }

    #low-credit-banner {
        margin: 0.65rem 0.75rem 0 0.75rem !important;
    }

    .view-header {
        margin-bottom: 0.85rem !important;
    }

    .view-header h1 {
        font-size: 1.25rem !important;
    }

    .view-header p {
        font-size: 0.78rem !important;
    }

    /* 1. DASHBOARD MOBILE OPTIMIZATION (2x2 KPI Grid & Compact Dual Lists) */
    .dash-top-bar {
        gap: 0.55rem !important;
        margin-bottom: 0.75rem !important;
        padding-bottom: 0.6rem !important;
    }

    .dash-quick-actions {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .dash-integrations-bar {
        width: 100%;
        justify-content: space-between;
    }

    .dash-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.55rem !important;
        margin-bottom: 0.9rem !important;
    }

    .dash-kpi-card {
        padding: 0.65rem 0.7rem !important;
        border-radius: 10px !important;
    }

    .kpi-compact-row {
        gap: 0.45rem !important;
    }

    .kpi-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1.05rem !important;
        border-radius: 8px !important;
    }

    .kpi-value {
        font-size: 1.22rem !important;
    }

    .kpi-label {
        font-size: 0.77rem !important;
    }

    .kpi-sub {
        font-size: 0.66rem !important;
    }

    .kpi-badge {
        font-size: 0.6rem !important;
        padding: 0.08rem 0.35rem !important;
    }

    #dash-incoming-table thead,
    #dash-outgoing-table thead {
        display: none !important;
    }

    #dash-incoming-table,
    #dash-outgoing-table,
    #dash-incoming-table tbody,
    #dash-outgoing-table tbody {
        display: block !important;
        width: 100% !important;
    }

    #dash-incoming-table tbody tr,
    #dash-outgoing-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 0.22rem 0.5rem !important;
        padding: 0.65rem 0.8rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
        align-items: center !important;
    }

    #dash-incoming-table tbody tr td,
    #dash-outgoing-table tbody tr td {
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        min-width: 0 !important;
    }

    #dash-incoming-table tbody tr td:nth-child(2),
    #dash-outgoing-table tbody tr td:nth-child(2) {
        grid-column: 1;
        grid-row: 1;
        font-size: 0.84rem !important;
    }

    #dash-incoming-table tbody tr td:nth-child(1),
    #dash-outgoing-table tbody tr td:nth-child(1) {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    #dash-incoming-table tbody tr td:nth-child(3),
    #dash-outgoing-table tbody tr td:nth-child(3) {
        grid-column: 1 / -1;
        grid-row: 2;
        font-size: 0.78rem !important;
        color: var(--text-muted) !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 2. MOBILE SEARCH & FILTER BAR FOR LISTS */
    .mobile-list-toolbar {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        margin-bottom: 0.75rem;
        background: rgba(15, 23, 42, 0.65);
        border: 1px solid var(--border);
        border-radius: 11px;
        padding: 0.6rem;
    }

    .mobile-list-search-wrap {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        background: rgba(30, 41, 59, 0.9);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 0.45rem 0.65rem;
    }

    .mobile-list-search-wrap i {
        color: var(--text-muted);
        font-size: 1rem;
    }

    .mobile-list-search-wrap input {
        width: 100%;
        background: transparent;
        border: none;
        outline: none;
        color: var(--text-main);
        font-size: 0.83rem;
    }

    .mobile-list-filters-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .mobile-list-filters-row select {
        width: 100%;
        background: rgba(30, 41, 59, 0.9);
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text-main);
        padding: 0.42rem 0.55rem;
        font-size: 0.78rem;
        outline: none;
    }

    .list-header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem !important;
    }

    .list-header-actions > button,
    .list-header-actions > div {
        flex: 1 1 auto;
    }

    /* 3. GELEN / GİDEN / TASLAK / ONAY EVRAK KART GÖRÜNÜMÜ (#list-table) */
    .table-container:has(#list-table),
    .table-container:has(#contacts-table) {
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    #list-table,
    #list-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    #list-table colgroup,
    #list-table thead {
        display: none !important;
    }

    #list-table tbody tr.doc-row {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 0.4rem 0.5rem !important;
        padding: 0.8rem 0.85rem !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
        align-items: center !important;
    }

    #list-table tbody tr.doc-row.unread-row {
        border-left: 4px solid #3b82f6 !important;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.14) 0%, rgba(30, 41, 59, 0.96) 100%) !important;
    }

    #list-table tbody tr.doc-row td {
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    /* Override .hide-on-mobile inside document cards so Subject, ID, Method, Status are visible! */
    #list-table tbody tr.doc-row td.col-id.hide-on-mobile {
        display: flex !important;
        grid-column: 1;
        grid-row: 1;
        align-items: center;
        min-width: 0 !important;
    }

    #list-table tbody tr.doc-row td.col-date {
        display: flex !important;
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
        font-size: 0.76rem !important;
        color: var(--text-muted) !important;
    }

    #list-table tbody tr.doc-row td.col-recipient {
        display: block !important;
        grid-column: 1 / -1;
        grid-row: 2;
        font-size: 0.88rem !important;
        padding-top: 0.1rem !important;
    }

    #list-table tbody tr.doc-row td.col-title.hide-on-mobile {
        display: block !important;
        grid-column: 1 / -1;
        grid-row: 3;
        background: rgba(15, 23, 42, 0.55) !important;
        border-left: 3px solid rgba(59, 130, 246, 0.5) !important;
        border-radius: 6px !important;
        padding: 0.42rem 0.6rem !important;
        font-size: 0.81rem !important;
        color: #e2e8f0 !important;
        line-height: 1.36 !important;
    }

    #list-table tbody tr.doc-row td.col-method.hide-on-mobile {
        display: inline-flex !important;
        grid-column: 1;
        grid-row: 4;
        justify-content: flex-start !important;
        text-align: left !important;
        padding-top: 0.15rem !important;
    }

    #list-table tbody tr.doc-row td.col-status.hide-on-mobile {
        display: inline-flex !important;
        grid-column: 2;
        grid-row: 4;
        justify-content: flex-end !important;
        text-align: right !important;
        padding-top: 0.15rem !important;
    }

    #list-table tbody tr.doc-row td.col-creator.hide-on-mobile {
        display: none !important;
    }

    #list-table tbody tr.doc-row td.col-action {
        grid-column: 1 / -1;
        grid-row: 5;
        padding-top: 0.45rem !important;
        margin-top: 0.15rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
        text-align: right !important;
    }

    /* Pagination on mobile */
    .pagination-container {
        padding: 0.65rem 0.75rem !important;
        gap: 0.6rem !important;
        justify-content: center !important;
    }

    /* 4. ADRES DEFTERİ (#contacts-table) MOBİL KART GÖRÜNÜMÜ */
    #tpl-contacts .view-header > div,
    .view-header > div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    #contacts-table,
    #contacts-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
        width: 100% !important;
    }

    #contacts-table thead {
        display: none !important;
    }

    #contacts-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 0.35rem 0.5rem !important;
        padding: 0.85rem 0.9rem !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        align-items: start !important;
    }

    #contacts-table tbody tr td {
        padding: 0 !important;
        border: none !important;
    }

    #contacts-table tbody tr td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    #contacts-table tbody tr td:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    #contacts-table tbody tr td:nth-child(3) {
        grid-column: 1 / -1;
        grid-row: 2;
        font-size: 0.8rem !important;
    }

    #contacts-table tbody tr td:nth-child(4) {
        grid-column: 1 / -1;
        grid-row: 3;
        word-break: break-all;
    }

    #contacts-table tbody tr td:nth-child(5) {
        grid-column: 1 / -1;
        grid-row: 4;
        font-size: 0.78rem !important;
        color: var(--text-muted);
    }

    #contacts-table tbody tr td:nth-child(6) {
        grid-column: 1 / -1;
        grid-row: 5;
        padding-top: 0.5rem !important;
        margin-top: 0.2rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
    }

    /* 5. GELEN EVRAK KAYDI & EVRAK OLUŞTUR FORM ALANLARI */
    #register-incoming-form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .create-sticky-actions {
        padding: 0.6rem 0.75rem !important;
        gap: 0.5rem !important;
    }

    .create-sticky-actions > div {
        width: 100%;
        justify-content: stretch !important;
    }

    .create-sticky-actions > div > button {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    /* 6. EVRAK DETAY MODALI (TAM EKRAN MOBİL UYUMU & SEKMELİ ÖNİZLEME) */
    #modal-overlay .modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .modal-header {
        padding: 0.65rem 0.9rem !important;
    }

    .modal-header h2 {
        font-size: 0.88rem !important;
        line-height: 1.3 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .modal-body {
        padding: 0.6rem !important;
        flex: 1 !important;
    }

    .modal-mobile-tabs {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
        background: rgba(15, 23, 42, 0.9);
        border: 1px solid var(--border);
        padding: 0.3rem;
        border-radius: 10px;
        margin-bottom: 0.6rem;
    }

    .modal-mobile-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        padding: 0.5rem 0.55rem;
        border-radius: 7px;
        border: 1px solid transparent;
        background: transparent;
        color: var(--text-muted);
        font-size: 0.79rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.18s ease;
    }

    .modal-mobile-tab.active {
        background: rgba(59, 130, 246, 0.22);
        border-color: rgba(59, 130, 246, 0.5);
        color: #ffffff;
    }

    .modal-mobile-section {
        display: none !important;
    }

    .modal-mobile-section.active-section {
        display: block !important;
    }

    #modal-section-meta-top div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .doc-modal-viewer-pane,
    .doc-single-pdf-container {
        height: calc(100dvh - 245px) !important;
        min-height: 390px !important;
    }

    .modal-preview-viewport {
        padding: 0 !important;
    }

    .docx-ebys-preview-wrapper {
        padding: 4px 0 !important;
    }

    .doc-viewer-quickbar {
        padding: 0.35rem 0.5rem !important;
        gap: 0.3rem !important;
    }

    .doc-viewer-quickbar-title {
        flex: 1 1 100% !important;
        font-size: 0.75rem !important;
    }

    .doc-viewer-quickbar-actions {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 0.28rem !important;
    }

    .doc-viewer-zoom-controls {
        padding: 2px !important;
        gap: 1px !important;
    }

    .doc-viewer-zoom-controls .zoom-ctrl-btn {
        padding: 0.2rem 0.38rem !important;
        font-size: 0.68rem !important;
    }

    .doc-viewer-zoom-controls .zoom-level-label {
        min-width: 34px !important;
        padding: 0 0.2rem !important;
        font-size: 0.68rem !important;
    }

    .doc-quickbar-btn {
        padding: 0.24rem 0.42rem !important;
        font-size: 0.68rem !important;
        gap: 0.22rem !important;
    }

    .modal-footer {
        padding: 0.55rem 0.7rem !important;
        gap: 0.35rem !important;
    }

    .doc-modal-footer-bar {
        flex-wrap: wrap !important;
        overflow-x: visible !important;
        gap: 0.4rem !important;
    }

    .doc-modal-footer-left,
    .doc-modal-footer-right {
        flex-wrap: wrap !important;
        width: 100% !important;
        justify-content: stretch !important;
        gap: 0.35rem !important;
    }

    .doc-modal-footer-left > *,
    .doc-modal-footer-right > * {
        flex: 1 1 auto !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .document-preview-viewport {
        min-height: 440px !important;
        max-height: 76dvh !important;
        padding: 6px 0 !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .preview-header-bar {
        gap: 0.45rem !important;
        padding-bottom: 0.55rem !important;
        margin-bottom: 0.6rem !important;
    }

    .preview-zoom-controls {
        width: 100%;
        justify-content: space-between;
    }

    /* 7. SİSTEM AYARLARI YATAY KAYDIRILABİLİR SEKME ÇUBUĞU */
    #settings-tabs-bar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0.45rem !important;
        gap: 0.35rem !important;
    }

    #settings-tabs-bar > button,
    #settings-tabs-bar > div {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .hide-on-mobile {
        display: none !important;
    }

    table th, table td {
        padding: 0.5rem !important;
        font-size: 0.85rem !important;
    }
}

/* Force Jodit editor to take 2.2fr and live preview to take 1fr in Company modal */
.company-modal-bottom-grid {
    display: grid !important;
    grid-template-columns: 2.2fr minmax(0, 1fr) !important;
    gap: 1.5rem !important;
    align-items: start !important;
    border-top: 1px solid var(--border) !important;
    padding-top: 1.5rem !important;
}

@media (max-width: 1024px) {
    .company-modal-bottom-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Prevent global table borders and paddings from leaking into A4 Live Preview */
#antet-preview-content table {
    background: transparent !important;
    margin-top: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
}
#antet-preview-content td,
#antet-preview-content th {
    border-bottom: none !important;
    padding: 0; /* resets global padding, allows inline styles to override */
}

/* ==========================================================================
   Modern Toast Notifications & Custom Confirm Modal (Enterprise EBYS)
   ========================================================================== */

.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 440px;
    width: calc(100vw - 3rem);
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    border-radius: 12px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    overflow: hidden;
    user-select: none;
}

.toast-item.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-item.hide {
    transform: translateX(120%);
    opacity: 0;
}

/* Toast types */
.toast-item.toast-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(15, 23, 42, 0.96));
    border-left: 4px solid #10b981;
}
.toast-item.toast-success .toast-icon {
    color: #10b981;
}

.toast-item.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(15, 23, 42, 0.96));
    border-left: 4px solid #ef4444;
}
.toast-item.toast-error .toast-icon {
    color: #ef4444;
}

.toast-item.toast-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(15, 23, 42, 0.96));
    border-left: 4px solid #f59e0b;
}
.toast-item.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-item.toast-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(15, 23, 42, 0.96));
    border-left: 4px solid #3b82f6;
}
.toast-item.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast-message {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-line;
}

.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    margin-left: 0.5rem;
}
.toast-close:hover {
    color: #fff;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transition: transform linear;
}
.toast-success .toast-progress-bar { background: #10b981; }
.toast-error .toast-progress-bar { background: #ef4444; }
.toast-warning .toast-progress-bar { background: #f59e0b; }
.toast-info .toast-progress-bar { background: #3b82f6; }

/* Custom Confirm Modal */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.confirm-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-dialog {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    max-width: 460px;
    width: calc(100% - 2rem);
    padding: 1.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    transform: scale(0.92) translateY(10px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.confirm-overlay.active .confirm-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.confirm-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    flex-shrink: 0;
}
.confirm-icon-box.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.confirm-icon-box.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.confirm-icon-box.info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.confirm-icon-box.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.confirm-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.confirm-body {
    font-size: 0.92rem;
    color: #cbd5e1;
    line-height: 1.55;
    margin-bottom: 1.5rem;
    white-space: pre-line;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.confirm-actions button {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#eimza-login-pin {
    text-align: center;
}

#eimza-login-pin::placeholder {
    letter-spacing: normal;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-align: center;
}
