body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f6f8fb;
    color: #1b1f23;
    margin: 0;
}

.topbar {
    background: #0e1e2f;
    color: #fff;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 36px;
}

.topnav a {
    color: #fff;
    text-decoration: none;
    margin-left: 16px;
    font-weight: 600;
}

.content {
    max-width: 1100px;
    margin: 32px auto;
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.flash {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.footer {
    text-align: center;
    padding: 16px;
    font-size: 14px;
    color: #667085;
}

form label {
    display: block;
    margin-bottom: 12px;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #dadfe9;
    border-radius: 6px;
    font-size: 16px;
}

button {
    background: #0057ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 16px;
    cursor: pointer;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.btn .icon,
button .icon {
    font-size: 14px;
    margin-right: 4px;
}

.btn {
    background: #e4e7ec;
    color: #0f172a;
    padding: 9px 16px;
    border-radius: 6px;
}

.btn.primary,
button.primary {
    background: #0057ff;
    color: #fff;
}

.btn.secondary {
    background: #0f172a;
    color: #fff;
}

.btn.danger {
    background: #e11d48;
    color: #fff;
}

.btn.small {
    font-size: 13px;
    padding: 6px 10px;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

table.table th,
table.table td {
    border: 1px solid #e4e7ec;
    padding: 8px 10px;
    text-align: left;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    align-items: start;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.inline {
    display: inline-block;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #dadfe9;
    border-radius: 6px;
    font-size: 14px;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.section-header.between {
    justify-content: space-between;
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filters input[type="text"],
.filters select {
    width: auto;
    min-width: 180px;
}

.table-wrapper {
    overflow-x: auto;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inline-form {
    display: inline-block;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-muted {
    background: #e2e8f0;
    color: #475569;
}

.badge-info {
    background: #e0f2fe;
    color: #0c4a6e;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin: 0 6px 4px 0;
    background: #e4e7ec;
    color: #0f172a;
}

.chip-light {
    background: #f1f5f9;
    color: #475467;
}

.chip-in {
    background: #dbeafe;
    color: #1d4ed8;
}

.chip-out {
    background: #fef3c7;
    color: #92400e;
}

.chip-success {
    background: #dcfce7;
    color: #15803d;
}

.chip-warning {
    background: #fef3c7;
    color: #92400e;
}

.form-card {
    background: #f9fafb;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 20px;
    margin-top: 16px;
}

.grid-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.text-center {
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.form-toggle {
    margin-top: 20px;
}

.form-toggle summary {
    list-style: none;
    cursor: pointer;
    margin-bottom: 12px;
}

.form-toggle summary::-webkit-details-marker {
    display: none;
}

.form-toggle > summary .btn {
    width: auto;
}

.form-toggle[open] > summary .btn::after,
.form-toggle > summary .btn::after {
    content: attr(data-label-closed);
    display: none;
}

.form-toggle summary .btn::after {
    content: attr(data-label-open);
    margin-left: 8px;
    font-weight: 400;
    font-size: 12px;
}

.inline-form form,
.inline-form {
    display: inline-block;
}

.chart-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-card {
    background: #f9fafb;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.chart-card.wifi-chart {
    border-color: #c7d7fe;
    background: #f8fbff;
}

.chart-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.chart-card h2 {
    margin: 0;
    font-size: 20px;
}

.chart-card p {
    margin: 2px 0 0;
    color: #475467;
    font-size: 14px;
}

.chart-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #475467;
    text-align: right;
}

.chart-svg {
    width: 100%;
    height: auto;
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #94a3b8;
}

.chart-empty {
    padding: 40px 0;
    text-align: center;
    color: #94a3b8;
    border: 1px dashed #e4e7ec;
    border-radius: 10px;
    background: #fff;
}

.chart-summary {
    margin: 0 0 16px;
    font-size: 15px;
    color: #475467;
}

.chart-visual {
    display: flex;
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

.chart-y-axis {
    position: relative;
    width: 80px;
    font-size: 12px;
    color: #475467;
    padding-right: 8px;
}

.chart-y-axis span {
    position: absolute;
    right: 0;
    transform: translateY(-50%);
    white-space: nowrap;
}

.chart-svg-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.chart-gridline {
    stroke: rgba(148, 163, 184, 0.4);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.chart-gridline-vertical {
    stroke: rgba(148, 163, 184, 0.35);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.chart-comfort {
    fill: rgba(52, 211, 153, 0.15);
}

.chart-comfort-line {
    stroke: rgba(16, 185, 129, 0.8);
    stroke-width: 1.5;
    stroke-dasharray: 6 3;
}

.chart-axis-time {
    position: relative;
    margin-top: 6px;
    min-height: 18px;
    font-size: 12px;
    color: #475467;
    padding: 0 18px;
    width: 100%;
    box-sizing: border-box;
}

.chart-axis-time span {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.chart-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-time-label {
    fill: #475467;
    font-size: 11px;
}

.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.chart-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475467;
}

.chart-legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.chart-legend li.level-poor .dot {
    background: #dc2626;
}

.chart-legend li.level-weak .dot {
    background: #f97316;
}

.chart-legend li.level-good .dot {
    background: #22c55e;
}

.chart-legend li.level-strong .dot {
    background: #0ea5e9;
}

.chart-legend small {
    display: block;
    color: #94a3b8;
    font-size: 11px;
}

.wifi-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(59,130,246,0.08), rgba(59,130,246,0.02));
}

.wifi-status p {
    margin: 0;
    font-size: 12px;
    color: #475467;
}

.wifi-status strong {
    font-size: 20px;
    color: #0f172a;
}

.wifi-quality {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
}

.wifi-quality small {
    font-weight: 400;
    color: #475467;
}

.wifi-quality.level-poor {
    color: #dc2626;
}

.wifi-quality.level-weak {
    color: #f97316;
}

.wifi-quality.level-good {
    color: #16a34a;
}

.wifi-quality.level-strong {
    color: #0ea5e9;
}

.wifi-timestamp {
    font-size: 13px;
    color: #475467;
}

.chart-visual-wifi .chart-y-axis {
    width: 90px;
}

.chart-svg-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.wifi-bands {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.wifi-band {
    position: absolute;
    left: 0;
    width: 100%;
    opacity: 0.22;
    border-top: 1px dashed rgba(255, 255, 255, 0.35);
}

.wifi-band em {
    position: absolute;
    left: 12px;
    top: 6px;
    font-style: normal;
    font-size: 11px;
    color: #111827;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.chart-svg {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 2;
}

.chart-latest-dot {
    fill: #0ea5e9;
    stroke: #fff;
    stroke-width: 2;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
}

.pagination span {
    font-size: 14px;
    color: #475467;
}

.events-wrapper {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.events-tabs {
    display: inline-flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 999px;
    align-self: flex-start;
}

.events-tabs .tab {
    padding: 8px 16px;
    border-radius: 999px;
    text-decoration: none;
    color: #475467;
    font-weight: 600;
}

.events-tabs .tab.active {
    background: #0f172a;
    color: #fff;
}

.events-filters {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.events-filters .filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.events-filters label {
    font-size: 14px;
    color: #475467;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.events-filters input[type="text"],
.events-filters select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
}

.events-filters input[type="datetime-local"] {
    width: 100%;
    max-width: 230px;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    color: #0f172a;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filter-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.events-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    overflow: hidden;
}

.events-table th {
    background: #f8fafc;
    text-align: left;
    padding: 12px 14px;
    font-size: 13px;
    color: #475467;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.events-table td {
    padding: 12px 14px;
    border-top: 1px solid #e4e7ec;
    vertical-align: top;
    font-size: 14px;
}

.events-table tr:nth-child(even) td {
    background: #fcfdff;
}

.mono {
    font-family: 'Fira Code', Consolas, monospace;
    font-size: 13px;
}

.payload {
    max-height: 160px;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 10px;
    font-size: 12px;
}

.muted {
    color: #94a3b8;
}

.per-page-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Person detail */
.person-detail {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.person-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.person-header .badge {
    margin-right: 6px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 6px;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-panel {
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card-panel.light {
    background: #fdfdfd;
}

.card-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-panel-desc {
    color: #64748b;
    font-size: 14px;
    margin: 4px 0 0;
}

.person-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    background: #f8fafc;
    font-size: 14px;
}

.pill input {
    margin: 0;
}

.card-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.card-slot-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-slot-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.slot-label {
    font-weight: 600;
    color: #0f172a;
}

.card-slot-card input,
.card-slot-card select {
    width: 100%;
}

.form-actions.between {
    justify-content: space-between;
    width: 100%;
}

.hint {
    font-size: 13px;
    color: #94a3b8;
}

.access-table td {
    vertical-align: top;
}

.checkbox.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-top: 26px;
}
