* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #1f2937;
    background: #f4f7fb;
}

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

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

.sidebar {
    width: 240px;
    background: #111827;
    color: #e5e7eb;
    padding: 1.2rem;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-links a {
    padding: 0.65rem 0.8rem;
    border-radius: 0.5rem;
    color: #d1d5db;
}

.nav-links a.active,
.nav-links a:hover {
    background: #2563eb;
    color: #fff;
}

.main-area {
    margin-left: 240px;
    width: calc(100% - 240px);
    min-height: 100vh;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.content {
    padding: 1.25rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card h2 {
    margin: 0.3rem 0 0;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert ul {
    margin: 0;
    padding-left: 1.2rem;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    border-radius: 0.5rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.92rem;
}

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

.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

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

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

th,
td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

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

.form-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

label {
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.55rem 0.65rem;
    font: inherit;
}

textarea {
    min-height: 110px;
}

.form-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.field-error {
    margin: 0;
    color: #b91c1c;
    font-size: 0.85rem;
}

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

.pagination-wrap {
    margin-top: 0.9rem;
}

@media (max-width: 960px) {
    .sidebar {
        position: static;
        width: 100%;
    }

    .main-area {
        margin-left: 0;
        width: 100%;
    }

    .app-shell {
        flex-direction: column;
    }
}

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

    .topbar {
        height: auto;
        padding: 0.8rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(130deg, #eff6ff 0%, #f8fafc 60%, #e2e8f0 100%);
}

.auth-shell {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.auth-card h1 {
    margin-top: 0;
    margin-bottom: 0.3rem;
}

.auth-subtitle {
    margin-top: 0;
    color: #4b5563;
}

.auth-form {
    display: grid;
    gap: 0.9rem;
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.remember-row input {
    width: auto;
}
