*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --brand: #004b8d;
    --brand-dark: #00366a;
    --brand-light: #aedff7;
    --brand-mid: #2f7fc0;
    --brand-soft: #e8f6fc;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #d2d6de;
    --page-bg: #eef3f8;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--page-bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font-family: inherit;
}

/* ---------- Simple login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(174, 223, 247, 0.55), transparent 40%),
        radial-gradient(circle at bottom right, rgba(0, 75, 141, 0.18), transparent 35%),
        #f4f8fb;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border: 1px solid #dbe7f0;
    border-radius: 10px;
    padding: 32px 28px;
    box-shadow: 0 12px 30px rgba(0, 75, 141, 0.08);
}

.login-logo {
    display: block;
    width: min(220px, 100%);
    height: auto;
    margin: 0 auto 18px;
}

.login-box h1 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--brand);
    text-align: center;
}

.login-box p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.alert {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 6px;
    font-size: 13px;
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.login-box input[type="email"],
.login-box input[type="password"] {
    width: 100%;
    height: 40px;
    margin-bottom: 14px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #111;
    font-size: 14px;
}

.login-box input:focus {
    outline: 2px solid var(--brand-light);
    outline-offset: 1px;
    border-color: var(--brand);
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 16px;
    font-weight: 400;
    color: #4b5563;
}

.login-box button {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.login-box button:hover {
    background: var(--brand-dark);
}

.login-box small {
    display: block;
    margin-top: 16px;
    color: #6b7280;
    font-size: 12px;
    text-align: center;
}

/* ---------- Admin layout ---------- */
.admin-layout {
    background: var(--page-bg);
}

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 54, 106, 0.25);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.brand-logo {
    height: 36px;
    width: auto;
    display: block;
    background: #fff;
    border-radius: 6px;
    padding: 4px 8px;
}

.brand-text {
    font-size: 16px;
    font-weight: 600;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-icon {
    position: relative;
    width: 40px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

.nav-icon:hover {
    background: rgba(0, 0, 0, 0.12);
}

.nav-icon .badge {
    position: absolute;
    top: 10px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    background: #f39c12;
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
}

.app-body {
    display: flex;
    min-height: 100vh;
    padding-top: 56px;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 56px);
}

.user-panel {
    height: 150px;
    padding: 20px 15px;
    background:
        linear-gradient(135deg, rgba(0, 75, 141, 0.92), rgba(47, 127, 192, 0.88)),
        linear-gradient(160deg, #004b8d, #aedff7);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    object-fit: cover;
    margin-bottom: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    padding: 10px 0 20px;
}

.menu-header {
    margin: 10px 15px 8px;
    font-size: 12px;
    color: #4b646f;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sidebar-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu li a,
.logout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    color: #444;
    border: 0;
    background: transparent;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.sidebar-menu li a i,
.logout-link i {
    width: 20px;
    text-align: center;
    color: var(--brand);
}

.sidebar-menu li.active a,
.sidebar-menu li a:hover,
.logout-link:hover {
    background: var(--brand);
    color: #fff;
}

.sidebar-menu li.active a i,
.sidebar-menu li a:hover i,
.logout-link:hover i {
    color: #fff;
}

.sidebar-footer {
    padding: 12px 15px 18px;
    font-size: 11px;
    color: var(--brand);
    line-height: 1.5;
}

.sidebar-tagline {
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 0.04em;
    color: #5a7a96;
}

.content-wrapper {
    flex: 1;
    padding: 15px;
    min-width: 0;
}

.page-title {
    margin: 0 0 15px;
    font-size: 22px;
    font-weight: 500;
    color: #444;
}

.info-boxes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-box {
    display: flex;
    min-height: 90px;
    color: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.info-box-icon {
    width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    background: rgba(0, 0, 0, 0.12);
}

.info-box-content {
    flex: 1;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-box-text {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-box-number {
    display: block;
    margin-top: 4px;
    font-size: 24px;
    font-weight: 700;
}

.bg-orange { background: #f39c12; }
.bg-pink { background: #d81b60; }
.bg-cyan { background: #00c0ef; }
.bg-green { background: #00a65a; }

.box {
    background: #fff;
    border-top: 3px solid var(--brand);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.box-header {
    padding: 12px 15px;
    border-bottom: 1px solid #f4f4f4;
}

.box-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #444;
}

.box-body {
    padding: 10px 15px 15px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f4f4f4;
    text-align: left;
    white-space: nowrap;
}

.table th {
    font-weight: 700;
    color: #333;
    background: #fff;
}

.table td {
    color: var(--brand);
}

.table-striped tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.text-center {
    text-align: center;
    color: #777 !important;
}

.alert-success {
    background: #eefbf1;
    border: 1px solid #b7ebc6;
    color: #1e7e34;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 4px;
}

.form-row-reason,
.form-row-details {
    grid-template-columns: 1fr 160px;
    align-items: start;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: #000;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid #d2d6de;
    border-radius: 3px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
    color: #555;
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
}

.form-group-action {
    display: flex;
    flex-direction: column;
}

.label-spacer {
    height: 20px;
}

.form-group-save {
    justify-content: flex-end;
    padding-top: 26px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-default {
    background: #f4f4f4;
    border-color: #ddd;
    color: #444;
}

.btn-warning {
    background: #f39c12;
    border-color: #e08e0b;
    color: #fff;
}

.btn-warning:hover {
    background: #e08e0b;
}

.action-cell {
    white-space: nowrap;
}

.modal-dialog-lg {
    width: min(920px, 100%);
}

.modal-body-file {
    min-height: 420px;
    background: #f5f5f5;
}

.file-frame {
    width: 100%;
    height: 70vh;
    border: 0;
    background: #fff;
}

.file-image {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
}

.camera-preview-wrap {
    margin-top: 10px;
    padding: 12px;
    border: 1px dashed #d2d6de;
    border-radius: 4px;
    background: #fafafa;
}

.preview-label {
    margin: 0 0 8px;
    font-weight: 700;
}

.camera-preview-wrap img {
    display: block;
    max-width: 280px;
    width: 100%;
    margin-bottom: 10px;
    border: 1px solid #ddd;
}

.modal[hidden],
.camera-preview-wrap[hidden] {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal-dialog {
    width: min(1500px, 100%);
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid #f4f4f4;
}

.modal-footer {
    border-bottom: 0;
    border-top: 1px solid #f4f4f4;
    justify-content: flex-end;
    gap: 8px;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #777;
}

.modal-body {
    padding: 15px;
}

#camera-video {
    width: 100%;
    max-height: 360px;
    background: #111;
}

.camera-error {
    margin: 8px 0 0;
    color: var(--brand);
}

.file-picker-btn {
    cursor: pointer;
    color:#fff !important;
}

.files-list {
    margin: 0 0 8px;
    padding-left: 18px;
}

.files-list li {
    margin-bottom: 4px;
    color: #444;
}

.help-text {
    margin: 0;
    color: #777;
    font-size: 12px;
}

.pdf-name {
    margin: 0;
    color: var(--brand);
    font-weight: 600;
}

.clickable-box {
    text-decoration: none;
    color: #fff;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.clickable-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    color: #fff;
}

.table-link {
    color: var(--brand);
    font-weight: 600;
    text-decoration: underline;
}

.table-link:hover {
    color: var(--brand);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #eef7fb !important;
}

.btn-sm {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
    margin-right: 4px;
}

.box-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.status-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.status-pending { background: var(--brand-soft); color: var(--brand); }
.status-progress { background: #fcf8e3; color: #8a6d3b; }
.status-done { background: #dff0d8; color: #3c763d; }
.status-rejected { background: #f2dede; color: #a94442; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px 12px;
}

.detail-item strong {
    display: block;
    margin-bottom: 4px;
    color: #666;
    font-size: 12px;
}

.detail-text {
    padding: 12px;
    border: 1px solid #d2d6de;
    border-radius: 3px;
    background: #fff;
    min-height: 70px;
    white-space: pre-wrap;
}

.status-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-form select {
    max-width: 220px;
    height: 38px;
    border: 1px solid #d2d6de;
    border-radius: 3px;
    padding: 0 10px;
}

.detail-image {
    max-width: min(420px, 100%);
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pagination-wrap {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pagination-meta {
    color: #666;
    font-size: 13px;
}

.pagination-wrap nav,
.pagination-wrap ul {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.pagination-wrap .page-item {
    list-style: none;
}

.pagination-wrap .page-link,
.pagination-wrap a,
.pagination-wrap span {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    color: #444;
    min-width: 34px;
    text-align: center;
}

.pagination-wrap .page-item.active .page-link,
.pagination-wrap .active > span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.pagination-wrap .page-item.disabled .page-link,
.pagination-wrap .disabled > span {
    opacity: 0.55;
    pointer-events: none;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--brand-soft);
    border: 1px solid #cfe6f3;
    border-radius: 6px;
}

.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
}

.filter-group input,
.filter-group select {
    width: 100%;
    height: 38px;
    border: 1px solid #d2d6de;
    border-radius: 4px;
    padding: 0 10px;
    background: #fff;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 992px) {
    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .filter-bar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .info-boxes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
    }

    .info-boxes {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-reason,
    .form-row-details {
        grid-template-columns: 1fr;
    }

    .form-group-save {
        padding-top: 0;
    }

    .box-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }
}
