:root {
  color-scheme: dark;
  --ink: #17130f;
  --ink-2: #211b15;
  --ink-3: #2b231b;
  --line: #443728;
  --line-soft: #32291f;
  --cream: #eee3cf;
  --muted: #a99d8b;
  --gold: #c89435;
  --gold-bright: #e0ad4c;
  --green: #61b985;
  --red: #db705f;
  --blue: #6aa7c9;
  --shadow: 0 20px 60px rgb(0 0 0 / 26%);
  --radius: 18px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 85% 8%, rgb(200 148 53 / 8%), transparent 32rem),
    var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* Public site */
.public-site { overflow: hidden; background: var(--ink); }
.public-header { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 clamp(22px, 5vw, 74px); border-bottom: 1px solid rgb(200 148 53 / 20%); background: rgb(23 19 15 / 92%); backdrop-filter: blur(18px); }
.public-brand { color: var(--cream); text-decoration: none; }
.public-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 42px); }
.public-nav a, .public-login-link { color: var(--muted); font-family: var(--mono); font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-decoration: none; transition: color .2s ease; }
.public-nav a:hover, .public-login-link:hover { color: var(--gold-bright); }
.public-login-link { padding: 12px 16px; border: 1px solid var(--line); color: var(--cream); }
.public-login-link span { margin-left: 10px; color: var(--gold-bright); }
.public-hero { position: relative; display: grid; min-height: calc(100vh - 76px); grid-template-columns: minmax(0, 1.03fr) minmax(360px, .97fr); align-items: center; padding: clamp(64px, 9vw, 132px) clamp(24px, 7vw, 110px); background: radial-gradient(circle at 80% 45%, rgb(200 148 53 / 12%), transparent 28rem), repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), rgb(255 255 255 / 2%) calc(25% - 1px) 25%); }
.public-hero::before { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, rgb(23 19 15 / 30%), transparent 55%); content: ""; }
.public-hero-copy { position: relative; z-index: 2; max-width: 820px; }
.public-hero h1 { margin: 0; font-size: clamp(3.7rem, 7vw, 7.8rem); font-weight: 620; letter-spacing: -.07em; line-height: .88; }
.public-hero h1 em { color: var(--gold-bright); font-style: normal; }
.hero-lead { max-width: 650px; margin: 32px 0 0; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero-actions a { min-height: 52px; align-items: center; justify-content: center; text-decoration: none; }
.hero-actions .secondary-button { display: inline-flex; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 0; margin-top: 70px; }
.hero-proof span { display: grid; gap: 5px; min-width: 150px; padding: 0 28px; border-left: 1px solid var(--line); }
.hero-proof span:first-child { padding-left: 0; border-left: 0; }
.hero-proof b { color: var(--cream); font-family: var(--mono); font-size: 1.05rem; }
.hero-proof small { color: var(--muted); font-family: var(--mono); font-size: .55rem; letter-spacing: .12em; }
.controller-visual { position: relative; display: grid; min-height: 520px; place-items: center; perspective: 1200px; }
.controller-panel { position: relative; z-index: 2; width: min(420px, 82%); padding: 30px; border: 1px solid #58462f; border-radius: 24px; background: linear-gradient(145deg, #30271e, #17130f 68%); box-shadow: -30px 40px 80px rgb(0 0 0 / 48%), inset 0 1px rgb(255 255 255 / 6%); transform: rotateY(-10deg) rotateX(4deg); }
.controller-panel::before { position: absolute; inset: 12px; border: 1px solid rgb(200 148 53 / 14%); border-radius: 15px; pointer-events: none; content: ""; }
.controller-label { display: flex; justify-content: space-between; margin-bottom: 28px; color: var(--gold-bright); font-family: var(--mono); font-size: .65rem; letter-spacing: .12em; }
.controller-label small { color: var(--muted); font-size: .46rem; }
.controller-screen { display: grid; min-height: 230px; align-content: center; padding: 26px; border: 1px solid #3e674f; border-radius: 10px; background: radial-gradient(circle at 50% 30%, rgb(97 185 133 / 12%), transparent 65%), #0c1510; box-shadow: inset 0 0 35px rgb(0 0 0 / 70%); text-align: center; }
.controller-screen small, .controller-screen span { color: #78d49d; font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; }
.controller-screen strong { margin: 12px 0; color: #a3e3bc; font-family: var(--mono); font-size: clamp(4rem, 7vw, 6rem); font-weight: 500; letter-spacing: -.08em; text-shadow: 0 0 18px rgb(97 185 133 / 30%); }
.controller-screen sup { font-size: .3em; letter-spacing: 0; }
.controller-screen i, .controller-status i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.controller-status { display: flex; justify-content: space-between; margin-top: 24px; color: var(--muted); font-family: var(--mono); font-size: .5rem; letter-spacing: .1em; }
.controller-status i.cool { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.visual-orbit { position: absolute; border: 1px solid rgb(200 148 53 / 15%); border-radius: 50%; }
.orbit-one { width: 510px; height: 510px; }
.orbit-two { width: 650px; height: 650px; border-style: dashed; opacity: .5; }
.public-section { padding: clamp(76px, 10vw, 150px) clamp(24px, 7vw, 110px); border-top: 1px solid var(--line-soft); scroll-margin-top: 74px; }
.section-kicker { display: flex; align-items: center; gap: 14px; margin-bottom: 38px; }
.section-kicker > span { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-family: var(--mono); font-size: .55rem; }
.section-kicker .eyebrow { margin: 0; }
.project-section { background: var(--ink-2); }
.project-heading { display: grid; grid-template-columns: 1.15fr .85fr; align-items: end; gap: clamp(30px, 7vw, 120px); }
.project-heading h2, .commerce-heading h2, .faq-layout > h2 { margin: 0; font-size: clamp(2.7rem, 5vw, 5.3rem); font-weight: 600; letter-spacing: -.055em; line-height: .98; }
.project-heading > p, .commerce-heading p { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 76px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.feature-grid article { min-height: 290px; padding: 30px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature-number { color: var(--gold); font-family: var(--mono); font-size: .65rem; }
.feature-grid h3 { margin: 70px 0 14px; font-size: 1.25rem; }
.feature-grid p, .product-card p, .plan-card > p { color: var(--muted); line-height: 1.65; }
.commerce-section { background: #15110e; }
.commerce-heading { display: flex; justify-content: space-between; }
.commerce-heading p { max-width: 760px; margin-top: 18px; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 60px; }
.product-card { position: relative; display: flex; min-height: 650px; flex-direction: column; padding: clamp(26px, 3vw, 42px); border: 1px solid var(--line); border-radius: 3px; background: linear-gradient(160deg, rgb(255 255 255 / 2%), transparent 45%), var(--ink-2); }
.product-card.featured { border-color: var(--gold); box-shadow: 0 26px 80px rgb(0 0 0 / 25%); }
.popular-ribbon, .plan-badge { position: absolute; top: 0; right: 0; padding: 8px 13px; color: var(--ink); background: var(--gold-bright); font-family: var(--mono); font-size: .52rem; font-weight: 800; letter-spacing: .1em; }
.product-tag { align-self: flex-start; margin-bottom: 60px; padding: 7px 9px; border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .52rem; letter-spacing: .12em; }
.product-card h3 { margin: 0; font-size: clamp(1.8rem, 2.6vw, 2.8rem); letter-spacing: -.04em; }
.product-description { min-height: 80px; }
.product-card ul, .plan-card ul { display: grid; gap: 11px; margin: 25px 0; padding: 24px 0 0; border-top: 1px solid var(--line-soft); list-style: none; }
.product-card li, .plan-card li { position: relative; padding-left: 18px; color: #c4b8a6; font-size: .88rem; }
.product-card li::before, .plan-card li::before { position: absolute; left: 0; color: var(--gold); content: "+"; }
.price { display: grid; gap: 5px; margin-top: auto; padding-top: 28px; }
.price small, .annual-note { color: var(--muted); font-family: var(--mono); font-size: .55rem; letter-spacing: .1em; }
.price strong { font-family: var(--mono); font-size: 3.4rem; font-weight: 500; letter-spacing: -.07em; }
.price sup, .plan-price sup { margin-right: 5px; color: var(--gold); font-size: .32em; letter-spacing: 0; vertical-align: super; }
.product-buy-button { width: 100%; min-height: 52px; justify-content: space-between; margin-top: 24px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.plans-section { background: var(--cream); color: var(--ink); }
.plans-section .eyebrow { color: #9b6c1e; }
.plans-section .section-kicker > span { border-color: #cbbfae; color: #756a5c; }
.plans-section .project-heading > p { color: #6f6558; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 64px; border: 1px solid #c8baa7; }
.plan-card { position: relative; display: flex; min-height: 550px; flex-direction: column; padding: clamp(28px, 4vw, 50px); border-right: 1px solid #c8baa7; }
.plan-card:last-child { border-right: 0; }
.plan-card.pro { color: var(--cream); background: var(--ink-2); }
.plan-card.pro > p { color: var(--muted); }
.plan-price { display: flex; min-height: 88px; align-items: flex-end; gap: 8px; margin: 25px 0 10px; }
.plan-price strong { font-family: var(--mono); font-size: clamp(2.4rem, 4vw, 4.2rem); font-weight: 500; letter-spacing: -.08em; }
.plan-price small { margin-bottom: 11px; color: #766a5d; font-family: var(--mono); font-size: .58rem; }
.plan-card ul { border-color: #d4c8b7; }
.plan-card li { color: #564e44; }
.plan-card.pro li { color: #c4b8a6; }
.plan-button { min-height: 50px; margin-top: auto; border: 1px solid #9d8f7d; color: inherit; background: transparent; font-family: var(--mono); font-size: .64rem; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.plan-card.pro .plan-button { border-color: var(--gold); color: var(--gold-bright); }
.annual-note { display: block; min-height: 30px; margin-top: 14px; line-height: 1.5; }
.faq-section { background: var(--ink-2); }
.faq-layout { display: grid; grid-template-columns: .7fr 1.3fr; gap: clamp(40px, 9vw, 150px); }
.faq-list { border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { position: relative; padding: 28px 50px 28px 0; font-size: 1.1rem; cursor: pointer; list-style: none; }
.faq-list summary::after { position: absolute; right: 8px; color: var(--gold); content: "+"; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { margin: 0; padding: 0 50px 28px 0; color: var(--muted); line-height: 1.7; }
.access-section { min-height: 820px; border-top: 1px solid var(--line); scroll-margin-top: 74px; }
.public-footer { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 38px clamp(24px, 7vw, 110px); border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .56rem; letter-spacing: .1em; }
.preview-environment-notice { display: grid; gap: 6px; margin: 18px 0; padding: 14px 16px; border: 1px solid rgb(200 148 53 / 35%); border-radius: 8px; color: var(--muted); background: rgb(200 148 53 / 8%); font-size: .76rem; line-height: 1.45; }
.preview-environment-notice b { color: var(--gold-bright); font-family: var(--mono); font-size: .58rem; letter-spacing: .11em; }
.preview-environment-notice a { color: var(--cream); }
.login-card :disabled { cursor: not-allowed; opacity: .48; }

@media (max-width: 1050px) {
  .public-nav { display: none; }
  .public-hero { grid-template-columns: 1fr; }
  .controller-visual { min-height: 480px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: 1fr; }
  .product-card { min-height: auto; }
  .product-tag { margin-bottom: 35px; }
}

@media (max-width: 760px) {
  .public-header { min-height: 68px; padding-inline: 16px; }
  .public-header .brand small { display: none; }
  .public-login-link { padding: 10px 11px; font-size: .58rem; }
  .public-hero { min-height: auto; padding-top: 76px; }
  .public-hero h1 { font-size: clamp(3.1rem, 16vw, 5rem); }
  .hero-proof { gap: 25px 0; margin-top: 50px; }
  .hero-proof span { min-width: 50%; padding-inline: 18px; }
  .hero-proof span:nth-child(3) { padding-left: 0; border-left: 0; }
  .controller-visual { min-height: 390px; }
  .controller-panel { width: 94%; padding: 22px; transform: none; }
  .controller-screen { min-height: 190px; }
  .orbit-one { width: 360px; height: 360px; }
  .orbit-two { display: none; }
  .project-heading, .faq-layout { grid-template-columns: 1fr; }
  .feature-grid, .plan-grid { grid-template-columns: 1fr; }
  .plan-card { min-height: 510px; border-right: 0; border-bottom: 1px solid #c8baa7; }
  .plan-card:last-child { border-bottom: 0; }
  .public-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-grid article { min-height: 230px; }
  .feature-grid h3 { margin-top: 45px; }
  .hero-actions > * { width: 100%; }
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand b {
  font-family: var(--mono);
  font-size: 0.98rem;
  letter-spacing: 0.12em;
}

.brand small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--ink), inset 0 0 0 6px var(--gold);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  width: 42px;
  height: 7px;
  border-right: 4px solid var(--gold);
  border-left: 4px solid var(--gold);
  content: "";
}

.brand-mark::after {
  transform: rotate(90deg);
}

.brand-mark i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

/* Login */
.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(430px, 0.85fr);
}

.login-story {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 6vw, 82px);
  border-right: 1px solid var(--line);
  background:
    linear-gradient(125deg, rgb(23 19 15 / 96%), rgb(27 22 17 / 83%)),
    repeating-linear-gradient(135deg, transparent 0 32px, rgb(200 148 53 / 4%) 32px 33px),
    var(--ink-2);
}

.login-story::after {
  position: absolute;
  right: -180px;
  bottom: -190px;
  width: 540px;
  height: 540px;
  border: 1px solid rgb(200 148 53 / 24%);
  border-radius: 50%;
  box-shadow:
    0 0 0 45px rgb(200 148 53 / 3%),
    0 0 0 110px rgb(200 148 53 / 2%);
  content: "";
}

.brand-large .brand-mark {
  width: 46px;
  height: 46px;
}

.brand-large .brand-mark::before,
.brand-large .brand-mark::after {
  width: 54px;
}

.brand-large b {
  font-size: 1.25rem;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(3.5rem, 7vw, 7.4rem);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 0.9;
}

.login-copy > p:last-child {
  max-width: 570px;
  margin: 32px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.7;
}

.signal-lines {
  position: absolute;
  top: 50%;
  right: clamp(30px, 7vw, 100px);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  opacity: 0.42;
  transform: translateY(-50%);
}

.signal-lines span {
  width: 5px;
  border-radius: 2px;
  background: var(--gold);
}

.signal-lines span:nth-child(1) { height: 18px; }
.signal-lines span:nth-child(2) { height: 33px; }
.signal-lines span:nth-child(3) { height: 52px; }
.signal-lines span:nth-child(4) { height: 75px; }

.build-note {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #766b5d;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
}

.login-panel {
  display: grid;
  padding: clamp(24px, 6vw, 90px);
  place-items: center;
  background: #130f0c;
}

.login-card {
  width: min(100%, 440px);
}

.signup-card {
  width: min(100%, 560px);
}

.signup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.signup-grid label {
  margin-bottom: 0;
}

.mobile-brand {
  display: none;
  margin-bottom: 60px;
}

.login-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.045em;
}

.form-intro {
  margin: 12px 0 42px;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin: 20px 0 9px;
  color: #c8bcaa;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.login-card input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--cream);
  background: #1b1611;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-card input:hover,
.login-card input:focus {
  border-color: #8b6933;
  box-shadow: 0 0 0 3px rgb(200 148 53 / 9%);
}

.login-card input::placeholder {
  color: #6f6558;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 54px;
}

.password-field button {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  margin-top: 30px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.button-primary {
  color: #17110a;
  background: var(--gold);
}

.button-primary:hover {
  background: var(--gold-bright);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.form-error {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgb(219 112 95 / 45%);
  border-radius: 8px;
  color: #ef9a8d;
  background: rgb(219 112 95 / 8%);
  font-size: 0.85rem;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  color: #71675b;
  font-size: 0.72rem;
  text-align: center;
}

.security-note span {
  color: var(--gold);
  font-size: 0.55rem;
}

.sales-callout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.sales-callout button {
  padding: 0;
  border: 0;
  color: var(--gold-bright);
  background: transparent;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.sales-callout button:hover,
.sales-callout button:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.contact-dialog {
  width: min(calc(100% - 32px), 560px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid #4b3924;
  border-radius: 18px;
  color: var(--cream);
  background: #17120e;
  box-shadow: 0 28px 90px rgb(0 0 0 / 62%);
}

.contact-dialog::backdrop {
  background: rgb(5 4 3 / 78%);
  backdrop-filter: blur(5px);
}

.claim-login-hint {
  display: grid;
  gap: 4px;
  margin: 0 0 18px;
  padding: 13px 14px;
  border: 1px solid #795b2e;
  border-radius: 10px;
  color: var(--cream);
  background: rgb(200 148 53 / 9%);
  font-size: 0.78rem;
}

.claim-login-hint b {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.claim-login-hint span,
.claim-security-note { color: var(--muted); }

.claim-security-note {
  margin: 18px 0;
  font-size: 0.78rem;
  line-height: 1.55;
}

.claim-dialog input {
  font-family: var(--mono);
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.claim-dialog #claimDeviceName {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.device-favorite-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / 2%);
  cursor: pointer;
}

.device-favorite-field input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--gold);
}

.device-favorite-field span { display: grid; gap: 4px; }
.device-favorite-field b { color: var(--cream); font-size: 0.82rem; }
.device-favorite-field small { color: var(--muted); font-size: 0.72rem; }

.edit-device-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  margin-top: 22px;
}

.edit-device-actions button { min-height: 48px; }

.delete-device-dialog {
  border-color: rgb(219 112 95 / 58%);
}

.danger-eyebrow { color: #ef9a8d; }

.delete-device-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / 2%);
}

.delete-device-summary span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.delete-device-summary b,
.delete-device-summary strong {
  overflow-wrap: anywhere;
  color: var(--cream);
  text-align: right;
}

.delete-device-summary strong,
.delete-device-dialog input {
  font-family: var(--mono);
  text-transform: uppercase;
}

.delete-device-warning {
  padding: 14px;
  border-left: 3px solid var(--red);
  color: #d8c5bd;
  background: rgb(219 112 95 / 8%);
  font-size: 0.8rem;
  line-height: 1.6;
}

.delete-device-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  margin-top: 20px;
}

.delete-device-actions button { min-height: 48px; }

.device-heading-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.device-heading-actions .secondary-button { white-space: nowrap; }

.contact-card {
  position: relative;
  padding: clamp(28px, 6vw, 52px);
}

.contact-card h2 {
  max-width: 430px;
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: -0.045em;
  line-height: 1;
}

.contact-card label:not(.contact-consent) {
  display: block;
  margin: 18px 0 8px;
  color: #c8bcaa;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.contact-card input:not([type="checkbox"]) {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--cream);
  background: #1b1611;
}

.contact-card input:hover,
.contact-card input:focus {
  border-color: #8b6933;
  box-shadow: 0 0 0 3px rgb(200 148 53 / 9%);
}

.contact-close {
  position: absolute;
  z-index: 1;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #1b1611;
  font-size: 1.4rem;
  cursor: pointer;
}

.contact-consent {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 11px;
  align-items: start;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  cursor: pointer;
}

.contact-consent input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--gold);
}

.contact-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-success {
  padding: 30px 0 10px;
  text-align: center;
}

.contact-success h2 {
  margin-inline: auto;
}

.contact-success > p:last-of-type {
  margin: 20px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

.contact-success-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 28px;
  border: 1px solid rgb(200 148 53 / 55%);
  border-radius: 50%;
  color: var(--gold-bright);
  font-size: 1.8rem;
  place-items: center;
}

/* App shell */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-areas:
    "topbar topbar"
    "sidebar dashboard";
  grid-template-columns: 264px minmax(0, 1fr);
  grid-template-rows: 74px 1fr;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  grid-area: topbar;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line-soft);
  background: rgb(23 19 15 / 92%);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-block {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 8px;
}

.notification-shell { position: relative; }

.notification-button {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid #66532f;
  border-radius: 50%;
  color: var(--gold-bright);
  background: rgb(200 148 53 / 8%);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.notification-button:hover,
.notification-button[aria-expanded="true"] {
  border-color: var(--gold-bright);
  background: rgb(200 148 53 / 16%);
  transform: translateY(-1px);
}

.notification-bell {
  font-size: 1.15rem;
  line-height: 1;
  transform: rotate(45deg);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid #17130f;
  border-radius: 999px;
  color: #fff;
  background: #c74e42;
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 15px;
  text-align: center;
}

.notification-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 16px);
  right: -54px;
  display: flex;
  width: min(420px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 96px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #58472a;
  border-radius: 16px;
  background: #1b1712;
  box-shadow: 0 24px 70px rgb(0 0 0 / 48%);
}

.notification-panel[hidden] { display: none; }

.notification-panel::before {
  position: absolute;
  top: -7px;
  right: 68px;
  width: 12px;
  height: 12px;
  border-top: 1px solid #58472a;
  border-left: 1px solid #58472a;
  background: #1b1712;
  content: "";
  transform: rotate(45deg);
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.notification-panel-head h2 { margin: 4px 0 0; font-size: 1.25rem; }

.notification-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.notification-toolbar button {
  padding: 4px 0;
  border: 0;
  color: var(--gold-bright);
  background: transparent;
  font-family: inherit;
  font-size: 0.58rem;
  cursor: pointer;
}

.notification-toolbar button:disabled { opacity: 0.35; cursor: default; }
.notification-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.notification-toolbar button.danger { color: #db705f; }

.notification-list { min-height: 0; overflow-y: auto; }

.notification-item {
  position: relative;
  width: 100%;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  transition: background 150ms ease;
}

.notification-item-open {
  display: grid;
  width: 100%;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  padding: 15px 50px 15px 18px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.notification-delete-button {
  position: absolute;
  top: 11px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #82766d;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.notification-delete-button:hover { border-color: rgb(219 112 95 / 35%); color: #db705f; background: rgb(219 112 95 / 8%); }
.notification-delete-button:disabled { opacity: 0.35; cursor: default; }

.notification-item:hover { background: rgb(255 255 255 / 3%); }
.notification-item.unread { background: rgb(200 148 53 / 7%); }
.notification-item.unread:hover { background: rgb(200 148 53 / 11%); }

.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #7d746b;
  box-shadow: 0 0 0 3px rgb(125 116 107 / 12%);
}

.notification-item[data-severity="success"] .notification-dot { background: #61b985; box-shadow: 0 0 0 3px rgb(97 185 133 / 12%); }
.notification-item[data-severity="warning"] .notification-dot { background: #d9a84e; box-shadow: 0 0 0 3px rgb(217 168 78 / 14%); }
.notification-item[data-severity="critical"] .notification-dot { background: #db705f; box-shadow: 0 0 0 3px rgb(219 112 95 / 14%); }

.notification-copy { min-width: 0; }
.notification-copy b { display: block; margin-bottom: 4px; font-size: 0.78rem; line-height: 1.35; }
.notification-copy p { margin: 0; color: #b7aea4; font-size: 0.72rem; line-height: 1.45; }
.notification-meta { display: flex; gap: 8px; margin-top: 7px; color: #776e65; font-family: var(--mono); font-size: 0.58rem; }
.notification-item.unread .notification-copy b::after { color: var(--gold-bright); content: "  •"; }

.notification-empty { margin: 0; padding: 34px 22px; color: var(--muted); font-size: 0.76rem; text-align: center; }

.notification-settings {
  flex: 0 0 auto;
  border-top: 1px solid #58472a;
  background: #17130f;
}

.notification-settings summary {
  padding: 14px 18px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.notification-settings form { display: grid; gap: 12px; padding: 0 18px 18px; }
.notification-settings label { display: flex; align-items: center; gap: 9px; color: #c9c0b6; font-size: 0.7rem; }
.notification-settings input { accent-color: var(--gold-bright); }
.notification-master-toggle { padding-bottom: 11px; border-bottom: 1px solid var(--line-soft); font-weight: 700; }
.notification-preference-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.notification-settings .secondary-button { min-height: 36px; justify-self: start; padding-inline: 14px; }

.admin-access-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid #637337;
  border-radius: 8px;
  color: #dce9a9;
  background: linear-gradient(145deg, rgb(99 115 55 / 20%), rgb(30 37 22 / 50%));
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.admin-access-link:hover {
  border-color: #a3bb4d;
  color: #f0f7ce;
  transform: translateY(-1px);
}

.admin-access-link > span { color: #b8d552; }

.user-block > span:last-child {
  display: grid;
  gap: 1px;
}

.user-block b {
  font-size: 0.78rem;
}

.user-block small {
  color: var(--muted);
  font-size: 0.66rem;
}

.user-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #806330;
  border-radius: 50%;
  color: var(--gold-bright);
  background: rgb(200 148 53 / 8%);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.status-pill.online { color: var(--green); }
.status-pill.unstable { color: var(--gold-bright); }
.status-pill.offline { color: var(--red); }
.status-pill.neutral { color: var(--muted); }

.icon-button,
.text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  font-size: 1.1rem;
}

.icon-button:hover,
.text-button:hover { color: var(--cream); }

.icon-button.loading { animation: spin 900ms linear infinite; }

.text-button {
  padding: 8px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sidebar {
  position: sticky;
  top: 74px;
  display: flex;
  height: calc(100vh - 74px);
  flex-direction: column;
  grid-area: sidebar;
  padding: 28px 18px 20px;
  border-right: 1px solid var(--line-soft);
  background: #15110e;
}

.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.12em;
}

.sidebar-title b {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  color: var(--gold-bright);
  background: rgb(200 148 53 / 10%);
}

.device-list {
  display: grid;
  gap: 7px;
}

.device-item {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--cream);
  background: transparent;
}

.device-item:hover { background: rgb(255 255 255 / 2%); }

.device-item.active {
  border-color: #594529;
  background: linear-gradient(90deg, rgb(200 148 53 / 12%), rgb(200 148 53 / 3%));
}

.device-select {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 12px 10px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.device-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--gold-bright);
  font-family: var(--mono);
}

.device-select > span:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.device-item b {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-item small {
  color: var(--muted);
  font-size: 0.62rem;
}

.device-favorite-mark {
  color: var(--gold-bright);
  font-style: normal;
}

.device-menu-shell { position: relative; }

.device-menu-button {
  display: grid;
  width: 30px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.device-menu-button:hover,
.device-menu-button[aria-expanded="true"] {
  color: var(--cream);
  background: rgb(255 255 255 / 6%);
}

.device-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  right: 0;
  display: grid;
  width: max-content;
  min-width: 178px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #211a15;
  box-shadow: 0 18px 38px rgb(0 0 0 / 42%);
}

.device-menu[hidden] { display: none; }

.device-menu button {
  padding: 10px 11px;
  border: 0;
  border-radius: 7px;
  color: var(--cream);
  background: transparent;
  text-align: left;
  font-size: 0.74rem;
  cursor: pointer;
}

.device-menu button:hover,
.device-menu button:focus-visible { background: rgb(255 255 255 / 6%); }
.device-menu button.danger { color: #ef9b8d; }

.device-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.device-dot.online { background: var(--green); box-shadow: 0 0 9px var(--green); }
.device-dot.unstable { background: var(--gold-bright); box-shadow: 0 0 7px rgb(224 173 76 / 65%); }
.device-dot.offline { background: var(--red); }

.sidebar-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: auto;
  padding: 15px 9px 0;
  border-top: 1px solid var(--line-soft);
  color: #766b5d;
  font-family: var(--mono);
  font-size: 0.57rem;
  letter-spacing: 0.08em;
}

.sidebar-foot b { color: var(--muted); }

.dashboard {
  width: 100%;
  max-width: 1580px;
  grid-area: dashboard;
  justify-self: center;
  padding: clamp(24px, 3vw, 48px);
}

.dashboard.no-devices {
  display: grid;
  min-height: calc(100vh - 74px);
  place-items: center;
}

.dashboard.no-devices > :not(.empty-device-view) {
  display: none !important;
}

.empty-device-view {
  width: min(100%, 680px);
  padding: clamp(30px, 6vw, 64px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0, rgb(200 148 53 / 13%), transparent 48%),
    var(--ink-2);
  box-shadow: var(--shadow);
}

.empty-device-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 28px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 800;
}

.empty-device-view h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.empty-device-view > p:not(.eyebrow) {
  max-width: 560px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.empty-device-view ol {
  display: grid;
  gap: 10px;
  margin: 26px 0 0;
  padding-left: 24px;
  color: #c8bcaa;
}

.empty-device-view .button {
  max-width: 340px;
}

.device-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 15px;
}

.title-line h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.05em;
}

.device-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.last-update {
  display: grid;
  gap: 5px;
  min-width: max-content;
  text-align: right;
}

.last-update span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.last-update b {
  font-size: 0.78rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1fr;
  gap: 14px;
}

.metric-card,
.chart-card,
.detail-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgb(37 30 23 / 94%), rgb(27 22 17 / 96%));
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 186px;
  padding: 20px;
}

.temperature-card {
  position: relative;
  overflow: hidden;
  border-color: #5d482b;
  background:
    radial-gradient(circle at 90% 10%, rgb(200 148 53 / 14%), transparent 50%),
    linear-gradient(145deg, #2a2117, #1c1611);
}

.temperature-card::after {
  position: absolute;
  top: -52px;
  right: -42px;
  width: 150px;
  height: 150px;
  border: 1px solid rgb(200 148 53 / 12%);
  border-radius: 50%;
  content: "";
}

.metric-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.metric-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #5b4932;
  border-radius: 7px;
  color: var(--gold-bright);
  font-size: 0.8rem;
}

.temperature-value {
  display: flex;
  align-items: baseline;
  margin-top: 15px;
}

.temperature-value b {
  font-family: var(--mono);
  font-size: clamp(3rem, 5vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.09em;
  line-height: 1;
}

.temperature-value span,
.secondary-value span {
  margin-left: 8px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.88rem;
}

.target-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 17px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.07em;
}

.target-row b { color: var(--cream); font-size: 0.68rem; }

.secondary-value {
  display: flex;
  align-items: baseline;
  margin-top: 27px;
}

.secondary-value b {
  font-family: var(--mono);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.06em;
}

.metric-caption {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.state-value {
  display: block;
  margin-top: 28px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 1.12rem;
  letter-spacing: 0.04em;
}

.relay-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 24px;
}

.relay-pill {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #71675a;
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.relay-pill.active-cooling {
  border-color: rgb(106 167 201 / 55%);
  color: #8cc2df;
  background: rgb(106 167 201 / 9%);
}

.relay-pill.active-heating {
  border-color: rgb(219 112 95 / 55%);
  color: #eb9385;
  background: rgb(219 112 95 / 9%);
}

.signal-meter {
  overflow: hidden;
  height: 5px;
  margin-top: 18px;
  border-radius: 99px;
  background: #0e0b09;
}

.signal-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 400ms ease, background 400ms ease;
}

.chart-card {
  margin-top: 14px;
  padding: clamp(20px, 2.5vw, 30px);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.section-heading.compact { align-items: center; }

.range-control {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #17120e;
}

.range-control button {
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  color: #756b5e;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
}

.range-control button.active {
  color: var(--ink);
  background: var(--gold);
}

.range-control button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.chart-heading-actions,
.history-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.chart-live-status {
  color: #68c38e;
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.chart-live-status.paused { color: var(--gold-bright); }

.chart-pause-button[aria-pressed="true"] {
  border-color: rgb(203 154 63 / 60%);
  color: var(--gold-bright);
  background: rgb(203 154 63 / 9%);
}

.temperature-range-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.temperature-range-toolbar > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.temperature-range-control {
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.temperature-range-control button { white-space: nowrap; }

.legend {
  display: flex;
  gap: 18px;
  margin: 26px 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
}

.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 2px; }
.legend-temp { background: var(--gold-bright); }
.legend-target { border-top: 2px dashed #7a7167; }

.chart-interaction-hint {
  margin: 0 0 10px;
  color: #817668;
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.5;
}

.chart-wrap {
  position: relative;
  min-height: 300px;
}

.chart-wrap svg { cursor: crosshair; }
.chart-wrap.zoomed svg { cursor: zoom-out; }

#temperatureChart {
  display: block;
  width: 100%;
  min-width: 700px;
  height: 300px;
  overflow: visible;
}

.chart-wrap {
  overflow-x: auto;
  scrollbar-color: #4e4030 transparent;
}

.chart-line {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.temperature-line {
  stroke: var(--gold-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  filter: drop-shadow(0 0 5px rgb(224 173 76 / 28%));
}

.target-line {
  stroke: #8b8175;
  stroke-dasharray: 7 6;
  stroke-width: 1.5;
}

.chart-grid-line { stroke: #3b3127; stroke-width: 1; }
.chart-grid-text { fill: #71675c; font: 11px var(--mono); }

.chart-inspector { pointer-events: none; }
.chart-inspector[hidden] { display: none; }
.chart-inspector-line { stroke: rgb(245 238 229 / 30%); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-inspector-point { vector-effect: non-scaling-stroke; }
.chart-inspector-point.temperature-point { fill: var(--gold-bright); stroke: #17120e; stroke-width: 2; }
.chart-inspector-point.setpoint-point { fill: #8b8175; stroke: #17120e; stroke-width: 2; }

.chart-tooltip {
  position: absolute;
  z-index: 12;
  display: grid;
  width: 216px;
  gap: 7px;
  padding: 12px 13px;
  border: 1px solid #5a4936;
  border-radius: 10px;
  background: rgb(25 20 16 / 96%);
  box-shadow: 0 16px 36px rgb(0 0 0 / 38%);
  pointer-events: none;
}

.chart-tooltip[hidden] { display: none; }
.chart-tooltip span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.chart-tooltip small { color: var(--muted); font: 0.61rem var(--mono); text-transform: uppercase; }
.chart-tooltip b { color: var(--cream); font: 0.69rem var(--mono); text-align: right; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.recipe-cloud-card {
  margin-top: 14px;
  padding: clamp(20px, 2.5vw, 30px);
  border: 1px solid #5d482b;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0, rgb(200 148 53 / 10%), transparent 42%),
    linear-gradient(145deg, rgb(37 30 23 / 96%), rgb(25 20 16 / 98%));
  box-shadow: var(--shadow);
}

.recipe-cloud-heading { align-items: center; }

.section-copy {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.secondary-button,
.primary-action-button,
.profile-command-actions button,
.recipe-card-actions button,
.stage-heading button,
.stage-remove-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #18130f;
  font-family: var(--mono);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.secondary-button {
  min-height: 40px;
  padding: 0 15px;
  border-color: var(--gold);
  color: var(--gold-bright);
}

.secondary-button:hover:not(:disabled),
.stage-heading button:hover:not(:disabled),
.recipe-card-actions button:hover:not(:disabled) {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

.profile-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgb(15 12 9 / 52%);
}

.profile-command-bar > div:first-child {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.profile-command-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.profile-command-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.profile-command-actions button {
  min-height: 38px;
  padding: 0 12px;
}

.profile-command-actions .danger-button {
  border-color: rgb(219 112 95 / 55%);
  color: #ef9a8d;
}

.recipe-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  margin-top: 18px;
}

.recipe-library,
.recipe-form {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgb(18 14 11 / 62%);
}

.subsection-title,
.stage-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.subsection-title b {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  color: var(--gold-bright);
  background: rgb(200 148 53 / 10%);
}

.recipe-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.recipe-item {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #17120e;
}

.recipe-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recipe-item h3 {
  margin: 0;
  font-size: 0.91rem;
}

.recipe-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.45;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 11px;
  color: #8d8172;
  font-family: var(--mono);
  font-size: 0.58rem;
}

.recipe-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.recipe-card-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.recipe-card-actions .start-recipe-button {
  border-color: var(--gold);
  color: #17110a;
  background: var(--gold);
}

.recipe-card-actions .delete-recipe-button {
  border-color: rgb(219 112 95 / 38%);
  color: #dc8a7d;
}

.recipe-empty {
  margin: 25px 0 8px;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.5;
  text-align: center;
}

.recipe-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.recipe-form h3 {
  margin: 0;
  font-size: 1.08rem;
}

.recipe-form > label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.recipe-form input,
.recipe-form textarea,
.recipe-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #17120e;
  font: inherit;
}

.recipe-form > input,
.recipe-form > textarea {
  padding: 11px 12px;
}

.recipe-form textarea { resize: vertical; }

.recipe-form input:focus,
.recipe-form textarea:focus,
.recipe-form select:focus {
  border-color: #8b6933;
  box-shadow: 0 0 0 3px rgb(200 148 53 / 9%);
}

.stage-heading {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}

.stage-heading button {
  min-height: 32px;
  padding: 0 9px;
}

.recipe-stages {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.recipe-stage-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 90px 80px 92px 34px;
  gap: 7px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgb(255 255 255 / 1.5%);
}

.stage-field {
  display: grid;
  gap: 5px;
}

.stage-field label {
  color: #786e62;
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.06em;
}

.stage-field input,
.stage-field select {
  height: 36px;
  padding: 0 9px;
  font-size: 0.7rem;
}

.stage-remove-button {
  width: 34px;
  height: 36px;
  border-color: rgb(219 112 95 / 32%);
  color: #dc8a7d;
}

.primary-action-button {
  width: 100%;
  min-height: 43px;
  margin-top: 15px;
  border-color: var(--gold);
  color: #17110a;
  background: var(--gold);
}

.primary-action-button:hover:not(:disabled),
.recipe-card-actions .start-recipe-button:hover:not(:disabled) {
  background: var(--gold-bright);
}

.secondary-button:disabled,
.primary-action-button:disabled,
.profile-command-actions button:disabled,
.recipe-card-actions button:disabled,
.stage-heading button:disabled,
.stage-remove-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.detail-card {
  min-height: 245px;
  padding: 22px;
}

.outline-badge {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.outline-badge.pending {
  border-color: rgb(224 173 76 / 55%);
  color: var(--gold-bright);
  background: rgb(224 173 76 / 8%);
}

.outline-badge.applied {
  border-color: rgb(97 185 133 / 50%);
  color: var(--green);
  background: rgb(97 185 133 / 8%);
}

.outline-badge.rejected {
  border-color: rgb(219 112 95 / 50%);
  color: var(--red);
  background: rgb(219 112 95 / 8%);
}

.remote-control-card {
  border-color: #5d482b;
  background:
    radial-gradient(circle at 100% 0, rgb(200 148 53 / 10%), transparent 52%),
    linear-gradient(145deg, rgb(42 33 23 / 96%), rgb(27 22 17 / 96%));
}

.remote-control-form {
  margin-top: 24px;
}

.remote-control-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.setpoint-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.temperature-input {
  position: relative;
}

.temperature-input input {
  width: 100%;
  height: 45px;
  padding: 0 42px 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #17120e;
  font-family: var(--mono);
}

.temperature-input span {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.72rem;
  transform: translateY(-50%);
}

.setpoint-input-row button {
  min-width: 88px;
  padding: 0 13px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: #17110a;
  background: var(--gold);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.setpoint-input-row button:hover:not(:disabled) {
  background: var(--gold-bright);
}

.temperature-input input:disabled,
.setpoint-input-row button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.command-status-text {
  min-height: 34px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.data-list {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.data-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.data-list div:last-child { border-bottom: 0; }
.data-list dt { color: var(--muted); font-size: 0.72rem; }
.data-list dd {
  overflow: hidden;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alarm-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 34px;
}

.alarm-summary > span {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(97 185 133 / 40%);
  border-radius: 50%;
  color: var(--green);
  background: rgb(97 185 133 / 8%);
  font-size: 1.2rem;
}

.alarm-summary b { font-size: 0.88rem; }
.alarm-summary p { margin: 5px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }

.alarm-card.active {
  border-color: rgb(219 112 95 / 42%);
  background: linear-gradient(145deg, rgb(50 29 23 / 95%), rgb(30 21 17 / 96%));
}

.alarm-card.active .alarm-summary > span {
  border-color: rgb(219 112 95 / 50%);
  color: var(--red);
  background: rgb(219 112 95 / 8%);
}

.dashboard-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 35px;
  padding: 0 4px;
  color: #665c50;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid #665035;
  border-radius: 10px;
  color: var(--cream);
  background: #271f18;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* Navegação por abas — Painel 5.9.0 */
.dashboard-tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  margin: 24px 0 18px;
  padding: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgb(15 12 9 / 64%);
  scrollbar-width: thin;
}

.dashboard-tabs button {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #85796a;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  cursor: pointer;
}

.dashboard-tabs button:hover { color: var(--cream); }

.dashboard-tabs button.active {
  border-color: #6c512d;
  color: #17110a;
  background: var(--gold);
}

.tab-panel { min-width: 0; }
.tab-card-first { margin-top: 0; }
.dashboard-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.alarms-grid { grid-template-columns: minmax(260px, 0.7fr) minmax(480px, 1.3fr); }
.device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.firmware-update-card { display: flex; flex-direction: column; gap: 16px; }
.firmware-update-card .section-heading { margin-bottom: 0; }
.firmware-update-status { margin: 0; color: var(--muted); line-height: 1.65; }
.firmware-update-card .secondary-button { align-self: flex-start; margin-top: auto; }
.firmware-update-note { display: block; color: var(--muted); line-height: 1.5; }

.configuration-card,
.alarm-settings-card { min-height: auto; }

.cloud-form { margin-top: 22px; }

.cloud-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cloud-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.field-with-unit { position: relative; }

.field-with-unit input {
  width: 100%;
  height: 44px;
  padding: 0 46px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #17120e;
  font-family: var(--mono);
}

.field-with-unit span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.68rem;
  transform: translateY(-50%);
}

.cloud-form .primary-action-button { margin-top: 18px; }

.tab-note {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: var(--muted);
  background: rgb(18 14 11 / 62%);
  font-size: 0.72rem;
  line-height: 1.55;
}

.tab-note b {
  flex: 0 0 auto;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.warning-note { border-color: #5d482b; }

.calibration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.calibration-sensor {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgb(18 14 11 / 62%);
}

.calibration-sensor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.calibration-sensor-head strong { font-size: 0.86rem; }

.calibration-readings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.calibration-readings div {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #17120e;
}

.calibration-readings dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.05em;
}

.calibration-readings dd {
  margin: 6px 0 0;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.calibration-sensor > p {
  margin: 10px 0 0;
  color: #786e62;
  font-size: 0.65rem;
}

.form-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}

.form-action-row .inline-action {
  width: auto;
  min-width: 180px;
  margin-top: 0;
}

.large-status-copy {
  min-height: 80px;
  margin: 28px 0 20px;
  color: var(--muted);
  line-height: 1.65;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.switch-grid label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--cream);
  background: #17120e;
  cursor: pointer;
}

.switch-grid input { accent-color: var(--gold); }
.alarm-values-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.history-actions .secondary-button { min-height: 36px; }

/* Dashboard e acompanhamento de densidade — Painel 5.9.0 */
.profile-progress-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.profile-progress-block > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.57rem;
  letter-spacing: 0.07em;
}

.profile-progress-block b { color: var(--gold-bright); }

.profile-progress-track {
  height: 9px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #4d3d2b;
  border-radius: 999px;
  background: #15100c;
}

.profile-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  box-shadow: 0 0 12px rgb(224 173 76 / 38%);
  transition: width 450ms ease;
}

.dashboard-chart-card { margin-top: 14px; }
.dashboard-chart-wrap { min-height: 260px; }

#dashboardTemperatureChart {
  display: block;
  width: 100%;
  min-width: 700px;
  height: 260px;
  overflow: visible;
}

.gravity-start-card { max-width: 1040px; }

.fermentation-start-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 0.7fr) minmax(220px, 1fr);
  gap: 14px;
}

.cloud-form > label,
.fermentation-start-grid label,
.gravity-reading-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.cloud-form > label > input,
.fermentation-start-grid label > input,
.gravity-reading-grid label > input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #17120e;
  font-family: var(--mono);
  color-scheme: dark;
}

.gravity-field input { padding-right: 54px; }

.gravity-heading { align-items: flex-start; }

.gravity-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.danger-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgb(219 112 95 / 55%);
  border-radius: 8px;
  color: #ef9a8d;
  background: #18130f;
  font-family: var(--mono);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.danger-button:hover:not(:disabled) {
  border-color: var(--red);
  color: #ffc0b7;
}

.danger-button:disabled { cursor: not-allowed; opacity: 0.45; }

.device-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid rgb(219 112 95 / 34%);
  border-radius: 14px;
  background: rgb(219 112 95 / 5%);
}

.device-danger-zone div {
  display: grid;
  gap: 6px;
}

.device-danger-zone b {
  color: #ef9a8d;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.device-danger-zone span {
  max-width: 700px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.device-danger-zone .danger-button { flex: 0 0 auto; }

.gravity-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.gravity-metrics-grid article {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgb(18 14 11 / 62%);
}

.gravity-metrics-grid span,
.gravity-metrics-grid small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gravity-metrics-grid b {
  display: block;
  margin: 8px 0 5px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: clamp(1.3rem, 2.6vw, 2rem);
}

.gravity-legend { margin-top: 22px; }
.legend-gravity { background: var(--blue); }
.legend-og { border-top: 2px dashed var(--gold); }
.gravity-chart-wrap { min-height: 320px; }

#gravityChart {
  display: block;
  width: 100%;
  min-width: 700px;
  height: 320px;
  overflow: visible;
}

.gravity-line {
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  filter: drop-shadow(0 0 5px rgb(106 167 201 / 28%));
}

.gravity-og-line {
  stroke: var(--gold);
  stroke-dasharray: 7 6;
  stroke-width: 1.5;
}

.gravity-point {
  fill: var(--blue);
  stroke: #17130f;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.gravity-entry-grid { grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr); }
.gravity-entry-grid .detail-card { min-height: 300px; }

.gravity-reading-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1.3fr);
  gap: 12px;
  margin-bottom: 14px;
}

.count-badge {
  min-width: 28px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.62rem;
  text-align: center;
}

.gravity-readings-list {
  display: grid;
  gap: 8px;
  max-height: 390px;
  margin-top: 16px;
  overflow-y: auto;
  padding-right: 3px;
}

.gravity-reading-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #17120e;
}

.gravity-reading-item > b {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.92rem;
}

.gravity-reading-copy { min-width: 0; }

.gravity-reading-copy span,
.gravity-reading-copy small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gravity-reading-copy small { color: #786e62; }

.gravity-reading-delete {
  width: 31px;
  height: 31px;
  border: 1px solid rgb(219 112 95 / 32%);
  border-radius: 7px;
  color: #dc8a7d;
  background: transparent;
  cursor: pointer;
}

.gravity-reading-delete:disabled { cursor: not-allowed; opacity: 0.4; }

.batch-library-card { margin-bottom: 18px; }

.batch-library-heading { align-items: flex-start; }

.batch-library-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 22px;
}

.batch-library-controls label,
.batch-form-grid label,
.ingredient-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
}

.batch-library-controls select,
.batch-form-grid input,
.batch-form-grid select,
.ingredient-form-grid input,
.ingredient-form-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--text);
  background: #0f0f0f;
  font: inherit;
  letter-spacing: normal;
}

.batch-comparison {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.batch-comparison-scroll { overflow-x: auto; }

.batch-comparison table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  white-space: nowrap;
}

.batch-comparison th,
.batch-comparison td {
  border-bottom: 1px solid rgb(255 255 255 / 7%);
  padding: 11px 10px;
  text-align: left;
  font-size: 0.72rem;
}

.batch-comparison th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.batch-comparison tbody tr { cursor: pointer; transition: background 150ms ease; }
.batch-comparison tbody tr:hover { background: rgb(210 164 79 / 8%); }

.batch-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.batch-sheet-card { grid-column: 1 / -1; }

.batch-form-grid,
.ingredient-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.ingredient-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ingredient-form-grid label:first-child { grid-column: span 2; }
.sensory-grid { align-items: start; margin-top: 14px; }

.batch-recipe-snapshot {
  margin-top: 22px;
  border: 1px solid rgb(210 164 79 / 18%);
  border-radius: 9px;
  padding: 16px;
  background: rgb(210 164 79 / 4%);
}

.batch-recipe-snapshot strong { color: var(--gold-bright); }
.batch-recipe-snapshot p { margin: 7px 0 0; color: var(--muted); font-size: 0.76rem; }
.batch-recipe-snapshot ol { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.73rem; line-height: 1.7; }

.batch-cost-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.batch-cost-summary span {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.65rem;
}

.batch-cost-summary b { color: var(--text); font-size: 0.78rem; }
.compact-batch-form { margin-top: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.compact-batch-form .secondary-button { margin-top: 14px; }

.batch-item-list { display: grid; gap: 8px; margin-top: 16px; }

.batch-item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgb(255 255 255 / 1.5%);
}

.batch-item-copy { display: grid; gap: 3px; min-width: 0; }
.batch-item-copy strong { overflow: hidden; color: var(--text); font-size: 0.77rem; text-overflow: ellipsis; white-space: nowrap; }
.batch-item-copy span { color: var(--gold-bright); font-family: var(--mono); font-size: 0.62rem; }
.batch-item-copy small { overflow: hidden; color: var(--muted); font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.batch-item-actions { display: flex; gap: 7px; align-items: center; }

.batch-item-delete,
.batch-item-download {
  min-width: 31px;
  height: 31px;
  border: 1px solid rgb(219 112 95 / 32%);
  border-radius: 7px;
  padding: 0 9px;
  color: #dc8a7d;
  background: transparent;
  cursor: pointer;
}

.batch-item-download { border-color: rgb(210 164 79 / 32%); color: var(--gold-bright); font-size: 0.58rem; }
.batch-item-delete:disabled { cursor: not-allowed; opacity: 0.4; }

@media (max-width: 1050px) {
  .detail-grid.alarms-grid,
  .detail-grid.gravity-entry-grid { grid-template-columns: 1fr; }
  .alarm-values-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gravity-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fermentation-start-grid { grid-template-columns: 1fr 1fr; }
  .fermentation-start-grid label:first-child { grid-column: 1 / -1; }
  .batch-library-controls { grid-template-columns: 1fr 1fr; }
  .batch-library-controls .secondary-button { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .detail-grid.dashboard-summary-grid,
  .detail-grid.control-grid,
  .detail-grid.device-grid,
  .calibration-grid,
  .cloud-form-grid,
  .detail-grid.gravity-entry-grid,
  .fermentation-start-grid { grid-template-columns: 1fr; }
  .batch-details-grid,
  .batch-form-grid,
  .ingredient-form-grid,
  .batch-library-controls { grid-template-columns: 1fr; }
  .batch-library-controls .secondary-button,
  .ingredient-form-grid label:first-child { grid-column: auto; }
  .fermentation-start-grid label:first-child { grid-column: auto; }
  .history-actions { align-items: stretch; flex-direction: column; }
  .chart-heading-actions { justify-content: flex-start; }
  .temperature-range-toolbar { align-items: stretch; flex-direction: column; }
  .temperature-range-control {
    align-self: stretch;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
  }
  .tab-note { flex-direction: column; gap: 7px; }
  .gravity-heading { gap: 18px; }
  .gravity-heading-actions { align-items: stretch; flex-direction: column; }
}

@media (max-width: 520px) {
  .switch-grid,
  .alarm-values-grid,
  .calibration-readings { grid-template-columns: 1fr; }
  .gravity-metrics-grid,
  .gravity-reading-grid { grid-template-columns: 1fr; }
  .batch-cost-summary { grid-template-columns: 1fr; }
  .form-action-row { align-items: stretch; flex-direction: column; }
  .form-action-row .inline-action { width: 100%; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1150px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .recipe-workspace { grid-template-columns: 1fr; }
  .login-copy h1 { font-size: clamp(3.4rem, 7vw, 5.6rem); }
}

@media (max-width: 850px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; }
  .mobile-brand { display: flex; }

  .app-shell {
    grid-template-areas: "topbar" "dashboard";
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar { display: none; }
  .user-block > span:last-child,
  .topbar .status-pill { display: none; }
  .dashboard { padding: 24px 16px 36px; }
}

@media (max-width: 640px) {
  .delete-device-actions { grid-template-columns: 1fr; }
  .device-danger-zone { align-items: stretch; flex-direction: column; }
  .signup-grid { grid-template-columns: 1fr; gap: 0; }
  .topbar { height: 66px; padding: 0 14px; }
  .topbar .brand small { display: none; }
  .topbar-actions { gap: 6px; }
  .notification-panel { position: fixed; top: 72px; right: 10px; left: 10px; width: auto; max-height: calc(100vh - 84px); }
  .notification-panel::before { display: none; }
  .notification-preference-grid { grid-template-columns: 1fr; }
  .text-button { padding-right: 0; }

  .device-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .last-update { text-align: left; }
  .device-heading-actions { width: 100%; align-items: stretch; flex-direction: column-reverse; gap: 12px; }
  .device-heading-actions .secondary-button { width: 100%; }
  .title-line { flex-wrap: wrap; gap: 10px; }
  .metrics-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 170px; }

  .section-heading:not(.compact) {
    align-items: stretch;
    flex-direction: column;
  }

  .range-control { align-self: flex-start; }
  .range-control button { padding-inline: 8px; }
  .chart-card { padding-inline: 16px; }
  .chart-wrap { margin-right: -10px; }
  .dashboard-footer { flex-direction: column; line-height: 1.6; }
  .recipe-cloud-heading,
  .profile-command-bar,
  .profile-command-bar > div:first-child {
    align-items: stretch;
    flex-direction: column;
  }
  .profile-command-actions { flex-wrap: wrap; }
  .recipe-stage-row {
    grid-template-columns: 1fr 1fr;
  }
  .recipe-stage-row .stage-name-field { grid-column: 1 / -1; }
  .stage-remove-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
