:root {
    --primary: #1F4E3D; /* Deep Agricultural Green */
    --primary-light: #2D6B54;
    --accent: #E9C46A; /* Earthy Yellow */
    --accent-hover: #F4A261;
    --bg-color: #F0F4F2;
    --text-main: #2C3E35;
    --text-muted: #6B7D73;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-radius: 16px;
    --shadow: 0 8px 32px rgba(31, 78, 61, 0.08);
    
    --status-good: #2A9D8F;
    --status-bad: #E76F51;
    --status-warning: #F4A261;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image: 
        radial-gradient(at 0% 0%, hsla(152, 43%, 90%, 1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(43, 74%, 90%, 1) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    width: 100%;
    max-width: 1000px;
    min-height: 100vh;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* HEADER */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo-text .highlight {
    color: var(--accent-hover);
}

.date-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,0.5);
    padding: 6px 12px;
    border-radius: 20px;
}

/* VIEWS */
.view {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 24px;
    animation: fadeIn 0.4s ease forwards;
}

.active-view {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-section h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.welcome-section p {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* TANK STATUS */
.tank-status-container {
    background: white;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

.tank-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--primary);
}

.tank-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.tank-bar-fill {
    height: 100%;
    background: var(--status-good);
    width: 100%;
    transition: width 0.5s ease, background-color 0.3s;
}

.tank-bar-fill.warning { background: var(--status-warning); }
.tank-bar-fill.danger { background: var(--status-bad); }

.btn-refill {
    width: 100%;
    background: rgba(42, 157, 143, 0.1);
    color: var(--status-good);
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-refill:hover {
    background: rgba(42, 157, 143, 0.2);
}

/* FORMS */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

select, input[type="text"], input[type="number"], input[type="password"], textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(31, 78, 61, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    color: var(--text-main);
    transition: all 0.2s;
    outline: none;
}

select:focus, input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 61, 0.1);
}

/* Ocultar flechitas (spinners) en campos numéricos para mejor UX móvil */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
}

.row-inputs {
    display: flex;
    gap: 16px;
}

.input-half {
    flex: 1;
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.help-text.error {
    color: var(--status-bad);
    font-weight: 600;
}

/* EQUIPMENT GRID */
.equipments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.equipment-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.equipment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.equipment-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(31, 78, 61, 0.1);
}

.equipment-card img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    padding: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    mix-blend-mode: multiply;
}

.equipment-card h3 {
    font-size: 0.85rem;
    padding: 12px;
    text-align: center;
    font-weight: 600;
}

/* BUTTONS */
.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(31, 78, 61, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(31, 78, 61, 0.05);
}

.link-dashboard {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}
.link-dashboard:hover {
    text-decoration: underline;
}

/* MODAL */
.modal-overlay {
    position: fixed; /* Fixed viewport positioning */
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(31, 78, 61, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    border-radius: inherit;
}

.hidden-view {
    display: none !important;
}

.modal-card {
    background: white;
    padding: 32px 24px;
    border-radius: 20px;
    width: 100%;
    max-width: 350px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.15);
    text-align: center;
    transform: translateY(0);
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-card h3 {
    color: var(--primary);
    margin-bottom: 12px;
}

.modal-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.pin-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 8px;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    text-align: center;
    border-bottom: 4px solid var(--primary);
}

.kpi-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-bottom: 24px;
    position: relative;
    height: 300px;
}

.chart-container h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* TABLE STYLES */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-top: 16px;
}

.admin-table th {
    background-color: rgba(31, 78, 61, 0.05);
    color: var(--primary);
    padding: 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
    border-bottom: 2px solid rgba(31, 78, 61, 0.1);
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    vertical-align: middle;
    font-size: 0.95rem;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover {
    background-color: rgba(31, 78, 61, 0.02);
}

.badge-clean {
    background: rgba(42, 157, 143, 0.15);
    color: var(--status-good);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* PAGINATION */
.page-btn {
    background: white;
    color: var(--text-muted);
    border: 1px solid rgba(0,0,0,0.1);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.85rem;
}
.page-btn:hover {
    background: rgba(31, 78, 61, 0.05);
}
.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
#view-login {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#view-login.active-view {
    display: flex;
}

.login-container {
    background: rgba(255, 255, 255, 0.8);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    text-align: center;
    max-width: 450px;
    width: 100%;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-logo {
    height: 60px;
    margin-bottom: 1.5rem;
}

.login-container h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.login-container p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

#btn-login-microsoft {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
