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

:root {
  --panel: rgba(10, 20, 45, 0.70);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.12);
  --line-focus: rgba(134, 204, 255, 0.5);
  --text: #f3f7ff;
  --muted: #a8c1e8;
  --accent: #00d2ff;
  --accent-2: #3a7bd5;
  --ok: #00e676;
  --warn: #ffca28;
  --risk: #ff5252;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 30px 60px -15px rgba(0, 150, 255, 0.3);
  --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  --glass-border: 1px solid rgba(255, 255, 255, 0.18);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: 'Outfit', system-ui, sans-serif;
  background: 
    radial-gradient(circle at 10% 20%, rgba(58, 123, 213, 0.5) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 210, 255, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(20, 40, 80, 0.8) 0%, transparent 60%),
    linear-gradient(135deg, #091221 0%, #030812 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before, body::after {
  content: "";
  position: fixed;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
  animation: float 20s ease-in-out infinite alternate;
}
body::before {
  top: -20vh; right: -10vw;
  background: radial-gradient(circle, rgba(0, 210, 255, 0.3), rgba(0,0,0,0));
  animation-delay: -5s;
}
body::after {
  left: -20vw; bottom: -20vh;
  background: radial-gradient(circle, rgba(58, 123, 213, 0.3), rgba(0,0,0,0));
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 30px) scale(1.1); }
  100% { transform: translate(20px, -40px) scale(0.9); }
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: #fff; text-shadow: 0 0 8px var(--accent); }

.app {
  position: relative; z-index: 1; max-width: 1600px;
  margin: 0 auto; padding: 30px; min-height: 100vh;
  display: flex; flex-direction: column;
}

.frame {
  width: 100%; padding: 16px; border-radius: 40px;
  background: var(--glass-bg); border: var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.shell { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; }

.glass, .panel, .sidebar-card {
  background: var(--panel); border: var(--glass-border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow);
  backdrop-filter: blur(25px) saturate(150%);
  -webkit-backdrop-filter: blur(25px) saturate(150%);
  transition: var(--transition);
}

.panel:hover, .sidebar-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-hover);
  border-color: rgba(255, 255, 255, 0.3);
}

.sidebar { display: grid; grid-template-rows: auto 1fr; gap: 16px; min-height: 0; }

.brand {
  padding: 24px; display: flex; justify-content: space-between;
  gap: 16px; align-items: flex-start; position: relative; overflow: hidden;
}
.brand::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

.brand-title { min-width: 0; }
.brand-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

.mini-logo {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.2);
  display: grid; place-items: center;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 10px rgba(0,0,0,0.2);
}
.mini-logo svg { width: 24px; height: 24px; display: block; }
.brand-lockup { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.brand-lockup-mark {
  width: 60px; height: 60px; flex-shrink: 0;
  filter: drop-shadow(0 4px 8px rgba(0, 210, 255, 0.3));
}
.brand-lockup-mark svg { width: 100%; height: 100%; display: block; }

.brand-lockup-text { line-height: 1.1; }
.brand-lockup-word {
  font-size: 38px; font-weight: 700; letter-spacing: 0.02em;
  background: linear-gradient(to right, #ffffff, #8fc8ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}
.brand-lockup-sub {
  margin-top: 6px; font-size: 11px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.eyebrow {
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 0;
}
.brand h1 { display: none; }
.brand p { display: none; }

.status-bubble {
  min-width: 110px; padding: 14px; border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
  text-align: right; transition: var(--transition);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.status-bubble:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.2); }
.status-bubble span {
  display: block; font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted);
}
.status-bubble strong { display: block; margin-top: 8px; font-size: 15px; font-weight: 600; }
.status-bubble.live strong { color: var(--ok); text-shadow: 0 0 10px rgba(0, 230, 118, 0.4); }
.status-bubble.fallback strong { color: var(--warn); text-shadow: 0 0 10px rgba(255, 202, 40, 0.4); }

.sidebar-card, .panel { padding: 24px; }
.card-title, .panel-head h3 {
  margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: #fff;
}
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.panel-badge {
  padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 500;
  color: var(--accent); background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.2); box-shadow: 0 0 10px rgba(0, 210, 255, 0.1);
}

.source-mini, .source-list { display: grid; gap: 10px; margin-top: 14px; }
.source-link {
  display: block; padding: 12px 16px; border-radius: var(--radius-md); text-decoration: none;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
  transition: var(--transition); position: relative; overflow: hidden;
}
.source-link::before {
  content: ""; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent); transition: var(--transition);
}
.source-link:hover::before { left: 100%; transition: .5s; }
.source-link:hover { background: rgba(255,255,255,0.08); border-color: var(--accent); transform: translateX(4px); }
.source-link div:last-child { margin-top: 6px; font-size: 13px; color: var(--muted); }

.input-panel { min-height: auto; overflow: visible; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field {
  padding: 14px; border-radius: var(--radius-lg); background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08); transition: var(--transition); min-width: 0; position: relative;
}
.field:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); }
.field:focus-within {
  border-color: var(--accent); background: rgba(0, 210, 255, 0.05);
  box-shadow: 0 0 0 1px var(--accent), 0 10px 20px rgba(0,0,0,0.2); transform: translateY(-2px);
}
.field.full { grid-column: 1 / -1; }
.field.is-dirty {
  border-color: var(--accent); background: rgba(0, 210, 255, 0.08); box-shadow: 0 8px 24px rgba(0, 210, 255, 0.15);
}
.field.is-auto { border-color: var(--ok); background: rgba(0, 230, 118, 0.05); }

.field label {
  display: block; margin-bottom: 8px; font-size: 12px; font-weight: 500;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.field-note { margin-top: 8px; font-size: 11px; line-height: 1.4; color: rgba(255,255,255,0.4); }

input, select, textarea, button {
  width: 100%; border: none; outline: none; font: inherit; color: #fff;
  background: rgba(0,0,0,0.2); border-radius: var(--radius-sm); transition: var(--transition);
}
input, select, textarea {
  padding: 12px 14px; border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); font-size: 14px;
}
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px rgba(10, 20, 45, 1) inset !important; -webkit-text-fill-color: #fff !important; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { background: rgba(0,0,0,0.3); border-color: var(--accent); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8c1e8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; cursor: pointer;
}
select option { background: #0a142d; color: #fff; }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
button {
  padding: 16px 20px; cursor: pointer; font-weight: 600; font-size: 15px;
  letter-spacing: 0.02em; border-radius: var(--radius-lg); display: flex;
  align-items: center; justify-content: center; gap: 8px; position: relative; overflow: hidden;
}
button::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 300%; height: 300%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  transform: translate(-50%, -50%) scale(0); opacity: 0; transition: transform 0.6s, opacity 0.6s;
}
button:active::after { transform: translate(-50%, -50%) scale(1); opacity: 1; transition: 0s; }

button.secondary { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #fff; }
button.secondary:hover {
  background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
button.primary {
  color: #fff; background: linear-gradient(135deg, #00d2ff, #3a7bd5); border: none;
  box-shadow: 0 10px 20px rgba(0, 210, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.3); text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(0, 210, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.5); filter: brightness(1.1);
}

.content { display: grid; grid-template-rows: auto auto 1fr; gap: 20px; }
.hero {
  padding: 20px 30px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(58, 123, 213, 0.1), rgba(0, 210, 255, 0.05));
  border: var(--glass-border);
}
.hero::before {
  content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at center, rgba(0, 210, 255, 0.1) 0%, transparent 50%);
  pointer-events: none; animation: rotate 30s linear infinite;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }

.hero-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; position: relative; z-index: 1; }
.hero h2 {
  margin: 4px 0 0; font-size: 32px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700;
  background: linear-gradient(to right, #fff, #a8c1e8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.change-chip {
  min-width: 160px; padding: 16px; border-radius: var(--radius-lg); background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1); box-shadow: inset 0 2px 5px rgba(0,0,0,0.2); text-align: right;
}
.change-chip span { display: block; font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.change-chip strong { display: block; margin-top: 8px; font-size: 16px; font-weight: 600; color: var(--accent); }

.quick-state { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; position: relative; z-index: 1; }
.quick-pill { padding: 10px 14px; border-radius: var(--radius-lg); background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); transition: var(--transition); }
.quick-pill:hover { background: rgba(255,255,255,0.06); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.quick-pill span { display: block; margin-bottom: 8px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.quick-pill strong { display: block; font-size: 13px; line-height: 1.4; color: #fff; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.kpi {
  padding: 24px; border-radius: var(--radius-xl); background: var(--panel); border: var(--glass-border);
  box-shadow: var(--shadow); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  transition: var(--transition); position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: 0.5;
}
.kpi:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.kpi span { display: block; font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi b { display: block; margin-top: 12px; font-size: 36px; letter-spacing: -0.02em; color: #fff; font-weight: 700; }
.kpi em { display: block; margin-top: 8px; font-style: normal; font-size: 13px; color: var(--muted); }

[hidden] { display: none !important; }
.board { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; overflow: visible; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }

.summary-card {
  padding: 20px; border-radius: var(--radius-lg); border: 1px solid rgba(0, 210, 255, 0.2);
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.05), rgba(58, 123, 213, 0.02));
  line-height: 1.6; font-size: 14px; box-shadow: inset 0 2px 10px rgba(0, 210, 255, 0.05);
}

.data-grid { display: grid; gap: 12px; }
.data-row {
  display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px;
  border-radius: var(--radius-md); background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); transition: var(--transition);
}
.data-row:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); transform: scale(1.01); }
.data-row strong { font-size: 14px; font-weight: 500; color: #fff; }
.data-row span { text-align: right; font-size: 13px; color: var(--muted); }

.map-shell { display: grid; gap: 16px; }
.map-frame {
  width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-lg); background: #030812; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1); position: relative; display: grid; place-items: center; box-shadow: inset 0 5px 15px rgba(0,0,0,0.5);
}
.map-svg { width: 100%; height: 100%; display: block; transition: transform 0.3s ease; }
.map-frame:hover .map-svg { transform: scale(1.05); }

.map-surface { fill: rgba(58, 123, 213, 0.1); stroke: rgba(255,255,255,0.05); stroke-width: 1; }
.map-parcel { fill: rgba(0, 210, 255, 0.15); stroke: var(--accent); stroke-width: 3; vector-effect: non-scaling-stroke; }
.map-building { fill: rgba(255, 255, 255, 0.1); stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.map-pin-ring { fill: rgba(0, 210, 255, 0.2); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; animation: pulsePin 2s infinite; }
@keyframes pulsePin { 0% { transform: scale(0.9); opacity: 0.8; } 50% { transform: scale(1.2); opacity: 0.4; } 100% { transform: scale(0.9); opacity: 0.8; } }
.map-pin-core { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.map-grid line { stroke: rgba(255,255,255,0.03); stroke-width: 1; }
.map-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 14px; }
.map-note { font-size: 13px; color: var(--muted); text-align: center; }

table { width: 100%; border-collapse: separate; border-spacing: 0 10px; font-size: 13px; }
th { padding: 0 12px 8px; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
td { padding: 14px 12px; background: rgba(255,255,255,0.02); border-top: 1px solid rgba(255,255,255,0.05); border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; transition: var(--transition); }
tr:hover td { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
td:first-child { border-left: 1px solid rgba(255,255,255,0.05); border-radius: var(--radius-md) 0 0 var(--radius-md); font-weight: 500; }
td:last-child { border-right: 1px solid rgba(255,255,255,0.05); border-radius: 0 var(--radius-md) var(--radius-md) 0; }

code { font-family: "Cascadia Code", "Consolas", monospace; font-size: 13px; color: var(--accent); background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; }

.scroll-panel { min-height: auto; overflow: visible; }
.group { margin-top: 14px; padding: 16px; border-radius: var(--radius-lg); background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); transition: var(--transition); }
.group:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); }
.group:first-child { margin-top: 0; }
.group-title { margin-bottom: 12px; font-size: 16px; font-weight: 600; color: #fff; }
.item { margin-top: 10px; padding: 16px; border-radius: var(--radius-md); background: rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.05); transition: var(--transition); }
.item:hover { background: rgba(0,0,0,0.25); border-color: rgba(255,255,255,0.1); }
.item:first-of-type { margin-top: 0; }
.item .d { margin-top: 8px; white-space: pre-line; font-size: 13px; line-height: 1.6; color: var(--muted); }

.tag { display: inline-flex; align-items: center; margin-top: 12px; padding: 6px 14px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2); }
.tag.ok { color: var(--ok); border-color: rgba(0, 230, 118, 0.3); background: rgba(0, 230, 118, 0.1); }
.tag.todo { color: var(--warn); border-color: rgba(255, 202, 40, 0.3); background: rgba(255, 202, 40, 0.1); }
.tag.risk { color: var(--risk); border-color: rgba(255, 82, 82, 0.3); background: rgba(255, 82, 82, 0.1); }

.evidence { margin-top: 10px; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,0.5); padding-left: 10px; border-left: 2px solid rgba(255,255,255,0.1); }

pre { margin: 0; min-height: 200px; max-height: 300px; overflow: auto; padding: 20px; border-radius: var(--radius-lg); background: #030812; border: 1px solid rgba(255,255,255,0.1); font-size: 12px; line-height: 1.6; color: #a8c1e8; box-shadow: inset 0 5px 15px rgba(0,0,0,0.5); }
pre::-webkit-scrollbar { width: 8px; height: 8px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
pre::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

.panel.flash { border-color: var(--accent); box-shadow: 0 0 30px rgba(0, 210, 255, 0.3); transform: translateY(-2px); animation: flash 1s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 rgba(0, 210, 255, 0); } 20% { box-shadow: 0 0 40px rgba(0, 210, 255, 0.6); border-color: #fff; } 100% { box-shadow: 0 0 30px rgba(0, 210, 255, 0.3); } }

@media (max-width: 1280px) {
  .shell { grid-template-columns: 320px minmax(0, 1fr); }
  .board { grid-template-columns: repeat(2, 1fr); }
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 1; }
  .panel.span-8 { grid-column: span 2; }
}
@media (max-width: 992px) {
  .app { padding: 16px; }
  .frame { width: 100%; border-radius: 30px; padding: 12px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar, .content, .board { min-height: auto; }
  .board { grid-template-columns: 1fr; }
  .span-4, .span-5, .span-7, .span-8, .panel.span-8 { grid-column: auto; }
}
@media (max-width: 640px) {
  .brand, .hero-top { flex-direction: column; }
  .status-bubble { text-align: left; }
  .field-grid, .button-row, .quick-state, .kpis { grid-template-columns: 1fr; }
  .hero h2 { font-size: 32px; }
  .kpi b { font-size: 28px; }
}
