:root {
    --bg: #eef2f6;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --ink: #111827;
    --muted: #667085;
    --muted-2: #98a2b3;
    --line: #d9e2ec;
    --line-strong: #c8d3df;
    --brand: #087f6f;
    --brand-dark: #056052;
    --brand-soft: #e7f6f3;
    --accent: #d9951f;
    --danger: #b42318;
    --radius: 8px;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        linear-gradient(180deg, #f7fafc 0, var(--bg) 310px),
        var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

button,
input {
    font: inherit;
}

button,
.topbar a {
    align-items: center;
    border: 0;
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
    white-space: nowrap;
}

button:hover,
.topbar a:hover {
    background: var(--brand-dark);
    box-shadow: 0 8px 18px rgba(8, 127, 111, 0.2);
}

button:active,
.topbar a:active {
    transform: translateY(1px);
}

button.secondary {
    background: #edf2f7;
    color: #344054;
}

button.secondary:hover {
    background: #dde7f0;
    box-shadow: none;
}

input {
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    color: var(--ink);
    min-height: 44px;
    outline: none;
    padding: 10px 12px;
    transition: border 140ms ease, box-shadow 140ms ease;
    width: 100%;
}

input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(8, 127, 111, 0.13);
}

input[readonly] {
    background: var(--panel-soft);
    color: #344054;
}

label {
    color: #475467;
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 8px;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 18px 30px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1,
.topbar span {
    margin: 0;
}

.topbar h1 {
    align-items: center;
    display: flex;
    font-size: 22px;
    gap: 10px;
    line-height: 1.2;
}

.topbar h1::before {
    background: var(--brand);
    border-radius: 7px;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.22);
    content: "";
    display: inline-block;
    height: 28px;
    width: 28px;
}

.topbar span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-top: 5px;
}

.layout {
    margin: 0 auto;
    max-width: 1320px;
    padding: 26px;
}

.create-panel,
.beacon-list,
.details,
.login-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.create-panel {
    align-items: end;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 20px;
    padding: 22px;
}

.create-panel h2,
.beacon-list h2,
.details h2,
.empty-state h2 {
    color: #101828;
    font-size: 18px;
    line-height: 1.25;
    margin: 0 0 16px;
}

.create-form {
    width: 100%;
}

.inline-form {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.notice {
    background: #fff8e8;
    border: 1px solid #efd08a;
    border-radius: 7px;
    color: #7a4f01;
    font-weight: 700;
    margin-top: 14px;
    padding: 12px 14px;
}

.notice.error {
    background: #fff1f0;
    border-color: #ffccc7;
    color: var(--danger);
}

.content {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: 340px minmax(0, 1fr);
}

.beacon-list {
    max-height: calc(100vh - 198px);
    overflow: auto;
    padding: 16px;
}

.beacon-list h2 {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.beacon-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: block;
    margin-bottom: 10px;
    padding: 13px;
    position: relative;
    text-decoration: none;
    transition: border 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.beacon-row:hover {
    background: #fbfdff;
    border-color: var(--line-strong);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.beacon-row.active {
    background: var(--brand-soft);
    border-color: rgba(8, 127, 111, 0.45);
    box-shadow: inset 4px 0 0 var(--brand);
}

.beacon-row strong,
.beacon-row span,
.beacon-row small {
    display: block;
}

.beacon-row strong {
    font-size: 14px;
    line-height: 1.35;
    padding-right: 4px;
}

.beacon-row span,
.beacon-row small,
.detail-head p,
.empty {
    color: var(--muted);
}

.beacon-row span {
    font-weight: 700;
    margin-top: 8px;
}

.beacon-row small {
    font-size: 12px;
    margin-top: 4px;
}

.details {
    min-width: 0;
    padding: 24px;
}

.detail-head {
    align-items: start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: -2px 0 20px;
    padding-bottom: 18px;
}

.detail-head h2 {
    margin-bottom: 8px;
}

.detail-head p {
    margin: 0;
}

.metric-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 20px 0;
}

.metric-grid div {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.metric-grid div:first-child {
    background: var(--brand-soft);
    border-color: rgba(8, 127, 111, 0.25);
}

.metric-grid span,
.metric-grid strong {
    display: block;
}

.metric-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.metric-grid strong {
    color: #101828;
    font-size: 22px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.copy-block {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 14px 0;
    padding: 14px;
}

.copy-line {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

h3 {
    color: #101828;
    font-size: 17px;
    line-height: 1.3;
    margin: 26px 0 12px;
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: auto;
}

table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    line-height: 1.45;
    max-width: 380px;
    padding: 13px;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

th {
    background: #f8fafc;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background: #fbfdff;
}

tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    color: var(--muted);
    padding: 68px 20px;
    text-align: center;
}

.empty-state h2 {
    color: #101828;
}

.empty-state p {
    margin: 0 auto;
    max-width: 420px;
}

.login-page {
    align-items: center;
    background:
        radial-gradient(circle at 50% 0, rgba(8, 127, 111, 0.12), transparent 330px),
        linear-gradient(180deg, #f7fafc 0, #eef2f6 100%);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    max-width: 430px;
    padding: 30px;
    width: 100%;
}

.login-box h1 {
    align-items: center;
    display: flex;
    font-size: 24px;
    gap: 10px;
    margin: 0 0 8px;
}

.login-box h1::before {
    background: var(--brand);
    border-radius: 7px;
    content: "";
    display: inline-block;
    height: 30px;
    width: 30px;
}

.login-box p {
    color: var(--muted);
    margin: 0 0 24px;
}

.login-box button {
    margin-top: 14px;
    width: 100%;
}

@media (max-width: 980px) {
    .content,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .beacon-list {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .topbar,
    .detail-head {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        padding: 16px;
    }

    .layout {
        padding: 14px;
    }

    .create-panel,
    .details {
        padding: 18px;
    }

    .inline-form,
    .copy-line {
        grid-template-columns: 1fr;
    }
}
