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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    padding: 2rem 1rem;
}

.container {
    max-width: 1376px;
    margin: 0 auto;
    padding: 0 32px;
}

h1 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: #e8f5e9;
    border-color: #43a047;
    color: #2e7d32;
}

.alert-error {
    background: #fce4ec;
    border-color: #e53935;
    color: #c62828;
}

.alert details {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.alert summary {
    cursor: pointer;
}

.alert ul {
    margin-top: 0.25rem;
    padding-left: 1.25rem;
}

/* Form */
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
select, input[type="file"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9rem;
    background: #fff;
}

select:focus, input:focus {
    outline: none;
    border-color: #4a7cff;
    box-shadow: 0 0 0 2px rgba(74, 124, 255, 0.15);
}

button {
    padding: 0.55rem 1.25rem;
    background: #4a7cff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover {
    background: #3a66dd;
}

.btn-danger {
    background: #e53935;
}

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

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

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

.stat {
    text-align: center;
    padding: 1rem;
    background: #f7f8fa;
    border-radius: 6px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #4a7cff;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.stat-range {
    display: block;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

/* Table */
.table-wrap {
    overflow: auto;
    max-height: 70vh;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

tbody tr:hover {
    background: #f7f8fa;
}

.muted {
    color: #999;
    font-style: italic;
}

/* Navigation */
.nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.nav a {
    color: #4a7cff;
    text-decoration: none;
    font-weight: 600;
}

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

.nav a.active {
    color: #1a1a2e;
    cursor: default;
}

/* Links styled as buttons */
.btn-link {
    color: #4a7cff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* Table action cells */
.actions {
    white-space: nowrap;
}

/* Grand total stat card */
.stat-total {
    background: #e8f0fe;
    border: 1px solid #c5d8f8;
}

/* Checkbox inline alignment */
.form-group-inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.form-group-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
}


#uploads_ext_link_container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 16px 0;
}

#uploads_ext_link_container a {
    color: #000;
    font-size: 14px;
}
#uploads_ext_link_container a:hover {
    color: #3a66dd;
}

/* Authentication */
body.auth-body {
    background: #0d1117;
    padding: 0;
    min-height: 100vh;
}

#landing {
    position: fixed;
    inset: 0;
    background: #0d1117;
    z-index: 100;
}

#landing-trigger {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 80px;
    height: 80px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
}

#landing-trigger:hover {
    background: transparent;
}

#login-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
}

#login-modal.active {
    display: flex;
}

.login-box {
    width: 100%;
    max-width: 340px;
    padding: 32px 24px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.login-box h2 {
    margin-bottom: 20px;
    color: #8b949e;
    font-size: 18px;
    font-weight: 400;
    text-align: center;
}

.login-box .form-group {
    margin-bottom: 12px;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 16px;
}

.login-box button {
    width: 100%;
    margin-top: 4px;
}

#login-error {
    margin-top: 12px;
    color: #e05040;
    font-size: 13px;
    text-align: center;
}
