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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #4a90d9;
}

button {
    width: 100%;
    padding: 12px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #357abd;
}

.link {
    text-align: center;
    margin-top: 20px;
}

.link a {
    color: #4a90d9;
    text-decoration: none;
}

.link a:hover {
    text-decoration: underline;
}

.error {
    color: #e74c3c;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #fdecea;
    border-radius: 4px;
}

.success {
    color: #27ae60;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #eafaf1;
    border-radius: 4px;
}

.dashboard {
    text-align: center;
    padding: 20px;
}

.dashboard h1 {
    margin-bottom: 10px;
}

.dashboard p {
    color: #666;
    margin-bottom: 30px;
}

.logout-btn {
    display: inline-block;
    padding: 10px 30px;
    background: #e74c3c;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
}

.entry-btn {
    display: inline-block;
    padding: 10px 30px;
    background: #27ae60;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.entry-btn:hover {
    background: #219150;
}

.container-wide {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 960px;
    margin: 40px auto;
}

.container-inner {
    margin-top: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

input[type="date"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="date"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #4a90d9;
}

.top-links {
    margin-top: 20px;
}

.link-btn {
    display: inline-block;
    padding: 10px 25px;
    background: #4a90d9;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
    margin: 0 5px;
}

.link-btn:hover {
    background: #357abd;
}

.section-title {
    margin: 30px 0 15px;
    color: #333;
}

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

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

table th,
table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 14px;
}

table th {
    background: #4a90d9;
    color: #fff;
}

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

table tr:hover {
    background: #f1f5fb;
}

.no-data {
    color: #999;
    text-align: center;
    margin-top: 20px;
}

/* ===== Professional App Shell ===== */
body {
    display: block;
    background: #eef1f5;
}

body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #eef1f5;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.brand-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    transition: background 0.25s, color 0.25s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
    border-left: 3px solid #3b82f6;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logout-link {
    color: #f87171;
}

.logout-link:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
}

/* Main */
.main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 18px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
}

.content {
    padding: 32px;
    flex: 1;
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border-top: 4px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card-blue { border-top-color: #3b82f6; }
.card-green { border-top-color: #10b981; }
.card-orange { border-top-color: #f59e0b; }

.stat-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
}

/* Content card */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.btn-view-all {
    padding: 8px 16px;
    background: #3b82f6;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.25s;
}

.btn-view-all:hover {
    background: #2563eb;
}

@media (max-width: 900px) {
    .sidebar {
        width: 200px;
    }
    .main {
        margin-left: 200px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 64px;
        padding: 0;
    }
    .brand-name,
    .nav-link span:not(.nav-icon) {
        display: none;
    }
    .brand {
        justify-content: center;
        padding: 20px 10px;
    }
    .nav-link {
        justify-content: center;
    }
    .main {
        margin-left: 64px;
    }
    .content {
        padding: 20px;
    }
}

/* Right slide-in form panel */
[hidden] {
    display: none !important;
}

.actions {
    white-space: nowrap;
}

.btn-edit,
.btn-delete {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    margin-right: 6px;
}

.btn-edit {
    background: #3b82f6;
    color: #fff;
}

.btn-edit:hover {
    background: #2563eb;
}

.btn-delete {
    background: #ef4444;
    color: #fff;
}

.btn-delete:hover {
    background: #dc2626;
}

.search-input {
    width: 100%;
    max-width: 320px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.column-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.column-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#filter-row th {
    background: #f1f5f9;
    border-bottom: 1px solid #ddd;
}

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

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.page-link:hover {
    background: #eef2f7;
    border-color: #cbd5e1;
}

.page-link.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* Advance entry */
.advance-hint {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
}

.lookup-form {
    margin-bottom: 4px;
}

.lookup-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-lookup {
    width: auto;
    padding: 12px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.25s;
    white-space: nowrap;
}

.btn-lookup:hover {
    background: #2563eb;
}

.bilty-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.detail-cell {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    font-weight: 600;
}

.detail-value {
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
}

.detail-value.detail-done {
    color: #10b981;
}

.btn-advance {
    background: #10b981;
}

.btn-advance:hover {
    background: #059669;
}

@media (max-width: 600px) {
    .lookup-row {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-lookup {
        width: 100%;
    }
    .bilty-detail-grid {
        grid-template-columns: 1fr;
    }
}

tbody tr.group-first td {
    border-top: 2px solid #cbd5e1;
}

tbody tr.group-footer td {
    background: #f1f5f9;
    font-weight: 600;
    color: #475569;
}
