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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    padding: 2rem;
}

header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink-strong);
}

main {
    max-width: 900px;
    margin: 0 auto;
}

.notice {
    color: var(--muted);
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 6px;
}

.notice code {
    background: var(--surface);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.client-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.client-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.client-header h2 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Opens the client's own portal, which is a different audience's page, so it
   goes to a new tab rather than replacing the dashboard. */
.client-portal-link {
    display: inline-block;
    flex: none;
    width: 0.95rem;
    height: 0.95rem;
    background: currentColor;
    color: var(--subtle);
    mask: url('/assets/icon-external.svg') center / contain no-repeat;
}

.client-portal-link:hover {
    color: var(--accent);
}

.client-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.badge {
    display: inline-block;
    padding: 0.15em 0.6em;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge--success {
    background: var(--success-bg);
    color: var(--success);
}

.badge--error {
    background: var(--error-bg);
    color: var(--error);
}

.badge--neutral {
    background: var(--neutral-bg);
    color: var(--muted);
}

.badge--disabled {
    background: var(--partial-bg);
    color: var(--partial);
}

.badge--cron-on {
    background: var(--info-bg);
    color: var(--accent);
}

.badge--cron-off {
    background: var(--neutral-bg);
    color: var(--subtle);
}

.badge--direction {
    background: var(--neutral-bg);
    color: var(--subtle);
}

.client-meta {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.counters {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.counters li {
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.35em 0.7em;
    font-size: 0.82rem;
}

.counter-label {
    color: var(--muted);
    margin-right: 0.35em;
}

.counter-value {
    color: var(--ink);
    font-weight: 600;
}

.direction-block {
    margin-bottom: 0.5rem;
}

.direction-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.sync-duration {
    font-size: 0.8rem;
    color: var(--subtle);
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.errors {
    background: var(--error-surface);
    border: 1px solid var(--error-border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--error);
}

.errors ul {
    margin-top: 0.3rem;
    padding-left: 1.2rem;
}

details {
    margin-top: 0.5rem;
}

details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.85rem;
    user-select: none;
}

details summary:hover {
    text-decoration: underline;
}

.log {
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--muted);
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre;
}

/* Login page */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    min-height: 100vh;
    padding: 1rem;
}

.login-form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2rem;
    width: 100%;
    max-width: 360px;
}

.login-form h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--ink-strong);
    text-align: center;
}

/* --- brand --- */
/* The lockup itself lives in design-system.css; only its size and the
   admin-only section suffix are set here. */

.brand {
    --brand-logo-size: 2rem;

    gap: 0.6rem;
}

.brand--stacked {
    --brand-logo-size: 2.75rem;

    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Secondary to the product name, which is why it is not its own heading. */
.brand__section {
    color: var(--muted);
    font-weight: 400;
}

.brand__section::before {
    content: '· ';
}

.login-error {
    background: var(--error-surface);
    border: 1px solid var(--error-border);
    border-radius: 4px;
    color: var(--error);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    font-size: 0.9rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
}

.btn-login {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
    background: var(--btn-primary);
    border: 1px solid var(--btn-primary-hover);
    border-radius: 4px;
    color: var(--on-solid);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-login:hover {
    background: var(--btn-primary-hover);
}

/* Logout link in header */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.btn-logout {
    color: var(--muted);
    font-size: 0.82rem;
    text-decoration: none;
    padding: 0.25em 0.6em;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.btn-logout:hover {
    color: var(--ink);
    border-color: var(--muted);
}
