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

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #213547;
    background: #f9fafb;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: #206bc4;
    color: #fff;
    font-weight: 600;
    border-radius: 0 0 0.375rem 0.375rem;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 0;
    color: #fff;
    outline: 3px solid #fff;
    outline-offset: -3px;
}

/* Visually hidden (screen reader only) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
*:focus-visible {
    outline: 2px solid #206bc4;
    outline-offset: 2px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Public Navbar */
.navbar {
    background: #1e293b;
    padding: 0.75rem 0;
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
}

.nav-links a:hover {
    color: #fff;
}

/* Main content */
main {
    padding-top: 1rem;
}

main h2 {
    margin-bottom: 1rem;
}

/* ============ Buttons ============ */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    color: #374151;
    background: #e5e7eb;
}

.btn:hover {
    background: #d1d5db;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

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

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

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

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

/* ============ Forms ============ */
input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-family: inherit;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

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

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* ============ Alerts ============ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

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

/* ============ Login ============ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-box {
    background: #fff;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ============ Page Entrance Animation ============ */
@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
main {
    animation: page-fade-in 0.25s ease-out;
}

/* ============ Top Loading Bar ============ */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #3b82f6;
    z-index: 9999;
    width: 0;
    opacity: 0;
    transition: none;
}
.loading-bar.active {
    opacity: 1;
    animation: loading-bar-progress 8s cubic-bezier(0.1, 0.4, 0.2, 1) forwards;
}
.loading-bar.done {
    width: 100% !important;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
    animation: none;
}
@keyframes loading-bar-progress {
    0%   { width: 0; }
    10%  { width: 25%; }
    30%  { width: 50%; }
    50%  { width: 70%; }
    70%  { width: 82%; }
    100% { width: 95%; }
}

/* ============ Flash Message Slide-In ============ */
@keyframes flash-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert {
    animation: flash-slide-in 0.3s ease-out;
}

/* ============ Micro-Transitions ============ */
.btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

input:not([type="checkbox"]), select, textarea {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nav-links a {
    transition: color 0.15s ease;
}
