/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html,
body {
    height: 100%;
}
body {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    color: #2d3748;
    background: #f4f6f9;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 64px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid #e8ecf0;
}
.navbar-brand {
    display: flex;
    align-items: center;
    line-height: 0;
}
.brand-logo {
    display: block;
    height: 48px;
    width: auto;
}
.btn-logout {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 5px 16px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.btn-logout:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

/* ── Layout ───────────────────────────────────────────── */
.app-shell {
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    padding-top: 64px;
}
.layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 64px - 78px);
}
.sidebar {
    width: 200px;
    background: #fff;
    border-right: 1px solid #e8ecf0;
    flex-shrink: 0;
    padding-top: 16px;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #555;
    font-size: 14px;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.sidebar-link:hover {
    background: #f0f4ff;
    color: #2563eb;
}
.sidebar-link.active {
    background: #eff4ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}
.sidebar-icon {
    width: 16px;
    text-align: center;
    font-size: 15px;
}
.main-content {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
    width: 100%;
    min-height: 78px;
    background: #fff;
    border-top: 1px solid #dfe4ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 28px;
    padding-right: 28px;
}
.site-footer__version {
    font-size: 14px;
    font-weight: 500;
    color: #5b6573;
}
.site-footer__brand {
    display: block;
    width: auto;
    height: 42px;
    max-width: 100%;
}

/* ── Alerts ───────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Page Header ──────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1f36;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition:
        opacity 0.15s,
        background 0.15s;
}
.btn:hover {
    opacity: 0.88;
}
.btn-primary {
    background: #2563eb;
    color: #fff;
}
.btn-secondary {
    background: #f1f3f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.btn-secondary:hover {
    background: #e5e7eb;
    opacity: 1;
}
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-size: 13px;
}
.btn-icon:hover {
    background: #f0f4ff;
    color: #2563eb;
    border-color: #c7d7fd;
}

/* ── Card ─────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8ecf0;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f2f5;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #2563eb;
}

/* ── Table ────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead tr {
    background: #f8fafc;
}
th {
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 1px solid #e8ecf0;
    white-space: nowrap;
}
td {
    padding: 11px 16px;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}
tbody tr:hover {
    background: #fafbff;
}
tbody tr:last-child td {
    border-bottom: none;
}
.actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}
.badge-blue {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.badge-green {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.badge-gray {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* ── Search ───────────────────────────────────────────── */
.search-wrap {
    position: relative;
}
.search-wrap input {
    padding: 7px 12px 7px 34px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: #fafbff;
    width: 220px;
    color: #374151;
    outline: none;
    transition: border 0.15s;
}
.search-wrap input:focus {
    border-color: #93c5fd;
    background: #fff;
}
.search-wrap .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 13px;
}

/* ── Forms ────────────────────────────────────────────── */
.form-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8ecf0;
    padding: 28px;
    max-width: 640px;
}
.form-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1f36;
    margin-bottom: 24px;
}
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.form-label .req {
    color: #ef4444;
    margin-left: 2px;
}
.req {
    color: #ef4444;
    margin-left: 2px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    outline: none;
    transition: border 0.15s;
}
.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-control[readonly] {
    background: #f9fafb;
    color: #6b7280;
    cursor: default;
}
.form-control.is-invalid {
    border-color: #f87171;
}
select.form-control {
    cursor: pointer;
}
.searchable-select {
    position: relative;
}
.searchable-select__native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    inset: 0;
}
.searchable-select__trigger {
    width: 100%;
    min-height: 35px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    box-shadow: none;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
    cursor: pointer;
}
.searchable-select__trigger.is-placeholder {
    color: #6b7280;
}
.searchable-select__trigger:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.searchable-select__icon {
    color: #9ca3af;
    transition: transform 0.15s ease;
}
.searchable-select.is-open .searchable-select__icon {
    transform: rotate(180deg);
}
.searchable-select__panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow:
        0 10px 28px rgba(15, 23, 42, 0.12),
        0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}
.searchable-select__search-wrap {
    padding: 16px;
    border-bottom: 1px solid #eceff4;
}
.searchable-select__search {
    width: 100%;
    border: none;
    outline: none;
    font-size: 13px;
    color: #374151;
    background: transparent;
    padding: 0;
}
.searchable-select__search::placeholder {
    color: #9ca3af;
}
.searchable-select__options {
    max-height: 240px;
    overflow-y: auto;
    padding: 10px;
}
.searchable-select__option {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
    transition: background-color 0.15s;
}
.searchable-select__option:hover,
.searchable-select__option.is-selected {
    background: #f3f4f6;
}
.searchable-select__empty {
    padding: 9px 12px;
    color: #9ca3af;
    font-size: 13px;
}
.searchable-select.is-invalid .searchable-select__trigger {
    border-color: #f87171;
}
.invalid-feedback {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

/* ── Copy to clipboard ────────────────────────────────── */
.copy-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.copy-wrap .form-control {
    padding-right: 38px;
}
.copy-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 13px;
    padding: 2px;
    transition: color 0.15s;
}
.copy-btn:hover {
    color: #2563eb;
}
.copy-tooltip {
    position: absolute;
    right: 0;
    top: -30px;
    background: #1a1f36;
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.copy-tooltip.show {
    opacity: 1;
}

/* ── PDF Viewer ───────────────────────────────────────── */
.pdf-viewer {
    width: 100%;
    height: 500px;
    border: 1px solid #e8ecf0;
    border-radius: 6px;
    margin-top: 6px;
}
.pdf-link {
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
}
.pdf-link:hover {
    text-decoration: underline;
}

/* ── Login Page ───────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6f9;
}
.login-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8ecf0;
    padding: 40px;
    width: 100%;
    max-width: 380px;
}
.login-logo {
    display: flex;
    justify-content: center;
    line-height: 0;
    margin-bottom: 20px;
}
.login-logo-image {
    display: block;
    height: 32px;
    width: auto;
    max-width: 100%;
}
.login-title {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 20px;
    text-align: center;
}

/* ── Public Verify Page ───────────────────────────────── */
.verify-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f4f6f9;
    padding: 20px;
}
.verify-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8ecf0;
    padding: 40px;
    width: 100%;
    max-width: 440px;
}
.verify-logo {
    display: flex;
    justify-content: center;
    line-height: 0;
    margin-bottom: 20px;
}
.verify-logo-image {
    display: block;
    height: 32px;
    width: auto;
    max-width: 100%;
}
.verify-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1f36;
    margin-bottom: 6px;
    text-align: center;
}
.verify-sub {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 28px;
}
.result-box {
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}
.result-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.result-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Pagination ───────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
}
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    color: #374151;
    text-decoration: none;
    transition: all 0.15s;
}
.pagination li.active span {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.pagination li a:hover {
    background: #f0f4ff;
    color: #2563eb;
    border-color: #c7d7fd;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar {
        height: 56px;
        padding: 0 16px;
    }
    .brand-logo {
        height: 26px;
    }
    .app-shell {
        min-height: calc(100vh - 56px);
        padding-top: 56px;
    }
    .layout {
        min-height: calc(100vh - 56px - 96px);
    }
    .sidebar {
        width: 56px;
    }
    .sidebar-link span {
        display: none;
    }
    .sidebar-icon {
        margin: 0;
    }
    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }
    .main-content {
        padding: 16px;
    }
    .search-wrap input {
        width: 160px;
    }
    .form-card {
        padding: 20px;
    }
    .site-footer {
        min-height: 96px;
        padding-right: 16px;
        padding-left: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .site-footer__version {
        font-size: 14px;
    }
    .site-footer__brand {
        height: 34px;
        align-self: flex-end;
    }
}
