/* Raseinių vandenys savitarna — v2 WOW */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:      #478cfd;
    --blue-dark: #354664;
    --blue-mid:  #2d3d58;
    --blue-light:#b6d3ff;
    --blue-pale: #e8f1ff;
    --bg:        #f0f4f9;
    --card-bg:   #fff;
    --text:      #354664;
    --text-light:#7b8492;
    --border:    #e2e8f2;
    --green:     #22c55e;
    --green-bg:  #f0fdf4;
    --red:       #ef4444;
    --red-bg:    #fef2f2;
    --nav-h:     64px;
    --side-w:    220px;
    --radius:    12px;
    --shadow:    0 2px 12px rgba(53,70,100,.08);
    --shadow-lg: 0 8px 32px rgba(53,70,100,.14);
}

body {
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* ── Navbar ── */
.rv-navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-h);
    background: linear-gradient(135deg, var(--blue-mid) 0%, var(--blue-dark) 100%);
    box-shadow: 0 2px 20px rgba(53,70,100,.25);
}
.rv-navbar-inner {
    display: flex; align-items: center;
    max-width: 1280px; margin: 0 auto;
    height: 100%; padding: 0 1.5em;
    gap: 1em;
}
.rv-logo { display:flex; align-items:center; text-decoration:none; flex-shrink:0; }
.rv-logo-img { height: 36px; filter: brightness(0) invert(1); }

.rv-user-info { flex: 1; text-align: center; }
.rv-user-name { color: #fff; font-weight: 500; font-size: .97em; line-height: 1.3; }
.rv-user-code { color: var(--blue-light); font-size: .8em; letter-spacing:.03em; }

.rv-logout {
    color: rgba(255,255,255,.65); text-decoration: none;
    font-size: .82em; white-space: nowrap; flex-shrink: 0;
    padding: .35em .8em; border-radius: 6px;
    border: 1px solid rgba(255,255,255,.2);
    transition: all .2s;
}
.rv-logout:hover { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.1); }

/* ── Shell ── */
.rv-shell {
    display: flex;
    margin-top: var(--nav-h);
    min-height: calc(100vh - var(--nav-h));
}

/* ── Sidenav ── */
.rv-sidenav {
    width: var(--side-w); flex-shrink: 0;
    background: linear-gradient(180deg, var(--blue-mid) 0%, #1e2d45 100%);
    padding: 1.5em 0;
    position: sticky; top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    overflow-y: auto;
}
.rv-nav-item {
    display: flex; align-items: center; gap: .75em;
    padding: .8em 1.5em;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .92em;
    border-left: 3px solid transparent;
    transition: all .18s;
    margin: .1em 0;
}
.rv-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.rv-nav-item.active {
    background: rgba(71,140,253,.2);
    color: #fff;
    border-left-color: var(--blue);
    font-weight: 500;
}
.rv-nav-icon { font-size: 1.15em; }

/* ── Main ── */
.rv-main {
    flex: 1; padding: 2em 2.2em;
    max-width: calc(1280px - var(--side-w));
}

/* ── Cards ── */
.rv-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4em 1.6em;
    margin-bottom: 1.2em;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}
.rv-card:hover { box-shadow: var(--shadow-lg); }
.rv-card h5 {
    font-size: .75em; font-weight: 600;
    text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-light); margin-bottom: 1em;
}

/* ── Balance hero card ── */
.rv-balance-card {
    background: linear-gradient(135deg, #e8f1ff 0%, #f0f6ff 100%);
    border: 1px solid #c8deff;
    border-left: 5px solid var(--blue);
}
.rv-balance-card.debt {
    background: linear-gradient(135deg, #fff1f1 0%, #fff7f7 100%);
    border: 1px solid #fecaca;
    border-left: 5px solid var(--red);
}
.rv-balance-amount {
    font-size: 2.6em; font-weight: 700;
    color: var(--blue);
    letter-spacing: -.02em;
    line-height: 1.1;
}
.rv-balance-amount.debt { color: var(--red); }

/* ── Stat grid ── */
.rv-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1em;
    margin-bottom: 1.2em;
}
.rv-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3em 1.5em;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}
.rv-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.rv-stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
}
.rv-stat-icon {
    font-size: 1.8em;
    margin-bottom: .4em;
    display: block;
}
.rv-stat-val {
    font-size: 1.6em; font-weight: 700;
    color: var(--blue-dark);
    letter-spacing: -.02em;
}
.rv-stat-lbl {
    font-size: .78em; color: var(--text-light);
    text-transform: uppercase; letter-spacing: .06em;
    margin-top: .15em;
}

/* ── Meter cards ── */
.rv-meter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1em; margin-bottom: 1.2em; }
.rv-meter-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4em 1.6em;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.rv-meter-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.rv-meter-card::after {
    content: '💧';
    position: absolute; right: 1em; top: 1em;
    font-size: 2.5em; opacity: .08;
}
.rv-meter-label { font-size: .75em; color: var(--text-light); text-transform: uppercase; letter-spacing:.07em; margin-bottom:.6em; font-weight:600; }
.rv-meter-val { font-size: 2em; font-weight: 700; color: var(--blue-dark); letter-spacing:-.02em; }
.rv-meter-unit { font-size: .82em; color: var(--text-light); }

/* ── Dashboard grid layouts ── */
.rv-grid-chart  { display:grid; grid-template-columns:1fr 300px; gap:1.2em; margin-bottom:1.3em; }
.rv-grid-bottom { display:grid; grid-template-columns:1fr auto; gap:1em; align-items:start; }

/* ── Table scroll wrapper ── */
.rv-table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }

/* ── Bar chart ── */
.rv-chart { display:flex; align-items:flex-end; gap:.5em; height:80px; margin:.8em 0 .3em; }
.rv-bar-wrap { flex:1; display:flex; flex-direction:column; align-items:center; gap:.3em; }
.rv-bar {
    width:100%; border-radius:4px 4px 0 0;
    background: linear-gradient(180deg, var(--blue) 0%, var(--blue-light) 100%);
    min-height:4px; transition: height .4s ease;
}
.rv-bar-lbl { font-size:.7em; color:var(--text-light); }
.rv-bar-val { font-size:.72em; font-weight:600; color:var(--blue-dark); }

/* ── Table ── */
.rv-table { width:100%; border-collapse:collapse; font-size:.9em; }
.rv-table th {
    text-align:left; padding:.6em .9em;
    font-size:.74em; font-weight:600;
    text-transform:uppercase; letter-spacing:.06em;
    color:var(--text-light);
    border-bottom: 2px solid var(--border);
    background: #fafbfd;
}
.rv-table th:first-child { border-radius:8px 0 0 0; }
.rv-table th:last-child  { border-radius:0 8px 0 0; }
.rv-table td { padding:.7em .9em; border-bottom:1px solid var(--border); }
.rv-table tr:last-child td { border-bottom:none; }
.rv-table tbody tr { transition: background .15s; }
.rv-table tbody tr:hover { background:#f7faff; }

/* ── Badges ── */
.badge { display:inline-flex; align-items:center; gap:.3em; padding:.22em .7em; border-radius:20px; font-size:.78em; font-weight:600; }
.badge-ok   { background:var(--green-bg); color:#16a34a; }
.badge-wait { background:#fffbeb; color:#d97706; }
.badge-blue { background:var(--blue-pale); color:var(--blue); }

/* ── Buttons ── */
.rv-btn {
    display:inline-flex; align-items:center; gap:.4em;
    padding:.6em 1.4em; border-radius:8px;
    font-size:.9em; font-weight:500; cursor:pointer;
    text-decoration:none; border:none; font-family:inherit;
    transition: all .2s;
}
.rv-btn-primary {
    background: linear-gradient(135deg, var(--blue) 0%, #2d6ef0 100%);
    color:#fff; box-shadow: 0 3px 10px rgba(71,140,253,.35);
}
.rv-btn-primary:hover { transform:translateY(-1px); box-shadow:0 5px 18px rgba(71,140,253,.45); }
.rv-btn-outline { background:transparent; color:var(--blue); border:1.5px solid var(--blue); }
.rv-btn-outline:hover { background:var(--blue-pale); }

/* ── Input ── */
.rv-input {
    padding:.6em .9em; border:1.5px solid var(--border);
    border-radius:8px; font-size:1em; font-family:inherit;
    color:var(--text); width:100%; transition:border-color .15s, box-shadow .15s;
}
.rv-input:focus { outline:none; border-color:var(--blue); box-shadow:0 0 0 3px rgba(71,140,253,.12); }

/* ── Alerts ── */
.rv-alert-err { background:var(--red-bg); border:1px solid #fecaca; color:#b91c1c; border-radius:8px; padding:.75em 1em; margin-bottom:1em; font-size:.9em; }
.rv-alert-ok  { background:var(--green-bg); border:1px solid #bbf7d0; color:#15803d; border-radius:8px; padding:.75em 1em; margin-bottom:1em; font-size:.9em; }

/* ── Login ── */
.rv-login-wrap {
    min-height:100vh; display:flex; align-items:center; justify-content:center;
    background: linear-gradient(135deg, #1e2d45 0%, var(--blue-dark) 50%, #2d5a9e 100%);
    position: relative; overflow: hidden;
}
.rv-login-wrap::before {
    content:'';
    position:absolute; width:600px; height:600px;
    background: radial-gradient(circle, rgba(71,140,253,.15) 0%, transparent 70%);
    top:-100px; right:-100px; pointer-events:none;
}
.rv-login-wrap::after {
    content:'💧';
    position:absolute; font-size:20em; opacity:.03;
    bottom:-80px; left:-40px; pointer-events:none;
}
.rv-login-box {
    background:#fff; border-radius:20px;
    padding:2.8em 3em; width:100%; max-width:420px;
    box-shadow:0 20px 60px rgba(0,0,0,.3);
    position:relative; z-index:1;
}
.rv-login-logo { text-align:center; margin-bottom:1.8em; }
.rv-login-logo img { height:48px; }
.rv-login-title { font-size:1.05em; font-weight:500; color:var(--blue-dark); text-align:center; margin-bottom:1.6em; }
.rv-login-label { font-size:.82em; color:var(--text-light); display:block; margin-bottom:.35em; font-weight:600; letter-spacing:.03em; }
.rv-login-group { margin-bottom:1.2em; }
.rv-login-hint { font-size:.8em; color:var(--text-light); text-align:center; margin-top:1.2em; line-height:1.6; }

/* ── Bottom tab bar ── */
.rv-bottomnav {
    display:none; position:fixed; bottom:0; left:0; right:0; z-index:100;
    background: linear-gradient(180deg, var(--blue-mid) 0%, #1e2d45 100%);
    border-top:1px solid rgba(255,255,255,.08);
    height:64px;
}
.rv-bn-item {
    flex:1; display:flex; flex-direction:column;
    align-items:center; justify-content:center;
    color:rgba(255,255,255,.55); text-decoration:none;
    font-size:.68em; gap:.15em; transition:color .15s;
}
.rv-bn-item span { font-size:1.5em; line-height:1; }
.rv-bn-item.active { color:var(--blue-light); }
.rv-bn-item:hover  { color:#fff; }

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity:0; transform:translateY(16px); }
    to   { opacity:1; transform:translateY(0); }
}
.rv-main > * { animation: fadeUp .35s ease both; }
.rv-main > *:nth-child(1) { animation-delay:.05s; }
.rv-main > *:nth-child(2) { animation-delay:.1s; }
.rv-main > *:nth-child(3) { animation-delay:.15s; }
.rv-main > *:nth-child(4) { animation-delay:.2s; }

/* ── Responsive ── */
@media (max-width:700px) {
    .rv-sidenav  { display:none; }
    .rv-bottomnav { display:flex; }
    .rv-main { padding:1em 1em 80px; max-width:100%; }
    .rv-navbar-inner { padding:0 1em; }
    .rv-logo-img { height:28px; }
    .rv-logout { display:none; }

    /* Balance */
    .rv-balance-amount { font-size:2em; }

    /* Stat grid — 2 per row */
    .rv-stat-grid { grid-template-columns:1fr 1fr; }

    /* Dashboard grid stacking */
    .rv-grid-chart  { grid-template-columns:1fr; }
    .rv-grid-bottom { grid-template-columns:1fr; }

    /* Meter grid — 1 column */
    .rv-meter-grid { grid-template-columns:1fr; }

    /* Meter val smaller */
    .rv-meter-val { font-size:1.6em; }

    /* Stat icon smaller */
    .rv-stat-icon { font-size:1.4em; }
    .rv-stat-val  { font-size:1.3em; }

    /* Login box */
    .rv-login-box { padding:2em 1.3em; margin:1em; }

    /* Hide less critical table columns on very narrow screens */
    .rv-col-hide-mobile { display:none; }

    /* Quick links row — make buttons side by side */
    .rv-grid-bottom > div:last-child {
        display:flex; flex-direction:row; flex-wrap:wrap; gap:.5em;
    }
    .rv-grid-bottom > div:last-child .rv-btn { flex:1; min-width:120px; }
}

@media (max-width:400px) {
    .rv-stat-grid { grid-template-columns:1fr; }
}
