/* Project NIFE Premium Glassmorphic Design System */

:root {
    /* HSL Color Palette */
    --bg-base: hsl(230, 20%, 6%);
    --bg-panel: hsla(228, 18%, 12%, 0.45);

    /* Primary Brand Color */
    --primary: #173861;
    --primary-glow: rgba(23, 56, 97, 0.35);
    --primary-hover: #21508A;

    --secondary: hsl(185, 75%, 45%);
    --secondary-glow: hsla(185, 75%, 45%, 0.3);

    --accent: hsl(325, 85%, 60%);
    --accent-glow: hsla(325, 85%, 60%, 0.3);

    --success: hsl(145, 70%, 45%);
    --warning: hsl(38, 90%, 55%);
    --danger: hsl(355, 75%, 55%);
    --info: hsl(205, 80%, 55%);

    /* Text colors */
    --text-primary: hsl(210, 30%, 96%);
    --text-secondary: hsl(210, 14%, 72%);
    --text-muted: hsl(210, 10%, 50%);

    /* Borders and shadows */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(23, 56, 97, 0.15);
    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 16px 2px rgba(23, 56, 97, 0.2);

    /* Layout Constants */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Ambient Background Lights */
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.brand-logo{
    width: 75px;
    height: 75px;
}

.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -10;
    pointer-events: none;
    opacity: 0.55;
    animation: floatGlow 15s infinite alternate ease-in-out;
}

.glow-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 80%);
    top: 5%;
    left: -10%;
}

.glow-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--secondary-glow) 0%, transparent 80%);
    bottom: 10%;
    right: -15%;
    animation-delay: -5s;
}

.glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 80%);
    top: 40%;
    left: 45%;
    animation-delay: -10s;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}

/* App Wrapper */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphic Navbar */
/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.75rem;
    transition: background 0.2s ease;

    margin-left: auto;
}

.mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.08);
}
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.brand-icon {
    font-size: 1.6rem;
    color: var(--primary);
    margin-right: 0.6rem;
    filter: drop-shadow(0 0 8px var(--primary));
}

.highlight {
    color:  #173861 !important;
    text-shadow: 0 0 10px var(--primary-glow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-fast);
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1.2rem;
    border-left: 1px solid var(--border-glass);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--primary);
}

.avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    border: 1.5px solid var(--primary);
}

.nickname {
    font-size: 0.9rem;
    font-weight: 600;
}

.logout-btn {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.logout-btn:hover {
    color: var(--danger);
    transform: translateX(2px);
}

/* Typography & Layouts */
.main-content {
    flex: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    color: var(--text-primary);
    font-weight: 700;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Glassmorphic Components */
.glass-card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.glass-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
}

.glass-card-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.glass-card-body {
    padding: 1.5rem;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 20px 4px hsla(245, 80%, 66%, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: hsl(355, 80%, 65%);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: hsl(145, 75%, 55%);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Forms styling */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px 1px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-control[readonly], .form-control:disabled {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Auth Pages Container */
.auth-wrapper {
    max-width: 440px;
    margin: 4rem auto;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.oauth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.oauth-divider::before, .oauth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

.oauth-divider span {
    padding: 0 0.8rem;
}

.btn-oauth {
    width: 100%;
    background: #fff;
    color: #1a1d2e;
    font-weight: 600;
}

.btn-oauth{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.75rem;
}

.google-icon{
    width:20px;
    height:20px;
    object-fit:contain;
    flex-shrink:0;
}

.btn-oauth:hover {
    background: #e2e8f0;
}

/* Flash alerts */
.flash-container {
    max-width: 1400px;
    margin: 1rem auto 0 auto;
    padding: 0 2.5rem;
    width: 100%;
    box-sizing: border-box;
}

.flash-alert {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    border: 1px solid transparent;
    backdrop-filter: blur(8px);
    position: relative;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: hsl(145, 80%, 75%);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: hsl(355, 80%, 75%);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: hsl(205, 80%, 75%);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: hsl(38, 90%, 75%);
}

.alert-icon {
    font-size: 1.1rem;
    margin-right: 0.8rem;
}

.alert-message {
    font-size: 0.9rem;
    flex-weight: 500;
}

.alert-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    margin-left: auto;
    padding: 0;
    opacity: 0.7;
    transition: var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

/* Dashboard Views & Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Widget Card sizing configurations */
.widget-card {
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

/* Column spans for widgets */
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

@media (max-width: 1024px) {
    .col-8, .col-6, .col-4, .col-3 { grid-column: span 6; }
}

@media (max-width: 680px) {
    .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
}

.widget-canvas {
    flex: 1;
    width: 100%;
    min-height: 220px;
    position: relative;
}

/* Specific Widget Styles */
/* 1. LED indicator */
.led-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 1.25rem;
}

.led-bulb {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: var(--text-muted);
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: var(--transition-smooth);
}

.led-bulb.state-on-green {
    background-color: var(--success);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.4), 0 0 25px 8px hsla(145, 70%, 45%, 0.6);
}

.led-bulb.state-on-red {
    background-color: var(--danger);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.4), 0 0 25px 8px hsla(355, 75%, 55%, 0.6);
}

.led-bulb.state-on-yellow {
    background-color: var(--warning);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.4), 0 0 25px 8px hsla(38, 90%, 55%, 0.6);
}

.led-bulb.state-off {
    background-color: #2a2e3f;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.8);
}

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

/* 2. Numeric / Status Panel */
.numeric-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.numeric-value {
    font-size: 3.8rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(255,255,255,0.1);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.numeric-units {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.min-max-panel {
    display: flex;
    width: 100%;
    margin-top: 1.25rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border-glass);
    justify-content: space-around;
}

.min-max-item {
    text-align: center;
}

.min-max-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.min-max-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* 3. 3D Volume Cylinder representation */
.volume-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 2rem;
}

.cylinder-glass {
    width: 100px;
    height: 180px;
    background: rgba(255, 255, 255, 0.03);
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px / 18px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 15px rgba(255,255,255,0.05);
}

/* Cylinder Top Overlay to give 3D illusion */
.cylinder-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    z-index: 5;
}

.cylinder-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%; /* Dynamic fill percent */
    background: linear-gradient(180deg, var(--secondary) 0%, hsla(185, 75%, 45%, 0.6) 100%);
    transition: height var(--transition-smooth);
    border-radius: 0 0 45px 45px / 0 0 15px 15px;
    box-shadow: 0 0 15px var(--secondary-glow);
}

/* Liquid top curve representing surface */
.liquid-surface {
    position: absolute;
    top: -9px;
    left: 0;
    right: 0;
    height: 18px;
    background: hsl(185, 80%, 55%);
    border-radius: 50%;
    box-shadow: inset 0 0 4px rgba(255,255,255,0.6);
}

.volume-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 4. Multi-Button Panel */
.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    padding: 1rem 0;
    height: 100%;
}

.control-btn {
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.9rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.control-btn:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 10px var(--primary-glow);
}

.control-btn i {
    font-size: 1.25rem;
}

/* Table UI (Admin settings) */
.glass-table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.glass-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
}

.glass-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

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

.glass-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: hsl(145, 80%, 75%); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: hsl(355, 80%, 75%); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: hsl(38, 90%, 75%); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: hsl(205, 80%, 75%); border: 1px solid rgba(59, 130, 246, 0.3); }

/* Footer styling */
.glass-footer {
    margin-top: auto;
    padding: 1.5rem 2.5rem;
    border-top: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}


/* Survey pipeline helpers */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}
.stat-tile {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.9rem;
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
}
.stat-value {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 800;
    margin-top: 0.25rem;
}
.survey-chart {
    width: 100%;
    min-height: 280px;
}
@media (max-width: 680px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Mobile survey/operator experience */
.survey-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}
.survey-page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.subsample-value-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}
.photo-strip {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.survey-create-card {
    grid-column: span 6;
}

@media (max-width: 760px) {
    body {
        min-width: 0;
    }

    .glass-nav {
        align-items: flex-start;
        gap: 0.85rem;
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-brand a {
        font-size: 1.15rem;
    }

    .brand-icon {
        font-size: 1.25rem;
        margin-right: 0.45rem;
    }

    .nav-links {
        display: none;
        width: 100%;
        gap: 0.45rem;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .nav-link {
        font-size: 0.84rem;
        padding: 0.48rem 0.58rem;
    }

    .user-menu {
        width: 100%;
        border-left: 0;
        border-top: 1px solid var(--border-glass);
        padding-left: 0;
        padding-top: 0.7rem;
        justify-content: space-between;
    }

    .nickname {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main-content {
        padding: 1rem;
    }

    .flash-container {
        padding: 0 1rem;
    }

    .page-title {
        font-size: 1.55rem;
        line-height: 1.15;
    }

    .page-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .survey-page-header {
        flex-direction: column;
        gap: 0.85rem;
        margin-bottom: 1.2rem;
    }

    .survey-page-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
    }

    .survey-page-actions .badge {
        grid-column: span 2;
        justify-content: center;
        border-radius: var(--radius-sm);
        padding: 0.55rem 0.6rem;
    }

    .survey-page-actions .btn {
        width: 100%;
        padding: 0.58rem 0.5rem;
    }

    .dashboard-grid {
        gap: 1rem;
    }

    .glass-card {
        border-radius: 8px;
    }

    .glass-card:hover {
        transform: none;
    }

    .glass-card-header {
        padding: 0.9rem 1rem;
        gap: 0.75rem;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .glass-card-title {
        font-size: 1rem;
    }

    .glass-card-body {
        padding: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-label {
        font-size: 0.82rem;
    }

    .form-control {
        min-height: 46px;
        font-size: 16px;
        padding: 0.72rem 0.78rem;
    }

    input[type="file"].form-control {
        padding: 0.6rem;
        min-height: auto;
    }

    .btn {
        min-height: 44px;
        padding: 0.65rem 0.9rem;
    }

    .subsample-value-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .subsample-value-grid .btn {
        width: 100%;
    }

    .photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .photo-strip img {
        width: 74px !important;
        height: 74px !important;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .stat-tile {
        padding: 0.7rem;
    }

    .stat-value {
        font-size: 1.05rem;
    }

    .survey-chart {
        min-height: 220px;
    }

    .glass-table-container {
        border-radius: 8px;
        max-width: 100%;
    }

    .glass-table {
        min-width: 680px;
        font-size: 0.82rem;
    }

    .glass-table th,
    .glass-table td {
        padding: 0.75rem;
    }

    .survey-create-card {
        grid-column: span 12;
    }

    .auth-wrapper {
        margin: 1.2rem auto;
    }

    .glass-footer {
        padding: 1rem;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding: 0.75rem;
    }

    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .survey-page-actions {
        grid-template-columns: 1fr;
    }

    .survey-page-actions .badge {
        grid-column: span 1;
    }
}

/* Sensor matrix rows */
.matrix-table {
    min-width: 980px;
}
.matrix-values {
    white-space: pre-wrap;
    margin: 0;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    max-width: 420px;
}
@media (max-width: 760px) {
    .matrix-table {
        min-width: 760px;
    }
    .matrix-values {
        max-width: 320px;
    }
}



/* Shared table search, filter, and sorting controls */
.table-tools {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-glass);
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    border-radius: 8px 8px 0 0;
    background: rgba(255, 255, 255, 0.025);
}

.table-tools + .glass-table-container {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.table-tool-input,
.table-tool-select {
    min-height: 38px;
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    background: rgba(5, 7, 15, 0.55);
    color: var(--text-primary);
    padding: 0.5rem 0.65rem;
    font: inherit;
    font-size: 0.86rem;
}

.table-tool-input {
    min-width: 210px;
}

.table-tool-column-input {
    min-width: 190px;
}

.table-tool-select {
    min-width: 155px;
}

.table-tool-count {
    margin-left: auto;
}

.sortable-table-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable-table-header::after {
    content: " sort";
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 0.35rem;
}

.sortable-table-header[aria-sort="ascending"]::after {
    content: " asc";
    color: var(--secondary);
}

.sortable-table-header[aria-sort="descending"]::after {
    content: " desc";
    color: var(--secondary);
}

@media (max-width: 760px) {

    .table-tools{
        padding:.75rem;
        gap:.6rem;
    }

    .table-tool-input,
    .table-tool-select{
        width:100%;
    }

    .table-tools-mobile-row{
        display:flex;
        gap:.6rem;
        width:100%;
        align-items:center;
    }

    .table-tools-mobile-row .table-tool-column-input{
        flex:1;
        width:auto;
        min-width:0;
    }

    .table-tools-mobile-row .table-tool-clear{
        width:auto;
        white-space:nowrap;
        flex-shrink:0;
    }

    .table-tool-count{
        margin-left:0;
    }
}


.device-command-form {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.device-command-form .btn {
    white-space: nowrap;
}

@media (max-width: 760px) {
    .device-command-form {
        align-items: stretch;
    }

    .device-command-form .btn {
        width: 100%;
    }
}


/* Compact survey controls and PWA/mobile refinements */
.survey-page-actions form {
    display: inline-flex;
    margin: 0;
}

.survey-page-actions .btn,
.survey-page-actions button.btn {
    min-width: 0;
}

.matrix-values {
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

@media (max-width: 760px) {
    .survey-page-actions {
        position: sticky;
        top: 0.5rem;
        z-index: 20;
        padding: 0.55rem;
        border: 1px solid var(--border-glass);
        border-radius: 8px;
        background: rgba(12, 15, 26, 0.92);
        backdrop-filter: blur(16px);
    }

    .survey-page-actions form,
    .survey-page-actions a,
    .survey-page-actions button.btn {
        width: 100%;
    }

    .survey-page-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .survey-page-actions .btn,
    .survey-page-actions button.btn {
        font-size: 0.78rem;
        padding: 0.55rem 0.45rem;
    }

    .dashboard-grid > .col-4,
    .dashboard-grid > .col-6,
    .dashboard-grid > .col-8,
    .dashboard-grid > .col-12 {
        grid-column: 1 / -1;
    }

    .device-command-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .subsample-value-grid {
        grid-template-columns: 1fr;
    }

    .glass-table.matrix-table {
        min-width: 560px;
    }

    .matrix-values {
        max-height: 120px;
        overflow: auto;
        font-size: 0.74rem;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding: 0.75rem;
    }

    .survey-page-actions {
        grid-template-columns: 1fr;
    }

    .survey-page-actions .badge {
        grid-column: span 1;
    }

    .page-title {
        font-size: 1.35rem;
    }

    .glass-card-header,
    .glass-card-body {
        padding: 0.75rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* Phone-first fixes: prevent desktop-width rendering on real mobile screens */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body,
.app-container {
    width: 100%;
    max-width: 100%;
}

.pwa-install-btn[hidden] {
    display: none !important;
}

.pwa-install-btn {
    white-space: nowrap;
}

@media (max-width: 760px), (max-device-width: 760px) {
    html,
    body {
        overflow-x: hidden;
    }

    .app-container,
    .main-content,
    .flash-container,
    .glass-nav,
    .glass-card,
    .dashboard-grid,
    .survey-page-header,
    .survey-page-actions {
        max-width: 100vw;
    }

    .ambient-glow {
        display: none;
    }

    .glass-nav {
        position: sticky;
        top: 0;
        padding: 0.7rem 0.75rem;
    }

    .nav-links {
        width: 100%;
    }

    .nav-link,
    .pwa-install-btn,
    .user-menu {
        min-width: 0;
        width: 100%;
    }

    .nav-link {
        justify-content: center;
    }

    .user-menu {
        grid-column: 1 / -1;
    }

    .main-content {
        padding: 0.65rem;
    }

    .survey-page-header > div:first-child {
        min-width: 0;
        width: 100%;
    }

    .survey-page-actions {
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .survey-page-actions .btn,
    .survey-page-actions button.btn,
    .survey-page-actions form {
        width: 100%;
    }

    .glass-card,
    .glass-table-container {
        width: 100%;
        min-width: 0;
    }

    .glass-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .glass-table:not(.matrix-table) {
        min-width: 0;
    }

    .glass-table:not(.matrix-table) thead {
        display: none;
    }

    .glass-table:not(.matrix-table),
    .glass-table:not(.matrix-table) tbody,
    .glass-table:not(.matrix-table) tr,
    .glass-table:not(.matrix-table) td {
        display: block;
        width: 100%;
    }

    .glass-table:not(.matrix-table) tr {
        border-bottom: 1px solid var(--border-glass);
        padding: 0.6rem 0;
    }

    .glass-table:not(.matrix-table) td {
        border-bottom: 0;
        padding: 0.35rem 0.75rem;
    }

    .matrix-table {
        min-width: 520px !important;
    }
}

@media (max-width: 420px), (max-device-width: 420px) {
    .nav-links,
    .survey-page-actions {
        grid-template-columns: 1fr;
    }

    .brand-text {
        font-size: 1.05rem;
    }

    .btn,
    .btn-sm {
        min-height: 42px;
        font-size: 0.82rem;
    }

    .matrix-table {
        min-width: 460px !important;
    }
}


/* Project NIFE light theme and mobile UX polish */
:root {
    --bg-base: #f6f8fb;
    --bg-panel: rgba(255, 255, 255, 0.92);
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.14);
    --primary-hover: #4338ca;
    --secondary: #0891b2;
    --secondary-glow: rgba(8, 145, 178, 0.13);
    --accent: #db2777;
    --accent-glow: rgba(219, 39, 119, 0.12);
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --text-primary: #111827;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-glass: rgba(15, 23, 42, 0.12);
    --border-glow: rgba(79, 70, 229, 0.18);
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 8px 18px rgba(79, 70, 229, 0.16);
}

html {
    background: var(--bg-base);
}

body {
    background: linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
    color: var(--text-primary);
}

.ambient-glow {
    display: none;
}

.nav-brand a,
.brand-text,
.nickname,
.glass-card-title,
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    letter-spacing: 0;
}

.page-title {
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: currentColor;
    color: var(--text-primary);
    letter-spacing: 0;
}

.glass-nav,
.glass-card,
.glass-footer {
    background: var(--bg-panel);
    border-color: var(--border-glass);
    box-shadow: var(--shadow-soft);
}

.glass-nav {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.glass-card:hover {
    border-color: rgba(79, 70, 229, 0.22);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
}

.glass-card-header,
.table-tools {
    background: rgba(248, 250, 252, 0.82);
}

.nav-link,
.btn-secondary,
.table-tool-input,
.table-tool-select {
    background: #f8fafc;
    color: var(--text-secondary);
    border-color: var(--border-glass);
}

.nav-link:hover,
.nav-link.active,
.btn-secondary:hover {
    background: #eef2ff;
    color: var(--primary);
}

.form-control,
.table-tool-input,
.table-tool-select {
    background: #ffffff;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.form-control[readonly],
.form-control:disabled {
    background: #f1f5f9;
    color: var(--text-muted);
}

.glass-table th {
    background: #f8fafc;
    color: var(--text-secondary);
}

.glass-table td {
    color: var(--text-primary);
}

.flash-alert {
    box-shadow: none;
}

.flash-alert.alert-success {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.flash-alert.alert-info {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.flash-alert.alert-warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.flash-alert.alert-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.stat-tile {
    background: #ffffff;
    border-color: var(--border-glass);
}

.reading-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.reading-preview {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    white-space: nowrap;
}

.reading-captured-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    color: var(--text-primary);
}

.reading-captured-card strong,
.reading-captured-card span:not(.badge) {
    display: block;
}

.reading-captured-card span:not(.badge) {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.matrix-table {
    min-width: 720px;
}

@media (max-width: 760px), (max-device-width: 760px) {
    body {
        background: #f7fafc;
    }

    .glass-nav {
        position: sticky;
        top: 0;
        padding: 0.65rem 0.75rem;
        gap: 0.55rem;
        border-radius: 0;
    }

    .nav-brand a {
        font-size: 1.05rem;
    }

    .brand-icon {
        font-size: 1.15rem;
        margin-right: 0.42rem;
    }

    .nav-links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.38rem;
    }

    .nav-link,
    .pwa-install-btn,
    .nav-links > .btn-primary {
        min-height: 38px;
        padding: 0.42rem 0.35rem;
        font-size: 0.7rem;
        gap: 0.22rem;
        border-radius: 8px;
    }

    .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .nav-link i,
    .pwa-install-btn i {
        font-size: 0.9rem;
    }

    .user-menu {
        margin-top: 0.15rem;
        padding: 0.5rem 0.65rem;
        border-top: 1px solid var(--border-glass);
        background: #f8fafc;
        border-radius: 10px;
    }

    .avatar,
    .avatar-placeholder {
        width: 28px;
        height: 28px;
    }

    .main-content {
        padding: 0.8rem;
    }

    .flash-container {
        padding: 0 0.8rem;
    }

    .flash-alert {
        padding: 0.75rem 0.85rem;
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.45rem;
        line-height: 1.16;
        margin-bottom: 0.25rem;
    }

    .page-subtitle {
        font-size: 0.88rem;
        line-height: 1.35;
    }

    .survey-page-actions {
        position: static;
        padding: 0;
        border: 0;
        background: transparent;
        backdrop-filter: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .survey-page-actions .badge,
    .survey-page-actions .btn,
    .survey-page-actions button.btn {
        min-height: 38px;
        font-size: 0.75rem;
    }

    .dashboard-grid {
        gap: 0.75rem;
    }

    .glass-card {
        border-radius: 10px;
    }

    .glass-card-header {
        padding: 0.8rem 0.9rem;
    }

    .glass-card-title {
        font-size: 0.98rem;
        gap: 0.45rem;
    }

    .glass-card-body {
        padding: 0.9rem;
    }

    .form-group {
        margin-bottom: 0.85rem;
    }

    .form-label {
        font-size: 0.78rem;
    }

    .form-control {
        min-height: 42px;
        font-size: 16px;
        padding: 0.62rem 0.7rem;
    }

    .btn,
    .btn-sm {
        min-height: 40px;
        padding: 0.55rem 0.7rem;
        font-size: 0.8rem;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .stat-tile {
        padding: 0.65rem;
        border-radius: 8px;
    }

    .stat-label {
        font-size: 0.68rem;
    }

    .stat-value {
        font-size: 1.05rem;
    }

    .device-command-form {
        grid-template-columns: 1fr;
    }

    .glass-table.matrix-table {
        min-width: 520px !important;
    }

    .matrix-table th,
    .matrix-table td {
        padding: 0.58rem;
    }

    .reading-summary {
        gap: 0.35rem;
    }

    .reading-summary .badge {
        padding: 0.3rem 0.45rem;
        font-size: 0.68rem;
    }

    .reading-preview {
        font-size: 0.72rem;
    }
}

@media (max-width: 420px), (max-device-width: 420px) {
    .nav-links {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nav-link,
    .pwa-install-btn,
    .nav-links > .btn-primary {
        font-size: 0.66rem;
    }

    .survey-page-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-title {
        font-size: 1.28rem;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .glass-table.matrix-table {
        min-width: 480px !important;
    }
}

.admin-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-console-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 760px), (max-device-width: 760px) {
    .admin-console-header {
        display: block;
        margin-bottom: 1rem;
    }

    .admin-console-actions {
        margin-top: 0.8rem;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .admin-console-actions .btn {
        width: 100%;
        min-height: 38px;
        padding: 0.48rem 0.35rem;
        font-size: 0.72rem;
    }

    .admin-console-actions .btn i {
        font-size: 0.85rem;
    }
}

@media (max-width: 420px), (max-device-width: 420px) {
    .admin-console-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Readability bump: larger typography without returning to crowded desktop scale */
html {
    font-size: 17px;
}

body {
    line-height: 1.55;
}

.nav-link,
.btn,
.form-control,
.form-label,
.glass-table,
.table-tool-input,
.table-tool-select {
    font-size: 0.96rem;
}

.page-title {
    font-size: 2.2rem;
}

.page-subtitle {
    font-size: 1.05rem;
}

.glass-card-title {
    font-size: 1.18rem;
}

.stat-label {
    font-size: 0.82rem;
}

.stat-value {
    font-size: 1.9rem;
}

.badge {
    font-size: 0.82rem;
}

.reading-preview {
    font-size: 0.9rem;
}

@media (max-width: 760px), (max-device-width: 760px) {
    html {
        font-size: 18px;
    }

    .nav-brand a {
        font-size: 1.16rem;
    }

    .nav-link,
    .pwa-install-btn,
    .nav-links > .btn-primary {
        min-height: 44px;
        font-size: 0.78rem;
        line-height: 1.2;
    }

    .user-menu,
    .nickname {
        font-size: 0.95rem;
    }

    .page-title {
        font-size: 1.72rem;
        line-height: 1.16;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    .glass-card-title {
        font-size: 1.08rem;
    }

    .form-label {
        font-size: 0.9rem;
    }

    .form-control {
        min-height: 48px;
        font-size: 1rem;
    }

    .btn,
    .btn-sm {
        min-height: 44px;
        font-size: 0.9rem;
    }

    .survey-page-actions .badge,
    .survey-page-actions .btn,
    .survey-page-actions button.btn {
        min-height: 42px;
        font-size: 0.84rem;
    }

    .glass-table {
        font-size: 0.92rem;
    }

    .stat-label {
        font-size: 0.78rem;
    }

    .stat-value {
        font-size: 1.28rem;
    }

    .reading-summary .badge {
        font-size: 0.78rem;
    }

    .reading-preview {
        font-size: 0.82rem;
    }

    .admin-console-actions .btn {
        min-height: 42px;
        font-size: 0.82rem;
    }
}

@media (max-width: 420px), (max-device-width: 420px) {
    html {
        font-size: 18px;
    }

    .page-title {
        font-size: 1.55rem;
    }

    .nav-link,
    .pwa-install-btn,
    .nav-links > .btn-primary {
        font-size: 0.76rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }
}

.auth-menu-button {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
}

.auth-menu-button:hover {
    color: var(--primary);
}

/* Project NIFE color refinement for the light theme */
:root {
    --bg-base: #f4f7fb;
    --bg-panel: #ffffff;
    --bg-soft: #eef6fb;
    --primary: #365bd6;
    --primary-hover: #2848b8;
    --primary-glow: rgba(54, 91, 214, 0.16);
    --secondary: #087f95;
    --secondary-glow: rgba(8, 127, 149, 0.14);
    --accent: #c2417a;
    --accent-glow: rgba(194, 65, 122, 0.12);
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --info: #1d4ed8;
    --text-primary: #172033;
    --text-secondary: #40516a;
    --text-muted: #6b7a90;
    --border-glass: rgba(100, 116, 139, 0.22);
    --shadow-soft: 0 12px 30px rgba(30, 41, 59, 0.08);
    --shadow-glow: 0 10px 22px rgba(54, 91, 214, 0.18);
}

body {
    background:
        linear-gradient(180deg, #f7fbff 0%, #eef4f9 48%, #f8fafc 100%);
}

.glass-nav {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(100, 116, 139, 0.18);
}

.brand-icon,
.highlight {
    color: var(--primary);
    filter: none;
    text-shadow: none;
}

.nav-link,
.btn-secondary,
.table-tool-input,
.table-tool-select,
.user-menu {
    background: #f6f9fc;
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.18);
}

.nav-link:hover,
.nav-link.active,
.btn-secondary:hover {
    background: #e8f0ff;
    border-color: rgba(54, 91, 214, 0.24);
    color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(54, 91, 214, 0.18);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 12px 24px rgba(54, 91, 214, 0.24);
}

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--danger);
}

.glass-card {
    background: #ffffff;
    border: 1px solid rgba(100, 116, 139, 0.18);
    box-shadow: 0 12px 30px rgba(30, 41, 59, 0.07);
}

.glass-card-header {
    background: #f8fbfd;
    border-bottom-color: rgba(100, 116, 139, 0.16);
}

.form-control {
    background: #ffffff;
    border-color: #cbd7e4;
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(54, 91, 214, 0.12);
}

.glass-table-container {
    background: #ffffff;
    border-color: rgba(100, 116, 139, 0.18);
}

.glass-table th {
    background: #f3f7fb;
    color: #52637a;
}

.glass-table tr:hover td {
    background: #f8fbff;
}

.badge-success {
    background: #e8f7ee;
    color: #166534;
    border-color: #a7e3bd;
}

.badge-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.badge-warning {
    background: #fff7ed;
    color: #9a4a05;
    border-color: #fed7aa;
}

.badge-info {
    background: #eaf2ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.stat-tile {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(100, 116, 139, 0.18);
}

.stat-label {
    color: #64748b;
}

.stat-value {
    color: #172033;
}

.survey-chart {
    background: #ffffff;
}

.glass-footer {
    background: transparent;
    box-shadow: none;
    color: var(--text-muted);
}

@media (max-width: 760px), (max-device-width: 760px) {
    body {
        background: #f6f9fc;
    }

    .glass-nav {
        background: #ffffff;
    }

    .nav-link,
    .pwa-install-btn,
    .nav-links > .btn-primary {
        box-shadow: none;
    }

    .survey-page-actions .btn,
    .survey-page-actions button.btn,
    .survey-page-actions .badge {
        box-shadow: none;
    }
}

.compact-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.compact-summary-item {
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid rgba(100, 116, 139, 0.18);
    border-radius: 10px;
    background: #f8fbff;
}

.compact-summary-item .stat-value {
    font-size: 1.45rem;
    line-height: 1.1;
}

.compact-summary-text {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.compact-summary-note {
    margin: 0.85rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

@media (max-width: 760px), (max-device-width: 760px) {
    .compact-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .compact-summary-item {
        padding: 0.7rem;
    }

    .compact-summary-item .stat-value {
        font-size: 1.25rem;
    }

    .compact-summary-latest {
        grid-column: 1 / -1;
    }
}


.account-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 36px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.account-action-btn:hover {
    background: #eef6ff;
    color: var(--primary);
    border-color: rgba(54, 91, 214, 0.28);
}

.account-action-danger:hover {
    background: #fef2f2;
    color: var(--danger);
    border-color: rgba(185, 28, 28, 0.28);
}

@media (max-width: 760px), (max-device-width: 760px) {
    .account-action-btn {
        flex: 1 1 100%;
        width: 100%;
    }
}

.device-connected-label {
    color: var(--success);
    background: #ecfdf5;
    border-color: rgba(22, 163, 74, 0.25);
    cursor: default;
}

@media (max-width: 1100px), (max-device-width: 1100px) {
    .glass-nav {
        align-items: flex-start;
        gap: 0.8rem;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
        gap: 0.55rem;
    }

    .user-menu {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.55rem;
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid var(--border-glass);
        padding-top: 0.65rem;
    }

    .user-info {
        flex: 1 1 100%;
    }

    .user-menu form,
    .user-menu .account-action-btn {
        flex: 1 1 220px;
    }

    .user-menu form .account-action-btn {
        width: 100%;
    }
}

@media (max-width: 560px), (max-device-width: 560px) {
    .account-action-btn {
        min-height: 44px;
        font-size: 0.92rem;
    }

    .user-menu form,
    .user-menu .account-action-btn {
        flex-basis: 100%;
    }
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    margin-top: 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.table-page-size-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.table-page-size-select {
    width: auto;
    min-width: 76px;
}

.table-page-range,
.table-page-label {
    color: var(--text-muted);
    font-weight: 700;
}

.table-page-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.table-page-buttons .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 760px), (max-device-width: 760px) {
    .table-pagination {
        align-items: stretch;
    }

    .table-page-size-label,
    .table-page-range,
    .table-page-buttons {
        width: 100%;
    }

    .table-page-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }

    .table-page-label {
        text-align: center;
    }
}

.survey-section-nav {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 1.25rem 0;
}

.survey-section-nav .btn {
    min-height: 42px;
}

@media (max-width: 720px) {
    .survey-section-nav {
        display: grid;
        grid-template-columns: 1fr;
    }

    .survey-section-nav .btn {
        width: 100%;
        justify-content: center;
    }
}

.survey-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin: -0.5rem 0 1.25rem 0;
}

@media (max-width: 720px) {
    .survey-step-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .survey-step-actions .badge {
        grid-column: 1 / -1;
        text-align: center;
        justify-content: center;
    }
}

/* Password visibility toggle */
.password-input-group{
    position:relative;
}

.password-input-group .form-control{
    padding-right:3rem;
}

.password-toggle{
    position:absolute;
    top:50%;
    right:.85rem;
    transform:translateY(-50%);
    border:none;
    background:transparent;
    color:var(--text-muted);
    cursor:pointer;
    padding:0;
    font-size:1rem;
    transition:color .2s ease;
}

.password-toggle:hover{
    color:var(--primary);
}

.password-toggle:focus{
    outline:none;
    color:var(--primary);
}