@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --bg: #eef3fa;
    --card: #ffffff;
    --ink: #0d1f3c;
    --accent: #1a4f8a;
    --accent-2: #f4b942;
    --danger: #c33830;
    --muted: #4d6685;
    --border: #c4d4e8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Montserrat", "Segoe UI", sans-serif;
    color: var(--ink);
    background: linear-gradient(135deg, #eaf0f9 0%, #f0f4fd 100%);
}


.container {
    width: min(1100px, 92%);
    margin: 0 auto;
}

/* App shell */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

/* Sidebar */
.sidebar {
    background: #0c1f3f;
    color: #d8eaf8;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.4rem 1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    width: auto;
    height: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    padding: 0.35rem;
    text-align: center;
}

.sidebar-logo {
    max-width: 80px;
    max-height: 60px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.4rem;
}

.sidebar-title {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0;
    color: #0c1f3f;
}

.sidebar-subtitle {
    margin: 0.2rem 0 0;
    color: #8ab3d4;
    font-size: 0.82rem;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.3rem;
}

.side-nav a {
    color: #b8d4f0;
    text-decoration: none;
    padding: 0.58rem 0.72rem;
    border-radius: 8px;
}

.side-nav a:hover,
.side-nav a.active {
    background: rgba(255, 255, 255, 0.16);
}

.nav-link-inner {
    display: flex;
    align-items: center;
    gap: 0.52rem;
}

.nav-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.link-btn {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #b8d4f0;
    padding: 0.48rem 0.8rem;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
}

.link-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Page content */
.page-content {
    padding: 2rem 0 3rem;
}

.page-content-shell {
    width: min(1200px, 94%);
    margin: 0 auto;
}

/* Top user bar */
.top-user-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}

.top-install-btn {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--accent);
    border-radius: 999px;
    padding: 0.38rem 0.8rem;
    width: auto;
    min-height: 36px;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(12, 31, 63, 0.08);
}

.top-install-btn:hover {
    background: #f0f6ff;
    opacity: 1;
}

.top-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--ink);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    box-shadow: 0 6px 14px rgba(12, 31, 63, 0.08);
}

.top-user-photo {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #fff;
}

.top-user-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    background: #0c1f3f;
    width: 30px;
    height: 30px;
    border-radius: 999px;
}

.top-user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
}

/* Mobile app header */
.mobile-app-header {
    display: none;
}

.mobile-app-title-wrap {
    min-width: 0;
}

.mobile-app-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0c1f3f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-app-subtitle {
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-notification-slot {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: #1a4f8a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    box-shadow: 0 4px 12px rgba(12, 31, 63, 0.08);
}

.mobile-bell-icon {
    width: 17px;
    height: 17px;
}

.mobile-badge-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #ef4444;
    border: 1px solid #ffffff;
}

.mobile-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.mobile-logout-form {
    margin: 0;
}

.mobile-logout-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: #1a4f8a;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(12, 31, 63, 0.08);
}

.mobile-logout-btn:hover {
    background: #f1f5f9;
    opacity: 1;
}

.mobile-logout-icon {
    width: 16px;
    height: 16px;
}

.mobile-install-btn {
    width: auto;
    min-height: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: #1a4f8a;
    padding: 0 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(12, 31, 63, 0.08);
}

.mobile-install-btn:hover {
    background: #f1f5f9;
    opacity: 1;
}

/* Loading overlay */
.pwa-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(12, 31, 63, 0.28);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.pwa-loading-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pwa-loading-card {
    width: min(300px, 100%);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 16px 38px rgba(12, 31, 63, 0.24);
    padding: 1rem 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.pwa-loading-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    animation: pwa-loading-pulse 1s ease-in-out infinite;
}

.pwa-loading-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0d1f3c;
}

@keyframes pwa-loading-pulse {
    0% { transform: scale(0.94); opacity: 0.84; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.94); opacity: 0.84; }
}


/* Grid and cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(12, 31, 63, 0.07);
}

.metric {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 0.25rem;
}

.muted {
    color: var(--muted);
}

/* Tables */
.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

th,
td {
    text-align: left;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

th {
    background: #eef3fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

/* Forms */
input,
select,
textarea,
button {
    width: 100%;
    padding: 0.62rem;
    border-radius: 9px;
    border: 1px solid #b0c8e0;
    font: inherit;
}

textarea {
    min-height: 120px;
}

button,
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    text-decoration: none;
    cursor: pointer;
    padding: 0.65rem 1rem;
    width: auto;
    border-radius: 9px;
    font-weight: 600;
}

button:hover,
.btn:hover {
    opacity: 0.9;
}

.btn-alt {
    background: var(--accent-2);
    color: #1f251f;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.filters,
.form-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 1rem;
}

/* Alerts */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert.success {
    background: #dcf7e8;
    color: #145a35;
}

.alert.error {
    background: #fce7e4;
    color: #8f211a;
}

/* Login page */
.login-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
}

.login-page-content {
    padding: 0;
}

.login-showcase {
    background: radial-gradient(circle at 20% 20%, #1e6bb8 0%, #0c1f3f 58%);
    color: #e8f4fd;
    padding: 2.4rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.login-showcase-logo {
    width: 300px;
    height: 300px;
    object-fit: contain;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    padding: 0.8rem;
    display: block;
}

.login-showcase-logo-fallback {
    width: 300px;
    height: 300px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 28px;
    margin-bottom: 1rem;
    font-size: 7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.34);
    border: 2px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
}

.login-kicker {
    margin: 0;
    font-size: 0.76rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    opacity: 0.9;
}

.login-showcase h2 {
    margin: 0.55rem 0 0.8rem;
    line-height: 1.2;
    font-size: clamp(1.5rem, 2.2vw, 2rem);
}

.login-showcase p {
    margin: 0;
    color: #c0dcf5;
}

.login-showcase ul {
    margin: 1.2rem 0 0;
    padding-left: 1.05rem;
    list-style-position: outside;
    display: grid;
    gap: 0.5rem;
}

.login-card-modern {
    padding: 2.4rem 2rem;
    background: linear-gradient(180deg, #ffffff 0%, #f5f9fd 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.login-brand-top {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.login-top-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #b0cce6;
    padding: 0.45rem;
}

.login-top-logo-fallback {
    width: 150px;
    height: 150px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #0c1f3f;
    font-size: 2.4rem;
    font-weight: 700;
}

.login-brand-name {
    font-weight: 700;
    color: #0f2d52;
}

.login-form-wrap {
    margin-top: 2.1rem;
    width: min(420px, 100%);
    text-align: left;
}

.login-card-modern h3 {
    margin: 0;
    font-size: 1.35rem;
}

.login-form {
    margin-top: 1rem;
}

.field-group {
    margin-bottom: 0.95rem;
}

.field-group label {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0d2545;
}

.field-group input {
    background: #fff;
    border: 1px solid #b0c8e0;
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap input {
    padding-right: 4.6rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #1a4f8a;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.22rem 0.4rem;
    line-height: 1;
    cursor: pointer;
    width: auto;
}

.password-toggle:hover { color: #0d3370; }

.password-toggle:focus-visible {
    outline: 2px solid #1a4f8a;
    outline-offset: 1px;
    border-radius: 4px;
}

.btn-login {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.78rem 1rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Row actions */
.row-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Status pills */
.status-pill {
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-logged,
.status-assigned {
    background: #2067c7;
}

.status-in_progress,
.status-pending_approval {
    background: #e0b300;
    color: #2a1f00;
}

.status-overdue,
.status-rejected {
    background: var(--danger);
}

.status-completed {
    background: #20854e;
}

.status-closed {
    background: #6b7581;
}

.status-on_hold {
    background: #9a5ebb;
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Attachments */
.ticket-attachment-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.ticket-attachment-thumbs img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
}

.ticket-attachment-docs {
    display: grid;
    gap: 0.2rem;
}

.ticket-attachment-docs a {
    font-size: 0.82rem;
}

/* User photos */
.user-photo-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
}

.user-photo-lg {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
}

/* Responsive */
@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        min-height: 100dvh;
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        height: auto;
        z-index: 50;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(12, 31, 63, 0.96);
        backdrop-filter: blur(10px);
        padding: 0.45rem 0.55rem calc(0.45rem + env(safe-area-inset-bottom));
        overflow: visible;
    }

    .sidebar-brand,
    .sidebar-footer {
        display: none;
    }

    .side-nav {
        margin-top: 0;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.3rem;
    }

    .side-nav a {
        padding: 0.35rem 0.3rem;
        border-radius: 12px;
    }

    .side-nav a.active {
        background: rgba(255, 255, 255, 0.22);
    }

    .nav-link-inner {
        flex-direction: column;
        justify-content: center;
        gap: 0.15rem;
        text-align: center;
        font-size: 0.68rem;
        line-height: 1.15;
        font-weight: 600;
    }

    .nav-icon {
        width: 1.1rem;
        height: 1.1rem;
        flex: 0 0 1.1rem;
    }

    .page-content {
        padding: 0.75rem 0 6.4rem;
    }

    .page-content-shell {
        width: 100%;
        margin: 0;
        padding: 0 0.8rem;
    }

    .mobile-app-header {
        position: sticky;
        top: 0;
        z-index: 21;
        margin: 0 -0.8rem;
        padding: 0.45rem 0.8rem;
        background: rgba(238, 243, 250, 0.96);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(196, 212, 232, 0.86);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.6rem;
    }

    .top-user-bar {
        display: none;
    }

    .top-user-chip {
        padding: 0.25rem 0.48rem 0.25rem 0.25rem;
    }

    .top-user-name {
        display: none;
    }

    .card {
        border-radius: 12px;
        padding: 0.85rem;
    }

    th,
    td {
        padding: 0.55rem 0.6rem;
        font-size: 0.84rem;
    }

    .row-actions {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    input,
    select,
    textarea,
    button {
        min-height: 44px;
    }

    button,
    .btn {
        min-height: 42px;
    }

    .filters,
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
}

@media (max-width: 700px) {
    .login-shell {
        min-height: 100dvh;
        grid-template-columns: 1fr;
    }

    .login-showcase,
    .login-card-modern {
        padding: 1.15rem 1rem;
    }

    .login-showcase-logo,
    .login-showcase-logo-fallback {
        width: 168px;
        height: 168px;
        font-size: 3.8rem;
    }

    .login-form-wrap {
        margin-top: 1.1rem;
        width: 100%;
    }
}
