/* ─── Double O Rentals — Global Styles ─── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

/* ─── Navbar ─── */
.navbar {
    background: #fff;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-wrap: nowrap;
}
.navbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
}
.navbar .brand img { height: 32px; width: auto; flex-shrink: 0; }
.navbar h1 {
    color: #1a73e8;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.nav-user {
    color: #555;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ─── Buttons ─── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d8e47; }
.btn-danger { background: #fce8e6; color: #d32f2f; }
.btn-danger:hover { background: #f8d7da; }
.btn-light { background: #e8f0fe; color: #1a73e8; }
.btn-light:hover { background: #d2e3fc; }
.btn-logout { background: #fce8e6; color: #d32f2f; }
.btn-logout:hover { background: #f8d7da; }
.btn-warning { background: #fff3e0; color: #e65100; }
.btn-warning:hover { background: #ffe0b2; }
.btn-sm { padding: 6px 12px; font-size: 0.76rem; }

/* ─── Container ─── */
.container {
    max-width: 1200px;
    margin: 15px auto;
    padding: 0 12px;
    flex: 1;
    width: 100%;
}

/* ─── Relay Grid ─── */
.relay-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 10px 0;
}
.relay-tile {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 18px 12px;
    width: 140px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    user-select: none;
}
.relay-tile:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.relay-tile.pulsing {
    border-color: #34a853;
    background: #f0faf2;
    animation: pulse-glow 1s ease-in-out;
}
.relay-tile.ripple {
    animation: ripple-effect 0.6s ease-out;
}
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(52,168,83,0.4); }
    50% { box-shadow: 0 0 20px 8px rgba(52,168,83,0.2); }
    100% { box-shadow: 0 0 0 0 rgba(52,168,83,0); }
}
@keyframes ripple-effect {
    0% { transform: scale(0.97); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
.relay-tile .icon { font-size: 1.8rem; margin-bottom: 6px; }
.relay-tile .name {
    font-size: 0.82rem; font-weight: 600;
    color: #333; margin-bottom: 3px; word-break: break-word;
}
.relay-tile .channel { font-size: 0.68rem; color: #aaa; margin-bottom: 8px; }
.relay-tile .state {
    font-size: 0.7rem; font-weight: 600;
    padding: 3px 10px; border-radius: 12px; display: inline-block;
}
.state-closed { background: #f0f0f0; color: #888; }
.state-open { background: #e6f4ea; color: #1e8e3e; }
.pulse-btn {
    margin-top: 10px; padding: 8px 16px;
    background: #1a73e8; color: #fff;
    border: none; border-radius: 8px;
    font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: all 0.3s; width: 100%;
}
.pulse-btn:hover { background: #1557b0; }
.pulse-btn:disabled { background: #ccc; cursor: not-allowed; }
.pulse-btn.close-btn { background: #d32f2f; }
.pulse-btn.close-btn:hover { background: #b71c1c; }
.pulse-btn.close-btn:disabled { background: #ccc; }

/* ─── Sections ─── */
.section {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
}
.section h2 {
    color: #1a73e8; font-size: 1.1rem;
    margin-bottom: 15px; padding-bottom: 10px;
    border-bottom: 2px solid #e8f0fe;
}

/* ─── Forms ─── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; margin-bottom: 5px;
    color: #333; font-weight: 600; font-size: 0.84rem;
}
.form-group input,
.form-group select {
    width: 100%; padding: 11px 14px;
    border: 2px solid #e0e0e0; border-radius: 8px;
    font-size: 16px;
    outline: none; transition: border 0.3s;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus { border-color: #1a73e8; }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 10px 8px; text-align: left;
    border-bottom: 1px solid #f0f0f0; font-size: 0.82rem;
}
th {
    color: #888; font-weight: 600;
    font-size: 0.72rem; text-transform: uppercase;
    white-space: nowrap;
}

/* ─── Scrollable History ─── */
.history-scroll {
    max-height: 450px; overflow-y: auto;
    border: 1px solid #f0f0f0; border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}
.history-scroll table th {
    position: sticky; top: 0; background: #fff;
    z-index: 2; box-shadow: 0 1px 0 #f0f0f0;
}

/* ─── Tags ─── */
.relay-tag {
    display: inline-block; background: #e8f0fe;
    color: #1a73e8; padding: 2px 8px;
    border-radius: 12px; font-size: 0.7rem; margin: 1px;
}
.status-tag {
    display: inline-block; padding: 2px 10px;
    border-radius: 12px; font-size: 0.7rem; font-weight: 600;
}
.tag-active { background: #e6f4ea; color: #1e8e3e; }
.tag-suspended { background: #fce8e6; color: #d32f2f; }

/* ─── Checkbox Grid ─── */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 10px 0;
}
.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 8px 6px;
    border-radius: 8px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
.checkbox-grid label:active {
    background: #f0f0f0;
}
.checkbox-grid label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #1a73e8;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

/* ─── Relay Name Row (DESKTOP + ALL SIZES) ─── */
.relay-name-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    background: #fafafa;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #eee;
    transition: all 0.2s;
}
.relay-name-row:hover {
    border-color: #d2e3fc;
    background: #f5f9ff;
}
.relay-name-row span {
    min-width: 55px;
    font-weight: 700;
    color: #1a73e8;
    font-size: 0.86rem;
    background: #e8f0fe;
    padding: 6px 12px;
    border-radius: 8px;
    text-align: center;
    flex-shrink: 0;
}
.relay-name-row input {
    flex: 1;
    padding: 11px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.92rem;
    outline: none;
    transition: border 0.3s, box-shadow 0.3s;
    background: #fff;
}
.relay-name-row input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* ─── Messages ─── */
.msg {
    padding: 10px; border-radius: 8px;
    margin-top: 10px; font-size: 0.82rem; display: none;
}
.msg-ok { background: #e6f4ea; color: #1e8e3e; }
.msg-err { background: #fce8e6; color: #d32f2f; }

/* ─── Status Bar ─── */
.status-bar {
    text-align: center; margin-top: 15px;
    color: #aaa; font-size: 0.74rem;
}

/* ─── Modal ─── */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100; align-items: flex-start; justify-content: center;
    padding: 20px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: 16px;
    padding: 28px 22px; width: 100%; max-width: 500px;
    margin: auto;
    position: relative;
}
.modal h3 { color: #1a73e8; margin-bottom: 20px; font-size: 1.15rem; }
.modal-btns {
    display: flex; gap: 10px; margin-top: 20px;
}
.modal-btns .btn { flex: 1; padding: 13px; }

/* ─── Password Row ─── */
.password-row {
    display: flex; gap: 8px; align-items: stretch;
}
.password-row input {
    flex: 1; min-width: 0;
    font-size: 16px !important;
}
.password-row .btn {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
}
.generated-pin {
    background: #e8f0fe; color: #1a73e8;
    padding: 10px 14px; border-radius: 10px;
    font-size: 1.3rem; font-weight: 700;
    letter-spacing: 5px; text-align: center;
    margin-top: 10px; display: none; font-family: monospace;
}

/* ─── Login ─── */
.login-wrapper {
    flex: 1; display: flex;
    align-items: center; justify-content: center; padding: 20px 15px;
}
.login-box {
    background: #fff; border-radius: 16px;
    padding: 35px 25px; width: 100%; max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); text-align: center;
}
.login-box .logo { margin-bottom: 15px; }
.login-box .logo img { height: 55px; width: auto; }
.login-box h1 { color: #1a73e8; font-size: 1.5rem; margin-bottom: 5px; }
.login-box .subtitle { color: #888; margin-bottom: 25px; font-size: 0.86rem; }
.login-box .form-group { text-align: left; }
.login-box .btn { width: 100%; padding: 14px; font-size: 1rem; }
.login-box .error {
    color: #d32f2f; text-align: center;
    margin-top: 15px; font-size: 0.86rem; display: none;
}

/* ─── History Filters ─── */
.history-filters {
    display: flex; gap: 8px; margin-bottom: 12px;
    flex-wrap: wrap; align-items: center;
}
.history-filters input,
.history-filters select {
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.82rem;
    outline: none;
    min-width: 0;
}
.history-filters input[type="text"] { flex: 1; min-width: 120px; }
.history-filters input[type="date"] { width: auto; }
.history-filters select { width: auto; }

.history-action {
    display: inline-block; padding: 2px 8px;
    border-radius: 12px; font-size: 0.7rem; font-weight: 600;
}
.action-open { background: #e6f4ea; color: #1e8e3e; }
.action-close { background: #fce8e6; color: #d32f2f; }
.action-system { background: #e8f0fe; color: #1a73e8; }
.pagination {
    display: flex; justify-content: center;
    gap: 6px; margin-top: 12px; flex-wrap: wrap;
}
.pagination button {
    padding: 6px 12px; border: 2px solid #e0e0e0;
    border-radius: 6px; background: #fff;
    cursor: pointer; font-size: 0.78rem;
}
.pagination button.active {
    background: #1a73e8; color: #fff; border-color: #1a73e8;
}

/* ─── Settings Rows ─── */
.setting-row {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 10px; flex-wrap: wrap;
}
.setting-row label { min-width: 120px; font-weight: 600; color: #555; font-size: 0.86rem; }
.setting-row input[type="number"],
.setting-row input[type="time"],
.setting-row input[type="text"],
.setting-row input[type="tel"] {
    width: 120px; padding: 8px 12px;
    border: 2px solid #e0e0e0; border-radius: 8px;
    font-size: 16px; outline: none;
}
.setting-row span { color: #888; font-size: 0.82rem; }

/* ─── SMS Section ─── */
.sms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}
.sms-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
}
.sms-card h4 {
    color: #1a73e8; font-size: 0.88rem;
    margin-bottom: 10px; padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.sms-toggle {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 7px 0; font-size: 0.84rem; color: #444;
    gap: 10px;
}
.sms-toggle .toggle-label { flex: 1; min-width: 0; }
.switch {
    position: relative; width: 44px; height: 24px;
    display: inline-block; flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc; border-radius: 12px; transition: 0.3s;
}
.slider:before {
    content: ""; position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: 0.3s;
}
.switch input:checked + .slider { background: #34a853; }
.switch input:checked + .slider:before { transform: translateX(20px); }

.day-picker {
    display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0;
}
.day-picker label {
    display: flex; align-items: center;
    gap: 4px; font-size: 0.78rem;
    background: #f0f0f0; padding: 6px 10px;
    border-radius: 6px; cursor: pointer;
}
.day-picker input:checked + span { color: #1a73e8; font-weight: 600; }
.time-row {
    display: flex; gap: 10px; align-items: center; margin: 8px 0;
}
.time-row label { font-size: 0.84rem; color: #555; min-width: 45px; }
.time-row input {
    padding: 8px 10px; border: 2px solid #e0e0e0;
    border-radius: 8px; font-size: 16px; outline: none;
    width: auto;
}

/* ─── SMS Log ─── */
.sms-log-scroll {
    max-height: 350px; overflow-y: auto;
    border: 1px solid #f0f0f0; border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}
.sms-log-scroll table th {
    position: sticky; top: 0; background: #fff;
    z-index: 2; box-shadow: 0 1px 0 #f0f0f0;
}
.sms-success { color: #1e8e3e; }
.sms-failed { color: #d32f2f; }

/* ─── Footer ─── */
.footer {
    background: #fff; text-align: center;
    padding: 15px 15px; border-top: 1px solid #eee;
    margin-top: auto;
}
.footer p { color: #999; font-size: 0.74rem; line-height: 1.6; }
.footer a { color: #1a73e8; text-decoration: none; font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* ════════════════════════════════════════
   RESPONSIVE — TABLET
   ════════════════════════════════════════ */
@media (max-width: 768px) {
    .navbar { padding: 10px 12px; }
    .navbar h1 { font-size: 1.05rem; }
    .navbar .brand img { height: 28px; }
    .nav-right { gap: 5px; }
    .nav-right .btn { padding: 5px 10px; font-size: 0.72rem; }
    .nav-user { font-size: 0.76rem; }

    .container { padding: 0 10px; margin: 10px auto; }
    .section { padding: 16px 14px; }
    .section h2 { font-size: 1rem; margin-bottom: 12px; }

    .relay-tile { width: 115px; padding: 14px 10px; }
    .relay-tile .icon { font-size: 1.5rem; }
    .relay-tile .name { font-size: 0.78rem; }
    .relay-grid { gap: 10px; }

    th, td { padding: 8px 6px; font-size: 0.76rem; }

    .sms-grid { grid-template-columns: 1fr; }
    .setting-row { flex-direction: column; align-items: flex-start; gap: 5px; }
    .setting-row input { width: 100%; }

    .history-scroll { max-height: 350px; }
    .sms-log-scroll { max-height: 300px; }

    .relay-name-row { padding: 10px 12px; gap: 10px; }
    .relay-name-row input { font-size: 0.88rem; padding: 10px 12px; }
}

/* ════════════════════════════════════════
   RESPONSIVE — PHONE
   ════════════════════════════════════════ */
@media (max-width: 480px) {
    .navbar {
        padding: 8px 10px;
        justify-content: space-between;
        flex-wrap: nowrap;
    }
    .navbar .brand {
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
    }
    .navbar .brand img { height: 24px; }
    .navbar h1 {
        font-size: 0.85rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .nav-right {
        flex-shrink: 0;
        gap: 4px;
    }
    .nav-right .btn {
        padding: 6px 8px;
        font-size: 0.68rem;
        border-radius: 6px;
    }
    .nav-user { display: none; }

    .container { padding: 0 6px; margin: 6px auto; }
    .section { padding: 14px 12px; margin-bottom: 10px; border-radius: 12px; }
    .section h2 { font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 8px; }

    .btn { padding: 8px 14px; font-size: 0.78rem; }
    .btn-sm { padding: 5px 10px; font-size: 0.72rem; }

    /* ── Relay tiles BIG on phone ── */
    .relay-grid {
        gap: 10px;
        padding: 8px 0;
    }
    .relay-tile {
        width: calc(50% - 6px);
        padding: 22px 12px;
        border-radius: 18px;
    }
    .relay-tile .icon {
        font-size: 2.8rem;
        margin-bottom: 10px;
    }
    .relay-tile .name {
        font-size: 0.95rem;
        margin-bottom: 4px;
    }
    .relay-tile .channel {
        font-size: 0.75rem;
        margin-bottom: 10px;
    }
    .relay-tile .state {
        font-size: 0.8rem;
        padding: 4px 14px;
    }
    .pulse-btn {
        margin-top: 10px;
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 12px;
        font-weight: 700;
    }

    /* ── Relay Name Rows on phone ── */
    .relay-name-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 14px 12px;
        border-radius: 12px;
    }
    .relay-name-row span {
        min-width: auto;
        font-size: 0.84rem;
        align-self: flex-start;
    }
    .relay-name-row input {
        padding: 14px 12px;
        font-size: 16px;
        border-radius: 10px;
    }

    /* ── Modal — FULL SCREEN ── */
    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }
    .modal {
        padding: 26px 20px 34px 20px;
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }
    .modal h3 {
        font-size: 1.35rem;
        margin-bottom: 24px;
        text-align: center;
        padding-top: 12px;
    }
    .modal-btns {
        flex-direction: column;
        gap: 10px;
        margin-top: 26px;
        padding-bottom: 28px;
    }
    .modal-btns .btn {
        width: 100%;
        padding: 17px;
        font-size: 1.08rem;
        border-radius: 12px;
    }

    .form-group { margin-bottom: 20px; }
    .form-group label {
        font-size: 0.98rem;
        margin-bottom: 8px;
    }
    .form-group input,
    .form-group select {
        padding: 16px 14px;
        font-size: 16px;
        border-radius: 12px;
    }

    .password-row {
        flex-direction: row;
        gap: 8px;
    }
    .password-row input {
        padding: 16px 14px;
        border-radius: 12px;
    }
    .password-row .btn {
        min-width: 60px;
        min-height: 56px;
        padding: 12px 14px;
        font-size: 1.5rem;
        border-radius: 12px;
    }

    /* ── Checkboxes BIG on phone ── */
    .checkbox-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .checkbox-grid label {
        padding: 16px 12px;
        font-size: 1.02rem;
        background: #fafafa;
        border-radius: 12px;
        border: 2px solid #f0f0f0;
        gap: 12px;
        transition: all 0.15s;
    }
    .checkbox-grid label:active {
        background: #e8f0fe;
        border-color: #1a73e8;
    }
    .checkbox-grid label input[type="checkbox"] {
        width: 26px;
        height: 26px;
        accent-color: #1a73e8;
    }

    .generated-pin {
        font-size: 1.8rem;
        padding: 16px;
        letter-spacing: 10px;
        border-radius: 14px;
        margin-top: 12px;
    }

    /* Tables on phone */
    th, td { padding: 7px 4px; font-size: 0.72rem; }
    .relay-tag { font-size: 0.65rem; padding: 1px 6px; }
    .status-tag { font-size: 0.65rem; }

    /* History filters stack */
    .history-filters {
        flex-direction: column;
        gap: 6px;
    }
    .history-filters input,
    .history-filters select {
        width: 100%;
        font-size: 16px;
        padding: 12px;
        border-radius: 10px;
    }
    .history-filters .btn {
        width: 100%;
        padding: 12px;
        border-radius: 10px;
    }

    /* Settings */
    .setting-row { gap: 4px; }
    .setting-row label { min-width: auto; font-size: 0.82rem; }
    .setting-row input {
        width: 100%;
        font-size: 16px;
        padding: 12px;
        border-radius: 10px;
    }

    /* SMS cards */
    .sms-card { padding: 14px 12px; }
    .sms-card h4 { font-size: 0.84rem; }
    .sms-toggle { font-size: 0.88rem; padding: 8px 0; }
    .switch { width: 50px; height: 28px; }
    .slider:before { height: 22px; width: 22px; }
    .switch input:checked + .slider:before { transform: translateX(22px); }

    .day-picker { gap: 3px; }
    .day-picker label { padding: 8px 10px; font-size: 0.8rem; }
    .time-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .time-row input { width: 100%; padding: 12px; }

    /* Login */
    .login-box { padding: 28px 18px; }
    .login-box h1 { font-size: 1.3rem; }
    .login-box .logo img { height: 48px; }
    .login-box .subtitle { font-size: 0.82rem; margin-bottom: 20px; }
    .login-box .btn { padding: 16px; font-size: 1.05rem; border-radius: 12px; }
    .login-box .form-group input {
        padding: 15px 14px;
        border-radius: 12px;
    }

    /* Footer */
    .footer { padding: 12px 10px; }
    .footer p { font-size: 0.68rem; }

    /* Pagination */
    .pagination { gap: 4px; }
    .pagination button { padding: 8px 12px; font-size: 0.78rem; }
}

/* ════════════════════════════════════════
   RESPONSIVE — VERY SMALL PHONE (320-360)
   ════════════════════════════════════════ */
@media (max-width: 360px) {
    .navbar h1 { font-size: 0.78rem; }
    .navbar .brand img { height: 22px; }
    .nav-right .btn { padding: 5px 6px; font-size: 0.64rem; }

    .relay-tile {
        width: calc(50% - 5px);
        padding: 18px 8px;
    }
    .relay-tile .icon { font-size: 2.4rem; }
    .relay-tile .name { font-size: 0.88rem; }
    .pulse-btn { padding: 10px; font-size: 0.85rem; }

    .modal { padding: 22px 16px 28px 16px; }
    .modal h3 { font-size: 1.2rem; }
    .form-group input,
    .form-group select { padding: 14px 12px; }
    .form-group label { font-size: 0.92rem; }
    .modal-btns .btn { padding: 15px; font-size: 1rem; }

    .checkbox-grid label {
        padding: 14px 10px;
        font-size: 0.95rem;
    }
    .checkbox-grid label input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    th, td { padding: 6px 3px; font-size: 0.68rem; }

    .generated-pin { font-size: 1.5rem; letter-spacing: 8px; padding: 14px; }

    .relay-name-row { padding: 12px 10px; }
    .relay-name-row input { padding: 12px 10px; }
}

/* ═   ══════════════════════════════════════
   RESPONSIVE — LARGE PHONE LANDSCAPE
   ════════════════════════════════════════ */
@media (max-width: 480px) and (orientation: landscape) {
    .modal {
        min-height: auto;
        border-radius: 14px;
        margin: 10px;
    }
    .relay-tile {
        width: calc(33.33% - 8px);
        padding: 16px 10px;
    }
    .relay-tile .icon { font-size: 2rem; }
}