/* SLDS Backend — sujala.org theme */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

:root {
    --primary: #C62828;
    --primary-dark: #B71C1C;
    --primary-light: #FFEBEE;
    --accent: #F9A825;
    --accent-dark: #F57F17;
    --accent-light: #FFF8E1;
    --text: #1a1a2e;
    --text-light: #546E7A;
    --bg: #FFFDF7;
    --white: #ffffff;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(198, 40, 40, 0.12);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body.backend-app {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.backend-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8rem;
    padding: 8px 16px;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.backend-topbar-brand {
    flex: 1;
    text-align: left;
    min-width: 0;
    font-family: "Poppins", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backend-topbar-brand-compact {
    font-size: 0.78rem;
}

.backend-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: auto;
}

.backend-topbar-form {
    margin: 0;
    display: inline-flex;
}

.backend-topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0.35rem 0.85rem;
    font-family: "Poppins", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--primary-dark);
    background: var(--accent);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.backend-topbar-btn:hover {
    background: var(--white);
    color: var(--primary-dark);
}

.backend-topbar-btn-outline {
    color: var(--white);
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
}

.backend-topbar-btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    border-color: var(--white);
}

.backend-topbar-link {
    box-sizing: border-box;
}

.backend-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
}

.backend-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.backend-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    padding: 1.5rem;
    margin: 1rem auto;
    max-width: 520px;
    text-align: center;
}

.backend-card h2,
.backend-card .card-heading {
    font-family: "Poppins", sans-serif;
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin: 0 0 1rem;
}

.backend-login-card {
    max-width: 420px;
    padding: 2rem 1.75rem;
}

.login-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: -0.5rem 0 1.5rem;
}

.backend-login-form {
    text-align: left;
}

.backend-login-form .form-field {
    margin-bottom: 1.15rem;
}

.backend-login-form .form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.4rem;
}

.backend-login-form .form-input {
    display: block;
    width: 100%;
    max-width: none;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
}

.backend-login-form .form-input::placeholder {
    color: #b0bec5;
    font-size: 0.92rem;
}

.backend-login-form .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.backend-login-form .form-readonly {
    background: var(--primary-light);
    border-color: #ef9a9a;
    color: var(--primary-dark);
    font-weight: 600;
    cursor: default;
}

.backend-login-form .form-or {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.25rem 0 1rem;
    letter-spacing: 0.05em;
}

.backend-login-form .form-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.backend-login-form .form-submit {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    letter-spacing: 0.02em;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(198, 40, 40, 0.25);
}

.backend-login-form .form-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(198, 40, 40, 0.35);
    background: linear-gradient(135deg, #D32F2F, var(--primary));
}

.backend-form {
    margin: 0 auto;
    text-align: center;
}

.backend-login-form table {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border: none !important;
}

.backend-login-form table td {
    border: none !important;
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
    text-align: left;
    vertical-align: middle;
}

.backend-login-form table td:first-child {
    font-weight: 600;
    color: var(--text-light);
    width: 42%;
}

.backend-or {
    text-align: center;
    padding: 0.5rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.backend-hint {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0.5rem 0 1rem;
}

.backend-content form {
    display: block;
    margin: 1.25rem auto;
    max-width: 100%;
}

.backend-content table {
    width: 100%;
    max-width: 100%;
    margin: 0.5rem auto 1rem;
    border-collapse: collapse;
    border: 1px solid #e8e8e8 !important;
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.88rem;
    background: var(--white);
    box-shadow: var(--shadow);
}

.backend-content caption {
    caption-side: top;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-dark);
    padding: 0.75rem;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-light));
    border-bottom: 2px solid var(--accent);
}

.backend-content th {
    background: var(--primary-dark) !important;
    color: var(--white) !important;
    font-weight: 600;
    padding: 0.65rem 0.5rem !important;
    border: 1px solid var(--primary-dark) !important;
    font-size: 0.85rem;
}

.backend-content td {
    padding: 0.55rem 0.5rem !important;
    border: 1px solid #eee !important;
    vertical-align: middle;
}

.backend-content tr:nth-child(even) td {
    background: #fafafa;
}

.backend-content td[style*="e0ebeb"],
.backend-content th[style*="e0ebeb"] {
    background: var(--primary-light) !important;
    color: var(--primary-dark) !important;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"],
select {
    width: 100%;
    max-width: 280px;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: var(--white);
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

input[type="submit"],
button[type="submit"]:not(.dashboard-btn):not(.backend-module-btn):not(.backend-topbar-btn):not(.form-submit):not(.backend-pick-btn):not(.backend-section-btn) {
    display: inline-block;
    min-height: 44px;
    padding: 0.6rem 1.5rem;
    margin: 0.35rem;
    font-family: "Poppins", sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(198, 40, 40, 0.25);
    transition: var(--transition);
}

input[type="submit"]:hover,
button[type="submit"]:not(.dashboard-btn):not(.backend-module-btn):not(.backend-topbar-btn):not(.form-submit):not(.backend-pick-btn):not(.backend-section-btn):hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(198, 40, 40, 0.35);
    background: linear-gradient(135deg, #D32F2F, var(--primary));
}

input[type="submit"][value="Home"],
input[type="submit"][value="Previous page"] {
    background: var(--white);
    color: var(--primary-dark);
    border: 2px solid var(--primary);
    box-shadow: none;
}

input[type="submit"][value="Home"]:hover,
input[type="submit"][value="Previous page"]:hover {
    background: var(--primary-light);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.backend-pick-table {
    max-width: 95% !important;
}

.backend-pick-table form {
    margin: 0;
}

.backend-pick-table input[type="submit"] {
    padding: 0.4rem 1rem;
    min-height: 36px;
    font-size: 0.8rem;
}

.backend-footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    padding: 1.25rem;
    margin-top: 2rem;
    border-top: 4px solid var(--accent);
    font-size: 0.85rem;
}

.backend-footer p { margin: 0; }

.backend-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.backend-footer a:hover { color: var(--white); }

.backend-footer-embed {
    margin-top: 0;
    padding: 0.6rem 0.75rem;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.backend-footer-embed p {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.15rem 0.35rem;
    line-height: 1.45;
}

.backend-dashboard {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 0 0.75rem;
    text-align: center;
}

.backend-page-header {
    margin: 0 0 1.25rem;
    text-align: center;
}

.backend-page-header .page-heading,
.page-heading {
    font-family: "Poppins", sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0 0 0.35rem;
    line-height: 1.25;
}

.backend-page-header .page-subtitle,
.page-subtitle {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.45;
}

.backend-consumer-view {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.backend-consumer-form {
    margin: 0 0 0.85rem;
}

.backend-section-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.backend-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-light));
    border-bottom: 1px solid #f0d9d9;
}

.backend-section-title {
    margin: 0;
    font-family: "Poppins", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.backend-section-action {
    flex-shrink: 0;
}

.backend-section-btn,
input.backend-section-btn {
    min-height: 34px;
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    margin: 0;
    border-radius: 50px;
}

.backend-kv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.backend-kv-grid-compact {
    padding: 0.5rem;
}

.backend-kv-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    text-align: left;
}

.backend-kv-item-full {
    grid-column: 1 / -1;
    border-right: none;
}

.backend-kv-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-light);
}

.backend-kv-value {
    font-size: 0.9rem;
    color: var(--text);
    word-break: break-word;
}

.backend-form-card {
    max-width: 640px;
    margin: 0 auto 1rem;
    text-align: left;
}

.backend-pick-card {
    max-width: 520px;
    margin: 0 auto;
}

.backend-pick-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.backend-pick-item {
    margin: 0;
}

.backend-pick-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    padding: 0.85rem 1rem;
    margin: 0;
    min-height: auto;
    border: 1.5px solid #ef9a9a;
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-weight: inherit;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: var(--transition);
}

.backend-pick-btn:hover {
    background: #ffebee;
    color: var(--text);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
    transform: none;
}

.backend-pick-name {
    font-family: "Poppins", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.backend-pick-meta {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.4;
}

.backend-inline-note {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.backend-inline-form {
    margin: 0 0 1rem;
}

.backend-inline-btn {
    min-height: 38px;
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
}

.backend-edit-table {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.backend-edit-table select,
.backend-edit-table input[type="text"] {
    max-width: 100%;
    width: 100%;
}

.backend-rdu-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}

.backend-rdu-pick {
    display: block;
    cursor: pointer;
}

.backend-rdu-pick > input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.backend-rdu-pick-body {
    display: block;
    padding: 0.9rem 1rem;
    border: 1.5px solid #ef9a9a;
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    background: #fff;
    transition: var(--transition);
}

.backend-rdu-pick > input[type="radio"]:checked + .backend-rdu-pick-body {
    background: #ffebee;
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}

.backend-rdu-pick-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin-bottom: 0.5rem;
}

.backend-rdu-pick-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-dark);
    background: var(--accent-light);
    padding: 0.15rem 0.45rem;
    border-radius: 50px;
}

.backend-rdu-pick-name {
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    color: var(--primary-dark);
    flex: 1;
}

.backend-rdu-pick-id {
    font-size: 0.8rem;
    color: var(--text-light);
}

.backend-rdu-pick-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text);
}

.backend-rdu-pick-meta em {
    display: block;
    font-style: normal;
    font-size: 0.68rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 600;
}

.backend-rdu-pick-action {
    display: inline-block;
    margin-top: 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
}

.backend-rdu-detail {
    margin: 0.5rem 0 1rem;
}

.backend-rdu-info-only {
    margin-bottom: 0.75rem;
}

.backend-hw-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.backend-hw-field input[type="text"] {
    max-width: 140px;
}

.backend-hw-disable {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.backend-module-grid {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
}

.backend-module-item {
    display: flex;
    flex: 0 0 auto;
    width: 100%;
    min-height: 56px;
    margin: 0;
}

.backend-module-item form,
form.backend-module-item {
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0;
}

a.backend-module-item,
.backend-module-link {
    text-decoration: none;
    color: inherit;
}

.backend-module-btn,
button.backend-module-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    width: 100%;
    height: 100%;
    padding: 0.5rem 0.9rem;
    margin: 0;
    font-family: inherit;
    text-align: left;
    background: #ffffff;
    border: 1.5px solid #ef9a9a;
    border-radius: 10px;
    border-left: 5px solid var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    color: var(--text);
    box-sizing: border-box;
    white-space: nowrap;
}

.backend-module-btn:hover,
button.backend-module-btn:hover {
    background: #ffebee;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.16);
}

.backend-module-btn.module-device {
    border-color: #ffe082;
    border-left-color: var(--accent-dark);
}
.backend-module-btn.module-device:hover { background: #fff8e1; }

.backend-module-btn.module-tap {
    border-color: #a5d6a7;
    border-left-color: #2e7d32;
}
.backend-module-btn.module-tap:hover { background: #e8f5e9; }

.backend-module-btn.module-search {
    border-color: #90caf9;
    border-left-color: #1565c0;
}
.backend-module-btn.module-search:hover { background: #e3f2fd; }

.backend-module-icon {
    font-size: 1.35rem;
    line-height: 1;
    margin: 0;
    flex-shrink: 0;
}

.backend-module-label {
    display: inline;
    font-family: "Poppins", sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--primary-dark);
    white-space: normal;
    text-align: left;
}

.backend-module-btn.module-device .backend-module-label { color: #e65100; }
.backend-module-btn.module-tap .backend-module-label { color: #2e7d32; }
.backend-module-btn.module-search .backend-module-label { color: #0d47a1; }

.form-submit-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--white) !important;
}

.backend-link-card .form-actions {
    margin-top: 0.5rem;
}

.backend-info-table td:first-child {
    font-weight: 600;
    background: var(--primary-light) !important;
    color: var(--primary-dark) !important;
    text-align: left !important;
    width: 38%;
}

.backend-info-table td:last-child {
    text-align: left !important;
}

.backend-status-warn {
    color: var(--primary-dark);
    font-weight: 600;
}

.backend-status-ok {
    color: #2e7d32;
    font-weight: 600;
}

.backend-content p[style*="font-size:16px"] {
    font-size: 1rem !important;
    color: var(--text-light);
    margin: 0.75rem 0;
}

.backend-wide-card {
    max-width: 100%;
    text-align: left;
}

.backend-data-form {
    margin: 0;
    text-align: left;
}

.backend-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0 1rem;
    border-radius: var(--radius);
}

.backend-data-table {
    width: 100%;
    min-width: 720px;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0;
}

.backend-data-table caption {
    caption-side: top;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-dark);
    padding: 0.75rem;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-light));
    border-bottom: 2px solid var(--accent);
    text-align: center;
}

.backend-data-table th,
.backend-data-table td {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 0.65rem 0.5rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.backend-data-table th {
    white-space: nowrap;
    font-size: 0.8rem;
}

.backend-data-table td.device-input-cell {
    min-width: 130px;
    white-space: normal;
}

.backend-data-table .device-input-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.backend-data-table .device-input-wrap input[type="text"] {
    max-width: 90px;
    text-align: center;
    margin: 0;
}

.backend-data-table .device-input-wrap label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

.backend-data-table .device-input-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.backend-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin: 1rem auto;
    max-width: 520px;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.5;
}

.backend-alert-error {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #ef9a9a;
}

.backend-alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.backend-alert-info {
    background: var(--accent-light);
    color: #e65100;
    border: 1px solid #ffe082;
}

.backend-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.backend-content input[type="radio"] {
    accent-color: var(--primary);
    margin-right: 0.35rem;
}

@media (max-width: 768px) {
    .backend-topbar { padding: 8px 10px; }
    .backend-topbar-brand { font-size: 0.72rem; }
    .backend-topbar-btn { padding: 0.3rem 0.65rem; font-size: 0.72rem; }
    .backend-main { padding: 0.75rem 0.5rem 1.25rem; }
    .backend-card { padding: 1rem; margin: 0.75rem auto; }
    .backend-login-form table td { display: block; width: 100%; }
    input[type="text"], input[type="password"], input[type="tel"], select { max-width: 100%; }

    .backend-dashboard {
        max-width: 100%;
        padding: 0 0.5rem;
    }

    .backend-page-header .page-heading,
    .page-heading { font-size: 1.2rem; }

    .backend-kv-grid {
        grid-template-columns: 1fr;
    }

    .backend-kv-item {
        border-right: none;
    }

    .backend-section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .backend-section-action {
        text-align: center;
    }

    .backend-rdu-pick-meta {
        grid-template-columns: 1fr;
    }

    .backend-module-grid {
        gap: 10px;
        padding: 0;
    }

    .backend-module-item {
        min-height: 48px;
    }

    .backend-module-icon { font-size: 1.2rem; }
    .backend-module-label { font-size: 0.88rem; }

    .backend-responsive-table thead {
        display: none;
    }

    .backend-responsive-table tbody tr {
        display: block;
        margin-bottom: 0.85rem;
        padding: 0.65rem;
        border: 1px solid #eee;
        border-radius: 10px;
        background: #fff;
    }

    .backend-responsive-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.45rem 0 !important;
        border: none !important;
        background: transparent !important;
        text-align: right !important;
    }

    .backend-responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary-dark);
        text-align: left;
        flex: 0 0 42%;
        font-size: 0.8rem;
    }

    .backend-responsive-table tbody td[data-label=""]::before,
    .backend-responsive-table .backend-edit-actions td:empty::before {
        display: none;
    }

    .backend-responsive-table .backend-edit-actions td {
        justify-content: center;
    }

    .backend-data-table {
        min-width: 0;
    }

    .backend-table-scroll {
        overflow: visible;
    }
}

/* Embedded in bibo overlay / iframe */
html.backend-embed,
html.backend-embed body.backend-app {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

html.backend-embed body.backend-app {
    background: #fff;
    display: block;
}

html.backend-embed .backend-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 8px 12px;
}

html.backend-embed .backend-topbar-brand-compact {
    font-size: 0.78rem;
}

html.backend-embed .backend-main {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.75rem 1rem 1.25rem;
    overflow: visible;
}

html.backend-embed .backend-dashboard {
    width: 100%;
    max-width: 400px;
    margin: 0.5rem auto 1rem;
    padding: 0;
}

html.backend-embed .backend-consumer-view {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: 0.5rem;
}

html.backend-embed .backend-module-grid {
    width: 100%;
    gap: 12px;
}

html.backend-embed .backend-module-item {
    width: 100%;
    min-height: 52px;
}

html.backend-embed .backend-module-btn,
html.backend-embed button.backend-module-btn {
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    min-height: 52px;
}

html.backend-embed .backend-module-btn:hover,
html.backend-embed button.backend-module-btn:hover {
    transform: none;
}

html.backend-embed .backend-module-icon { font-size: 1.3rem; }
html.backend-embed .backend-module-label { font-size: 0.95rem; }

html.backend-embed .backend-footer-embed {
    margin-top: 0;
}

@media (max-width: 480px) {
    html.backend-embed .backend-main {
        padding: 0.5rem 0.75rem 1rem;
    }

    html.backend-embed .backend-topbar {
        padding: 6px 10px;
    }

    html.backend-embed .backend-topbar-brand-compact {
        font-size: 0.72rem;
    }

    html.backend-embed .backend-topbar-btn {
        padding: 0.28rem 0.55rem;
        font-size: 0.68rem;
        min-height: 28px;
    }

    html.backend-embed .backend-module-grid {
        gap: 10px;
    }

    html.backend-embed .backend-module-item,
    html.backend-embed .backend-module-btn,
    html.backend-embed button.backend-module-btn {
        min-height: 48px;
    }

    html.backend-embed .backend-module-icon { font-size: 1.15rem; }
    html.backend-embed .backend-module-label { font-size: 0.88rem; }

    html.backend-embed .backend-footer-embed {
        padding: 0.45rem 0.5rem;
        font-size: 0.65rem;
    }
}
