/* ═══════════════════════════════════════════════
   IQchef · Design System
   Aesthetic: Industrial Utility — dark green/slate,
   amber accents, mono data, warm cream bg
═══════════════════════════════════════════════ */
:root {
  --bg:          #f0ebe0;
  --bg2:         #e8e2d6;
  --surface:     #ffffff;
  --surface2:    #f8f4ee;
  --border:      #ddd5c4;
  --border-dark: #c9bfad;

  --header:      #4A9A9E;
  --header2:     #3d8a8e;
  --accent:      #FF6C0C;
  --accent2:     #ff8c3c;
  --green:       #2d6a4f;
  --green-light: #52b788;
  --blue:        #2563a8;
  --red:         #c0392b;

  --strom:       #FF6C0C;
  --gas:         #2563a8;
  --wasser:      #3aafa9;

  --text:        #1c1c1a;
  --text-mid:    #4a4540;
  --text-soft:   #8a8078;
  --text-dim:    #b5aba0;
  --mono:        'Courier New', monospace;

  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(28,28,26,.08);
  --shadow-lg:   0 8px 32px rgba(28,28,26,.13);

  --sidebar-w:   260px;
  --header-h:    60px;
}

*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html,body { height:100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-dark); border-radius:2px; }

/* ══════════════════════════════════
   SHELL
══════════════════════════════════ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════
   HEADER
══════════════════════════════════ */
.topbar {
  grid-column: 1/-1;
  background: var(--header);
  display: flex;
  align-items: center;
  padding: 0 20px 0 16px;
  gap: 14px;
  border-bottom: 2px solid var(--accent);
  position: relative;
  z-index: 100;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
  font-family: var(--mono);
}
.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  font-weight: 400;
  font-family: var(--mono);
  letter-spacing: .5px;
}

.header-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.15);
}

.nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
}
.nav-tab {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.nav-tab:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-tab.active {
  background: rgba(232,130,12,.2);
  color: var(--accent2);
  border-bottom: 2px solid var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn-login {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
}
.btn-login:hover { background: rgba(255,255,255,.2); }

.user-chip {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.user-avatar img { width:100%; height:100%; object-fit:cover; }
.user-name { font-size: 12px; color: rgba(255,255,255,.9); font-weight: 500; }
.user-role-badge {
  font-size: 9px;
  font-family: var(--mono);
  background: rgba(232,130,12,.3);
  color: var(--accent2);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Notification bell */
.notif-wrap { position: relative; cursor: pointer; }
.notif-bell { font-size: 18px; line-height:1; color:rgba(255,255,255,.7); }
.notif-badge {
  display: none;
  position: absolute;
  top: -4px; right: -6px;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 3px;
  font-family: var(--mono);
}

/* Notification panel */
.notif-panel {
  display: none;
  position: absolute;
  top: calc(var(--header-h) + 4px);
  right: 80px;
  width: 300px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
}
.notif-panel.open { display: block; }

.notif-panel-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-panel-head span { font-size: 12px; font-weight: 700; }
.notif-panel-head button {
  font-size: 11px;
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-weight: 600;
}

/* ══════════════════════════════════
   SIDEBAR
══════════════════════════════════ */
.sidebar {
  background: #3d8a8e;
  border-right: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 0;
}

.sidebar-section {
  padding: 0 10px;
  margin-bottom: 4px;
}
.sidebar-label {
  font-size: 9px;
  font-family: var(--mono);
  color: rgba(255,255,255,.3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 10px 6px;
}
.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: rgba(255,255,255,.65);
  font: inherit;
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all .15s;
}
.sidebar-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-btn.active {
  background: rgba(232,130,12,.15);
  color: var(--accent2);
}
.sidebar-btn .s-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-btn .s-count {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  background: rgba(255,255,255,.1);
  padding: 1px 6px;
  border-radius: 8px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.version-tag {
  font-size: 10px;
  font-family: var(--mono);
  color: rgba(255,255,255,.2);
  text-align: center;
}

/* ══════════════════════════════════
   MAIN CONTENT
══════════════════════════════════ */
.main {
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.view { display: none; flex-direction: column; height: 100%; }
.view.active { display: flex; }

/* Page header */
.page-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.page-head-text { flex: 1; }
.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}
.page-subtitle {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ══════════════════════════════════
   BUTTONS
══════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--header); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d47008; }
.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border-dark);
}
.btn-ghost:hover { background: var(--bg2); border-color: var(--text-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ══════════════════════════════════
   CARDS / GRID
══════════════════════════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 20px 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-meta { font-size: 11px; color: var(--text-soft); }
.card-badge {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.card-body { padding: 14px 16px; }

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 11px; color: var(--text-soft); }
.stat-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Energy type pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
}
.pill-strom  { background: rgba(245,165,53,.15); color: #b57800; }
.pill-gas    { background: rgba(74,144,217,.15);  color: #1a5fa8; }
.pill-wasser { background: rgba(58,175,169,.15);  color: #1e7a76; }

/* Type color dots */
.dot-strom  { background: var(--strom); }
.dot-gas    { background: var(--gas); }
.dot-wasser { background: var(--wasser); }

/* ══════════════════════════════════
   TABLE
══════════════════════════════════ */
.tbl-wrap {
  overflow-x: auto;
  padding: 0 24px 24px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead { background: var(--header); color: #fff; }
th {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

td.mono { font-family: var(--mono); font-size: 12px; }
td.num  { text-align: right; font-family: var(--mono); }

/* ══════════════════════════════════
   SUMMARY STATS (Dashboard)
══════════════════════════════════ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.stat-box {
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-box-label {
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.stat-box-val {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -1px;
  color: var(--text);
}
.stat-box-sub {
  font-size: 11px;
  color: var(--text-soft);
}
.stat-box.strom .stat-box-val  { color: #b57800; }
.stat-box.gas .stat-box-val    { color: #1a5fa8; }
.stat-box.wasser .stat-box-val { color: #1e7a76; }

/* ══════════════════════════════════
   FORM / MODAL
══════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,42,30,.5);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title { font-size: 15px; font-weight: 700; flex: 1; }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-soft);
  line-height: 1;
  padding: 2px;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1/-1; }
label { font-size: 11px; font-weight: 600; color: var(--text-mid); }
input, select, textarea {
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  color: var(--text);
  transition: border-color .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}
input.mono-input { font-family: var(--mono); }

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface2);
}

/* ══════════════════════════════════
   ENERGY TYPE SELECTOR
══════════════════════════════════ */
.type-selector {
  display: flex;
  gap: 8px;
}
.type-btn {
  flex: 1;
  border: 2px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  padding: 8px 6px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.type-btn .t-icon { font-size: 20px; }
.type-btn.active-strom  { border-color: var(--strom);  background: rgba(245,165,53,.12); color: #b57800; }
.type-btn.active-gas    { border-color: var(--gas);    background: rgba(74,144,217,.12); color: #1a5fa8; }
.type-btn.active-wasser { border-color: var(--wasser); background: rgba(58,175,169,.12); color: #1e7a76; }

/* ══════════════════════════════════
   CHART BAR (simple CSS chart)
══════════════════════════════════ */
.chart-wrap {
  padding: 0 24px 24px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.chart-title { font-size: 13px; font-weight: 700; margin-bottom: 16px; }
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 100px; font-size: 11px; color: var(--text-soft); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 20px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }
.bar-val { width: 80px; font-size: 11px; font-family: var(--mono); color: var(--text-mid); flex-shrink: 0; }

/* ══════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════ */
.login-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #4A9A9E;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: 32px;
}
.login-screen.show { display: flex; }
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.login-icon {
  width: 72px;
  height: 72px;
  background: var(--accent);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.login-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
}
.login-sub {
  font-size: 13px;
  color: rgba(255,255,255,.5);
  font-family: var(--mono);
  letter-spacing: .5px;
}
.login-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-hint {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  text-align: center;
  line-height: 1.7;
}
.btn-google-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  width: 100%;
}
.btn-google-login:hover { background: #f0f0f0; }

/* Pending screen */
.pending-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-soft);
  text-align: center;
  padding: 40px;
}
.pending-screen.show { display: flex; }
.pending-icon { font-size: 48px; margin-bottom: 8px; }
.pending-title { font-size: 20px; font-weight: 700; color: var(--text); }
.pending-text  { font-size: 13px; max-width: 400px; line-height: 1.7; }

/* ══════════════════════════════════
   EMPTY STATE
══════════════════════════════════ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-soft);
  gap: 12px;
}
.empty-icon { font-size: 40px; opacity: .5; }
.empty-text { font-size: 14px; }

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--header);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .2s ease;
  border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--green-light); }
.toast.error   { border-left-color: var(--red); }
@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.badge-paid     { background: rgba(82,183,136,.15); color: #2d6a4f; }
.badge-open     { background: rgba(192,57,43,.12);  color: #c0392b; }
.badge-inactive { background: rgba(176,168,152,.15); color: #7a7570; }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 768px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; padding: 12px; }
  .page-head { padding: 14px 16px 12px; }
  .tbl-wrap  { padding: 0 12px 16px; }
  .chart-wrap{ padding: 0 12px 16px; }
}

/* ── Sidebar Navigation (sb-nav-btn) v3.8.x ── */
.sb-nav { display:flex; flex-direction:column; gap:2px; padding:12px 10px; flex:1; }
.sb-nav-btn { display:flex; align-items:center; gap:8px; padding:9px 12px; border:none; border-radius:8px; background:transparent; color:var(--text-mid); font-size:13px; font-weight:500; cursor:pointer; text-align:left; transition:background .15s,color .15s; font-family:inherit; width:100%; }
.sb-nav-btn:hover { background:var(--surface2); color:var(--text); }
.sb-nav-btn.active { background:var(--teal,#4A9A9E); color:#fff; font-weight:600; }
