:root {
    --bg: #f3efe6;
    --ink: #1c2418;
    --muted: #5d6758;
    --card: #fffdf8;
    --line: #d7d0c3;
    --accent: #2f6b4f;
    --danger: #b42318;
    --on: #1f7a4d;
    --off: #7a5a1f;
    --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
}

a { color: var(--accent); }
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 10% 10%, #e7f0e4, transparent 40%),
        radial-gradient(circle at 90% 80%, #efe4d2, transparent 35%),
        var(--bg);
}
.auth-card, .sheet {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
    width: min(440px, 92vw);
    box-shadow: 0 16px 40px rgba(40, 32, 16, 0.08);
}
.sheet.wide { width: min(980px, 94vw); margin: 24px auto; }
.eyebrow { letter-spacing: 0.12em; text-transform: uppercase; font-size: 12px; color: var(--muted); margin: 0; }
h1 { margin: 8px 0 12px; font-size: 28px; }
.muted, .hint { color: var(--muted); }
label { display: block; margin: 12px 0; font-size: 14px; }
input, select {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    background: white;
}
.btn {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: white; }
.btn.danger { background: var(--danger); color: white; }
.btn:not(.primary):not(.danger) { background: #ece6da; color: var(--ink); }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.follow-row { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 12px 0; }
.follow-row input { width: auto; margin: 0; }
.badge {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 700;
}
.badge.online { background: #d8f3e1; color: var(--on); }
.badge.offline { background: #ececec; color: #555; }
.live-list li { cursor: pointer; }
.live-list li.selected { background: #f4efe4; margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 10px; }
.pin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #1c2418;
}
.pin.online { background: #1f7a4d; }
.pin.offline { background: #6b6b6b; }
.name-label {
    background: #1c2418;
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.alert { padding: 10px 12px; border-radius: 10px; }
.alert.error { background: #fde8e6; color: var(--danger); }
.alert.success { background: #e7f6ee; color: var(--on); }
.topbar {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 14px 20px;
    background: #1c2418;
    color: #f6f1e7;
}
.topbar a { color: #d8e7d6; text-decoration: none; }
.topbar nav { display: flex; gap: 14px; margin-right: auto; }
.topbar .active { color: white; font-weight: 600; }
.status {
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 600;
}
.status.on { background: #e5f6ea; color: var(--on); }
.status.off { background: #f7eed8; color: var(--off); }
.actions { display: flex; gap: 12px; margin-top: 16px; }
.coords { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.admin-layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 54px); }
.panel { padding: 20px; overflow: auto; background: var(--card); border-right: 1px solid var(--line); }
#map { min-height: 420px; }
.live-list { list-style: none; padding: 0; margin: 0; }
.live-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; }
@media (max-width: 800px) {
    .admin-layout { grid-template-columns: 1fr; }
    .inline-form { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; }
}
