/* ---------------------------------------------------------
   entrance.css — Zugangssystem / Nuki Smart Locks (Nayax-Stil)
   Klassen mit en- und gc- präfixiert.
--------------------------------------------------------- */

/* ── Page header ──────────────────────────────────────── */
.en-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.en-head__text h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
    border-left: 3px solid var(--brand);
    padding-left: 12px;
    line-height: 1.2;
}
.en-head__text p {
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 3px;
    padding-left: 15px;
}

/* ── Status badge inline in header ───────────────────── */
.en-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 999px;
}
.en-status--ok     { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.en-status--warn   { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.en-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.en-status--ok   .en-status__dot  { background: #10B981; }
.en-status--warn .en-status__dot  { background: #EF4444; }

/* ── Alerts ───────────────────────────────────────────── */
.en-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.6;
}
.en-alert--ok    { background: #ECFDF5; border: 1px solid #A7F3D0; color: #047857; }
.en-alert--error { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; }
.en-alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.en-alert ul { margin: 4px 0 0; padding-left: 16px; }
.en-alert li { margin-bottom: 2px; }

/* ── Door cards ───────────────────────────────────────── */
.en-board {
    display: grid;
    gap: 14px;
}
.en-empty {
    padding: 40px 24px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-mute);
    font-size: 13.5px;
}

.en-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.en-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
    flex-wrap: wrap;
}

.en-card__title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.en-card__icon {
    width: 38px;
    height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    flex-shrink: 0;
}
.en-card__icon i { font-size: 18px; }
.en-card__info strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.en-card__info small {
    font-size: 12px;
    color: var(--text-mute);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.en-card__info code {
    font-family: 'Outfit', ui-monospace, monospace;
    font-size: 11px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

/* Lock control buttons group */
.en-card__controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────── */
.en-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
    text-decoration: none;
}
.en-btn:hover { background: var(--bg-soft); color: var(--text); }
.en-btn i { font-size: 15px; }

.en-btn--primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.en-btn--primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.en-btn--primary:disabled,
.en-btn--ghost:disabled,
.en-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.en-btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-soft);
}
.en-btn--ghost:hover { background: var(--bg-soft); color: var(--text); }

.en-btn--danger {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #B91C1C;
}
.en-btn--danger:hover { background: #FEE2E2; border-color: #FCA5A5; }

.en-btn--sm { height: 28px; padding: 0 10px; font-size: 11.5px; }

/* ── Card body: codes table ───────────────────────────── */
.en-card__body { padding: 16px 18px; }

.en-codes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.en-codes-head h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.en-codes-count {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mute);
    padding: 1px 7px;
    line-height: 1.4;
}

.en-no-codes {
    padding: 18px 0;
    text-align: center;
    color: var(--text-mute);
    font-size: 13px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}

/* Codes table */
.en-codes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.en-codes-table thead th {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.en-codes-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.en-codes-table tbody tr:last-child td { border-bottom: none; }
.en-codes-table tbody tr:hover td { background: var(--bg-soft); }

/* PIN mask/reveal */
.pin-mask {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 3px 9px;
    font-family: 'Outfit', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .1em;
    color: var(--text-mute);
    transition: background .12s;
}
.pin-mask:hover { background: var(--surface); }
.pin-mask .pin-mask__value {
    filter: blur(4px);
    transition: filter .2s;
    color: var(--text);
    letter-spacing: .12em;
    user-select: none;
}
.pin-mask.is-revealed .pin-mask__value { filter: none; }

/* ── New code form (inline) ───────────────────────────── */
.en-codeform {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.en-codeform__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.en-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.en-field span {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.en-field input {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
}
.en-field input:focus { border-color: var(--brand); }
.en-codeform__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 700px) {
    .en-card__head { flex-direction: column; align-items: flex-start; }
    .en-codeform__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .en-codeform__grid { grid-template-columns: 1fr; }
}

/* =========================================================
   bat- — Battery / Low-Battery Dashboard (manage-battery)
   ========================================================= */

/* ── Page head ─────────────────────────────────────────── */
.bat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.bat-h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
}
.bat-h1 .hgi { color: var(--brand); font-size: 20px; }
.bat-sub {
    font-size: 13px;
    color: var(--text-soft);
    margin: 0;
}
.bat-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-mute);
    padding: 6px 12px;
    background: var(--bg-soft);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-soft);
    white-space: nowrap;
    align-self: flex-start;
    margin-top: 4px;
}

/* ── Summary strip ─────────────────────────────────────── */
.bat-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.bat-summary__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
}
.bat-summary__item .hgi {
    font-size: 22px;
    flex-shrink: 0;
}
.bat-summary__item strong {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}
.bat-summary__item span {
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 600;
}
.bat-summary__item--ok .hgi,
.bat-summary__item--ok strong { color: var(--ok); }
.bat-summary__item--warn .hgi,
.bat-summary__item--warn strong { color: #f59e0b; }
.bat-summary__item--alert .hgi,
.bat-summary__item--alert strong { color: var(--danger); }
.bat-summary__item--alert {
    border-color: color-mix(in srgb, var(--danger) 20%, transparent);
    background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

/* ── Section ───────────────────────────────────────────── */
.bat-section { margin-bottom: 28px; }

.bat-section__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.bat-section__head .hgi {
    font-size: 18px;
    color: var(--brand);
}
.bat-section__head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* ── Badge (section header) ────────────────────────────── */
.bat-badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.bat-badge--ok       { background: #dcfce7; color: #15803d; }
.bat-badge--warn     { background: #fef3c7; color: #92400e; }
.bat-badge--critical { background: #fee2e2; color: #b91c1c; }

/* ── Error / Empty states ──────────────────────────────── */
.bat-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 13px;
    font-weight: 600;
}
.bat-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 500;
}
.bat-empty .hgi { color: var(--ok); font-size: 18px; }

/* ── Device grid ───────────────────────────────────────── */
.bat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 10px;
}

/* ── Device card ───────────────────────────────────────── */
.bat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .15s;
}
.bat-card--warn {
    border-color: #fcd34d;
    background: #fffbeb;
}
.bat-card--critical {
    border-color: #fca5a5;
    background: #fff5f5;
}

.bat-card__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-soft);
    font-size: 18px;
    color: var(--text-soft);
}
.bat-card--warn     .bat-card__icon { background: #fef3c7; color: #b45309; }
.bat-card--critical .bat-card__icon { background: #fee2e2; color: #b91c1c; }

.bat-card__body {
    flex: 1;
    min-width: 0;
}
.bat-card__name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bat-card__apt {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
}
.bat-card__model {
    font-size: 11px;
    color: var(--text-mute);
    margin-top: 2px;
}

.bat-card__right {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    align-items: flex-end;
}

/* ── Status pill ───────────────────────────────────────── */
.bat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    position: relative;
}
.bat-pill .hgi { font-size: 13px; }
.bat-pill__label {
    font-size: 10px;
    font-weight: 600;
    opacity: .75;
    margin-left: 2px;
}
.bat-pill--ok       { background: #dcfce7; color: #15803d; }
.bat-pill--charging { background: #dbeafe; color: #1d4ed8; }
.bat-pill--warn     { background: #fef3c7; color: #92400e; }
.bat-pill--critical { background: #fee2e2; color: #b91c1c; }
.bat-pill--offline  { background: var(--bg-soft); color: var(--text-mute); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .bat-summary { grid-template-columns: repeat(3, 1fr); }
    .bat-grid    { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .bat-summary { grid-template-columns: 1fr; }
    .bat-card    { flex-wrap: wrap; }
    .bat-card__right { flex-direction: row; flex-wrap: wrap; }
}
