:root {
  --blue: #111a4a;
  --blue-deep: #111a4a;
  --red: #d92b3e;
  --ink: #172033;
  --muted: #718096;
  --line: #e7ebf3;
  --surface: #ffffff;
  --background: #f5f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); }
button, input { font: inherit; }
button { cursor: pointer; }

.login-shell { min-height: 100vh; display: block; background: #fff; }
.login-brand { display: none; }
.brand-mark { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.04em; font-size: 25px; }
.brand-mark strong { color: #fff; }
.brand-mark em { color: #ff5260; font-style: normal; }
.brand-symbol { width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.8); border-radius: 14px; font-weight: 900; font-size: 15px; }
.brand-copy { max-width: 500px; }
.brand-copy h1 { margin: 0 0 18px; max-width: 520px; font-size: clamp(36px, 5vw, 66px); line-height: .98; letter-spacing: -.06em; }
.brand-copy p { max-width: 430px; margin: 0; color: rgba(255,255,255,.72); font-size: 17px; line-height: 1.6; }
.brand-footer { color: rgba(255,255,255,.5); font-size: 12px; }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 36px; background: #fff; }
.login-card { width: min(100%, 450px); }
.login-card h2 { margin: 28px 0 9px; font-size: 32px; letter-spacing: -.05em; }
.login-card > p { margin: 0 0 34px; color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; color: #465166; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; outline: none; background: #fbfcfe; transition: .2s; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(32,45,143,.1); background: #fff; }
.button-primary { width: 100%; border: 0; border-radius: 12px; padding: 14px 18px; color: #fff; font-weight: 800; background: var(--blue); box-shadow: 0 7px 18px rgba(32,45,143,.2); }
.button-primary:hover { background: var(--blue-deep); }
.login-note { margin: 20px 0 0; padding: 13px 15px; border-left: 3px solid #dbe0ef; color: #5d677c; background: #f8f9fc; font-size: 12px; line-height: 1.5; }
.preview-links { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.preview-links a { flex: 1; padding: 9px; border: 1px solid var(--line); border-radius: 8px; text-align: center; color: var(--blue); background: #fff; font-size: 12px; font-weight: 700; text-decoration: none; }
.preview-links a:hover { border-color: #bbc4e8; background: #fafbff; }

.app-shell { min-height: 100vh; display: block; }
.main { min-width: 0; flex: 1; padding: 31px clamp(25px, 4vw, 65px); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 39px; }
.eyebrow { margin: 0 0 8px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-title { margin: 0; color: #111a4a; font-size: clamp(26px, 3vw, 38px); font-weight: 750; line-height: 1.18; letter-spacing: -.035em; text-wrap: balance; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 40px; background: #fff; font-size: 13px; font-weight: 700; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--red); font-size: 11px; }
.section-title { margin: 0 0 15px; color: #111a4a; font-size: 18px; font-weight: 700; line-height: 1.35; letter-spacing: -.025em; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 33px; }
.metric-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 680px; }
.metric-grid--one { grid-template-columns: minmax(0, 340px); }
.map-panel { margin-bottom: 20px; }
.organization-map { display: block; width: 100%; height: clamp(380px, 65vh, 720px); border: 0; border-radius: 12px; background: #eef2f5; }
.map-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-caption a { color: var(--blue); }
.map-interaction { position: relative; }
.map-interaction .organization-map { pointer-events: none; }
.map-interaction.is-interactive .organization-map { pointer-events: auto; }
.map-lock { position: absolute; top: 12px; left: 12px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: #111a4a; background: #fff; box-shadow: 0 3px 15px #17203320; }
.map-lock[aria-pressed="true"] { background: #111a4a; color: #fff; border-color: #111a4a; }
.map-lock:focus-visible { outline: 3px solid #8ea5ff; outline-offset: 3px; }
.map-surface { position: relative; min-height: 480px; overflow: hidden; border: 1px solid #e1e5ef; border-radius: 12px; background: #eef2f5; }
.map-surface::before, .map-surface::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.46); filter: blur(2px); }
.map-surface::before { width: 320px; height: 180px; left: 7%; top: 12%; }
.map-surface::after { width: 390px; height: 210px; right: 5%; bottom: 8%; }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; }
.map-lines path { fill: none; stroke: #d1d9d6; stroke-width: 14; stroke-linecap: round; }
.map-lines path:nth-child(2), .map-lines path:nth-child(4) { stroke: #dbe2df; stroke-width: 8; }
.map-lines path:nth-child(5) { stroke: #e0e6e2; stroke-width: 5; }
.map-empty { position: absolute; top: 50%; left: 50%; width: min(360px, calc(100% - 40px)); transform: translate(-50%, -50%); padding: 26px; border: 1px solid rgba(255,255,255,.9); border-radius: 14px; text-align: center; background: rgba(255,255,255,.91); box-shadow: 0 13px 35px rgba(40,53,69,.09); }
.map-empty h4 { margin: 0 0 7px; font-size: 16px; }
.map-empty p { margin: 0 0 17px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.map-action { display: inline-block; padding: 10px 13px; border-radius: 8px; color: #fff; background: var(--blue); font-size: 12px; font-weight: 800; text-decoration: none; }
.setup-panel, .settings-panel { max-width: 900px; }
.setup-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 32px; }
.setup-step { display: flex; align-items: center; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: #8a94a8; }
.setup-step span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #eef0f5; font-size: 12px; font-weight: 800; }
.setup-step.active { border-color: #c8cfee; color: var(--blue); background: #fafbff; }
.setup-step.active span { color: #fff; background: var(--blue); }
.setup-step strong, .setup-step small { display: block; }
.setup-step strong { font-size: 13px; }
.setup-step small { margin-top: 3px; font-size: 11px; }
.setup-placeholder { padding: 54px 25px; border: 1px dashed #ccd3e4; border-radius: 12px; text-align: center; background: #fbfcff; }
.setup-placeholder h3 { margin: 0 0 8px; font-size: 17px; }
.setup-placeholder p { margin: 0 auto 21px; max-width: 410px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.setup-button { width: auto; }
.setup-panel .setup-actions .button-back, .setup-panel .setup-actions .setup-button { padding: 10px 16px; border: 1px solid; border-radius: 14px; font-family: Arial, sans-serif; font-size: 13.333px; font-weight: 600; line-height: normal; transition: transform 150ms ease, box-shadow 150ms ease; }
.setup-panel .setup-actions .button-back { border-color: #ed1c24; background: linear-gradient(135deg, #ed1c24, #b9141a); color: #fff; box-shadow: 0 8px 18px rgba(237,28,36,.2); }
.setup-panel .setup-actions .setup-button { border-color: var(--blue); background: var(--blue); color: #fff; box-shadow: 0 8px 18px rgba(17,26,74,.2); }
.setup-panel .setup-actions button:disabled { opacity: .5; cursor: not-allowed; }
.setup-panel .setup-actions .button-back:hover:not(:disabled) { background: linear-gradient(135deg, #ed1c24, #b9141a); }
.setup-panel .setup-actions .setup-button:hover { background: var(--blue); }
.setup-progress { margin: 8px 0 24px; font-family: Arial, sans-serif; }
#setup-step-label { margin-bottom: 6px; font-size: 14px; }
.setup-progress-track { width: 100%; height: 10px; overflow: hidden; border-radius: 9999px; background: rgba(17,26,74,.1); box-shadow: inset 0 1px 2px rgba(15,23,42,.08); }
.setup-progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #5868ad); transition: width 320ms cubic-bezier(.2,.8,.2,1); }
.button-back { padding: 14px 18px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font: inherit; font-weight: 800; }
.button-back:hover:not(:disabled) { background: #b82031; }
.button-back:disabled, .setup-button:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.setup-button:hover:disabled { background: var(--blue); }
.plant-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; list-style: none; padding: 0 0 24px; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.plant-progress li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.plant-progress li span { display: grid; place-items: center; flex: 0 0 28px; height: 28px; background: #eef0f5; border-radius: 50%; }
.plant-progress [aria-current] { color: #111a4a; font-weight: 700; }
.plant-progress [aria-current] span { color: white; background: #111a4a; }
.plant-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.plant-field-wide { grid-column: 1 / -1; }
.gateway-credentials { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.gateway-credentials[hidden] { display: none; }
.gateway-credentials h3 { margin: 0 0 16px; color: var(--blue); font-size: 18px; }
.gateway-manual-label { margin: 24px 0 18px; font-size: 13px; color: var(--muted); }
.plant-card { padding: 20px 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.plant-card h3 { margin: 0; color: var(--blue); }
.plant-card p { line-height: 1.5; overflow-wrap: anywhere; }
.address-results { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.address-results button { display: block; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; line-height: 1.5; }
.address-results button:hover, .address-results button:focus-visible { background: #eef0ff; }
.field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; background: #fbfcfe; color: var(--ink); font: inherit; }
.field textarea { resize: vertical; }
.field select:focus, .field textarea:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.plant-position iframe { width: 100%; height: 230px; border: 1px solid var(--line); border-radius: 12px; }
.location-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.location-actions button:disabled { opacity: .5; cursor: wait; }
.setup-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
@media (max-width: 620px) { .plant-progress { grid-template-columns: repeat(2, 1fr); } .plant-fields { grid-template-columns: 1fr; } }
.settings-row { display: flex; align-items: center; gap: 15px; padding: 17px 0; border-top: 1px solid var(--line); }
.settings-row > div:nth-child(2) { flex: 1; }
.settings-row strong { display: block; font-size: 14px; }
.settings-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.settings-logo, .settings-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border-radius: 10px; color: var(--blue); background: #eef0ff; font-size: 14px; font-weight: 800; }
.settings-logo img, .brand-symbol img { width: 100%; height: 100%; object-fit: contain; }
.secondary-button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue); background: #fff; font-size: 12px; font-weight: 700; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 22px rgba(27,39,72,.04); }
.metric-card { padding: 22px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 16px; font-size: 35px; font-weight: 800; letter-spacing: -.06em; }
.metric-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--blue); background: #eef0ff; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.panel { padding: 23px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
.panel-header h3 { margin: 0; color: #111a4a; font-size: 18px; font-weight: 700; line-height: 1.35; letter-spacing: -.025em; }
.panel-header h3 + .subtle { display: block; margin-top: 6px; line-height: 1.5; }
.subtle { color: var(--muted); font-size: 12px; }
.empty-state { display: grid; place-items: center; min-height: 220px; padding: 25px; text-align: center; border: 1px dashed #ccd3e4; border-radius: 12px; background: #fbfcff; }
.empty-icon { width: 47px; height: 47px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 14px; color: var(--blue); background: #eef0ff; font-size: 22px; }
.empty-state h4 { margin: 0 0 7px; font-size: 16px; }
.empty-state p { max-width: 360px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.action-list { display: grid; gap: 10px; }
.action { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; }
.action:hover { border-color: #bcc6e7; background: #fafbff; }
.action span:first-child { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--red); background: #fff0f1; }
.role-badge { padding: 6px 9px; border-radius: 7px; color: var(--blue); background: #eef0ff; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.logout { display: inline-block; margin-top: 22px; color: rgba(255,255,255,.6); font-size: 12px; text-decoration: none; }

@media (max-width: 850px) { .main { padding: 25px 18px; } }
@media (max-width: 620px) { .login-panel { padding: 25px 19px; } .metric-grid, .content-grid { grid-template-columns: 1fr; } .topbar { margin-bottom: 28px; } .user-chip { padding-right: 8px; } .user-chip > span:not(.avatar) { display: none; } .setup-steps { grid-template-columns: 1fr; } .settings-row { align-items: flex-start; flex-wrap: wrap; } .settings-row .secondary-button { margin-left: 57px; } }


/* Navigation: one centered radial layout for every screen size. */
.sidebar {
  --radius: clamp(104px, 30vw, 150px);
  position: fixed;
  z-index: 30;
  top: 54px;
  left: 54px;
  width: 0;
  height: 0;
  transition: top .42s ease, left .42s ease;
}
.sidebar.is-open { top: 50%; left: 50%; }
@media (min-width: 851px) {
  .sidebar:not(.is-open) { left: calc(clamp(25px, 4vw, 65px) + 34px); }
}
.organization-toggle {
  position: absolute;
  z-index: 2;
  width: 68px;
  height: 68px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 20px;
  background: #111a4a;
  box-shadow: 0 8px 24px #111a4a33;
  transition: width .42s ease, height .42s ease, border-radius .42s ease;
}
.organization-toggle img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sidebar.is-open .organization-toggle { width: 84px; height: 84px; border-radius: 50%; }
.organization-brand-name, .organization-toggle-arrow,
.sidebar .nav-label, .sidebar-bottom { display: none; }
.sidebar-content, .nav { position: absolute; inset: 0; }
.nav a {
  --x: 0px; --y: 0px;
  position: absolute;
  left: 0; top: 0;
  width: clamp(92px, 27vw, 124px);
  min-height: 74px;
  padding: 10px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 20px;
  background: #111a4a;
  color: white;
  text-decoration: none;
  text-align: center;
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 8px 24px #111a4a33;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-35deg) scale(.25);
  transition: transform .32s ease, opacity .22s ease, visibility .32s;
}
.nav a:nth-child(1) { --y: calc(-1 * var(--radius)); --delay: .42s; }
.nav a:nth-child(2) { --x: calc(.951 * var(--radius)); --y: calc(-.309 * var(--radius)); --delay: .49s; }
.nav a:nth-child(3) { --x: calc(-.951 * var(--radius)); --y: calc(-.309 * var(--radius)); --delay: .70s; }
.nav a:nth-child(4) { --x: calc(-.588 * var(--radius)); --y: calc(.809 * var(--radius)); --delay: .63s; }
.nav a:nth-child(5) { --x: calc(.588 * var(--radius)); --y: calc(.809 * var(--radius)); --delay: .56s; }
.sidebar.is-open .nav a {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(0deg) scale(1);
  transition-delay: var(--delay);
}
.nav a.active, .nav a:hover { background: #111a4a; }
.nav-icon { font-size: 26px; line-height: 1; }
.organization-toggle:focus-visible, .nav a:focus-visible { outline: 3px solid #8ea5ff; outline-offset: 4px; }
.menu-backdrop {
  position: fixed; inset: 0; z-index: 25;
  background: #10183040;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
body.menu-open .menu-backdrop { opacity: 1; visibility: visible; }
body.menu-open { overflow: hidden; }
.app-shell .topbar { padding-left: 82px; min-height: 68px; }
@media (max-width: 380px) {
  .sidebar { --radius: 104px; }
  .nav a { width: 92px; }
}
@media (max-height: 420px) {
  .sidebar { --radius: 102px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .organization-toggle, .nav a, .menu-backdrop { transition: none; }
  .sidebar.is-open .nav a { transition-delay: 0s; }
}
