/* ── Reset & tokens ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-hover: #bbbbbb;
    --text: #111111;
    --text2: #666666;
    --text3: #999999;
    --row-hover: #fafafa;
    --chip: #f0f0f0;
    --avatar: #1a1f2e;
    --accent: #4f6ef7;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --scrollbar: #d1d5db;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d3a;
    --border-hover: #3d4155;
    --text: #e8eaf0;
    --text2: #9aa0b0;
    --text3: #6b7280;
    --row-hover: #1e2130;
    --chip: #252836;
    --avatar: #4f6ef7;
    --scrollbar: #3d4155;
}

body {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    background: var(--bg); color: var(--text);
    font-size: 14px; line-height: 1.5;
    transition: background 0.2s, color 0.2s;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── AUTH ── */
#screen-auth {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: var(--bg); padding: 24px;
}
#screen-auth.active { display: flex; }
.auth-wrap { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-mark {
    width: 48px; height: 48px; background: var(--avatar);
    border-radius: 3px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white;
}
.auth-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.auth-logo p  { color: var(--text3); font-size: 13px; margin-top: 4px; }
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; padding: 28px;
}
.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.auth-tab {
    flex: 1; padding: 10px; border: none; background: transparent;
    color: var(--text3); font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.field input {
    width: 100%; padding: 9px 11px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 3px; font-family: inherit; font-size: 14px; color: var(--text);
    outline: none; transition: border-color 0.2s;
}
.field input:focus { border-color: var(--accent); }
.btn-primary {
    width: 100%; padding: 10px; margin-top: 6px;
    background: var(--accent); color: white; border: none; border-radius: 3px;
    font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.88; }
.auth-msg { font-size: 12px; text-align: center; margin-top: 10px; display: none; padding: 8px; border-radius: 3px; }
.auth-msg.error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.auth-msg.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
[data-theme="dark"] .auth-msg.error   { background: rgba(220,38,38,0.1); color: #fca5a5; border-color: rgba(220,38,38,0.2); }
[data-theme="dark"] .auth-msg.success { background: rgba(22,163,74,0.1); color: #86efac; border-color: rgba(22,163,74,0.2); }
.auth-footer { text-align: center; margin-top: 14px; }
.auth-footer a { font-size: 12px; color: var(--text3); text-decoration: none; transition: color 0.2s; }
.auth-footer a:hover { color: var(--accent); }

/* ── CLAIM ── */
#screen-claim { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
#screen-claim.active { display: flex; }
.claim-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: 28px; }
.claim-card h2 { font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.claim-card p  { color: var(--text3); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
.claim-input {
    width: 100%; padding: 10px 11px; margin-bottom: 12px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
    font-family: monospace; font-size: 15px; letter-spacing: 3px; color: var(--text);
    text-align: center; text-transform: uppercase; outline: none;
}
.claim-input:focus { border-color: var(--accent); }
.claim-input::placeholder { letter-spacing: 1px; color: var(--text3); font-size: 12px; }
.btn-ghost {
    width: 100%; padding: 9px; margin-top: 8px;
    background: transparent; color: var(--text3); border: 1px solid var(--border);
    border-radius: 3px; font-family: inherit; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
.claim-msg { font-size: 12px; text-align: center; margin-top: 10px; display: none; color: var(--red); }

/* ── HOME screen ── */
#screen-home { min-height: 100vh; background: var(--bg); }
#screen-home.active { display: block; }
.home-body { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }
.home-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.home-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.btn-sm {
    padding: 7px 14px; border-radius: 3px; border: 1px solid var(--border);
    background: transparent; color: var(--text2); font-family: inherit;
    font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.btn-sm:hover { border-color: var(--border-hover); color: var(--text); }
.btn-sm-accent {
    padding: 7px 14px; border-radius: 3px; border: none;
    background: var(--accent); color: white; font-family: inherit;
    font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.btn-sm-accent:hover { opacity: 0.88; }

/* Location grid */
.locations-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.loc-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; padding: 20px; cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column; gap: 12px;
}
.loc-card:hover { border-color: var(--border-hover); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.loc-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.loc-name { font-size: 15px; font-weight: 600; color: var(--text); }
.loc-type-chip {
    font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 3px;
    background: var(--chip); color: var(--text3); flex-shrink: 0;
}
.loc-device-info { display: flex; flex-direction: column; gap: 4px; }
.loc-device-name { font-size: 12px; color: var(--text2); }
.loc-level { font-size: 28px; font-weight: 700; line-height: 1; }
.loc-status { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
.loc-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 8px 0; color: var(--text3);
}
.loc-empty-icon { opacity: 0.35; }
.loc-empty-text { font-size: 13px; }
.loc-link-btn {
    font-size: 12px; font-weight: 500; color: var(--accent);
    background: none; border: 1px solid var(--accent); border-radius: 3px;
    padding: 5px 12px; cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.loc-link-btn:hover { background: rgba(79,110,247,0.06); }
.loc-add-card {
    background: transparent; border: 1px dashed var(--border);
    border-radius: 3px; padding: 20px; cursor: pointer;
    transition: border-color 0.2s; display: flex;
    align-items: center; justify-content: center; gap: 8px;
    color: var(--text3); font-size: 13px; min-height: 120px;
}
.loc-add-card:hover { border-color: var(--accent); color: var(--accent); }

/* ── APP screen ── */
#screen-app { min-height: 100vh; background: var(--bg); }
#screen-app.active { display: block; }

/* ── NAV (shared) ── */
.topnav {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 52px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
}
.nav-logo { display: flex; align-items: center; gap: 10px; }
.nav-logo .mark {
    width: 28px; height: 28px; background: var(--avatar);
    border-radius: 3px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: white; font-weight: 700; flex-shrink: 0;
}
.nav-logo span { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.nav-right { display: flex; align-items: center; gap: 4px; }
.nav-icon-btn {
    width: 32px; height: 32px; border-radius: 3px; border: 1px solid var(--border);
    background: transparent; color: var(--text2); cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
    position: relative;
}
.nav-icon-btn:hover { background: var(--row-hover); border-color: var(--border-hover); color: var(--text); }
.nav-text-btn {
    padding: 6px 12px; border-radius: 3px; border: 1px solid var(--border);
    background: transparent; color: var(--text2); cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 500; transition: all 0.2s;
}
.nav-text-btn:hover { border-color: var(--border-hover); color: var(--text); }
.notif-badge {
    position: absolute; top: 4px; right: 4px; width: 7px; height: 7px;
    background: var(--red); border-radius: 50%; display: none;
}

/* ── Location switcher (nav) ── */
.device-switcher { position: relative; }
.device-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 10px; border-radius: 3px; border: 1px solid var(--border);
    background: transparent; color: var(--text); cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 500; transition: all 0.2s; max-width: 200px;
}
.device-btn:hover { border-color: var(--border-hover); background: var(--row-hover); }
.device-btn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-btn-chevron { color: var(--text3); font-size: 9px; flex-shrink: 0; }
.device-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 200; display: none;
}
.device-dropdown.show { display: block; }
.device-dd-item {
    padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.15s;
    font-size: 13px; color: var(--text);
}
.device-dd-item:last-child { border-bottom: none; }
.device-dd-item:hover { background: var(--row-hover); }
.device-dd-item.active { color: var(--accent); font-weight: 500; }
.device-dd-active-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.device-dd-add {
    padding: 10px 14px; display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 13px; color: var(--text3); border-top: 1px solid var(--border);
    transition: background 0.15s;
}
.device-dd-add:hover { background: var(--row-hover); color: var(--accent); }

/* ── Notifications dropdown ── */
.notif-dropdown {
    position: absolute; top: 56px; right: 16px; width: 320px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 200; display: none;
}
.notif-dropdown.show { display: block; }
.notif-head { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.notif-head span { font-size: 13px; font-weight: 500; color: var(--text); }
.notif-mark { font-size: 12px; color: var(--accent); background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; transition: background 0.15s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--row-hover); }
.notif-item.unread { background: rgba(79,110,247,0.04); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.notif-dot.urgent   { background: var(--red); }
.notif-dot.very_low { background: var(--amber); }
.notif-dot.low      { background: var(--green); }
.notif-msg   { font-size: 13px; color: var(--text); line-height: 1.4; }
.notif-time  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text3); font-size: 13px; }

/* ── App body ── */
.app-body { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }

.invite-banner {
    background: var(--surface); border: 1px solid var(--border); border-radius: 3px;
    padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.invite-banner p      { color: var(--text2); font-size: 13px; margin: 0; }
.invite-banner strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 1px; }
.btn-accent { padding: 7px 14px; background: var(--accent); color: white; border: none; border-radius: 3px; font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: opacity 0.2s; }
.btn-accent:hover { opacity: 0.88; }

.status-bar { font-size: 12px; color: var(--text3); margin-bottom: 24px; }
.section-label { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }

/* ── Tank layout ── */
.main-grid { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: start; }

.tank-section { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tank-wrap { position: relative; }
.tank-top {
    width: 160px; height: 12px; background: var(--border);
    border-radius: 3px 3px 0 0; border: 1px solid var(--border-hover); border-bottom: none;
}
.tank-outer {
    width: 160px; height: 300px;
    border: 1px solid var(--border-hover); border-top: none; border-radius: 0 0 3px 3px;
    background: var(--surface); position: relative; overflow: hidden;
}
.tank-fill {
    position: absolute; bottom: 0; left: 0; right: 0;
    transition: height 1.2s cubic-bezier(0.4,0,0.2,1); overflow: hidden;
    background-color: #e8e4dc;
    background-image:
        radial-gradient(ellipse 4px 3px at 12% 18%, rgba(255,255,255,0.9)  0%, transparent 100%),
        radial-gradient(ellipse 5px 4px at 34% 52%, rgba(255,255,255,0.7)  0%, transparent 100%),
        radial-gradient(ellipse 3px 3px at 58% 28%, rgba(255,255,255,0.85) 0%, transparent 100%),
        radial-gradient(ellipse 6px 4px at 72% 65%, rgba(255,255,255,0.75) 0%, transparent 100%),
        radial-gradient(ellipse 4px 3px at 88% 40%, rgba(255,255,255,0.8)  0%, transparent 100%),
        radial-gradient(ellipse 3px 4px at 22% 75%, rgba(255,255,255,0.7)  0%, transparent 100%),
        radial-gradient(ellipse 5px 3px at 48% 88%, rgba(255,255,255,0.85) 0%, transparent 100%),
        radial-gradient(ellipse 4px 5px at 65% 10%, rgba(255,255,255,0.7)  0%, transparent 100%),
        radial-gradient(ellipse 3px 3px at 80% 82%, rgba(255,255,255,0.9)  0%, transparent 100%),
        radial-gradient(ellipse 5px 4px at 5%  60%, rgba(255,255,255,0.75) 0%, transparent 100%),
        radial-gradient(ellipse 4px 3px at 42% 35%, rgba(200,194,182,0.8)  0%, transparent 100%),
        radial-gradient(ellipse 3px 4px at 90% 15%, rgba(200,194,182,0.7)  0%, transparent 100%),
        radial-gradient(ellipse 5px 3px at 16% 44%, rgba(200,194,182,0.65) 0%, transparent 100%),
        radial-gradient(ellipse 4px 4px at 55% 70%, rgba(200,194,182,0.75) 0%, transparent 100%);
    background-size: 60px 50px;
}
.tank-fill::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 6px;
    background: linear-gradient(to bottom, rgba(180,174,162,0.5), transparent);
}
.tank-fill.ok     { background-color: #e8e4dc; }
.tank-fill.warn   { background-color: #e8dfc8; }
.tank-fill.danger { background-color: #e8d5c8; }

.threshold-line { position: absolute; left: 0; right: 0; height: 1px; }
.threshold-line span { position: absolute; top: -14px; right: 4px; font-size: 9px; font-weight: 500; padding: 1px 5px; border-radius: 2px; white-space: nowrap; color: white; }
.t-low    { background: var(--amber); } .t-low span    { background: var(--amber); }
.t-medium { background: var(--red);   } .t-medium span { background: var(--red);   }
.t-urgent { background: #991b1b;      } .t-urgent span { background: #991b1b;      }

.tank-pct    { font-size: 36px; font-weight: 700; color: var(--text); letter-spacing: -1px; line-height: 1; }
.tank-status { font-size: 12px; font-weight: 500; color: var(--text3); letter-spacing: 0.3px; text-transform: uppercase; }
.ok     { color: var(--green); }
.warn   { color: var(--amber); }
.danger { color: var(--red);   }

/* ── Stat cards ── */
.stats-col { display: flex; flex-direction: column; gap: 12px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; padding: 16px 18px; transition: border-color 0.2s;
}
.stat-card:hover    { border-color: var(--border-hover); }
.stat-card.clickable { cursor: pointer; }
.s-label { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.s-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.s-hint  { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── Tooltip ── */
.tip { position: relative; display: inline-flex; align-items: center; }
.tip-icon {
    width: 13px; height: 13px; border-radius: 50%;
    border: 1px solid var(--border-hover); color: var(--text3);
    font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    cursor: default; flex-shrink: 0; font-style: normal; text-transform: none; letter-spacing: 0;
}
.tip-box {
    display: none; position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--surface); font-size: 11px; font-weight: 400;
    white-space: nowrap; padding: 5px 9px; border-radius: 3px; z-index: 500;
    pointer-events: none; letter-spacing: 0; text-transform: none;
}
.tip-box::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 4px solid transparent; border-top-color: var(--text);
}
.tip:hover .tip-box { display: block; }

/* ── Day filters ── */
.day-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.day-btn {
    padding: 5px 12px; border-radius: 3px; border: 1px solid var(--border);
    background: transparent; color: var(--text3); font-size: 12px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.day-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.day-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text); }

/* ── Refill list ── */
.refill-list { display: flex; flex-direction: column; }
.refill-row {
    display: flex; align-items: center; gap: 14px; padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.refill-row:last-child { border-bottom: none; }
.refill-dot   { width: 8px; height: 8px; background: var(--green); border-radius: 50%; flex-shrink: 0; }
.refill-info  { flex: 1; }
.refill-date  { font-size: 13px; font-weight: 500; color: var(--text); }
.refill-detail { font-size: 12px; color: var(--text3); margin-top: 1px; }
.refill-badge { font-size: 12px; font-weight: 500; color: var(--green); background: var(--chip); padding: 3px 8px; border-radius: 3px; }
.empty-state  { padding: 20px 0; text-align: center; color: var(--text3); font-size: 13px; }

/* ── Modals ── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 400;
    align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; width: 100%; max-width: 640px;
    max-height: 88vh; display: flex; flex-direction: column;
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; }

/* ── Settings panel ── */
.panel-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 300;
    justify-content: flex-end; align-items: stretch;
}
.panel-overlay.show { display: flex; }
.panel-box {
    background: var(--surface); width: 400px; height: 100%; overflow-y: auto;
    border-left: 1px solid var(--border); animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.panel-header {
    padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.panel-header h2 { font-size: 15px; font-weight: 700; color: var(--text); }
.panel-close {
    background: transparent; border: 1px solid var(--border); width: 28px; height: 28px;
    border-radius: 3px; cursor: pointer; font-size: 13px; color: var(--text2);
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.panel-close:hover { border-color: var(--border-hover); color: var(--text); }
.panel-body { padding: 20px; }
.p-section { margin-bottom: 24px; }
.p-section-title { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.p-field { margin-bottom: 14px; }
.p-field label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.p-field .p-hint { font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.p-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; font-family: inherit; font-size: 13px; background: var(--bg); color: var(--text); outline: none; transition: border-color 0.2s; }
.p-input:focus { border-color: var(--accent); }
.p-select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; font-family: inherit; font-size: 13px; background: var(--bg); color: var(--text); outline: none; cursor: pointer; }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.num-input { width: 68px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 3px; font-size: 13px; text-align: center; font-family: inherit; outline: none; background: var(--bg); color: var(--text); transition: border-color 0.2s; }
.num-input:focus { border-color: var(--accent); }
.unit-label { font-size: 12px; color: var(--text3); font-weight: 400; width: 24px; }
.h-row { display: flex; gap: 8px; align-items: center; }
.h-input { width: 90px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; font-size: 13px; font-family: inherit; outline: none; background: var(--bg); color: var(--text); transition: border-color 0.2s; }
.h-input:focus { border-color: var(--accent); }
.seg-control { display: flex; background: var(--chip); border-radius: 3px; padding: 2px; width: fit-content; margin-bottom: 20px; }
.seg-btn { padding: 5px 16px; border: none; background: transparent; color: var(--text3); font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer; border-radius: 2px; transition: all 0.15s; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.t-low-lbl { color: var(--amber); }
.t-med-lbl { color: var(--red); }
.t-urg-lbl { color: #991b1b; }
.save-btn { width: 100%; padding: 10px; background: var(--accent); color: white; border: none; border-radius: 3px; font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: opacity 0.2s; }
.save-btn:hover { opacity: 0.88; }
.save-confirm { text-align: center; color: var(--green); font-size: 13px; margin-top: 10px; display: none; }

/* ── Members ── */
.member-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 16px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.member-avatar { width: 30px; height: 30px; border-radius: 3px; background: var(--avatar); display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.member-info  { flex: 1; min-width: 0; }
.member-email { font-size: 13px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.role-chip { font-size: 11px; padding: 2px 7px; border-radius: 3px; font-weight: 500; background: var(--chip); color: var(--text2); }
.role-chip.owner   { background: var(--avatar); color: white; }
.role-chip.pending { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .role-chip.pending { background: rgba(251,191,36,0.1); color: #fbbf24; }
.member-actions { display: flex; gap: 6px; align-items: center; }
.role-select  { padding: 4px 7px; border: 1px solid var(--border); border-radius: 3px; font-size: 12px; background: var(--bg); color: var(--text); font-family: inherit; cursor: pointer; }
.remove-btn   { padding: 4px 9px; background: transparent; color: var(--red); border: 1px solid var(--border); border-radius: 3px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.remove-btn:hover { border-color: var(--red); background: rgba(220,38,38,0.05); }
.invite-row   { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.invite-input { flex: 1; min-width: 140px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 3px; font-size: 13px; font-family: inherit; outline: none; background: var(--bg); color: var(--text); }
.invite-input:focus { border-color: var(--accent); }
.invite-role   { padding: 7px 9px; border: 1px solid var(--border); border-radius: 3px; font-size: 13px; background: var(--bg); color: var(--text); font-family: inherit; }
.invite-submit { padding: 7px 14px; background: var(--accent); color: white; border: none; border-radius: 3px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: opacity 0.2s; }
.invite-submit:hover { opacity: 0.88; }
.invite-msg { font-size: 12px; margin-top: 8px; display: none; }
.invite-msg.error   { color: var(--red); }
.invite-msg.success { color: var(--green); }

/* ── Assign device list ── */
.assign-dev-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 0; border-bottom: 1px solid var(--border);
    gap: 12px;
}
.assign-dev-item:last-child { border-bottom: none; }
.assign-dev-name { font-size: 13px; color: var(--text); font-weight: 500; }
.assign-dev-sub  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.assign-dev-btn  {
    padding: 5px 12px; border-radius: 3px; border: 1px solid var(--accent);
    background: none; color: var(--accent); font-family: inherit; font-size: 12px;
    font-weight: 500; cursor: pointer; white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
}
.assign-dev-btn:hover { background: rgba(79,110,247,0.07); }
.assign-dev-btn.assigned { border-color: var(--border); color: var(--text3); cursor: default; }

/* ── Device selector in stat card ── */
.device-loc-select {
    margin-top: 4px; width: calc(100% - 28px); padding: 4px 6px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
    color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer;
}
.device-loc-add {
    position: absolute; top: 10px; right: 10px;
    width: 22px; height: 22px; border-radius: 3px; border: 1px solid var(--border);
    background: none; color: var(--text3); cursor: pointer; display: flex;
    align-items: center; justify-content: center; padding: 0; transition: all 0.15s;
}
.device-loc-add:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,110,247,0.07); }

/* ── Mobile ── */
@media (max-width: 640px) {
    .main-grid  { grid-template-columns: 1fr; justify-items: center; }
    .stats-row  { grid-template-columns: 1fr 1fr; }
    .stats-col  { width: 100%; }
    .tank-outer { width: 140px; height: 260px; }
    .tank-top   { width: 150px; }
    .app-body   { padding: 16px 14px 48px; }
    .notif-dropdown { right: 8px; width: calc(100vw - 16px); }
    .panel-overlay { align-items: flex-end; justify-content: stretch; }
    .panel-box  { width: 100% !important; max-height: 90vh; border-radius: 3px 3px 0 0 !important; }
    .locations-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
    .locations-grid { grid-template-columns: 1fr; }
}
