:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #17202a;
    --muted: #64748b;
    --line: #d9e1ec;
    --primary: #116466;
    --primary-dark: #0b4b4d;
    --danger: #b42318;
    --ok: #067647;
    --warn: #b54708;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button, .button {
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    font-weight: 700;
}
button:hover, .button:hover { background: var(--primary-dark); }
.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.danger { background: var(--danger); }
.ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); }
input, select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
}
label { display: grid; gap: 6px; font-weight: 700; color: #334155; }
small, code { color: var(--muted); overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: #475569; font-size: 13px; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
    background: #12343b;
    color: #fff;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.brand { font-size: 24px; font-weight: 800; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar a { padding: 11px 12px; border-radius: 6px; color: #e8f3f1; }
.sidebar a:hover { background: rgba(255,255,255,.1); }
.content { padding: 26px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.panel, .stat, .item-card, .login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}
.panel { padding: 18px; margin-bottom: 18px; }
.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.panel-title h2, .item-card h3 { margin: 0; font-size: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; display: grid; gap: 4px; }
.stat strong { font-size: 34px; }
.stat span { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 14px; align-items: end; }
.inline-form { display: flex; gap: 12px; align-items: end; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.item-card { padding: 16px; }
.item-card p { color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 0 10px; font-weight: 700; font-size: 12px; }
.badge.online { color: var(--ok); background: #dcfae6; }
.badge.offline { color: var(--warn); background: #fef0c7; }
.alert { margin: 0 0 16px; padding: 12px 14px; border-radius: 6px; background: #e0f2fe; border: 1px solid #7dd3fc; }
.alert.error { background: #fee4e2; border-color: #fda29b; }
.alert.success { background: #dcfae6; border-color: #75e0a7; }
.guest {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}
.login-card {
    width: min(420px, 100%);
    padding: 28px;
}
.login-card h1 { margin: 0 0 6px; font-size: 32px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card form { display: grid; gap: 14px; }
.thumb {
    width: 96px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    background: #000;
}
.number { max-width: 96px; }
.row-form {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.6fr 1fr auto 1fr auto;
    gap: 10px;
    align-items: center;
}
.delete-form { margin-top: 8px; display: flex; justify-content: flex-end; }
.inline-delete {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .stats-grid, .form-grid { grid-template-columns: 1fr 1fr; }
    .row-form { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 560px) {
    .content { padding: 16px; }
    .stats-grid, .form-grid { grid-template-columns: 1fr; }
    .inline-form, .topbar { flex-direction: column; align-items: stretch; }
}
