@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap");

:root {
  --bg: #06110D; --glass: rgba(14,36,28,0.62); --glass-strong: rgba(14,36,28,0.92);
  --line: rgba(255,255,255,0.09); --text: #E8F3EC; --muted: #9DB5A8; --accent: #A3E635; --accent-2: #C5F56B;
  --solar: #F5B83D; --wind: #2DD4BF;
  --running: #34D399; --limited: #F59E0B; --paused: #4FA8E0; --warning: #FACC15;
  --fault: #EF4444; --error: #8B5CF6; --offline: #9CA3AF;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Manrope", system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh;
  background-image: radial-gradient(1100px 520px at 75% -8%, rgba(163,230,53,0.09), transparent 62%); background-repeat: no-repeat; }
a { color: var(--accent); } a:hover { color: var(--accent-2); }
button, input, select { font: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.big { font-weight: 300; letter-spacing: -0.02em; }
.hidden { display: none !important; }

.wrap { width: 100%; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 20px; transform-origin: top left; margin: 0 auto; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 20px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); min-width: 0; }
.pad { padding: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.grow { flex: 1 1 320px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 24px rgba(163,230,53,0.35); }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: 0.14em; }
.brand-sub { font-size: 11px; color: var(--muted); }
.topnav { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.topnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; color: #C9DAD0; text-decoration: none; font-size: 13px; font-weight: 700; }
.topnav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.topnav a.on { background: var(--accent); color: var(--bg); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); color: var(--bg); }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--text); border-color: rgba(255,255,255,0.16); }
.btn-ghost:hover { background: rgba(163,230,53,0.14); color: #fff; }
.btn-danger { background: rgba(239,68,68,0.12); color: #FCA5A5; border-color: rgba(239,68,68,0.4); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.lang { min-width: 40px; min-height: 36px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.14); background: transparent; font-size: 12px; font-weight: 800; color: var(--muted); cursor: pointer; }
.lang.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }
.input, select.input { min-height: 46px; border: 1px solid rgba(255,255,255,0.18); border-radius: 14px; padding: 0 14px; background: rgba(255,255,255,0.05); color: var(--text); width: 100%; }
.input:focus, .btn:focus-visible, .lang:focus-visible, .topnav a:focus-visible, .tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select.input option { background: #0E241C; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.msg { padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; }
.msg-error { background: rgba(239,68,68,0.15); color: #FCA5A5; }
.msg-ok { background: rgba(52,211,153,0.14); color: #6EE7B7; }
.msg-info { background: rgba(255,255,255,0.06); color: var(--muted); }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.s-running { background: rgba(52,211,153,0.14); color: #6EE7B7; } .s-running .dot { background: var(--running); box-shadow: 0 0 8px var(--running); }
.s-limited { background: rgba(245,158,11,0.16); color: #FCD34D; } .s-limited .dot { background: var(--limited); }
.s-paused { background: rgba(79,168,224,0.16); color: #9BD1F2; } .s-paused .dot { background: var(--paused); }
.s-warning { background: rgba(250,204,21,0.14); color: #FDE68A; } .s-warning .dot { background: var(--warning); }
.s-fault { background: rgba(239,68,68,0.18); color: #FCA5A5; } .s-fault .dot { background: var(--fault); box-shadow: 0 0 8px var(--fault); }
.s-error { background: rgba(139,92,246,0.2); color: #C4B5FD; } .s-error .dot { background: var(--error); }
.s-offline, .s-pending, .s-info { background: rgba(156,163,175,0.16); color: #D1D5DB; } .s-offline .dot, .s-pending .dot, .s-info .dot { background: var(--offline); }
.s-mode { background: rgba(163,230,53,0.14); color: var(--accent-2); }

/* KPIs and gauges */
.kpi-value { font-size: 52px; line-height: 1; }
.unit { font-size: 16px; font-weight: 500; color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.kv { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.05); }
.kv .v { font-size: 22px; font-weight: 300; }
.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

/* hero */
.hero { position: relative; border-radius: 26px; overflow: hidden; border: 1px solid var(--line); min-height: 300px; }
.hero > svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-content { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 24px; min-height: 300px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tile { min-height: 70px; border-radius: 10px; padding: 8px; text-align: left; color: var(--text); cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  border: 1px solid rgba(156,195,234,0.35);
  background-image: repeating-linear-gradient(90deg,rgba(156,195,234,0.2) 0 1px,transparent 1px 25%), repeating-linear-gradient(0deg,rgba(156,195,234,0.2) 0 1px,transparent 1px 50%), linear-gradient(160deg,#3A679A,#152E4C); }
.tile .tag { display: inline-flex; align-items: center; gap: 6px; background: rgba(6,17,13,0.82); border-radius: 6px; padding: 3px 6px; font-size: 11px; font-weight: 800; align-self: flex-start; }
.tile.t-warning { box-shadow: 0 0 0 2px var(--warning), 0 0 16px rgba(250,204,21,0.45); }
.tile.t-fault { box-shadow: 0 0 0 2px var(--fault), 0 0 20px rgba(239,68,68,0.6); }
.tile.t-error { box-shadow: 0 0 0 2px var(--error); filter: saturate(0.35); }
.tile.t-limited { box-shadow: 0 0 0 2px var(--limited); }
.tile.t-paused { box-shadow: 0 0 0 2px var(--paused); }
.tile.t-offline { opacity: 0.55; }
.tile.sel { outline: 3px solid var(--accent); outline-offset: 3px; }

/* turbines */
.turbines { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tcard { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; }
.rotor { transform-box: view-box; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rotor { animation: none; } }

/* turbine page */
.turbine-grid { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(260px, 340px); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .turbine-grid { grid-template-columns: minmax(0, 1fr); } }

/* lists and tables */
.list-row { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid rgba(255,255,255,0.07); font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,0.07); vertical-align: middle; }

/* login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 420px; padding: 28px; display: flex; flex-direction: column; gap: 18px; background: var(--glass-strong); }
.powered { background: #fff; border-radius: 12px; padding: 6px 12px; display: inline-flex; align-items: center; gap: 10px; }
.powered img { height: 32px; width: auto; }
.powered span { font-size: 11px; color: #3D5248; line-height: 1.3; font-weight: 600; }

/* dialog */
.overlay { position: fixed; inset: 0; background: rgba(3,10,8,0.7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.dialog { width: 100%; max-width: 460px; padding: 24px; display: flex; flex-direction: column; gap: 14px; background: var(--glass-strong); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 18px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.08); user-select: all; word-break: break-all; }

@media (max-width: 640px) {
  .wrap { padding: 14px 16px 32px; }
  .kpi-value { font-size: 40px; }
  .list-row { grid-template-columns: 52px minmax(0,1fr); }
  .list-row > :last-child { grid-column: 2; justify-self: start; }
}
