/* =========================================================
   MyDeviceGuide
   Professional Support Portal Theme
   ========================================================= */


/* ===== Design System ===== */

:root {
    /* Core surfaces */
    --page-bg: #f3f5f7;
    --surface: #ffffff;
    --surface-soft: #f7f9fa;
    --surface-blue: #edf3f7;

    /* Unified MyDeviceGuide blue family */
    --blue-950: #142f46;
    --blue-900: #18364f;
    --blue-850: #1c3d58;
    --blue-800: #214762;
    --blue-700: #285a78;
    --blue-600: #316b8d;
    --blue-500: #3c7da1;
    --blue-200: #bfd5e2;
    --blue-100: #dbe8ef;
    --blue-050: #edf4f7;

    /* Header */
    --header-bg: var(--blue-950);
    --header-nav: var(--blue-900);
    --header-border: #345b76;

    /* Text */
    --text-main: #202b35;
    --text-heading: #18364f;
    --text-muted: #63707b;
    --text-light: #dbe6ed;

    /* Primary actions */
    --primary: var(--blue-600);
    --primary-hover: var(--blue-700);
    --primary-active: var(--blue-800);
    --primary-soft: var(--blue-050);

    /* Secondary actions */
    --secondary: #536b7c;
    --secondary-hover: #435968;

    /* Borders */
    --border: #d4dce2;
    --border-strong: #b8c4cd;

    /* Status colors */
    --success: #18734c;
    --success-bg: #edf8f2;
    --success-border: #afd6c1;

    --warning: #825300;
    --warning-bg: #fff7e7;
    --warning-border: #e6cf9e;

    --danger: #ac2b24;
    --danger-hover: #8d211c;
    --danger-bg: #fff2f1;
    --danger-border: #dfaaa6;

    /* Shape */
    --radius-sm: 4px;
    --radius-md: 6px;

    /* Shadows */
    --shadow-panel:
        0 1px 2px rgba(16, 42, 67, 0.03),
        0 4px 14px rgba(16, 42, 67, 0.045);

    /* Focus */
    --focus-ring: 0 0 0 3px rgba(49, 107, 141, 0.20);

    /* Layout */
    --content-width: 1180px;
}


/* =========================================================
   Global Reset
   ========================================================= */

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

/*Keep hidden elements hidden when other styles set their display*/
[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;

    margin: 0;
    padding: 0;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    font-size: 16px;
    line-height: 1.5;

    background-color: var(--page-bg);
    color: var(--text-main);

    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
input,
select,
textarea,
a {
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-hover);
}


/* =========================================================
   Main Page Container
   ========================================================= */

.page-wrapper {
    width: min(94%, var(--content-width));

    margin: 0 auto;
    padding: 24px 0 32px;
}


/* =========================================================
   Header
   ========================================================= */

header {
    overflow: hidden;

    margin-bottom: 24px;
    padding: 27px 30px 0;

    color: var(--text-main);

    background:
        linear-gradient(
            100deg,
            #ffffff 0%,
            #ffffff 12%,
            #f4f9fc 27%,
            #b8dbea 43%,
            #5aa4cb 58%,
            #316b8d 73%,
            #214762 87%,
            #18364f 100%
        );

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-panel);
}

header h1 {
    margin: 0;

    color: #173b59;

    font-size: clamp(30px, 4vw, 42px);
    font-weight: 700;

    letter-spacing: -0.8px;
    line-height: 1.1;
}

header > p {
    max-width: 720px;

    margin: 8px 0 0;

    color: #345a76;

    font-size: 15px;
    font-weight: 500;

    line-height: 1.5;
}


/* =========================================================
   Main Navigation
   ========================================================= */

.main-nav {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;

    gap: 0;

    margin: 22px -30px 0;
    padding: 0 20px;

    background:
        linear-gradient(
            90deg,
            var(--blue-950) 0%,
            var(--blue-900) 55%,
            var(--blue-850) 100%
        );

    border-top: 1px solid var(--blue-800);
}

.main-nav a {
    position: relative;

    display: flex;
    align-items: center;

    min-height: 50px;

    padding: 0 16px;

    color: #edf4f8;

    text-decoration: none;

    font-size: 15px;
    font-weight: 600;

    border-bottom: 3px solid transparent;

    transition:
        color 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.main-nav a:hover {
    color: #ffffff;

    background-color: rgba(255, 255, 255, 0.08);

    border-bottom-color: var(--blue-200);
}

.main-nav a[aria-current="page"] {
    color: #ffffff;

    background-color: rgba(255, 255, 255, 0.10);

    border-bottom-color: #ffffff;
}

.main-nav a:focus-visible {
    z-index: 2;

    outline: 3px solid rgba(255, 255, 255, 0.85);
    outline-offset: -4px;
}

/*Align the account name with the navigation links*/
.main-nav #signedInStatus {
    display: flex;
    align-items: center;

    margin-left: auto;
    padding: 12px 16px;

    color: #edf4f8;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/*Keep the logout button consistent with the dark navigation*/
.main-nav #logoutBTN {
    align-self: center;
    flex-shrink: 0;

    min-height: 44px;
    margin: 6px 0;
    padding: 8px 16px;

    color: #ffffff;
    background: transparent;
    border: 1px solid #91b0c6;
    border-radius: 6px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
}

/*Show when logout is hovered or selected with the keyboard*/
.main-nav #logoutBTN:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: #ffffff;
}

.main-nav #logoutBTN:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
    box-shadow: none;
}

/* =========================================================
   Main Content
   ========================================================= */

main {
    display: grid;

    gap: 20px;
}


/* ===== Shared Panels ===== */

.intro-box,
.tool-box,
.result-box {
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-panel);
}


/* =========================================================
   Page Introduction
   ========================================================= */

.intro-box {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    padding: 22px 26px;

    background:
        linear-gradient(
            90deg,
            #ffffff 0%,
            #ffffff 74%,
            #f2f6f8 100%
        );

    border-left: 5px solid var(--primary);
}

.intro-box > div {
    min-width: 0;
}

.intro-box h2 {
    margin: 0 0 5px;

    color: var(--text-heading);

    font-size: clamp(23px, 3vw, 29px);
    font-weight: 700;

    line-height: 1.2;
}

.intro-box p {
    max-width: 820px;

    margin: 0;

    color: var(--text-muted);

    font-size: 16px;
    line-height: 1.6;
}

.intro-tag {
    flex-shrink: 0;

    display: inline-flex;
    align-items: center;

    min-height: 32px;

    padding: 5px 10px;

    color: var(--blue-700);
    background-color: var(--blue-050);

    border: 1px solid var(--blue-200);
    border-radius: var(--radius-sm);

    font-size: 13px;
    font-weight: 700;
}


/* =========================================================
   General Content Panels
   ========================================================= */

.tool-box,
.result-box {
    padding: 26px;
}

.tool-box h2,
.result-box h2 {
    margin: 0 0 22px;

    color: var(--text-heading);

    font-size: 23px;
    font-weight: 700;

    line-height: 1.25;
}

.tool-box h3,
.result-box h3 {
    color: var(--text-heading);
}


/* =========================================================
   Forms
   ========================================================= */

.section {
    margin-bottom: 18px;
}

.section:last-child {
    margin-bottom: 0;
}

label {
    display: block;

    margin: 0 0 7px;

    color: #344554;

    font-size: 14px;
    font-weight: 600;
}


/* ===== Inputs ===== */

input,
select,
textarea {
    width: 100%;

    color: var(--text-main);
    background-color: #ffffff;

    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

input,
select {
    min-height: 46px;

    padding: 10px 12px;
}

textarea {
    min-height: 110px;

    padding: 11px 12px;

    line-height: 1.5;

    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #8a96a0;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #91a2af;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);

    box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
    color: #707b85;
    background-color: #edf1f3;

    cursor: not-allowed;
}

input[type="radio"],
input[type="checkbox"] {
    width: auto;
    min-height: 0;

    accent-color: var(--primary);
}


/* =========================================================
   Buttons
   ========================================================= */

button {
    min-height: 44px;

    padding: 10px 18px;

    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            var(--blue-500) 0%,
            var(--blue-600) 100%
        );

    border: 1px solid var(--blue-700);
    border-radius: var(--radius-sm);

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
}

button:hover {
    background:
        linear-gradient(
            180deg,
            var(--blue-600) 0%,
            var(--blue-700) 100%
        );

    border-color: var(--blue-800);
}

button:active {
    background:
        linear-gradient(
            180deg,
            var(--blue-700) 0%,
            var(--blue-800) 100%
        );

    border-color: var(--blue-800);
}

button:focus-visible {
    outline: none;

    box-shadow: var(--focus-ring);
}

button:disabled {
    color: #84909a;

    background: #e4e8eb;

    border-color: #d1d8dd;

    cursor: not-allowed;
}


/* ===== Button Groups ===== */

.tool-buttons,
.step-buttons {
    display: flex;
    align-items: stretch;

    gap: 10px;

    margin-top: 18px;
}

.tool-buttons button,
.step-buttons button {
    flex: 1;
}


/* ===== Secondary Buttons ===== */

#resetBTN,
#clearDeviceFormBTN,
#cancelEditBTN,
#clearRecallFiltersBTN,
#clearHistoryFiltersBTN {
    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            #60788a 0%,
            var(--secondary) 100%
        );

    border-color: #485f70;
}

#resetBTN:hover,
#clearDeviceFormBTN:hover,
#cancelEditBTN:hover,
#clearRecallFiltersBTN:hover,
#clearHistoryFiltersBTN:hover {
    background:
        linear-gradient(
            180deg,
            var(--secondary) 0%,
            var(--secondary-hover) 100%
        );

    border-color: #3d5261;
}


/* =========================================================
   Messages
   ========================================================= */

#loginMessage,
#registerMessage,
#deviceMessage,
#feedbackMessage,
#historyMessage {
    margin: 14px 0 0;

    color: var(--text-muted);

    font-size: 14px;
    font-weight: 600;
}

#feedbackMessage {
    color: var(--blue-700);
}


/* =========================================================
   Troubleshooter
   ========================================================= */

.result-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(280px, 0.8fr);

    gap: 20px;

    align-items: stretch;
}

.result-text,
.result-image {
    min-width: 0;

    padding: 20px;

    background-color: var(--surface-soft);

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}


/* ===== Step Information ===== */

#stepCounter {
    display: inline-flex;
    align-items: center;

    min-height: 31px;

    margin: 0 0 13px;

    padding: 5px 9px;

    color: var(--blue-700);
    background-color: var(--blue-050);

    border: 1px solid var(--blue-200);
    border-radius: var(--radius-sm);

    font-size: 13px;
    font-weight: 700;
}

#guideTitle {
    margin: 0 0 12px;

    color: var(--text-muted);

    font-size: 15px;
    font-weight: 500;
}

#guideMeta {
    display: inline-flex;

    margin: 0 0 18px;

    padding: 5px 9px;

    color: var(--blue-700);
    background-color: var(--blue-050);

    border: 1px solid var(--blue-200);
    border-radius: var(--radius-sm);

    font-size: 13px;
    font-weight: 600;
}

#result {
    min-height: 170px;

    color: #354655;

    font-size: 16px;
    line-height: 1.7;
}

#result h3 {
    margin: 0 0 12px;

    color: var(--text-heading);

    font-size: 22px;

    line-height: 1.3;
}

#result p {
    margin: 0 0 12px;
}


/* ===== Support Note ===== */

#supportNote {
    margin-top: 16px;

    padding: 13px 15px;

    color: #425767;
    background-color: var(--blue-050);

    border: 1px solid var(--blue-200);
    border-left: 4px solid var(--primary);

    border-radius: var(--radius-sm);

    font-size: 14px;
    line-height: 1.55;
}


/* ===== Troubleshooting Image ===== */

.result-image {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 230px;
}

.result-image img {
    display: block;

    width: auto;
    max-width: 100%;
    max-height: 330px;

    object-fit: contain;

    padding: 8px;

    background-color: #ffffff;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}


/* ===== Troubleshooting Feedback ===== */

.feedback-box {
    display: none;

    margin-top: 18px;

    padding: 18px;

    background-color: var(--surface-soft);

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.feedback-box h3,
.feedback-box p {
    margin-top: 0;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;

    gap: 20px;

    margin: 12px 0 14px;
}

.radio-group label {
    display: inline-flex;
    align-items: center;

    gap: 7px;

    margin: 0;

    font-weight: 500;

    cursor: pointer;
}

#reasonBox {
    display: none;

    margin-top: 14px;
}

#submitFeedbackBTN {
    margin-top: 10px;
}


/* =========================================================
   Recalls
   ========================================================= */

.recall-list {
    display: grid;

    gap: 12px;

    margin-top: 20px;
}

.recall-card {
    position: relative;

    padding: 20px 22px;

    background-color: #ffffff;

    border: 1px solid var(--border);
    border-left: 4px solid var(--blue-500);

    border-radius: var(--radius-sm);

    transition:
        border-color 0.15s ease,
        background-color 0.15s ease;
}

.recall-card:hover {
    background-color: #fbfcfd;

    border-color: #b8c5ce;
    border-left-color: var(--blue-700);
}

.recall-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 10px;
}

.recall-card h3 {
    margin: 8px 0 10px;

    color: var(--text-heading);

    font-size: 20px;

    line-height: 1.3;
}

.recall-card p {
    margin: 7px 0;

    color: #40515f;

    line-height: 1.55;
}

.recall-category,
.risk-badge {
    display: inline-flex;
    align-items: center;

    padding: 4px 8px;

    border-radius: var(--radius-sm);

    font-size: 12px;
    font-weight: 700;

    line-height: 1.4;
}

.recall-category {
    color: var(--blue-700);
    background-color: var(--blue-050);

    border: 1px solid var(--blue-200);
}

.risk-badge {
    color: var(--warning);
    background-color: var(--warning-bg);

    border: 1px solid var(--warning-border);
}

.recall-source {
    color: var(--text-muted);

    font-size: 13px;
}


/* =========================================================
   My Devices
   ========================================================= */

.devices-dashboard {
    display: grid;

    grid-template-columns:
        minmax(0, 1.12fr)
        minmax(330px, 0.88fr);

    gap: 20px;

    align-items: start;
}

.devices-dashboard .tool-box,
.devices-dashboard .result-box {
    margin: 0;
}


/* ===== Add / Edit Device Form ===== */

.devices-page .devices-dashboard .tool-box {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    column-gap: 18px;
    row-gap: 14px;

    padding: 24px;
}

.devices-page .devices-dashboard .tool-box > h2 {
    grid-column: 1 / -1;

    margin: 0 0 4px;
}

.devices-page .devices-dashboard .tool-box > .section {
    margin: 0;
}

.devices-page .devices-dashboard .tool-box label {
    margin-bottom: 6px;
}

.devices-page .devices-dashboard .tool-box input,
.devices-page .devices-dashboard .tool-box select {
    min-height: 43px;

    padding: 8px 10px;
}

.devices-page .devices-dashboard .tool-box textarea {
    min-height: 72px;

    padding: 9px 10px;
}

.devices-page .devices-dashboard .tool-buttons {
    grid-column: 1 / -1;

    margin-top: 4px;
}

.devices-page .devices-dashboard #deviceMessage {
    grid-column: 1 / -1;

    margin: 0;
}


/* ===== Saved Devices ===== */

.devices-page .devices-dashboard .result-box {
    position: sticky;

    top: 18px;

    padding: 24px;
}

.device-list {
    display: grid;

    gap: 10px;

    margin-top: 16px;
}

.devices-page #deviceList {
    max-height: 520px;

    overflow-y: auto;
    overscroll-behavior: contain;

    padding-right: 5px;

    scrollbar-width: thin;
    scrollbar-color: #a7b5bf transparent;
}

.device-card {
    padding: 17px 18px;

    background-color: var(--surface-soft);

    border: 1px solid var(--border);
    border-left: 4px solid var(--blue-500);

    border-radius: var(--radius-sm);

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.device-card:hover {
    background-color: #ffffff;

    border-color: #b9c6cf;
    border-left-color: var(--blue-700);
}

.device-card h3 {
    margin: 0 0 9px;

    color: var(--text-heading);

    font-size: 18px;

    line-height: 1.3;
}

.device-card p {
    margin: 5px 0;

    color: #465765;

    font-size: 14px;

    line-height: 1.45;
}


/* ===== Device Actions ===== */

.devices-page .device-actions {
    display: flex;

    gap: 8px;

    margin-top: 14px;
    padding-top: 13px;

    border-top: 1px solid var(--border);
}

.devices-page .device-actions button {
    flex: 1;

    min-height: 39px;

    padding: 8px 12px;

    font-size: 14px;
}

.devices-page .edit-device-btn {
    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            var(--blue-500),
            var(--blue-600)
        );

    border-color: var(--blue-700);
}

.devices-page .edit-device-btn:hover {
    background:
        linear-gradient(
            180deg,
            var(--blue-600),
            var(--blue-700)
        );

    border-color: var(--blue-800);
}

.devices-page .delete-device-btn {
    color: var(--danger);
    background: #ffffff;

    border-color: var(--danger-border);
}

.devices-page .delete-device-btn:hover {
    color: #ffffff;
    background: var(--danger);

    border-color: var(--danger);
}

.devices-page .delete-device-btn:active {
    background: var(--danger-hover);

    border-color: var(--danger-hover);
}


/* ===== Compact Devices Header ===== */

.devices-page header {
    padding-top: 23px;
}

.devices-page header h1 {
    margin-bottom: 0;
}

.devices-page header > p {
    margin-top: 7px;
}

.devices-page main {
    gap: 18px;
}

.devices-page .intro-box {
    padding: 18px 22px;
}


/* =========================================================
   Troubleshooting History
   ========================================================= */

.history-page .tool-box {
    padding: 25px 26px;
}


/* ===== History Filters ===== */

.history-filter-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-top: 4px;
}

.history-filter-grid .section {
    margin-bottom: 0;
}


/* ===== History Results ===== */

.history-results-panel {
    padding: 26px;
}

.history-results-panel h2 {
    margin-bottom: 12px;
}


/* Keep session count clean and simple */

#historyCount {
    margin: 0 0 18px;

    color: var(--text-muted);

    font-size: 14px;
}


/* ===== History Message ===== */

#historyMessage {
    margin: 0;

    color: var(--text-muted);

    font-size: 14px;
    font-weight: 600;
}

#historyMessage:not(:empty) {
    margin-bottom: 18px;
}


/* ===== History List ===== */

#historyList {
    display: grid;

    gap: 12px;
}


/* ===== Simple Empty State ===== */

.history-empty-state {
    padding: 22px 0 6px;

    border-top: 1px solid var(--border);
}

.history-empty-state h3 {
    margin: 0 0 7px;

    color: var(--text-heading);

    font-size: 18px;
    font-weight: 700;
}

.history-empty-state p {
    margin: 0 0 12px;

    color: var(--text-muted);

    font-size: 15px;
    line-height: 1.5;
}

.history-start-link {
    color: var(--primary);

    font-size: 14px;
    font-weight: 600;

    text-decoration: underline;
    text-underline-offset: 3px;
}

.history-start-link:hover {
    color: var(--primary-hover);
}


/* ===== Future History Records ===== */

.history-card {
    padding: 18px 20px;

    background-color: var(--surface-soft);

    border: 1px solid var(--border);
    border-left: 4px solid var(--blue-500);

    border-radius: var(--radius-sm);

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.history-card:hover {
    background-color: #ffffff;

    border-color: #b9c6cf;
    border-left-color: var(--blue-700);
}

.history-card h3 {
    margin: 0 0 8px;

    color: var(--text-heading);

    font-size: 18px;
}

.history-card p {
    margin: 5px 0;

    color: #465765;

    font-size: 14px;
    line-height: 1.45;
}

.history-card-actions {
    display: flex;

    gap: 8px;

    margin-top: 14px;
    padding-top: 13px;

    border-top: 1px solid var(--border);
}

/* Style the actions on each history card */
.history-card-actions > a,
.history-card-actions > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
}

/* Make retry the primary action */
.history-card-actions > a {
    background: var(--blue-700);
    color: #ffffff;
}

.history-card-actions > a:hover {
    background: var(--blue-800);
}

/* Give deletion a distinct appearance */
.history-card-actions > button {
    background: #ffffff;
    color: #9b2424;
    border-color: #c98b8b;
    box-shadow: none;
}

.history-card-actions > button:hover:not(:disabled) {
    background: #fff1f1;
    border-color: #9b2424;
}

.history-card-actions > button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Keep keyboard focus clearly visible */
.history-card-actions > a:focus-visible,
.history-card-actions > button:focus-visible {
    outline: 3px solid var(--blue-700);
    outline-offset: 3px;
}

/* ===== Load More ===== */

.history-load-more {
    display: flex;
    justify-content: center;

    margin-top: 18px;
}

.history-load-more button[hidden] {
    display: none;
}


/* =========================================================
   Login / Registration
   ========================================================= */

#loginForm,
#registerForm {
    width: 100%;
    max-width: 620px;

    margin-left: auto;
    margin-right: auto;
}

#loginForm .section,
#registerForm .section {
    margin-bottom: 17px;
}

#loginForm .tool-buttons,
#registerForm .tool-buttons {
    margin-top: 22px;
}

#loginForm > p:last-child,
#registerForm > p:last-child {
    margin: 20px 0 0;

    padding-top: 16px;

    color: var(--text-muted);

    border-top: 1px solid var(--border);

    font-size: 14px;
}

#loginForm > p:last-child a,
#registerForm > p:last-child a {
    font-weight: 600;
}

#loginMessage,
#registerMessage {
    min-height: 21px;
}


/* =========================================================
   Content Links
   ========================================================= */

main a {
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

main a:hover {
    text-decoration-thickness: 2px;
}


/* =========================================================
   Footer
   ========================================================= */

footer {
    margin-top: 28px;

    padding: 18px 12px;

    color: #697783;

    text-align: center;

    font-size: 13px;

    border-top: 1px solid var(--border);
}

footer p {
    margin: 0;
}


/* =========================================================
   Text Selection
   ========================================================= */

::selection {
    color: #ffffff;

    background-color: var(--blue-600);
}


/* =========================================================
   Scrollbars
   ========================================================= */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background-color: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #a8b5bf;

    border: 2px solid transparent;
    border-radius: 10px;

    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #8797a3;

    border: 2px solid transparent;

    background-clip: padding-box;
}


/* =========================================================
   Small Desktop / Laptop
   ========================================================= */

@media (max-width: 1000px) {

    .page-wrapper {
        width: 95%;
    }

    .devices-dashboard {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(300px, 0.8fr);
    }

    .result-layout {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(260px, 0.72fr);
    }
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {

    .history-filter-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}


@media (max-width: 850px) {

    .page-wrapper {
        width: 95%;

        padding-top: 16px;
    }

    header {
        padding: 23px 22px 0;
    }

    .main-nav {
        margin-left: -22px;
        margin-right: -22px;

        padding: 0 12px;
    }

    .intro-box {
        align-items: flex-start;
    }

    .devices-dashboard {
        grid-template-columns: 1fr;
    }

    .devices-page .devices-dashboard .result-box {
        position: static;
    }

    .devices-page #deviceList {
        max-height: none;
    }

    .result-layout {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 680px) {

    body {
        font-size: 15px;
    }

    .page-wrapper {
        width: 100%;

        padding: 0 0 24px;
    }

    header {
        margin-bottom: 16px;

        padding: 20px 18px 0;

        background:
            linear-gradient(
                110deg,
                #ffffff 0%,
                #f4f9fc 30%,
                #76b3d1 65%,
                #214762 100%
            );

        border-top: 0;
        border-left: 0;
        border-right: 0;

        border-radius: 0;
    }

    header h1 {
        font-size: 30px;
    }

    header > p {
        font-size: 14px;
    }

    /*Make the mobile menu button easy to find*/
    .mobile-nav-bar {
        margin: 18px -18px 0;
        padding: 12px;
        background: var(--blue-900);
        color: #ffffff;
    }

    .mobile-current-page {
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        font-weight: 600;
    }

    #mobileNavToggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;

        width: 100%;
        min-height: 48px;
        padding: 10px 16px;

        background: #ffffff;
        color: var(--blue-900);
        border: 2px solid #ffffff;
        border-radius: 6px;
        font-size: 16px;
        font-weight: 700;
    }

    #mobileNavToggle:hover {
        background: var(--blue-100);
        border-color: var(--blue-100);
    }

    #mobileNavToggle:focus-visible {
        outline: 3px solid #ffffff;
        outline-offset: 3px;
        box-shadow: none;
    }

    #mobileNavIcon {
        font-size: 22px;
        line-height: 1;
    }

    #mobileNavHint {
        display: block;
        margin-top: 8px;
        text-align: center;
        font-size: 13px;
        color: #edf4f8;
    }

    /*Show one page link per row when the menu opens*/
    .main-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: center;

        margin: 0 -18px;
        padding: 8px 12px 12px;
        gap: 4px;
    }

    .main-nav a {
        justify-content: flex-start;
        min-width: 0;
        min-height: 48px;
        padding: 12px;

        font-size: 16px;
        border-radius: 4px;
        overflow-wrap: anywhere;
    }

    /*Keep account details below the page links*/
    .main-nav #signedInStatus {
        min-width: 0;
        margin: 0;
        padding: 12px;
    }

    .main-nav #logoutBTN {
        width: 100%;
        min-height: 48px;
        margin: 4px 0 0;
    }

    main {
        gap: 14px;

        padding: 0 14px;
    }

    .intro-box {
        flex-direction: column;
        align-items: flex-start;

        gap: 12px;

        padding: 18px;
    }

    .intro-box h2 {
        font-size: 23px;
    }

    .intro-tag {
        align-self: flex-start;
    }

    .tool-box,
    .result-box {
        padding: 20px 18px;
    }

    .tool-box h2,
    .result-box h2 {
        margin-bottom: 18px;

        font-size: 21px;
    }

    .tool-buttons,
    .step-buttons {
        flex-direction: column;
    }

    .tool-buttons button,
    .step-buttons button {
        width: 100%;
    }

    .result-text,
    .result-image {
        padding: 16px;
    }

    .result-image {
        min-height: 190px;
    }

    .radio-group {
        gap: 14px;
    }

    .recall-card {
        padding: 17px;
    }

    .devices-page main {
        padding-top: 0;
    }

    .devices-page .intro-box {
        padding: 18px;
    }

    .devices-page .devices-dashboard .tool-box {
        grid-template-columns: 1fr;

        padding: 20px 18px;
    }

    .devices-page .devices-dashboard .tool-box > h2,
    .devices-page .devices-dashboard .tool-buttons,
    .devices-page .devices-dashboard #deviceMessage {
        grid-column: 1;
    }

    .devices-page .devices-dashboard .result-box {
        padding: 20px 18px;
    }

    .devices-page .device-actions {
        flex-direction: column;
    }

    .history-filter-grid {
        grid-template-columns: 1fr;
    }

    .history-results-panel {
        padding: 20px 18px;
    }

    .history-empty-state {
        padding-top: 18px;
    }

    .history-card-actions {
        flex-direction: column;
    }

    footer {
        margin: 22px 14px 0;
    }
}


/* =========================================================
   Very Small Screens
   ========================================================= */

@media (max-width: 420px) {

    main {
        padding-left: 10px;
        padding-right: 10px;
    }

    header {
        padding-left: 14px;
        padding-right: 14px;
    }

    /*Keep the menu aligned with the header on smaller phones*/
    .mobile-nav-bar,
    .main-nav {
        margin-left: -14px;
        margin-right: -14px;
    }

    .intro-box,
    .tool-box,
    .result-box {
        border-radius: var(--radius-sm);
    }

    .tool-box,
    .result-box {
        padding: 17px 15px;
    }

    input,
    select {
        min-height: 45px;
    }

    button {
        min-height: 45px;
    }

    .recall-card,
    .device-card,
    .history-card {
        padding: 15px;
    }
}

/* =========================================================
   Increased Contrast
   ========================================================= */

@media (prefers-contrast: more) {

    :root {
        --border: #8c9aa5;
        --border-strong: #6e7e8a;
    }

    button {
        border-width: 2px;
    }

    input,
    select,
    textarea {
        border-width: 2px;
    }

    .intro-box,
    .tool-box,
    .result-box,
    .device-card,
    .recall-card,
    .history-card {
        border-color: var(--border-strong);
    }
}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/*Keep model suggestions positioned beneath their input*/
.model-input-wrapper {
    position: relative;
}

.model-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #ffffff;
    color: #17344a;
    border: 1px solid #8aa5b8;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/*Give each suggestion a clear pointer and keyboard highlight*/
.model-suggestions [role="option"] {
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.model-suggestions [role="option"]:hover,
.model-suggestions [role="option"][aria-selected="true"] {
    background: #dceefa;
    color: #12344d;
}

/*Give each troubleshooting answer its own readable row*/
#stepChoices:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

#stepChoices button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 14px 18px;

    background: #f8fbff;
    color: #173f5b;
    border: 1px solid #9bb9ce;
    border-radius: 8px;

    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

#stepChoices button:hover {
    background: #e8f3fc;
    border-color: #3679a5;
}

#stepChoices button:active {
    background: #d5e9f8;
    border-color: #245e85;
}

/*Keep keyboard navigation clearly visible*/
#stepChoices button:focus-visible {
    outline: 3px solid #17699f;
    outline-offset: 3px;
    box-shadow: none;
}

/*Separate backward navigation from the answer choices*/
#prevBTN {
    flex: 0 0 auto;
    min-width: 120px;
    border-radius: 8px;
}

#prevBTN:not(:disabled) {
    background: #ffffff;
    color: #34546c;
    border-color: #9bb0bf;
}

#prevBTN:not(:disabled):hover {
    background: #edf3f7;
    border-color: #607f95;
}

/* Hide the image panel when the guide is showing the placeholder. */
.result-image:has(> img[src$="/placeholder.jpg"]) {
    display: none;
}

/* Let the instructions and buttons use the space from the hidden panel. */
.result-layout:has(> .result-image > img[src$="/placeholder.jpg"]) > .result-text {
    grid-column: 1 / -1;
}

/* Give the picture more room when the panels are side by side. */
@media (min-width: 851px) {
    .result-layout {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    }
}

/* Line up the picture with the top of the instructions. */
.result-image {
    align-self: start;
    min-height: 0;
    padding: 8px;
}

/* Fill the panel and preserve the picture's proportions. */
.result-image img {
    width: 100%;
    height: auto;
    max-height: none;
    padding: 0;
}

/* MyElectronicsGuide banner */
.page-wrapper > header {
    --inset: clamp(22px, 3vw, 48px);
    --wing: clamp(0px, calc((100vw - var(--content-width)) / 2 - 32px), 80px);

    margin-inline: calc(0px - var(--wing));
    padding: 34px var(--inset) 0;
    background-color: #f6fafb;
    background-image:
        linear-gradient(107deg, #f6fafb 44%, #e4f0f2 52%,
                        #80b9be 52%, #80b9be 52.35%, transparent 52.35%),
        url("../images/electronics-header.png");
    background-position: center top, right center;
    background-size: 100% 100%, 56% auto;
    background-repeat: no-repeat;
    border: 1px solid #ccd9df;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(19, 46, 59, 0.09);
}

.page-wrapper > header h1 {
    color: #133448;
    font-size: clamp(32px, 3.5vw, 52px);
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.page-wrapper > header > p {
    max-width: 46%;
    margin-top: 8px;
    color: #365461;
}

/* Desktop navigation */
@media (min-width: 681px) {
    .page-wrapper > header > .main-nav {
        margin: 28px calc(0px - var(--inset)) 0;
        padding-inline: calc(var(--inset) - 16px);
        background: #173647;
    }
}

/* Home electronics banner */
.page-wrapper > header {
    background-color: #edf3f6;

    /* Start blending near the title and reveal the devices toward the right. */
    background-image:
        linear-gradient(
            to right,
            #edf3f6 25%,
            rgba(237, 243, 246, 0.94) 31%,
            rgba(237, 243, 246, 0.65) 40%,
            rgba(237, 243, 246, 0.22) 49%,
            transparent 57%
        ),
        url("../images/home-electronics.png");

    background-size: 100% 100%, 75% auto;
    background-position: left top, right center;
    background-repeat: no-repeat;
}

.page-wrapper > header h1,
.page-wrapper > header > p {
    color: #17384c;
}

/* Keep the site name readable on phones. */
@media (max-width: 680px) {
    .page-wrapper > header {
        background-image:
            linear-gradient(
                to right,
                #edf3f6 10%,
                rgba(237, 243, 246, 0.94) 55%,
                rgba(237, 243, 246, 0.35) 100%
            ),
            url("../images/home-electronics.png");

        background-size: 100% 125px, auto 125px;
        background-position: left top, right top;
    }
}

/* Match the navigation colors to the home electronics banner. */
.page-wrapper > header > .main-nav,
.page-wrapper > header > .mobile-nav-bar {
    background: linear-gradient(90deg, #293e4a, #23343e);
    border-top: 1px solid #526671;
}

/* Highlight the current page with a soft fill and a pale blue underline. */
.page-wrapper > header > .main-nav a[aria-current="page"] {
    background-color: rgba(255, 255, 255, 0.10);
    border-bottom-color: #b9dce6;
    color: #ffffff;
}