:root {
    --navy: #07172c;
    --navy-2: #0d2440;
    --navy-3: #183451;
    --cyan: #1ac5d9;
    --cyan-soft: #e4f9fb;
    --blue: #377dff;
    --ink: #162336;
    --muted: #738096;
    --line: #e8edf3;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --green: #11875d;
    --green-soft: #e7f7ef;
    --amber: #a85b07;
    --amber-soft: #fff3dd;
    --red: #c13e4c;
    --red-soft: #fff0f1;
    --shadow: 0 18px 50px rgba(18, 37, 61, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.eyebrow { color: #8995a6; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.muted { color: var(--muted); line-height: 1.65; }

/* Login */
.auth-page { min-height: 100vh; background: #fff; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, .92fr) 1.08fr; }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(38px, 7vw, 100px); color: #fff; background: radial-gradient(ellipse at 18% 90%, rgba(26,197,217,.24), transparent 35%), radial-gradient(ellipse at 90% 4%, rgba(55,125,255,.22), transparent 36%), linear-gradient(145deg, #07172c 4%, #0d2947 100%); }
.auth-brand::before, .auth-brand::after { position: absolute; content: ""; border: 1px solid rgba(80,196,219,.15); border-radius: 50%; pointer-events: none; }
.auth-brand::before { width: 540px; height: 540px; right: -260px; bottom: -250px; }
.auth-brand::after { width: 380px; height: 380px; right: -180px; bottom: -170px; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border: 1px solid rgba(91,229,239,.45); border-radius: 15px; color: #07172c; background: linear-gradient(145deg, #c1fbff, #19c4d8); box-shadow: 0 8px 22px rgba(26,197,217,.18); font-size: 25px; font-weight: 950; font-style: italic; }
.auth-brand > .brand-mark { margin-bottom: 34px; }
.auth-brand .eyebrow { color: #58dbea; margin-bottom: 15px; }
.auth-brand h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(34px, 4.3vw, 58px); line-height: 1.06; letter-spacing: -.055em; }
.auth-brand h1 span { color: #4ed8e6; }
.auth-brand p { position: relative; z-index: 1; max-width: 490px; margin: 22px 0 0; color: #bccad9; font-size: 15px; line-height: 1.75; }
.auth-points { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 33px; color: #d2e5ef; font-size: 12px; }
.auth-points span::first-letter { color: #54dce7; }
.auth-foot { position: absolute; bottom: 34px; color: #8fa4b9; font-size: 11px; }
.auth-panel-wrap { display: grid; place-items: center; padding: 48px 28px; background: #fff; }
.auth-panel { width: min(100%, 435px); }
.auth-icon { display: grid; place-items: center; width: 45px; height: 45px; margin-bottom: 22px; border-radius: 14px; color: #087f92; background: var(--cyan-soft); font-size: 22px; font-weight: 800; }
.auth-panel .eyebrow { color: #11889a; margin-bottom: 9px; }
.auth-panel h2 { margin: 0; color: #152238; font-size: 30px; letter-spacing: -.04em; }
.auth-panel > .muted { margin: 10px 0 25px; font-size: 13px; }
.auth-form { display: grid; gap: 17px; margin-top: 25px; }
.auth-form label, .field { display: grid; gap: 8px; color: #3b485a; font-size: 12px; font-weight: 700; }
.auth-form input, .field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 12px 13px; outline: none; border: 1px solid #dfe5ed; border-radius: 9px; color: var(--ink); background: #fff; transition: border .18s, box-shadow .18s; }
.auth-form input:focus, .field input:focus, .field select:focus, .field textarea:focus, .search-box:focus-within { border-color: #39b9cb; box-shadow: 0 0 0 3px rgba(26,197,217,.12); }
.auth-form input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #a5afbc; font-weight: 400; }
.auth-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: #8490a0; font-size: 11px; line-height: 1.6; }
.setup-steps { display: grid; gap: 12px; margin: 22px 0; padding-left: 20px; color: #536175; font-size: 12px; line-height: 1.6; }
.setup-steps code { padding: 2px 5px; border-radius: 4px; background: #f0f4f8; color: #17273b; }
.alert { margin: 17px 0; padding: 11px 13px; border-radius: 8px; font-size: 12px; line-height: 1.5; }
.alert-error { border: 1px solid #f2c5ca; color: #a22f3d; background: #fff4f5; }

/* Shared controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 750; white-space: nowrap; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #052134; background: linear-gradient(135deg, #2dd1de, #74e4e6); box-shadow: 0 5px 16px rgba(26,197,217,.18); }
.button-primary:hover { box-shadow: 0 8px 22px rgba(26,197,217,.27); }
.button-secondary { border-color: #dfe7ef; color: #25364c; background: #fff; }
.button-secondary:hover { border-color: #bde8ed; background: #f8feff; }
.button-ghost { border-color: #e1e7ef; color: #526175; background: #fff; }
.button-small { min-height: 32px; padding: 0 10px; font-size: 11px; }
.button-full { width: 100%; min-height: 46px; margin-top: 4px; }
.button-plus { font-size: 18px; font-weight: 400; }
.text-button { padding: 5px 0; border: 0; color: #108c9c; background: transparent; font-size: 12px; font-weight: 750; }
.text-button span { margin-left: 3px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; color: #667487; background: transparent; font-size: 17px; }
.icon-button:hover { color: var(--navy); background: #eef3f7; }

/* Main application */
.system-page { min-height: 100vh; background: var(--canvas); }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 15; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 252px; padding: 24px 15px 16px; color: #d8e5f1; background: linear-gradient(180deg, var(--navy) 0%, #0b1e34 100%); }
.brand-lockup { display: flex; align-items: center; gap: 12px; padding: 0 9px 26px; text-decoration: none; }
.brand-lockup .brand-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 21px; }
.brand-lockup strong { display: block; color: #fff; font-size: 18px; letter-spacing: -.055em; }
.brand-lockup small { display: block; margin-top: 3px; color: #76a1b8; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.nav-label { padding: 12px 12px 9px; color: #63809c; font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.main-nav { display: grid; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 43px; padding: 0 12px; border: 0; border-radius: 9px; color: #a5bacd; background: transparent; text-align: left; font-size: 12px; font-weight: 650; }
.nav-item:hover { color: #f4fbff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #eaffff; background: linear-gradient(90deg, rgba(31,191,209,.2), rgba(31,191,209,.055)); box-shadow: inset 2px 0 #40d4df; }
.nav-icon { display: inline-grid; place-items: center; width: 20px; color: #75dce5; font-size: 17px; }
.nav-count { display: grid; place-items: center; min-width: 21px; height: 19px; margin-left: auto; border-radius: 6px; color: #9adfe5; background: rgba(26,197,217,.13); font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.support-card { display: flex; align-items: flex-start; gap: 9px; margin: 0 5px 15px; padding: 12px 10px; border: 1px solid rgba(136,181,204,.12); border-radius: 10px; background: rgba(255,255,255,.035); }
.support-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #41d79b; box-shadow: 0 0 0 4px rgba(65,215,155,.1); }
.support-card strong { display: block; color: #d7e8f2; font-size: 10px; }
.support-card small { display: block; margin-top: 4px; color: #7893a9; font-size: 9px; }
.sidebar-user { position: relative; display: flex; align-items: center; gap: 9px; padding: 12px 6px 1px; border-top: 1px solid rgba(160,192,218,.13); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid rgba(89,218,230,.28); border-radius: 10px; color: #72e2e9; background: rgba(30,153,173,.16); font-size: 14px; font-weight: 800; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong { display: block; overflow: hidden; color: #eef7fb; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy small { display: block; margin-top: 4px; color: #7893a9; font-size: 9px; }
.user-menu-toggle { color: #89a0b5; }
.user-menu { position: absolute; z-index: 4; right: 3px; bottom: 45px; width: 165px; padding: 5px; border: 1px solid #e2e8ef; border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.user-menu button { display: block; width: 100%; padding: 10px; border: 0; border-radius: 6px; color: #344357; background: transparent; text-align: left; font-size: 11px; }
.user-menu button:hover { background: #f2f6f9; }
.user-menu form { margin: 0; border-top: 1px solid var(--line); }
.main-content { min-height: 100vh; margin-left: 252px; padding: 0 34px 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 88px; border-bottom: 1px solid #e8edf2; }
.topbar-leading { display: flex; align-items: center; gap: 12px; }
.topbar .eyebrow { margin-bottom: 5px; font-size: 8px; }
.topbar h1 { margin: 0; color: #152338; font-size: 20px; letter-spacing: -.04em; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.today-chip { color: #778497; font-size: 11px; }
.mobile-menu-toggle { display: none; }
.view-panel { max-width: 1420px; margin: 0 auto; padding-top: 27px; animation: viewIn .25s ease-out; }
@keyframes viewIn { from { opacity: .25; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.welcome-row, .section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 1px 22px; }
.welcome-row h2, .section-intro h2 { margin: 7px 0 5px; color: #14243a; font-size: 25px; letter-spacing: -.05em; }
.welcome-row p, .section-intro p { margin: 0; color: #7a8798; font-size: 12px; }
.welcome-row .eyebrow, .section-intro .eyebrow { color: #108a9c; }
.wave { display: inline-block; color: #13aabe; font-size: 17px; vertical-align: 3px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 19px; }
.stat-card { position: relative; overflow: hidden; min-height: 132px; padding: 17px 17px 14px; border: 1px solid #e8edf2; border-radius: 13px; background: var(--surface); box-shadow: 0 3px 13px rgba(20,39,60,.025); }
.stat-card::after { position: absolute; right: -20px; bottom: -37px; width: 100px; height: 100px; border: 1px solid rgba(35,185,199,.1); border-radius: 50%; content: ""; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; color: #778497; font-size: 10px; font-weight: 700; }
.stat-symbol { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: #058fa0; background: var(--cyan-soft); font-size: 15px; }
.stat-card strong { display: block; margin-top: 10px; color: #15263c; font-size: 30px; line-height: 1; letter-spacing: -.06em; }
.stat-card strong em { color: #4e9ea6; font-size: 13px; font-style: normal; letter-spacing: 0; }
.stat-card small { display: block; margin-top: 8px; color: #9aa5b2; font-size: 9px; }
.stat-draft .stat-symbol { color: #aa690d; background: #fff4e2; }
.stat-done .stat-symbol { color: #14885d; background: #e9f7ef; }
.content-card { overflow: hidden; border: 1px solid #e7edf3; border-radius: 13px; background: #fff; box-shadow: 0 4px 17px rgba(26,44,67,.025); }
.card-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 13px; }
.card-heading .eyebrow { color: #8d9aaa; font-size: 8px; }
.card-heading h3 { margin: 5px 0 0; color: #1c2b3f; font-size: 14px; letter-spacing: -.02em; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 11px 15px; border-block: 1px solid #eef1f5; color: #8a95a5; background: #fbfcfd; font-size: 9px; font-weight: 800; letter-spacing: .035em; white-space: nowrap; }
.data-table td { padding: 12px 15px; border-bottom: 1px solid #f0f3f6; color: #4c5a6c; font-size: 10px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fcfefe; }
.primary-cell strong { display: block; color: #25344a; font-size: 11px; font-weight: 750; }
.primary-cell small { display: block; margin-top: 4px; color: #8e99a8; font-size: 9px; }
.status-pill, .role-pill, .active-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-draft { color: var(--amber); background: var(--amber-soft); }
.status-completed { color: var(--green); background: var(--green-soft); }
.role-pill { color: #087f92; background: #e8f9fb; }
.role-admin { color: #5365aa; background: #eff0ff; }
.active-yes { color: var(--green); background: var(--green-soft); }
.active-no { color: #7a8491; background: #eef1f4; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.row-action { display: inline-grid; place-items: center; width: 27px; height: 27px; border: 0; border-radius: 7px; color: #738094; background: transparent; font-size: 13px; }
.row-action:hover { color: #108b9b; background: #e8f9fb; }
.row-action.danger:hover { color: #b33c4a; background: #fff0f1; }
.empty-cell { padding: 36px 15px !important; color: #96a2b0 !important; text-align: center; }
.dashboard-tip { display: flex; align-items: center; gap: 11px; margin-top: 15px; padding: 14px 17px; border: 1px solid #dceff1; border-radius: 11px; background: #f2fbfc; }
.dashboard-tip > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: #087f92; background: #dff6f8; }
.dashboard-tip strong { display: block; color: #24515b; font-size: 10px; }
.dashboard-tip small { display: block; margin-top: 3px; color: #668a90; font-size: 9px; }
.section-intro { align-items: center; margin-bottom: 19px; }
.section-intro h2 { font-size: 24px; }
.filter-row { display: flex; gap: 10px; padding: 14px 15px; border-bottom: 1px solid #eef1f5; }
.search-box { display: flex; align-items: center; gap: 9px; width: min(460px, 100%); min-height: 37px; padding: 0 11px; border: 1px solid #e2e8ef; border-radius: 8px; color: #8c99a7; background: #fff; transition: border .18s, box-shadow .18s; }
.search-box > span { font-size: 19px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; color: #36465c; background: transparent; font-size: 10px; }
.search-box input::placeholder { color: #a6b0bc; }
.select-control { min-width: 145px; padding: 0 10px; border: 1px solid #e2e8ef; border-radius: 8px; outline: 0; color: #526175; background: #fff; font-size: 10px; }
.table-foot { display: flex; justify-content: space-between; padding: 10px 16px; border-top: 1px solid #eef1f5; color: #8e99a8; font-size: 9px; }
.user-limit-banner { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; padding: 13px 16px; border: 1px solid #dceff1; border-radius: 11px; background: #f5fcfd; }
.user-limit-banner > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #098798; background: #e2f7f9; font-size: 17px; }
.user-limit-banner strong { display: block; color: #284251; font-size: 11px; }
.user-limit-banner small { display: block; margin-top: 3px; color: #7d969d; font-size: 9px; }
.limit-progress { width: min(180px, 22vw); height: 5px; margin-left: auto; overflow: hidden; border-radius: 8px; background: #dcecef; }
.limit-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1ab7c6, #48d9d7); transition: width .25s; }
.page-footer { display: flex; justify-content: space-between; max-width: 1420px; margin: 24px auto 0; padding: 14px 1px 0; border-top: 1px solid #e7ecf1; color: #9aa5b1; font-size: 9px; }

/* Dialogs and forms */
.modal { width: min(calc(100vw - 28px), 570px); max-height: min(92vh, 920px); padding: 0; overflow: hidden; border: 1px solid #e3eaf0; border-radius: 16px; color: var(--ink); background: #fff; box-shadow: 0 28px 90px rgba(5,22,40,.28); }
.modal::backdrop { background: rgba(4,17,32,.62); backdrop-filter: blur(3px); }
.modal-large { width: min(calc(100vw - 28px), 900px); }
.modal-compact { width: min(calc(100vw - 28px), 500px); }
.modal-form { display: flex; flex-direction: column; max-height: inherit; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 21px 23px 16px; border-bottom: 1px solid #edf1f5; }
.modal-header .eyebrow { color: #0c8e9d; }
.modal-header h2 { margin: 5px 0; color: #18283d; font-size: 21px; letter-spacing: -.04em; }
.modal-header p { margin: 0; color: #8591a0; font-size: 10px; }
.close-dialog { width: 30px; height: 30px; flex: none; border-radius: 8px; color: #687789; background: #f3f6f8; font-size: 21px; }
.modal-body { overflow-y: auto; padding: 0 23px; }
.modal-body > .field { margin: 16px 0; }
.modal-body .field { color: #516075; font-size: 10px; }
.modal-body .field > b { color: #e0515e; }
.field input, .field select, .field textarea { min-height: 38px; padding: 9px 10px; border-color: #e2e8ee; border-radius: 8px; font-size: 11px; font-weight: 450; }
.field textarea { min-height: 75px; resize: vertical; }
.field small { color: #94a0ad; font-size: 9px; font-weight: 450; line-height: 1.45; }
.form-section { padding: 19px 0 20px; border-bottom: 1px solid #edf1f5; }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.form-section-title .section-index { display: grid; place-items: center; width: 29px; height: 29px; flex: none; border-radius: 9px; color: #0c8998; background: #e5f8fa; font-size: 9px; font-weight: 850; }
.form-section-title h3 { margin: 0; color: #29394d; font-size: 12px; }
.form-section-title small { display: block; margin-top: 3px; color: #9aa5b1; font-size: 9px; }
.form-section-actions { align-items: center; }
.form-section-actions > div { flex: 1; }
.limit-pill { margin-left: 4px; padding: 3px 6px; border-radius: 99px; color: #0c8391; background: #e7f8fa; font-size: 8px; vertical-align: 1px; }
.form-grid { display: grid; gap: 12px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: 1 / -1; }
.password-field { display: flex; }
.password-field input { border-radius: 8px 0 0 8px; }
.password-toggle { width: 39px; flex: none; border: 1px solid #e2e8ee; border-left: 0; border-radius: 0 8px 8px 0; color: #6c8092; background: #f8fafb; }
.inline-security { align-self: end; padding: 10px 0; color: #82919f; font-size: 9px; }
.inline-security span { margin-right: 4px; color: #0e9aaa; }
.checks-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.check-control { padding: 9px 10px; border: 1px solid #e8edf1; border-radius: 9px; background: #fbfcfd; }
.check-control label { display: block; margin-bottom: 7px; color: #5a687b; font-size: 9px; font-weight: 700; }
.check-control select, .device-row select { width: 100%; min-height: 29px; padding: 0 7px; border: 1px solid #e4e9ee; border-radius: 6px; outline: 0; color: #506077; background: white; font-size: 9px; }
.device-list { display: grid; gap: 7px; }
.device-list:empty::after { padding: 14px 12px; border: 1px dashed #dfe7ed; border-radius: 8px; color: #9aa5b1; background: #fbfcfd; content: "Nenhum ponto adicionado."; text-align: center; font-size: 9px; }
.device-row { display: grid; grid-template-columns: 34px 1.05fr 1.3fr .8fr 94px 30px; align-items: center; gap: 7px; padding: 7px; border: 1px solid #e9eef2; border-radius: 9px; background: #fcfdfd; }
.device-list[data-type="sensor"] .device-row { grid-template-columns: 34px 1.05fr 1.3fr 94px 30px; }
.device-number { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: #147e8c; background: #e6f8fa; font-size: 9px; font-weight: 800; }
.device-row input { min-width: 0; width: 100%; height: 29px; padding: 0 8px; border: 1px solid #e4e9ee; border-radius: 6px; outline: 0; color: #405068; background: white; font-size: 9px; }
.device-row input:focus, .device-row select:focus { border-color: #3ebdca; }
.device-row .device-model, .device-row .device-notes { display: none; }
.device-row .device-delete { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; color: #9ca7b3; background: transparent; font-size: 17px; }
.device-row .device-delete:hover { color: #b33c4a; background: #fff0f1; }
.device-list[data-type="camera"] .device-row { grid-template-columns: 34px 1fr 1fr 1fr 94px 30px; }
.device-list[data-type="camera"] .device-row .device-model { display: block; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 23px; border-top: 1px solid #edf1f5; background: #fbfcfd; }
.account-summary { display: flex; align-items: center; gap: 10px; margin: 16px 0 20px; padding: 12px; border: 1px solid #e8edf2; border-radius: 10px; background: #fbfcfd; }
.account-summary strong { display: block; color: #29394e; font-size: 11px; }
.account-summary small { display: block; margin-top: 4px; color: #8c98a6; font-size: 9px; }
.switch-field { display: flex; align-items: center; gap: 9px; margin: 8px 0; color: #5e6a7b; font-size: 10px; font-weight: 650; }
.switch-field input { position: absolute; opacity: 0; }
.switch-track { position: relative; width: 34px; height: 19px; border-radius: 99px; background: #cbd4dd; transition: background .15s; }
.switch-track::after { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.18); content: ""; transition: transform .15s; }
.switch-field input:checked + .switch-track { background: #1ab8c6; }
.switch-field input:checked + .switch-track::after { transform: translateX(15px); }
.form-note { margin: 14px 0 4px; padding: 10px 11px; border-radius: 8px; color: #748294; background: #f4f7f9; font-size: 9px; }
.toast-region { position: fixed; z-index: 40; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { min-width: 220px; max-width: min(380px, calc(100vw - 40px)); padding: 12px 15px; border: 1px solid #d8ece8; border-radius: 10px; color: #21634f; background: #f1fbf7; box-shadow: var(--shadow); font-size: 11px; animation: viewIn .18s ease-out; }
.toast.error { border-color: #f1d1d4; color: #9d3a47; background: #fff6f6; }
.sidebar-scrim { display: none; }
.print-host { display: none; }

@media (max-width: 1100px) {
    .main-content { padding-inline: 23px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .today-chip { display: none; }
}
@media (max-width: 780px) {
    .auth-layout { grid-template-columns: 1fr; }
    .auth-brand { min-height: 290px; padding: 34px 28px 55px; }
    .auth-brand > .brand-mark { width: 38px; height: 38px; margin-bottom: 19px; }
    .auth-brand h1 { font-size: 35px; }
    .auth-brand p { max-width: 490px; margin-top: 13px; font-size: 12px; }
    .auth-points { gap: 7px 13px; margin-top: 16px; font-size: 10px; }
    .auth-foot { bottom: 15px; font-size: 9px; }
    .auth-panel-wrap { padding: 34px 22px 45px; }
    .sidebar { z-index: 25; transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-scrim:not(.hidden) { position: fixed; z-index: 20; inset: 0; display: block; background: rgba(4,17,32,.44); }
    .main-content { margin-left: 0; padding-inline: 18px; }
    .topbar { min-height: 72px; }
    .mobile-menu-toggle { display: inline-grid; }
    .topbar .eyebrow { font-size: 7px; }
    .topbar h1 { font-size: 17px; }
    .topbar-actions .button { min-height: 36px; padding: 0 10px; font-size: 10px; }
    .welcome-row, .section-intro { align-items: flex-start; }
    .welcome-row h2, .section-intro h2 { font-size: 22px; }
    .welcome-row .button { display: none; }
    .stats-grid { gap: 9px; }
    .stat-card { min-height: 119px; padding: 13px; }
    .stat-card-top { font-size: 9px; }
    .stat-card strong { font-size: 26px; }
    .data-table th, .data-table td { padding-inline: 10px; }
    .modal-large { width: min(calc(100vw - 16px), 680px); max-height: 96vh; border-radius: 13px; }
    .modal-header { padding: 16px 15px 13px; }
    .modal-body { padding-inline: 15px; }
    .modal-footer { padding: 12px 15px; }
    .form-grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .field-span-3 { grid-column: 1 / -1; }
    .checks-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .device-row, .device-list[data-type="camera"] .device-row { grid-template-columns: 28px 1fr 1fr 80px 28px; }
    .device-row .device-model { display: none !important; }
    .filter-row { flex-wrap: wrap; }
    .search-box { flex: 1 1 100%; }
}
@media (max-width: 480px) {
    .main-content { padding-inline: 12px; }
    .topbar-leading { gap: 5px; }
    .topbar-actions { gap: 3px; }
    .button-plus { display: none; }
    .view-panel { padding-top: 20px; }
    .welcome-row { margin-bottom: 15px; }
    .welcome-row p, .section-intro p { max-width: 250px; font-size: 10px; line-height: 1.5; }
    .stat-card { min-height: 106px; padding: 10px; }
    .stat-symbol { width: 23px; height: 23px; }
    .stat-card-top { gap: 4px; font-size: 8px; }
    .stat-card small { font-size: 8px; }
    .card-heading { padding: 14px 13px 10px; }
    .data-table { min-width: 690px; }
    .page-footer { font-size: 8px; }
    .section-intro { gap: 7px; }
    .section-intro .button { min-height: 33px; padding: 0 8px; font-size: 9px; }
    .limit-progress { display: none; }
    .form-grid-3, .form-grid-2 { grid-template-columns: 1fr; }
    .field-span-2, .field-span-3 { grid-column: auto; }
    .checks-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .form-section-actions { flex-wrap: wrap; }
    .form-section-actions .button { margin-left: 39px; }
    .device-row, .device-list[data-type="camera"] .device-row, .device-list[data-type="sensor"] .device-row { grid-template-columns: 26px 1fr 1fr 27px; }
    .device-row select { grid-column: 2 / 4; }
    .device-row .device-delete { grid-column: 4; grid-row: 1; }
    .modal-footer .button { flex: 1; padding-inline: 9px; }
}

/* One-page A4 report */
@page { size: A4 portrait; margin: 5mm; }
@media print {
    html, body { width: 210mm; min-width: 0; height: 297mm; margin: 0 !important; padding: 0 !important; overflow: hidden !important; background: white !important; }
    body * { visibility: hidden !important; }
    #printHost, #printHost * { visibility: visible !important; }
    #printHost { position: fixed !important; inset: 0 !important; display: block !important; width: 200mm !important; height: 287mm !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; background: white !important; }
    .print-sheet { width: 200mm; height: 287mm; overflow: hidden; color: #142033; background: white; font-family: Arial, Helvetica, sans-serif; font-size: 7.1pt; line-height: 1.2; }
    .print-header { display: flex; align-items: center; justify-content: space-between; min-height: 16mm; padding: 0 0 3mm; border-bottom: 1.4pt solid #122d49; }
    .print-brand { display: flex; align-items: center; gap: 3mm; }
    .print-brand-mark { display: grid; place-items: center; width: 10mm; height: 10mm; border-radius: 2mm; color: white; background: #0d2947; font-size: 17pt; font-weight: 900; font-style: italic; }
    .print-brand-name { color: #0c2440; font-size: 12pt; font-weight: 900; letter-spacing: -.5pt; }
    .print-brand-name small { display: block; margin-top: 1mm; color: #3aa9b8; font-size: 6.1pt; letter-spacing: 1pt; }
    .print-title { text-align: right; }
    .print-title strong { display: block; color: #122d49; font-size: 12pt; letter-spacing: .2pt; }
    .print-title span { display: block; margin-top: 1mm; color: #627285; font-size: 7pt; }
    .print-ident { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 1.4mm 4mm; padding: 3mm 0 2.5mm; border-bottom: .5pt solid #dce3ea; }
    .print-field { min-width: 0; overflow: hidden; }
    .print-field.wide { grid-column: 1 / -1; }
    .print-field.half { grid-column: span 2; }
    .print-field label { display: block; margin-bottom: .6mm; color: #69798b; font-size: 5.8pt; font-weight: 700; text-transform: uppercase; letter-spacing: .25pt; }
    .print-field strong { display: block; min-height: 3mm; overflow: hidden; color: #162a40; font-size: 7.3pt; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
    .print-subhead { display: flex; align-items: center; justify-content: space-between; margin: 2.5mm 0 1.1mm; color: #122d49; font-size: 7.3pt; font-weight: 800; }
    .print-subhead span { color: #65778a; font-size: 5.8pt; font-weight: 500; }
    .print-mini-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.4mm 4mm; padding: 2mm 2.5mm; border: .5pt solid #dce3ea; border-radius: 1.3mm; background: #fbfcfd; }
    .print-checks { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.2mm; }
    .print-check { padding: 1.4mm 1.8mm; border: .5pt solid #dce3ea; border-radius: 1.2mm; }
    .print-check label { display: block; color: #66778b; font-size: 5.7pt; }
    .print-check strong { display: block; margin-top: .5mm; color: #18314b; font-size: 6.2pt; }
    .print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
    .print-table th { padding: 1.05mm 1.3mm; border: .4pt solid #cbd5df; color: #fff; background: #193956; text-align: left; font-size: 5.7pt; }
    .print-table td { height: 4.2mm; padding: .7mm 1.3mm; overflow: hidden; border: .4pt solid #d8e0e8; color: #29384b; font-size: 6.2pt; text-overflow: ellipsis; white-space: nowrap; }
    .print-table tr:nth-child(even) td { background: #f7f9fb; }
    .print-table .col-num { width: 8mm; text-align: center; }
    .print-table .col-status { width: 20mm; }
    .print-table .col-model { width: 36mm; }
    .print-status { font-weight: 750; }
    .print-status.ok { color: #0e7954; }
    .print-status.attention { color: #a05b0a; }
    .print-status.na { color: #68778a; }
    .print-observations { min-height: 12mm; max-height: 19mm; overflow: hidden; padding: 2mm 2.2mm; border: .5pt solid #dce3ea; border-radius: 1.3mm; color: #29384b; white-space: pre-wrap; overflow-wrap: anywhere; }
    .print-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 15mm; margin-top: 9mm; }
    .print-signature { padding-top: 1.5mm; border-top: .6pt solid #596b7f; color: #4f6074; text-align: center; font-size: 5.9pt; }
    .print-footer { display: flex; justify-content: space-between; margin-top: 3mm; padding-top: 1.5mm; border-top: .5pt solid #dce3ea; color: #788697; font-size: 5.4pt; }
}
