:root {
    --app-bg: #f3f4f6;
    --app-card-bg: #ffffff;
    --app-text: #111827;
    --app-muted: #6b7280;
    --app-border: #e5e7eb;
    --app-nav-bg: #ffffff;
    --app-hover: #f9fafb;
}

@media (prefers-color-scheme: dark) {
    :root {
        --app-bg: #0f172a;
        --app-card-bg: #111827;
        --app-text: #f9fafb;
        --app-muted: #9ca3af;
        --app-border: #374151;
        --app-nav-bg: #111827;
        --app-hover: #1f2937;
    }
}

html,
body {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 35%),
        var(--app-bg);
    color: var(--app-text);
    background-attachment: fixed;
}

/* Layout */

.app-navbar {
    background: var(--app-nav-bg);
    border-bottom: 1px solid var(--app-border);
}

.app-main {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.app-card {
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.app-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--app-border);
}

.app-card-body {
    padding: 1.25rem;
}

.app-page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.app-muted {
    color: var(--app-muted);
}

.min-w-0 {
    min-width: 0;
}

/* Logo */

.app-logo-text {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--app-text);
    text-decoration: none;
}

.app-logo-text:hover {
    color: var(--app-text);
    text-decoration: none;
}

/* Navigation */

.app-icon-nav {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--app-muted);
    text-decoration: none;
}

.app-icon-nav:hover,
.app-icon-nav.active {
    background: var(--app-hover);
    color: var(--app-text);
}

.app-mobile-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--app-text);
    text-decoration: none;
    border-radius: 0.5rem;
}

.app-mobile-link:hover,
.app-mobile-link.active {
    background: var(--app-hover);
}

/* Forms / buttons / tables */

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.table {
    margin-bottom: 0;
}

.form-control,
.form-select {
    border-radius: 0.5rem;
}

/* Login */

.app-login-body {
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 35%),
        var(--app-bg);
}

.app-login-logo {
    width: 3.25rem;
    height: 3.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    font-size: 1.5rem;
}

/* Check cards / permissions */

.app-check-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--app-border);
    border-radius: 0.65rem;
    background: var(--app-card-bg);
    cursor: pointer;
}

.app-check-card:hover {
    background: var(--app-hover);
}

.app-check-card input {
    margin: 0;
}

.app-check-card span {
    font-weight: 500;
}

.app-check-card-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.app-check-card-disabled input {
    cursor: not-allowed;
}

.app-permission-table th,
.app-permission-table td {
    white-space: nowrap;
}

.app-permission-table th:first-child,
.app-permission-table td:first-child {
    min-width: 220px;
}

.app-permission-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* Mobile user cards */

.app-user-card-mobile .app-card-body {
    padding: 1rem;
}

.app-mobile-meta {
    display: grid;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: var(--app-muted);
}

/* List items / color dots */

.app-list-item {
    background: transparent;
    color: var(--app-text);
    border-color: var(--app-border);
}

.app-list-item:hover {
    background: var(--app-hover);
}

.app-color-dot {
    width: 1rem;
    height: 1rem;
    display: inline-block;
    border-radius: 999px;
    border: 1px solid var(--app-border);
}

.app-color-dot-small {
    width: 0.65rem;
    height: 0.65rem;
}

/* Logs */

.app-log-level-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.app-log-level-filter input {
    margin: 0;
}

.app-log-table th,
.app-log-table td {
    white-space: nowrap;
}

.app-log-table td:nth-child(3),
.app-log-table td:nth-child(6) {
    white-space: normal;
}

.app-log-url {
    word-break: break-all;
}

/* Scores */

.app-score-card {
    overflow: hidden;
}

.app-score-side {
    min-width: 5rem;
}

.app-score-number {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
}

.app-score-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 18rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.app-score-filter-list .app-check-card {
    margin: 0;
}

/* Workdays */

.app-workdays-summary-table th,
.app-workdays-summary-table td {
    white-space: nowrap;
}

.app-workdays-summary-table th:not(:first-child),
.app-workdays-summary-table td:not(:first-child) {
    text-align: center;
}

.app-workdays-table-wrap {
    overflow-x: auto;
}

.app-workdays-table {
    table-layout: fixed;
    min-width: 24rem;
    border-collapse: collapse;
}

.app-workdays-table th,
.app-workdays-table td {
    vertical-align: middle;
    text-align: center;
    padding: 0;
}

.app-workdays-table th {
    padding: 0.25rem 0.15rem;
    font-size: 0.75rem;
}

.app-workdays-table th:first-child,
.app-workdays-table td:first-child {
    width: 3.6rem;
    min-width: 3.6rem;
    max-width: 3.6rem;
}

.app-workdays-table td:not(:first-child) {
    width: 2.55rem;
    min-width: 2.55rem;
    max-width: 2.55rem;
}

.app-workday-week-date {
    font-size: 0.72rem;
}

.app-workday-cycle-cell {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 2.35rem;
    min-height: 2.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-workday-cycle-cell:focus {
    outline: 2px solid rgba(59, 130, 246, 0.55);
    outline-offset: -2px;
}

.app-workday-icon {
    width: 1.65rem;
    height: 1.65rem;
    min-width: 1.65rem;
    min-height: 1.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    padding: 0;
    border-radius: 0.45rem;
}

.app-workday-saving {
    opacity: 0.55;
    pointer-events: none;
}

.app-workday-outside-year {
    opacity: 0.35;
}

/* Mobile */

@media (max-width: 575.98px) {
    .app-main {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .app-card {
        border-radius: 0.5rem;
    }

    .app-card-header,
    .app-card-body {
        padding: 1rem;
    }

    .app-workdays-table {
        min-width: 22rem;
    }

    .app-workdays-table th:first-child,
    .app-workdays-table td:first-child {
        width: 3.2rem;
        min-width: 3.2rem;
        max-width: 3.2rem;
    }

    .app-workdays-table td:not(:first-child) {
        width: 2.35rem;
        min-width: 2.35rem;
        max-width: 2.35rem;
    }

    .app-workday-cycle-cell {
        height: 2.25rem;
        min-height: 2.25rem;
    }

    .app-workday-icon {
        width: 1.55rem;
        height: 1.55rem;
        min-width: 1.55rem;
        min-height: 1.55rem;
        font-size: 0.72rem;
    }

    .app-workday-week-date {
        font-size: 0.66rem;
    }
}