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

body {
    font-family: Arial, sans-serif;
    background: #f4f6f9;
    color: #202938;
}

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

.sidebar {
    width: 250px;
    background: #172235;
    color: white;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-footer p {
    margin-top: 8px;
    font-size: 11px;
    color: #888;
    line-height: 1.5;
}
.logo {
    padding: 5px 12px 30px;
}

.logo h2 {
    font-size: 22px;
}

.logo h2 span {
    color: #60a5fa;
}

.logo p {
    color: #9ca3af;
    font-size: 12px;
    margin-top: 6px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-btn {
    border: none;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    padding: 12px;
    border-radius: 7px;
    font-size: 14px;
    cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
    background: #263b59;
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px 10px 0;
    font-size: 11px;
    color: #94a3b8;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.topbar h1 {
    font-size: 27px;
}

.topbar p {
    color: #6b7280;
    margin-top: 6px;
    font-size: 14px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}

#connection-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #eab308;
}

.loading {
    padding: 30px;
    color: #6b7280;
}

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

    .sidebar {
        width: 100%;
        padding: 15px;
    }

    .logo {
        padding-bottom: 15px;
    }

    nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .nav-btn {
        white-space: nowrap;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        gap: 15px;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 18px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.stat-card h2 {
    font-size: 28px;
    color: #2563eb;
    margin-bottom: 9px;
}

.stat-card p {
    color: #6b7280;
    font-size: 14px;
}

.section-heading {
    font-size: 19px;
    margin: 25px 0 18px;
}

.table-info {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 10px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

th,td {
    padding: 15px 18px;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
}

td {
    color: #374151;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

.error-message {
    padding: 20px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
}

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

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

    .topbar h1 {
        font-size: 21px;
    }
}

/* TABLE TOOLBAR */

.table-toolbar {
    display: flex;
    gap: 10px;
    margin: 18px 0;
    flex-wrap: wrap;
}

/* BUTTONS */

.primary-btn,
.secondary-btn,
.small-btn {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.primary-btn {
    background: #2563eb;
    color: white;
}

.primary-btn:hover {
    background: #1d4ed8;
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.secondary-btn {
    background: #e5e7eb;
    color: #374151;
}

.secondary-btn:hover {
    background: #d1d5db;
}

.small-btn {
    padding: 7px 11px;
    margin-right: 6px;
    font-size: 12px;
}

.edit-btn {
    background: #dbeafe;
    color: #1d4ed8;
}

.delete-btn {
    background: #fee2e2;
    color: #b91c1c;
}

.edit-btn:hover {
    background: #bfdbfe;
}

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

.action-cell {
    min-width: 140px;
}

/* RECORD FORM */

.form-panel {
    background: white;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    background: white;
    color: #202938;
}

.form-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.form-group input:disabled {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.form-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.form-error {
    grid-column: 1 / -1;
    color: #dc2626;
    font-size: 13px;
}

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

    .form-panel {
        padding: 16px;
    }

    .action-cell {
        min-width: 150px;
    }
}
