* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #0b1120; color: #e2e8f0; }
a { color: inherit; text-decoration: none; }

.topnav { display: flex; justify-content: space-between; align-items: center; padding: 1rem 5%; background: rgba(17, 24, 39, 0.85); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(255,255,255,0.06); }
.nav-actions { display: flex; gap: .6rem; align-items: center; }
.logo { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.3px; }

.hero { min-height: 78vh; display: flex; align-items: center; justify-content: center; padding: 5rem 5% 4rem; background: radial-gradient(ellipse at 50% 0%, #1e1b4b 0%, #0b1120 65%); }
.hero-content { max-width: 700px; text-align: center; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); margin: 0 0 1rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.8px; }
.hero p { font-size: clamp(1rem, 2.2vw, 1.2rem); color: #94a3b8; margin: 0 auto 2rem; max-width: 520px; line-height: 1.6; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn-ghost { padding: .55rem 1.1rem; border-radius: 10px; border: 1px solid #374151; transition: background .15s; }
.btn-ghost:hover { background: #1f2937; }
.btn-primary { background: linear-gradient(90deg, #6366f1, #8b5cf6); color: white; padding: .65rem 1.4rem; border-radius: 10px; border: none; font-weight: 500; transition: filter .15s; display: inline-block; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary.large, .btn-ghost.large { font-size: 1.05rem; padding: .85rem 1.7rem; }
.btn-primary.full { width: 100%; text-align: center; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; padding: 3rem 5% 4rem; max-width: 1100px; margin: 0 auto; }
.card { background: #1e293b; padding: 1.8rem 1.5rem; border-radius: 16px; border: 1px solid #334155; transition: transform .2s, border-color .2s; }
.card:hover { transform: translateY(-4px); border-color: #6366f1; }
.card-icon { font-size: 1.8rem; margin-bottom: .5rem; }
.card h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.card p { margin: 0; color: #94a3b8; line-height: 1.5; font-size: .95rem; }

footer { text-align: center; padding: 2.5rem 1rem; color: #64748b; border-top: 1px solid #1f2937; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #0b1120; }
.login-wrap { width: 100%; max-width: 400px; padding: 1rem; }
.login-card { background: #1e293b; padding: 2rem; border-radius: 16px; border: 1px solid #334155; }
.login-card h1 { margin: 0 0 .5rem; text-align: center; }
.sub { text-align: center; color: #94a3b8; margin-bottom: 1.5rem; }
.divider { text-align: center; margin: 1.5rem 0; color: #64748b; position: relative; }
.divider::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #334155; }
.divider span { background: #1e293b; padding: 0 .8rem; position: relative; }
#local-form input { width: 100%; margin-bottom: .8rem; padding: .7rem; border-radius: 8px; border: 1px solid #475569; background: #0f172a; color: #fff; }
.error { color: #f87171; text-align: center; min-height: 1.2rem; }
.hint { text-align: center; font-size: .8rem; color: #64748b; margin-top: 1rem; }

#app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.content { flex: 1; display: flex; flex-direction: row; min-height: 0; overflow: hidden; }
aside { width: 260px; flex-shrink: 0; background: #111827; border-right: 1px solid #1f2937; overflow-y: auto; padding: .8rem; }
#cy { flex: 1; background: #0b1120; min-width: 0; position: relative; }
header { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem 1rem; background: #111827; border-bottom: 1px solid #1f2937; }
header button, header input { background: #1f2937; color: #e5e7eb; border: 1px solid #374151; border-radius: 8px; padding: .4rem .8rem; font-size: 13px; }
header input { flex: 1; min-width: 140px; max-width: 240px; }
#user-label { margin-left: auto; font-size: .85rem; color: #9ca3af; }

.content { flex: 1; display: flex; flex-direction: row; min-height: 0; overflow: hidden; }
aside { width: 260px; flex: 0 0 260px; background: #111827; border-right: 1px solid #1f2937; overflow-y: auto; padding: .8rem; }
#cy { flex: 1; background: #0b1120; min-width: 0; }
aside h3 { margin: 1rem 0 .3rem; font-size: .7rem; color: #9ca3af; text-transform: uppercase; }
.item { padding: .35rem .5rem; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.item:hover { background: #1f2937; }
.item img { width: 16px; height: 16px; border-radius: 3px; }

#cy { flex: 1; background: #0b1120; }

.panel { position: fixed; top: 0; right: 0; width: min(380px, 100vw); height: 100vh; background: #111827; border-left: 1px solid #1f2937; z-index: 50; transform: translateX(100%); transition: transform .2s; display: flex; flex-direction: column; }
.panel.open { transform: none; }
.panel h3 { margin: 0; padding: 1rem; }
#form, #stats-content { flex: 1; overflow-y: auto; padding: 0 1rem 1rem; }
.panel label { display: block; margin: .5rem 0 .2rem; font-size: .75rem; color: #9ca3af; }
.panel input, .panel select, .panel textarea { width: 100%; padding: .45rem; background: #1f2937; color: #fff; border: 1px solid #374151; border-radius: 6px; }
.panel-actions { padding: .8rem 1rem; border-top: 1px solid #1f2937; display: flex; gap: .5rem; }
.panel-actions button { flex: 1; padding: .5rem; border: none; border-radius: 6px; cursor: pointer; }
#go-btn { background: #059669; color: white; }
#del-btn { background: #dc2626; color: white; }
#close-btn { background: #374151; color: white; }

body.light { background: #f8fafc; color: #0f172a; }
body.light header, body.light aside, body.light .panel { background: #fff; border-color: #e2e8f0; }
body.light header button, body.light header input, body.light .panel input, body.light .panel select, body.light .panel textarea { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
body.light #cy { background: #f1f5f9; }

@media (max-width: 700px) {
  .content { flex-direction: column; }
  aside { width: 100%; max-height: 40vh; }
}