/* LUMA · Interface compartilhada de crudmac.php, crudled.php e crudpainel.php.
   Sem bibliotecas, fontes externas ou JavaScript. */

:root {
  color-scheme: dark;
  --bg: #111413;
  --sidebar: #0c100f;
  --surface: #191e1c;
  --surface-raised: #202622;
  --field: #121714;
  --line: #2a322d;
  --line-strong: #3b473e;
  --text: #edf1e9;
  --muted: #9ba79c;
  --soft: #879383;
  --accent: #d2f89a;
  --accent-ink: #203414;
  --red: #ff919c;
  --green: #a6e8b5;
  --blue: #9abaff;
  --radius: 20px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-field: 16px;
  --font-label: 14px;
  --font-support: 13px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
svg { display: block; flex-shrink: 0; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.svg-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 20; padding: 12px 20px; background: var(--accent); color: var(--accent-ink); border-radius: 10px; }
.skip-link:focus { top: 16px; }

/* Estrutura e navegação */
.app-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); padding: 32px 20px 22px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); }
.brand-mark .icon { width: 25px; height: 25px; stroke-width: 1.85; }
.brand-name { font-size: 24px; font-weight: 700; letter-spacing: -.9px; }
.brand-tag { margin: 15px 10px 44px; color: var(--soft); font-size: 10px; font-weight: 600; letter-spacing: 1.65px; }
.nav-label { padding: 0 12px; margin-bottom: 14px; font-size: 10px; color: var(--soft); font-weight: 600; letter-spacing: 1.8px; }
.nav-list { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 47px; border: 1px solid transparent; border-radius: 11px; padding: 11px 13px; font-size: 13px; font-weight: 500; color: var(--muted); transition: color .18s, background .18s, border-color .18s; }
.nav-link:hover { color: var(--text); background: #171e19; }
.nav-link[aria-current="page"] { color: var(--accent); border-color: #354b2c; background: #1e2c1d; }
.nav-link[aria-current="page"]::after { content: ""; width: 5px; height: 5px; margin-left: auto; border-radius: 50%; background: var(--accent); }
.sidebar-note { position: relative; margin-top: auto; padding: 22px 17px 21px; background: linear-gradient(145deg, #1b251b, #121813); border: 1px solid #2b3a28; border-radius: 15px; overflow: hidden; }
.note-pixels { display: flex; gap: 5px; margin-bottom: 22px; }
.note-pixels span { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.note-pixels span:nth-child(2) { opacity: .6; }
.note-pixels span:nth-child(3) { opacity: .25; }
.sidebar-note strong { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 550; letter-spacing: -.3px; }
.sidebar-note p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.profile { display: flex; align-items: center; gap: 11px; margin-top: 24px; padding: 0 7px; }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; background: #242d25; border: 1px solid #364036; border-radius: 10px; font-size: 13px; color: var(--accent); font-weight: 600; }
.profile strong { display: block; font-weight: 500; font-size: 12px; }
.profile small { color: var(--soft); font-size: 10px; }
.workspace { min-width: 0; padding: 0 42px 25px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 85px; border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--soft); }
.breadcrumb .icon { width: 14px; height: 14px; color: #546155; }
.breadcrumb strong { color: #c2ccc0; font-weight: 500; }
.workspace-tag { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.workspace-tag .icon { width: 15px; height: 15px; }

/* Cabeçalho e indicadores */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding: 40px 0 34px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 1.8px; font-weight: 600; color: var(--accent); text-transform: uppercase; }
.eyebrow-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
h1 { margin-top: 14px; font-size: clamp(34px, 3.5vw, 49px); font-weight: 550; line-height: 1.12; letter-spacing: -2px; }
h1 em { font-style: normal; color: var(--accent); }
.hero-description { max-width: 460px; margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.hero-art { position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 240px; height: 156px; border-radius: 24px; background-image: radial-gradient(circle, #354137 1px, transparent 1px); background-size: 13px 13px; mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
.circuit { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; padding: 23px; border: 1px solid #4a5745; border-radius: 18px; background: #172017; box-shadow: 0 0 50px #bddf8512, 0 20px 36px #0003; transform: rotate(-10deg); }
.circuit::before, .circuit::after { content: ""; position: absolute; left: -12px; right: -12px; height: 1px; background: #4a5745; z-index: -1; }
.circuit::before { top: 38%; }
.circuit::after { bottom: 38%; }
.diode { width: 21px; height: 21px; border: 1px solid #83a760; border-radius: 6px; background: #9dc379; box-shadow: 0 0 14px #b7e58644; }
.diode:nth-child(2), .diode:nth-child(7) { background: #4c6140; box-shadow: none; }
.diode:nth-child(3), .diode:nth-child(6) { background: #273725; box-shadow: none; }
.hero-art--rgb .diode:nth-child(1), .hero-art--rgb .diode:nth-child(4) { background: #e79794; border-color: #e79794; box-shadow: 0 0 14px #f0909030; }
.hero-art--rgb .diode:nth-child(2), .hero-art--rgb .diode:nth-child(5) { background: #9dc379; border-color: #9dc379; box-shadow: 0 0 14px #9dc37930; }
.hero-art--rgb .diode:nth-child(3), .hero-art--rgb .diode:nth-child(6) { background: #93a7d6; border-color: #93a7d6; box-shadow: 0 0 14px #93a7d630; }
.art-caption { position: absolute; bottom: 0; right: 26px; padding: 4px 10px; border: 1px solid #3b4c32; border-radius: 6px; background: #121a12; color: var(--accent); font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: 1.5px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
.metric { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: #171c18; }
.metric-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border: 1px solid #38452f; border-radius: 11px; background: #222e1d; color: var(--accent); }
.metric:nth-child(2) .metric-icon { border-color: #364443; background: #1e2b28; color: #a4d0c3; }
.metric:nth-child(3) .metric-icon { border-color: #403d4a; background: #27242f; color: #c1b2e4; }
.metric-label { color: var(--muted); font-size: 11px; }
.metric-value { display: flex; align-items: baseline; gap: 7px; margin-top: 2px; font-size: 23px; font-weight: 550; letter-spacing: -.7px; }
.metric-value small { color: var(--soft); font-size: 10px; font-weight: 400; letter-spacing: 0; }

/* Formulários */
.content-grid { display: grid; grid-template-columns: 312px minmax(0, 1fr); align-items: start; gap: 24px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.create-card { padding: 25px 24px 22px; }
.section-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--soft); font-size: 9px; letter-spacing: 1.45px; font-weight: 600; }
.section-kicker .icon { width: 14px; height: 14px; }
h2, h3 { font-size: 17px; font-weight: 550; letter-spacing: -.45px; }
.card-description { margin-top: 7px; color: var(--muted); font-size: var(--font-support); line-height: 1.8; }
.create-form { display: grid; gap: 20px; margin-top: 27px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > label, .field-label { display: flex; align-items: center; gap: 6px; color: #bcc7b9; font-size: var(--font-label); font-weight: 500; }
.field-hint { color: var(--soft); font-size: var(--font-support); }
input:not([type="checkbox"]):not([type="hidden"]), select, textarea { display: block; width: 100%; min-width: 0; height: 48px; padding: 0 12px; border: 1px solid #344034; border-radius: 9px; background: var(--field); color: var(--text); font-size: var(--font-field); transition: border-color .18s, box-shadow .18s, background .18s; }
input::placeholder, textarea::placeholder { color: #728072; opacity: 1; }
input:not([type="checkbox"]):not([type="hidden"]):hover { border-color: #53634d; }
input:not([type="checkbox"]):not([type="hidden"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #171e16; box-shadow: 0 0 0 3px #d2f89a16; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="datetime-local"] { font-size: var(--font-field); padding: 0 10px; }
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }
.pin-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pin-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--red); }
.pin-dot--g { background: var(--green); }
.pin-dot--b { background: var(--blue); }
.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #161b17; cursor: pointer; }
.toggle-copy strong { display: block; font-size: var(--font-label); font-weight: 500; }
.toggle-copy small { display: block; margin-top: 3px; color: var(--soft); font-size: var(--font-support); }
.switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
input[type="checkbox"] { position: relative; appearance: none; width: 34px; height: 20px; margin: 0; border: 1px solid #455443; border-radius: 30px; background: #2c362c; cursor: pointer; transition: background .2s, border-color .2s; }
input[type="checkbox"]::after { content: ""; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; border-radius: 50%; background: #b9c1b3; transition: transform .2s, background .2s; }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: translateX(14px); background: #293c1d; }
.btn-primary, .create-card button[type="submit"] { display: inline-flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 650; transition: transform .18s, box-shadow .18s, background .18s; }
.btn-primary:hover, .create-card button[type="submit"]:hover { background: #e1ffb6; box-shadow: 0 5px 20px #d2f89a16; transform: translateY(-1px); }
.btn-primary:active, .create-card button[type="submit"]:active { transform: translateY(0); }
.btn-primary .icon { width: 16px; height: 16px; }
.form-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 19px; color: var(--soft); font-size: var(--font-support); line-height: 1.7; }
.form-note .icon { width: 13px; height: 13px; margin-top: 2px; }

/* Lista editável */
.list-card { min-width: 0; }
.records-list { max-height: min(520px, 55dvh); overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.list-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 24px 23px; }
.list-title { display: flex; align-items: center; gap: 10px; }
.count-badge { display: grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border: 1px solid #3e4b37; border-radius: 6px; background: #27321f; color: var(--accent); font-size: 10px; font-weight: 600; }
.list-header .icon { width: 17px; height: 17px; color: var(--soft); }
.list-subtitle { margin-top: 6px; color: var(--muted); font-size: var(--font-support); }
.list-columns { display: grid; grid-template-columns: minmax(126px, 1fr) 228px 82px; align-items: center; gap: 16px; padding: 12px 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #151a16; color: var(--soft); font-size: 12px; letter-spacing: .7px; font-weight: 600; }
.list-columns > :last-child { text-align: right; }
.record { padding: 19px 22px; transition: background .18s; }
.record + .record { border-top: 1px solid var(--line); }
.record:hover { background: #1d241e; }
.record-form { display: grid; grid-template-columns: minmax(126px, 1fr) 228px 82px; align-items: center; gap: 16px; }
.record-name { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.record-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #394435; border-radius: 9px; background: #263020; color: #b6cd98; }
.record-icon .icon { width: 16px; height: 16px; }
.record-identity { display: grid; gap: 4px; min-width: 0; }
.record-identity input { height: 40px !important; padding: 0 7px !important; margin-left: -8px; width: calc(100% + 8px) !important; border-color: transparent !important; background: transparent !important; font-size: var(--font-field); font-weight: 500; }
.record-identity input:hover { border-color: var(--line-strong) !important; background: var(--field) !important; }
.record-identity input:focus { border-color: var(--accent) !important; background: var(--field) !important; }
.record-id { color: var(--soft); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.record-pins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.record-pins .field { gap: 5px; }
.record-pins label { font-size: var(--font-label); color: var(--muted); }
.record-pins input { height: 42px !important; padding: 0 8px !important; font-size: var(--font-field); }
.record-actions { display: flex; justify-content: flex-end; gap: 7px; }
.btn-icon { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #435038; border-radius: 8px; background: #293721; color: var(--accent); transition: background .18s, border-color .18s, transform .18s; }
.btn-icon .icon { width: 15px; height: 15px; }
.btn-icon:hover { border-color: var(--accent); background: #3b4b2c; transform: translateY(-1px); }
.btn-delete { background: transparent; border-color: var(--line); color: #a2a99d; }
.btn-delete:hover { color: #ffb0b7; border-color: #795157; background: #39262a; }
.record-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding-right: 4px; }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); font-size: var(--font-label); }
.status-label::before { content: ""; width: 5px; height: 5px; background: #758071; border-radius: 50%; }
.record-toggle:has(input:checked) .status-label { color: #b4d898; }
.record-toggle:has(input:checked) .status-label::before { background: var(--accent); }
.status-off { display: inline; }
.status-on { display: none; }
.record-toggle:has(input:checked) .status-off { display: none; }
.record-toggle:has(input:checked) .status-on { display: inline; }
.record-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.record-dates label { font-size: var(--font-label); color: var(--muted); }
.record-dates .field { gap: 5px; }
.record-dates input { height: 44px; font-size: var(--font-field); padding: 0 10px; }
.module-painel .list-columns, .module-painel .record-form { grid-template-columns: minmax(0, 1fr) 82px; gap: 16px; }
.module-painel .list-columns > :nth-child(2) { display: none; }
.module-painel .record-dates { grid-column: 1 / -1; }
.module-painel .record-actions { grid-column: 2; grid-row: 1; }
.list-footer { display: flex; align-items: center; gap: 7px; padding: 14px 22px; border-top: 1px solid var(--line); color: var(--soft); font-size: var(--font-support); background: #171c18; }
.list-footer .icon { width: 13px; height: 13px; }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 58px 24px; text-align: center; }
.empty-state > .icon { width: 32px; height: 32px; margin-bottom: 4px; color: #829775; }
.empty-state strong { font-weight: 500; font-size: 13px; }
.empty-state p { max-width: 280px; color: var(--muted); font-size: 12px; }
.notice { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; padding: 13px 17px; border: 1px solid #485d36; border-radius: 10px; background: #23331d; color: var(--accent); font-size: 12px; }
.notice--error { color: #ffb0b7; background: #39262a; border-color: #795157; }
.notice .icon { width: 16px; height: 16px; }
.workspace-footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 30px; margin-top: 28px; color: #7b897b; font-size: 10px; }
.workspace-footer span:last-child { display: flex; align-items: center; gap: 6px; }
.workspace-footer .icon { width: 12px; height: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Compatibilidade: também estiliza as classes presentes nos PHPs originais. */
body:not(:has(.app-shell)) { display: grid; grid-template-columns: 320px minmax(0, 700px); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "titulo titulo" "cadastro lista"; justify-content: center; align-content: stretch; gap: 24px; height: 100vh; height: 100dvh; overflow: hidden; padding: 64px 32px; }
body:not(:has(.app-shell))::before { content: "LUMA / Controle de iluminação"; grid-area: titulo; padding-bottom: 22px; margin-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--accent); font-size: 26px; font-weight: 600; letter-spacing: -.8px; }
/* Mensagens do PHP têm uma linha própria e não alteram a posição dos painéis. */
body:not(:has(.app-shell)) > .container { grid-area: cadastro; }
body:not(:has(.app-shell)) > .containerlista { grid-area: lista; }
body:not(:has(.app-shell)):has(> p) { grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "titulo titulo" "aviso aviso" "cadastro lista"; }
body:not(:has(.app-shell)) > p { grid-area: aviso; margin: 0; padding: 10px 14px; border: 1px solid #795157; border-radius: 10px; color: #ffb0b7; background: #39262a; font-size: var(--font-label); }
.container, .containerlista { min-width: 0; padding: 26px; align-self: start; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.containerlista { min-height: 0; height: 100%; max-height: 100%; align-self: stretch; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.container::before { content: "Novo cadastro"; display: block; margin-bottom: 24px; font-size: 19px; font-weight: 550; letter-spacing: -.5px; }
.container form > label { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: var(--font-label); }
.container form > br { display: none; }
.container form > input:not([type="checkbox"]) { margin-bottom: 20px; }
.container form > input[type="checkbox"] { vertical-align: middle; margin: 0 8px 22px 0; }
.container button { width: 100%; margin-top: 4px; padding: 12px 18px; border: 0; border-radius: 10px; color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.containerlista h3 { position: sticky; top: 0; z-index: 1; margin-bottom: 22px; font-size: 21px; background: var(--surface); }
.containerlista table { width: 100%; border: 0; border-collapse: collapse; }
.containerlista td { padding: 19px 0; border: 0; border-bottom: 1px solid var(--line); }
.containerlista tr:last-child td { border-bottom: 0; }
.containerlista input { margin: 6px 0 12px; }
.containerlista input[type="number"] { min-width: 82px; }
.containerlista label { color: var(--muted); font-size: var(--font-label); }
.containerlista button { padding: 10px 14px; margin-right: 10px; border: 1px solid #435038; border-radius: 8px; color: var(--accent); background: #293721; font-size: var(--font-label); }
.containerlista a[href*="delete="] { display: inline-block; padding: 10px 14px; border: 1px solid #69484d; border-radius: 8px; color: #ffb0b7; background: #39262a; font-size: var(--font-label); }

/* A rolagem pertence à lista; a página e o cadastro permanecem no lugar. */
.containerlista, .records-list { scrollbar-width: thin; scrollbar-color: #60734e var(--field); }
.containerlista::-webkit-scrollbar, .records-list::-webkit-scrollbar { width: 9px; }
.containerlista::-webkit-scrollbar-track, .records-list::-webkit-scrollbar-track { background: var(--field); border-radius: 10px; }
.containerlista::-webkit-scrollbar-thumb, .records-list::-webkit-scrollbar-thumb { background: #60734e; border: 2px solid var(--field); border-radius: 10px; }
.containerlista::-webkit-scrollbar-thumb:hover, .records-list::-webkit-scrollbar-thumb:hover { background: #8caa6c; }

/* Telas menores */
@media (min-width: 1600px) { .workspace { padding-right: max(42px, calc((100vw - 1420px) / 2)); padding-left: max(42px, calc((100vw - 1420px) / 2)); } }
@media (max-width: 1240px) {
  .app-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .workspace { padding-right: 28px; padding-left: 28px; }
  .content-grid { grid-template-columns: 270px minmax(0, 1fr); gap: 18px; }
  .create-card { padding: 23px 20px; }
  .record-form, .list-columns { grid-template-columns: minmax(104px, 1fr) 228px 73px; gap: 10px; }
  .record, .list-columns { padding-right: 18px; padding-left: 18px; }
  .module-painel .record-form, .module-painel .list-columns { grid-template-columns: minmax(0, 1fr) 78px; }
  .module-painel .list-columns > :nth-child(2) { display: none; }
  .module-painel .record-name { grid-column: 1; }
  .module-painel .record-actions { grid-column: 2; grid-row: 1; }
  .module-painel .record-dates { grid-column: 1 / -1; }
}
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 178px minmax(0, 1fr); }
  .brand-tag { font-size: 8px; letter-spacing: 1px; }
  .nav-link { padding: 11px 10px; font-size: 12px; gap: 9px; }
  .workspace { padding-right: 25px; padding-left: 25px; }
  .content-grid { grid-template-columns: 1fr; gap: 20px; }
  .create-card { padding: 24px; }
  .create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .create-form .btn-primary { align-self: end; }
  .module-led .create-form .btn-primary { grid-column: 1 / -1; }
  .module-mac .create-form .toggle-field { min-height: 69px; }
  .module-painel .create-form > .field:first-child { grid-column: 1 / -1; }
  .module-painel .create-form .btn-primary { grid-column: 1 / -1; }
  .hero-art { width: 170px; }
  .metric { padding: 15px 14px; gap: 10px; }
  .metric-icon { width: 32px; height: 32px; }
  .metric-icon .icon { width: 17px; height: 17px; }
  .metric-value small { display: none; }
  .metric-label { font-size: 10px; }
  .record-form, .list-columns { grid-template-columns: minmax(130px, 1fr) 228px 82px; gap: 12px; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 20px 22px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand-name { font-size: 21px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
  .brand-mark .icon { width: 22px; height: 22px; }
  .brand-tag, .nav-label, .sidebar-note, .profile { display: none; }
  .nav-list { display: flex; gap: 8px; margin-top: 18px; }
  .nav-link { flex: 1; justify-content: center; min-height: 40px; padding: 9px 10px; font-size: 11px; white-space: nowrap; }
  .nav-link .icon { width: 16px; height: 16px; }
  .nav-link[aria-current="page"]::after { display: none; }
  .workspace { padding: 0 22px 25px; }
  .topbar { height: 61px; }
  .hero { padding: 30px 0 27px; gap: 10px; }
  h1 { font-size: 36px; letter-spacing: -1.6px; }
  .hero-art { width: 128px; height: 136px; }
  .circuit { gap: 10px; padding: 15px; }
  .diode { width: 17px; height: 17px; border-radius: 5px; }
  .art-caption { right: 9px; font-size: 8px; }
  .hero-description { font-size: 12px; }
  .metrics { gap: 9px; margin-bottom: 22px; }
  .metric { display: block; padding: 14px; }
  .metric-icon { width: 28px; height: 28px; margin-bottom: 12px; border-radius: 8px; }
  .metric-value { margin-top: 4px; font-size: 23px; }
  .record-form, .list-columns { grid-template-columns: minmax(110px, 1fr) 228px 76px; gap: 10px; }
  .module-painel .record-form, .module-painel .list-columns { grid-template-columns: minmax(0, 1fr) 78px; }
  .module-painel .list-columns > :nth-child(2) { display: none; }
  .module-painel .record-dates { grid-column: 1 / -1; }
  .module-painel .record-actions { grid-column: 2; }
  .workspace-tag { font-size: 10px; }
  body:not(:has(.app-shell)) { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "titulo" "cadastro" "lista"; gap: 16px; padding: 24px 18px; }
  body:not(:has(.app-shell)):has(> p) { grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-areas: "titulo" "aviso" "cadastro" "lista"; }
}
@media (max-width: 510px) {
  .sidebar { padding: 18px 16px 14px; }
  .workspace { padding-right: 16px; padding-left: 16px; }
  .nav-list { gap: 6px; }
  .nav-link { gap: 6px; padding: 8px; font-size: 10px; }
  .hero-art { display: none; }
  h1 { font-size: 37px; }
  .hero-description { max-width: 320px; }
  .eyebrow { font-size: 9px; letter-spacing: 1.2px; }
  .metric { padding: 12px 10px; }
  .metric-label { font-size: 9px; }
  .metric-value { font-size: 22px; }
  .create-card { padding: 22px 20px; }
  .create-form { grid-template-columns: 1fr; gap: 19px; margin-top: 23px; }
  .list-header { padding: 21px 19px; }
  .list-title { gap: 8px; }
  h2, h3 { font-size: 16px; }
  .list-columns { display: none !important; }
  .record { padding: 17px 19px; border-top: 1px solid var(--line); }
  .record + .record { border-top: 1px solid var(--line); }
  .record-form, .module-painel .record-form { grid-template-columns: minmax(0, 1fr) 76px; gap: 16px 10px; }
  .record-name { grid-column: 1; }
  .record-actions, .module-painel .record-actions { grid-column: 2; grid-row: 1; }
  .record-pins, .record-dates, .module-painel .record-dates { grid-column: 1 / -1; }
  .record-pins { gap: 12px; }
  .record-pins input { height: 44px !important; }
  .module-mac .record-toggle { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; }
  .record-dates { grid-template-columns: 1fr; gap: 12px; }
  .record-dates input { height: 48px; font-size: var(--font-field); }
  .workspace-footer { flex-direction: column; gap: 7px; margin-top: 8px; }
  .workspace-tag { display: none; }
}
@media (max-width: 760px), (max-height: 800px) {
  body:not(:has(.app-shell)) { gap: 16px; padding: 24px 18px; }
  body:not(:has(.app-shell))::before { font-size: 22px; margin-bottom: 0; padding-bottom: 12px; }
  .container, .containerlista { padding: 18px; }
  .container::before { margin-bottom: 14px; }
  .container form { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; gap: 8px; }
  .container form > label { margin-bottom: 0; }
  .container form > input:not([type="checkbox"]) { height: 44px; margin-bottom: 0; }
  .container form > button { grid-column: 1 / -1; min-height: 44px; }
  .container form > input[type="checkbox"] { grid-column: 2; grid-row: 3; margin: 0; }
  .container form > input[type="checkbox"] + label { grid-column: 1; grid-row: 3; }
  .container form > label:has(+ input[type="datetime-local"]), .container form > input[type="datetime-local"] { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --text: #111; --muted: #444; --soft: #555; --line: #ccc; --accent: #35521b; }
  .app-shell { display: block; }
  .sidebar, .topbar, .hero-art, .create-card, .record-actions, .workspace-footer { display: none; }
  .workspace { padding: 0; }
  .hero { padding: 0 0 24px; }
  .content-grid { display: block; }
  .card, .metric, .record { break-inside: avoid; background: white; }
  input:not([type="checkbox"]):not([type="hidden"]) { color: #111; background: white; border-color: #ccc; }
  .record-form { display: flex; flex-wrap: wrap; }
  body:not(:has(.app-shell)) { display: block; height: auto; overflow: visible; padding: 0; }
  .containerlista, .records-list { height: auto; max-height: none; overflow: visible; }
  .containerlista h3 { position: static; }
}
