/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
    position: relative;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ==========================================
   ZenSmart design tokens (from zensmart-ui
   design system: shared/styles.js)
   ========================================== */

:root {
    --zs-font: 'Rubik', sans-serif;

    --zs-heading: #2E384D;
    --zs-body: #8798AD;
    --zs-nav-blue: #194787;

    --zs-blue: #0B6BF2;
    --zs-blue-dark: #0243EB;
    --zs-blue-light: #DBE9FD;

    --zs-green: #2CC2A5;
    --zs-green-dark: #11A783;
    --zs-green-light: #E0F6F2;

    --zs-amber: #F7C137;
    --zs-amber-light: #FEF6E1;

    --zs-red: #E84A50;
    --zs-red-dark: #DC262B;
    --zs-red-light: #FCE4E5;

    --zs-gray: #BFC5D2;
    --zs-bg: #E9EDF9;
    --zs-white: #FFFFFF;

    --zs-radius: 10px;
    --zs-radius-sm: 5px;

    --zs-shadow-card: 0 4px 14px rgba(46, 56, 77, 0.08);
    --zs-shadow-float: 0 10px 30px rgba(46, 56, 77, 0.22);

    --zs-header-height: 56px;
}

/* ========================================== */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #000;
    overflow: hidden;
    touch-action: manipulation;
}

*, html {
    font-family: var(--zs-font);
    font-style: normal;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--zs-bg);
    font-size: 16px;
    line-height: 1.5; /* the reset's line-height:1 is too tight as an app-wide default */
    color: var(--zs-heading);
}

/* honour the OS-level reduced motion setting everywhere */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.light {
    font-weight: 300;
}
.regular {
    font-weight: 400;
}
.semibold {
    font-weight: 500;
}
strong {
    font-weight: 700;
}

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

#header {
    display: flex;
    align-items: center;
    height: var(--zs-header-height);
    background-color: var(--zs-nav-blue);
    color: #fff;
    padding: 0 14px;
    position: relative;
    z-index: 55;
    box-shadow: 0 2px 10px rgba(25, 71, 135, 0.35);
}

    /* the brand sits dead-centre of the bar regardless of what flanks it */
    #header #logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        height: 26px;
        display: block;
    }

#hamburger {
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: -10px;
    border-radius: var(--zs-radius-sm);
    transition: background-color 0.15s ease;
}

#hamburger:active {
    background-color: rgba(255, 255, 255, 0.14);
}

#hamburger svg {
    width: 26px;
    height: 26px;
    display: block;
}

#hamburger .open {
    display: block;
}
#hamburger .close {
    display: none;
}

#hamburger.open .open {
    display: none;
}
#hamburger.open .close {
    display: block;
}

/* ==========================================
   Nav drawer
   ========================================== */

#header nav {
    position: absolute;
    top: var(--zs-header-height);
    left: 0;
    right: auto;
    background-color: var(--zs-white);
    border: none;
    border-radius: 0 0 14px 0;
    box-shadow: var(--zs-shadow-float);
    width: 300px;
    max-width: 86vw;
    max-height: calc(100vh - var(--zs-header-height) - 16px);
    overflow-y: auto;
    z-index: 1000;
    padding: 0 0 16px;
    /* class-driven slide: transform animates on the compositor (no jank),
       visibility keeps the closed drawer out of the tab order */
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.28s;
}

#header nav.open {
    transform: none;
    visibility: visible;
}

/* dimmed backdrop behind the open drawer - tapping it closes the menu */
#scrim {
    position: fixed;
    top: var(--zs-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(46, 56, 77, 0.4);
    z-index: 54;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s;
}

#scrim.open {
    opacity: 1;
    visibility: visible;
}

/* who's signed in - identity lives at the top of the drawer, not the bar */
#header nav #who {
    display: flex;
    align-items: center;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--zs-bg);
    margin-bottom: 6px;
}

#who .who-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--zs-nav-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    flex: none;
}

#who .who-details {
    margin-left: 12px;
    min-width: 0;
}

#who .who-name {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--zs-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#who .who-details a {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--zs-blue);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 13px 16px 13px 0; /* 44px-tall hit area for a text link */
    margin: -5px 0 -13px;
}

#header nav::-webkit-scrollbar {
    width: 6px;
}

#header nav::-webkit-scrollbar-thumb {
    background: var(--zs-gray);
    border-radius: 3px;
}

/* Section titles (e.g. Scan Apps, Dashboards) - a class, not `nav > div`,
   because the #others container is also a div and must not inherit
   heading typography (uppercase/letter-spacing leak onto its links) */
#header nav .heading {
    font-size: 11px;
    font-weight: 500;
    color: var(--zs-body);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 18px 20px 8px;
}

/* Top-level links (like AI Insights) - padding sized for a 44px touch row */
#header nav > a:not(.suba) {
    display: block;
    color: var(--zs-heading);
    font-weight: 500;
    font-size: 15px;
    padding: 13px 20px;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

#header nav > a:not(.suba):active,
#header nav > a:not(.suba).active {
    background-color: var(--zs-blue-light);
    border-left-color: var(--zs-blue);
    color: var(--zs-blue);
}

/* hover feedback only where a real pointer exists - on touch screens a
   :hover rule sticks visibly to the last thing tapped */
@media (hover: hover) {
    #header nav > a:not(.suba):hover {
        background-color: var(--zs-blue-light);
        border-left-color: var(--zs-blue);
        color: var(--zs-blue);
    }
}

/* "Others" collapsed group (custom menus) */
#header nav #others {
    display: none;
}
#header nav #others-toggle .chev {
    float: right;
    transition: transform 0.15s ease;
}
#header nav #others-toggle.open .chev {
    display: inline-block;
    transform: rotate(180deg);
}
/* Section titles inside Others - #header nav > div only styles direct children */
#header nav .subheading {
    font-size: 11px;
    font-weight: 500;
    color: var(--zs-body);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 20px 6px 30px;
}

/* Submenu links - same 44px touch row as top-level entries */
#header nav .suba {
    display: block;
    padding: 12px 20px 12px 30px;
    font-size: 15px;
    font-weight: 400;
    color: var(--zs-heading);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
#header nav .suba.active {
    background-color: var(--zs-blue-light);
    border-left-color: var(--zs-blue);
    color: var(--zs-blue);
    font-weight: 500;
}
#header nav .suba:active {
    background-color: var(--zs-blue-light);
    border-left-color: var(--zs-blue);
    color: var(--zs-blue);
}
@media (hover: hover) {
    #header nav .suba:hover {
        background-color: var(--zs-blue-light);
        border-left-color: var(--zs-blue);
        color: var(--zs-blue);
    }
}

/* ==========================================
   Main content
   ========================================== */

main {
    background-color: var(--zs-bg);
    min-height: calc(100vh - var(--zs-header-height));
    padding: 20px 16px;
    color: var(--zs-heading);
}

main h1, main h2, main h3 {
    color: var(--zs-heading);
    font-weight: 500;
    margin-bottom: 10px;
}

main h1 { font-size: 22px; }
main h2 { font-size: 18px; }
main h3 { font-size: 16px; }

main p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 1em;
    color: var(--zs-body);
}

/* ==========================================
   Feedback toast
   ========================================== */

#message {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 10%;
    margin: 0 auto;
    max-width: 480px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    background: var(--zs-white);
    color: var(--zs-heading);
    border-radius: 12px;
    box-shadow: var(--zs-shadow-float);
    z-index: 50;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#message.info {
    background: var(--zs-white);
    color: var(--zs-heading);
}

#message.good {
    background: var(--zs-green);
    color: #fff;
}

#message.put {
    background: var(--zs-amber);
    color: var(--zs-heading);
}

#message.bad {
    background: var(--zs-red);
    color: #fff;
}

    #message #contents {
        width: 100%;
        justify-content: center;
        text-align: center;
        font-size: 22px;
        font-weight: 400;
        line-height: 1.35;
    }

        #message #contents .smaller {
            font-size: 50%;
        }

        #message #contents .bigger {
            font-size: 200%;
            font-weight: 700;
            letter-spacing: 0.02em;
        }

/* ==========================================
   Spinner - shared by the feedback toast and the page-loading overlay
   ========================================== */

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--zs-blue-light);
    border-top-color: var(--zs-blue);
    border-radius: 50%;
    animation: spinner-spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spinner-spin {
    to { transform: rotate(360deg); }
}

/* full-screen veil shown the moment a menu link is tapped - the browser
   stays on the old page until the server responds, which otherwise reads
   as a dead tap */
#page-loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

#page-loading.show {
    display: flex;
}

/* ==========================================
   Modal prompt
   ========================================== */

#overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(46, 56, 77, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
}

#custom-prompt {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(90vw, 420px);
    background: var(--zs-white);
    border: none;
    border-radius: var(--zs-radius);
    box-shadow: var(--zs-shadow-float);
    padding: 24px 20px 78px;
    z-index: 9999;
    display: none;
}

#custom-message {
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--zs-body);
    padding-right: 24px;
}

#custom-message strong {
    display: block;
    font-size: 17px;
    font-weight: 500;
    color: var(--zs-heading);
    margin-bottom: 6px;
}

#custom-input, #custom-select, #custom-notes {
    width: 100%;
    max-width: 100%;
    margin-bottom: 4px;
    display: none;
    padding: 11px 12px;
    font-size: 16px;
    font-family: var(--zs-font);
    color: var(--zs-heading);
    background: var(--zs-white);
    border: 1px solid var(--zs-gray);
    border-radius: var(--zs-radius-sm);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#custom-input:focus, #custom-select:focus, #custom-notes:focus {
    border-color: var(--zs-blue);
    box-shadow: 0 0 0 3px rgba(11, 107, 242, 0.15);
}

/* appearance:none strips the native dropdown arrow - selects need one back
   or they read as plain text fields with no hint there are more choices */
#custom-select, .qafail-field select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238798AD' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
    padding-right: 38px;
}

#custom-notes {
    font-size: 16px; /* 16px stops iOS from zooming the page */
    resize: none;
}

#stopwatch {
    display: none;
    text-align: center;
    margin-bottom: 4px;
}

#stopwatch-time {
    font-size: 44px;
    font-weight: 500;
    color: var(--zs-heading);
    font-variant-numeric: tabular-nums;
    margin-bottom: 6px;
}

#stopwatch.paused #stopwatch-time {
    color: var(--zs-body);
}

#stopwatch-paused {
    font-size: 13px;
    color: var(--zs-body);
    font-variant-numeric: tabular-nums;
    margin-bottom: 14px;
}

#stopwatch-pause {
    font-family: var(--zs-font);
    font-size: 15px;
    font-weight: 500;
    color: var(--zs-blue);
    background: var(--zs-blue-light);
    border: none;
    border-radius: var(--zs-radius-sm);
    padding: 12px 24px;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.15s ease;
}

#stopwatch.paused #stopwatch-pause {
    color: #fff;
    background: var(--zs-amber);
}

#custom-prompt.stopwatch-paused #custom-submit,
#custom-prompt.stopwatch-paused #close-btn {
    opacity: 0.4;
    pointer-events: none;
}

#error-message {
    color: var(--zs-red);
    font-size: 13px;
    margin-top: 6px;
    min-height: 1em;
}

#qafail-form {
    display: none;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 4px;
}

#quiz {
    display: none;
    max-height: 55vh;
    overflow-y: auto;
    margin-bottom: 4px;
}

.quiz-option {
    border: 2px solid var(--zs-blue-light);
    border-radius: var(--zs-radius);
    padding: 12px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 16px;
    color: var(--zs-heading);
    cursor: pointer;
}

.quiz-option:active {
    border-color: var(--zs-blue);
    background: var(--zs-blue-light);
}

.quiz-option img {
    max-width: 100%;
    max-height: 30vh;
    display: block;
    margin: 0 auto;
    pointer-events: none;
}

.qafail-field {
    margin-bottom: 12px;
}

.qafail-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--zs-heading);
    margin-bottom: 4px;
}

.qafail-field input,
.qafail-field select,
.qafail-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 11px 12px;
    font-size: 16px;
    font-family: var(--zs-font);
    color: var(--zs-heading);
    background: var(--zs-white);
    border: 1px solid var(--zs-gray);
    border-radius: var(--zs-radius-sm);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qafail-field input:focus,
.qafail-field select:focus,
.qafail-field textarea:focus {
    border-color: var(--zs-blue);
    box-shadow: 0 0 0 3px rgba(11, 107, 242, 0.15);
}

#button-wrapper {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

#custom-submit {
    font-family: var(--zs-font);
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    background: var(--zs-blue);
    border: none;
    border-radius: var(--zs-radius-sm);
    padding: 12px 24px;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.15s ease;
}

#custom-submit:active {
    background: var(--zs-blue-dark);
}

#close-btn {
    /* 44px hit area around the 24px glyph */
    position: absolute;
    top: 4px;
    right: 4px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#close-btn svg {
    width: 24px;
    height: 24px;
    color: var(--zs-body);
}

#close-btn:active svg {
    color: var(--zs-heading);
}

@media (hover: hover) {
    #close-btn:hover svg {
        color: var(--zs-heading);
    }
}
