.device-management {
    width: min(100%, 940px);
    margin: 18px auto 0;
}

.device-management-heading,
.device-management-panel-heading {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
}

.device-management-heading {
    padding: 22px;
    border: 1px solid var(--gold-line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--panel-shadow);
}

.device-management-kicker,
.device-management-number {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.device-management-heading h1,
.device-management-panel h2 {
    margin: 4px 0 0;
    color: var(--light);
    font-weight: 600;
}

.device-management-heading h1 {
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.device-management-service-link,
.device-management-button {
    display: inline-flex;
    min-height: 40px;
    padding: 8px 13px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--light);
    background: var(--cale-button-secondary, #30343a);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.device-management-service-link:hover,
.device-management-service-link:focus-visible,
.device-management-button:hover,
.device-management-button:focus-visible {
    border-color: var(--accent);
    background: rgba(45, 212, 191, .12);
    outline: none;
    transform: translateY(-1px);
}

.device-management-button.is-primary {
    border-color: var(--calendar-area-service, #672d31);
    color: #ffffff;
    background: var(--calendar-area-service, #672d31);
}

.device-management-button:disabled {
    cursor: default;
    opacity: .48;
    transform: none;
}

.device-management-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.device-management-tabs a {
    display: grid;
    min-height: 68px;
    padding: 10px 12px;
    gap: 2px;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--light);
    background: var(--panel-head);
    text-decoration: none;
}

.device-management-tabs a:hover,
.device-management-tabs a:focus-visible,
.device-management-tabs a.is-active {
    border-color: var(--calendar-area-service, #672d31);
    outline: none;
    box-shadow: inset 0 0 0 1px var(--calendar-area-service, #672d31);
}

.device-management-tabs span {
    color: var(--muted);
    font-size: .72rem;
}

.device-management-tabs strong {
    font-size: .9rem;
}

.device-management-panel {
    margin: 12px 0;
    padding: 20px;
    scroll-margin-top: 12px;
    border: 1px solid var(--gold-line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--panel-shadow);
}

.device-management-panel:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.device-management-panel h2 {
    font-size: 1.2rem;
}

.device-management-state {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: var(--panel-head);
    font-size: .75rem;
}

.device-management-state[data-state="connected"] {
    border-color: var(--accent);
    color: var(--accent);
}

.device-management-state[data-state="error"],
.device-management-state[data-state="locked"],
.device-management-status[data-error="true"] {
    color: #ff9b9b;
}

.device-management-copy,
.device-management-note,
.device-management-status {
    color: var(--muted);
    line-height: 1.55;
}

.device-management-copy {
    margin: 12px 0;
}

.device-management-note {
    margin: 12px 0 0;
    font-size: .78rem;
}

.device-management-status {
    min-height: 1.5em;
    margin: 10px 0;
    font-size: .84rem;
}

.device-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.device-facts div {
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-head);
}

.device-facts dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .72rem;
}

.device-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--light);
    font-size: .84rem;
}

.sync-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.sync-inputs label,
.sync-retention {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: .78rem;
}

.sync-inputs input,
.sync-retention select,
.sync-retention input,
.sync-challenge input {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--light);
    background: var(--panel-head);
    font: inherit;
}

.sync-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 12px;
    padding: 11px;
    gap: 9px 15px;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.sync-options legend {
    padding: 0 5px;
    color: var(--muted);
    font-size: .78rem;
}

.sync-options label {
    display: flex;
    gap: 7px;
    align-items: center;
    color: var(--light);
    font-size: .8rem;
}

.sync-retention {
    grid-template-columns: minmax(0, 1fr) minmax(220px, .55fr);
    align-items: center;
    margin-bottom: 10px;
}

.sync-challenge {
    display: flex;
    margin: 10px 0;
    padding: 10px 11px;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(244, 183, 64, .65);
    border-radius: 9px;
    color: var(--light);
    background: rgba(244, 183, 64, .08);
    font-size: .82rem;
}

.sync-challenge[hidden] {
    display: none;
}

.sync-challenge input {
    width: 120px;
}

.device-management-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.device-management-actions.is-four-column {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.backup-summary {
    margin: 12px 0;
    padding-left: 20px;
    color: var(--light);
    line-height: 1.55;
}

.backup-file-input {
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 700px) {
    .device-management-heading,
    .device-management-panel-heading {
        flex-direction: column;
        gap: 10px;
    }

    .device-management-service-link {
        width: 100%;
    }

    .device-management-tabs {
        grid-template-columns: 1fr;
    }

    .device-management-tabs a {
        min-height: 54px;
    }

    .device-facts,
    .sync-inputs,
    .sync-options,
    .sync-retention,
    .device-management-actions.is-four-column {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .device-management-service-link,
    .device-management-button {
        transition: none;
    }
}
