:root {
    --primary: #d4a017;
    /* Predial Scan Yellow/Gold */
    --primary-dark: #b8860b;
    --secondary: #3e2723;
    /* Dark Brown */
    --bg-light: #f8f9fa;
    --bg-dark: #121212;
    --text-main: #333;
    --text-muted: #666;
    --white: #ffffff;
    --error: #d32f2f;
    --success: #388e3c;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Views */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: flex;
}

/* Login View */
#login-view {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, #1a0f0d 100%);
    padding: 20px;
}

.login-card {
    background: transparent;
    padding: 0;
    border-radius: 0;
    width: 100%;
    max-width: 400px;
    box-shadow: none;
    text-align: center;
}

.logo {
    width: 150px;
    margin-bottom: 40px;
}

h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--secondary);
}

header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    text-align: left;
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-main);
}

input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--secondary);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: none;
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-text {
    background: transparent;
    border: 1.5px solid transparent;
    color: var(--primary-dark);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-text:hover {
    color: var(--primary);
}

.error-msg {
    color: var(--error);
    font-size: 13px;
    margin-top: 15px;
}

/* Dashboard Layout */
#dashboard-view {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

#sidebar {
    width: 280px;
    background: linear-gradient(180deg, #4e342e 0%, #2c1e1c 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar-logo {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-img {
    max-width: 140px;
    height: auto;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 20px 0;
    overflow-y: auto;
}

#nav-links {
    list-style: none;
}

#nav-links li {
    margin-bottom: 4px;
    padding: 0 15px;
}

#nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    gap: 12px;
}

#nav-links a span {
    font-size: 18px;
    opacity: 1;
}

#nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    transform: translateX(5px);
}

#nav-links li.active a {
    background: var(--primary);
    color: var(--secondary);
    font-weight: 700;
}

#nav-links li.active a span {
    filter: brightness(0.2);
}

.sidebar-footer {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-info {
    margin-bottom: 15px;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#user-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(211, 47, 47, 0.08);
    color: #ff5252;
    border: 1.5px solid rgba(211, 47, 47, 0.2);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout:hover {
    background: #d32f2f;
    color: white;
}

.btn-full {
    width: 100% !important;
}

#content {
    flex-grow: 1;
    padding: 30px;
    background-color: var(--bg-light);
    height: 100vh;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

#view-title {
    flex-grow: 1;
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
}

#menu-toggle {
    background: transparent;
    border: none;
    color: var(--secondary);
    font-size: 24px;
    cursor: pointer;
    display: none;
    padding: 10px;
    margin-right: -10px;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebar-overlay.active {
    display: block;
    opacity: 1;
}

#dashboard-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--background);
}

body {
    background-color: var(--background) !important;
}

#lovable-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    /* Increased height to accommodate larger logo */
    background-color: #3e2723 !important;
    /* Lovable Brown */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    box-shadow: var(--shadow-sm);
}

.header-logo {
    height: 60px;
    /* Doubled from previous ~30-35px */
    object-fit: contain;
}

#sidebar {
    display: none;
    /* Hide old sidebar in favor of bottom nav */
}

#content {
    flex: 1;
    padding: 100px 20px 100px 20px !important;
    /* Adjusted top padding for taller header */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Fix Toggle Switches visibility */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--primary);
}

input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.content-header {
    margin-bottom: 24px;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

#bottom-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    /* Allow auto height for stats + nav */
    background-color: #ffffff !important;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.nav-stats-bar {
    background-color: #f9fafb;
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.nav-stats-item b {
    color: var(--primary);
}

.nav-links-container {
    height: 65px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}


#bottom-navigation a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    flex: 1;
    transition: var(--transition-base);
}

#bottom-navigation a i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

#bottom-navigation a.active {
    color: var(--primary);
}

#bottom-navigation a.active i {
    color: var(--primary);
}

@media (max-width: 768px) {
    #content {
        padding: 75px 15px 90px 15px;
    }

    #bottom-navigation span {
        font-size: 0.65rem;
    }
}

/* Table Design */
.panel {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #eee;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.badge {
    padding: 4px 8px;
    background: var(--primary);
    color: var(--white);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* Grids and Layouts */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.full-width {
    grid-column: span 2;
}

.separator {
    display: flex;
    align-items: center;
    margin: 25px 0 15px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    grid-column: span 2;
}

.separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #eee;
    margin-left: 15px;
}

.form-tip {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -10px;
}

/* Sensor Configuration */
.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* Botão Deslizante (Switch) */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f44336;
    /* Vermelho (OFF) */
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4CAF50;
    /* Verde (ON) */
}

input:focus+.slider {
    box-shadow: 0 0 1px #4CAF50;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.sensor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 12px 15px;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.sensor-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.sensor-item label {
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary);
    cursor: pointer;
}

/* Form Sections and Grid Layouts */
.form-section {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 20px;
}

.form-grid-lovable {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.form-group-lovable {
    grid-column: span 6;
}

.form-group-lovable.span-3 {
    grid-column: span 3;
}

.form-group-lovable.span-2 {
    grid-column: span 2;
}

.form-group-lovable.span-4 {
    grid-column: span 4;
}

.form-group-lovable label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

.form-group-lovable input,
.form-group-lovable textarea {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
    width: 100%;
}

.form-group-lovable input:focus {
    border-color: var(--primary);
    background-color: #fff;
    outline: none;
}

.form-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.btn-save-lovable {
    width: 100%;
    background-color: #f59e0b;
    color: #1a1a1a;
    font-weight: 600;
    padding: 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    margin-top: 24px;
}

@media (max-width: 600px) {

    .form-group-lovable.span-3,
    .form-group-lovable.span-2,
    .form-group-lovable.span-4 {
        grid-column: span 6;
    }
}


/* Telemetry Dashboard */
.telemetria-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.device-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--primary);
    transition: transform 0.2s;
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.device-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
    display: block;
}

.device-last-reading {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sensor-values {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
}

.sensor-card {
    padding: 16px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
    min-width: 0;
}

.sensor-label {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.sensor-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
}


.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.pulse {
    background: #e6fffa;
    color: #047857;
}

.status-badge.status-online {
    background: #dcfce7;
    color: #15803d;
    font-weight: 600;
}

.status-badge.status-offline {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 600;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e6f4ea;
    color: #1e8e3e;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    animation: blink 2s infinite ease-in-out;
}


/* Botão de atualização manual */
.btn-refresh {
    background: rgba(212, 160, 23, 0.1);
    color: var(--primary);
    border: 1px solid rgba(212, 160, 23, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 15px;
}

.btn-refresh:hover {
    background: var(--primary);
    color: var(--secondary);
}

.btn-refresh.spinning .icon-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .telemetria-grid {
        grid-template-columns: 1fr;
    }

    .sensor-values {
        grid-template-columns: 1fr;
    }

    #view-title .btn-refresh {
        margin-right: 5px;
        padding: 6px 10px;
    }
}

/* Configura��o de Sensores Granular */
.config-groups {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

.config-group h4 {
    color: var(--primary-dark);
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
}

.sensor-card {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.sensor-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
}

.sensor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sensor-header label {
    font-weight: 600;
    margin-bottom: 0;
}

.sensor-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}

.sensor-inputs.multi-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mini-group label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.mini-group input {
    padding: 8px;
    font-size: 14px;
    width: 100%;
}

.sensor-grid-simple {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.sensor-item-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
}

.sensor-item-simple span {
    font-size: 14px;
    font-weight: 500;
}

/* Dashboard Stats Cards */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.bg-amber-100 {
    background-color: #fef3c7;
    color: #d97706;
}

.bg-blue-100 {
    background-color: #dbeafe;
    color: #2563eb;
}

/* Login Screen Redesign (Lovable Style) */
#login-view.active {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #3e2723;
    /* Dark brown background */
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}

.login-container {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo-large {
    height: 140px;
    margin-bottom: 0;
    object-fit: contain;
}

.login-subtitle {
    color: #f59e0b;
    font-size: 1.1rem;
    font-weight: 400;
    margin-top: 0;
}

.login-version-badge {
    text-align: center;
    margin-top: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(245, 158, 11, 0.6);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
    width: 100%;
    justify-content: center;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.pwa-install-hint {
    font-size: 0.70rem;
    color: rgba(245, 158, 11, 0.5);
    margin-top: 6px;
    margin-bottom: 0;
}

.login-card {
    width: 100%;
}

.login-form-group {
    margin-bottom: 24px;
}

.login-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #f59e0b;
    margin-bottom: 8px;
}

.login-input-dark {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 1rem;
    transition: all 0.2s;
}

.login-input-dark:focus {
    outline: none;
    border-color: #f59e0b;
    background-color: rgba(255, 255, 255, 0.12);
}

.login-input-dark::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-footer-links {
    display: flex;
    justify-content: flex-end;
    margin-top: -12px;
    margin-bottom: 30px;
}

.login-link-amber {
    color: #f59e0b;
    font-size: 0.8rem;
    text-decoration: none;
}

.login-btn-primary {
    width: 100%;
    background-color: #f59e0b;
    color: #1a1a1a;
    font-weight: 700;
    padding: 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
}

.login-btn-primary:hover {
    background-color: #d97706;
}

.login-input-wrapper {
    position: relative;
}

.login-input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

/* Lovable Sensor Cards */
.sensor-card-lovable {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.sensor-card-header {
    background: var(--bg-secondary);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sensor-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sensor-card-body {
    padding: 20px;
}

.sensor-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
}

.param-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.param-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.param-field input,
.param-field select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    /* Cinza um pouco mais escuro */
    border-radius: 8px;
    font-size: 0.85rem;
    background: #f9fafb;
    /* Cinza bem clarinho */
    color: #111827;
    /* Texto escuro para contrastar com o fundo claro */
}

.param-field input:focus,
.param-field select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.btn-save-lovable {
    background: var(--primary);
    color: #1a1b1e;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save-lovable:hover {
    background: var(--primary-hover);
}

.btn-save-lovable:active {
    transform: scale(0.98);
}

.var-badge {
    font-size: 0.70rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 6px;
    font-family: monospace;
    opacity: 0.8;
}

.hardware-section {
    margin-top: 32px;
    border-top: 2px dashed var(--border-color);
    padding-top: 24px;
}

.hardware-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toggle Switch Styling Refinement (Lovable Version) */
.toggle-switch-lovable {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.toggle-switch-lovable input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-lovable {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.toggle-slider-lovable:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked+.toggle-slider-lovable {
    background-color: #10b981;
}

input:checked+.toggle-slider-lovable:before {
    transform: translateX(22px);
}

/* ===== CARD NÍVEL CAIXA D'ÁGUA ===== */
.nivel-caixa-card {
    padding: 16px !important;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1.5px solid #bae6fd;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.nivel-caixa-card .sensor-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0369a1;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.nivel-percentual-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nivel-percentual {
    font-size: 2rem;
    font-weight: 800;
    color: #0c4a6e;
    line-height: 1;
}

.nivel-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

.nivel-status-badge.nivel-critico {
    background-color: #ef4444;
}

.nivel-status-badge.nivel-baixo {
    background-color: #f97316;
}

.nivel-status-badge.nivel-medio {
    background-color: #eab308;
    color: #1a1a1a;
}

.nivel-status-badge.nivel-cheio {
    background-color: #22c55e;
}

.nivel-bar-wrapper {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nivel-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.nivel-range-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: #475569;
    font-weight: 500;
}

.nivel-range-min {
    color: #ef4444;
    font-weight: 600;
}

.nivel-range-max {
    color: #22c55e;
    font-weight: 600;
}

.nivel-valor-atual {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0c4a6e;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 8px;
}

/* ===== CARD TEMPERATURA BOMBAS ===== */
.temp-bomba-card {
    padding: 16px !important;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1.5px solid #fde68a;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    transition: border-color 0.4s ease, background 0.4s ease;
}

.temp-bomba-card.temp-alerta {
    background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    animation: temp-pulse 1.2s ease-in-out infinite;
}

.temp-bomba-card.temp-atencao {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #fdba74;
}

@keyframes temp-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.temp-bomba-card .sensor-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.temp-valor-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.temp-valor-atual {
    font-size: 2rem;
    font-weight: 800;
    color: #78350f;
    line-height: 1;
}

.temp-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

.temp-status-badge.temp-normal {
    background-color: #22c55e;
}

.temp-status-badge.temp-quente {
    background-color: #eab308;
    color: #1a1a1a;
}

.temp-status-badge.temp-atencao {
    background-color: #f97316;
}

.temp-status-badge.temp-alerta {
    background-color: #ef4444;
}

.temp-bar-wrapper {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.temp-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.temp-range-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: #78350f;
    font-weight: 500;
    gap: 6px;
}

.temp-range-min {
    color: #94a3b8;
    white-space: nowrap;
}

.temp-max-label {
    color: #ef4444;
    font-weight: 700;
    white-space: nowrap;
}

.temp-valor-pct {
    font-size: 0.72rem;
    color: #78350f;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dashboard Alerts Card - Premium Redesign */
.alerts-container-wrapper {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-out;
}

.alerts-group {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.alerts-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.alerts-group-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alerts-group-title i {
    color: #d4a017;
    font-size: 1.3rem;
}

.alerts-group-title h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #3e2723;
    letter-spacing: -0.01em;
}

.alerts-count-badge {
    background: #fee2e2;
    color: #ef4444;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.alert-list-v2 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item-v2 {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
}

.alert-item-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.alert-item-v2 i {
    font-size: 1.4rem;
    width: 28px;
    text-align: center;
}

.alert-item-v2 .alert-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-item-v2 .alert-msg {
    font-size: 0.95rem;
    font-weight: 600;
}

.alert-item-v2 .alert-sub {
    font-size: 0.8rem;
    opacity: 0.8;
}

.alert-item-v2 .alert-arrow {
    opacity: 0.2;
    transition: all 0.3s;
}

.alert-item-v2:hover .alert-arrow {
    opacity: 0.8;
    transform: translateX(4px);
}

/* Severity Variants */
.severity-critical {
    background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 100%);
    border-color: #fecaca;
    color: #9f1239;
}

.severity-critical i {
    color: #e11d48;
    animation: pulse-icon 1.5s infinite;
}

.severity-high {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #fed7aa;
    color: #9a3412;
}

.severity-high i {
    color: #ea580c;
}

.severity-medium {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-color: #fef08a;
    color: #854d0e;
}

.severity-medium i {
    color: #ca8a04;
}

.severity-offline {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: #e2e8f0;
    color: #334155;
}

.severity-offline i {
    color: #64748b;
}

@keyframes pulse-icon {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(225, 29, 72, 0));
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px rgba(225, 29, 72, 0.4));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(225, 29, 72, 0));
    }
}

/* Redesign Alerts to Grid Layout */
.alert-list-v2 {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 15px !important;
    flex-direction: unset !important;
}

.alert-item-v2 {
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    padding: 16px !important;
    min-height: 100px !important;
    justify-content: space-between !important;
}

.alert-item-v2 i {
    font-size: 1.5rem !important;
    margin-bottom: 8px !important;
    width: auto !important;
}

.alert-item-v2 .alert-body {
    width: 100% !important;
}

.alert-item-v2 .alert-msg {
    display: block !important;
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
}

.alert-item-v2 .alert-arrow {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
}

@media (min-width: 1200px) {
    .alert-list-v2 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 1199px) and (min-width: 768px) {
    .alert-list-v2 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Compact Grid Layout for Alerts (5 per line) */
.alert-list-v2 {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 12px !important;
}

@media (min-width: 1400px) {
    .alert-list-v2 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (max-width: 1399px) and (min-width: 1024px) {
    .alert-list-v2 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 1023px) and (min-width: 768px) {
    .alert-list-v2 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

.alert-item-v2 {
    padding: 12px !important;
    min-height: 85px !important;
}

.alert-item-v2 i {
    font-size: 1.25rem !important;
}

.alert-item-v2 .alert-msg {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
}

/* Standardized Premium Form System - Lovable Style */
.premium-form-view-container {
    padding: 24px;
    max-width: 900px;
    margin: 0 auto 100px auto;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.premium-hero {
    background: linear-gradient(135deg, var(--color-brown-deep) 0%, #3d2900 100%);
    border-radius: 24px;
    padding: 40px;
    color: white;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.premium-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(245, 168, 0, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.premium-avatar-large {
    width: 100px;
    height: 100px;
    background: var(--color-primary);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--color-brown-deep);
    box-shadow: 0 10px 20px rgba(245, 168, 0, 0.2);
    flex-shrink: 0;
}

.premium-hero-content h2 {
    color: var(--color-primary);
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.premium-hero-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.premium-sections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.premium-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s;
}

.premium-card:hover {
    transform: translateY(-4px);
}

.premium-card.full-width {
    grid-column: span 2;
}

.premium-card h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-brown-deep);
    font-size: 1.1rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.premium-card h4 i {
    color: var(--color-primary);
}

.premium-input-group {
    margin-bottom: 20px;
}

.premium-input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    color: #1e293b;
    background-color: #f8fafc;
    transition: all 0.2s;
}

.premium-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(245, 168, 0, 0.1);
}

.premium-input::placeholder {
    color: #94a3b8;
}

.premium-actions-bar {
    grid-column: span 2;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 10px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 20px;
}

@media (max-width: 768px) {
    .premium-sections-grid {
        grid-template-columns: 1fr;
    }

    .premium-card.full-width,
    .premium-actions-bar {
        grid-column: span 1;
    }

    .premium-hero {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
}

.btn-premium-save {
    background: var(--color-primary);
    color: var(--color-brown-deep);
    padding: 14px 30px;
    border-radius: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 20px rgba(245, 168, 0, 0.2);
    transition: all 0.3s;
}

.btn-premium-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(245, 168, 0, 0.3);
    background: var(--color-primary-dark);
}

.btn-premium-cancel {
    background: #f1f5f9;
    color: #64748b;
    padding: 14px 25px;
    border-radius: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-premium-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.premium-warning-box {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    padding: 12px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.premium-warning-box i {
    color: #d97706;
}

.premium-warning-box p {
    font-size: 0.75rem;
    color: #92400e;
    margin: 0;
}