/* ============================================================
   VidaPOS — Dashboard Cerveau
   ============================================================ */

body.cerveau-body { overflow: auto; background: var(--bg); }

/* ---- Layout ---- */
#cerveau-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
#cerveau-sidebar {
  background: #1a1f2e;
  color: #e0e6f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.cerveau-logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.cerveau-logo .logo-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.5px;
  display: block;
  color: #fff;
}
.cerveau-logo small {
  font-size: .72rem;
  opacity: .5;
  text-transform: uppercase;
  letter-spacing: .5px;
}

#cerveau-nav { padding: .75rem 0; flex: 1; }

.cerveau-nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .65rem 1.25rem;
  background: none;
  border: none;
  color: rgba(224,230,240,.65);
  font-size: .88rem;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  border-radius: 0;
}
.cerveau-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.cerveau-nav-item.active { background: rgba(99,179,136,.18); color: #63b388; font-weight: 600; }
.cerveau-nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

a.cerveau-link { text-decoration: none; font-size: .82rem; opacity: .7; }
a.cerveau-link:hover { opacity: 1; }

.cerveau-store-selector {
  padding: .6rem 1rem;
  margin: .5rem .75rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  color: #e0e6f0;
  font-size: .82rem;
  width: calc(100% - 1.5rem);
  cursor: pointer;
}
.cerveau-store-selector option { background: #1a1f2e; }

.cerveau-nav-section {
  padding: .4rem 1.25rem .2rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.3);
  margin-top: .5rem;
}

.cerveau-user-bar {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}
.cerveau-user-bar strong { color: rgba(255,255,255,.8); font-weight: 600; }
.cerveau-user-bar button {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.5);
  border-radius: 4px;
  padding: .25rem .55rem;
  font-size: .75rem;
  cursor: pointer;
}
.cerveau-user-bar button:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---- Main content ---- */
#cerveau-main {
  padding: 1.75rem 2rem;
  min-width: 0;
}

.cerveau-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .25rem;
}
.cerveau-page-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}
.kpi-card .kpi-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.kpi-card .kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.kpi-card .kpi-sub {
  font-size: .78rem;
  margin-top: .3rem;
}
.kpi-up   { color: #22863a; }
.kpi-down { color: #d73a49; }
.kpi-neu  { color: var(--text-muted); }

/* ---- Chart ---- */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}
.chart-card h3 {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-wrap { width: 100%; overflow-x: auto; }

/* ---- Store comparison ---- */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}
.store-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.store-card .store-row {
  display: flex;
  justify-content: space-between;
  padding: .3rem 0;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
.store-card .store-row:last-child { border-bottom: none; }
.store-card .store-row .sr-label { color: var(--text-muted); }
.store-card .store-row .sr-val   { font-weight: 600; }

/* ---- Tables ---- */
.cerveau-table-wrap { overflow-x: auto; }
.cerveau-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}
.cerveau-table th {
  text-align: left;
  padding: .6rem .75rem;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 2px solid var(--border);
}
.cerveau-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
}
.cerveau-table tbody tr:hover { background: var(--surface2); }
.cerveau-table tbody tr.row-inactive td { opacity: .5; }

/* ---- Period tabs ---- */
.period-tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: 1.25rem;
}
.period-tab {
  padding: .4rem .9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.period-tab.active {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
  font-weight: 600;
}

/* ---- Loading / error ---- */
.cerveau-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ---- Login ---- */
#cerveau-login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1f2e;
}
.cerveau-login-box {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.cerveau-login-box h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.cerveau-login-box p  { font-size: .85rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ---- Categories ---- */
.cat-row {
  border-bottom: 1px solid var(--border);
}
.cat-row:last-child { border-bottom: none; }

.cat-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .75rem;
  gap: .5rem;
  transition: background .12s;
}
.cat-row-main:hover { background: var(--surface2); }

.cat-row.cat-inactive .cat-row-main { opacity: .5; }

.cat-row-left {
  display: flex;
  align-items: center;
  gap: .15rem;
  flex: 1;
  min-width: 0;
}

.cat-name {
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-row.cat-child .cat-row-main {
  padding-left: 2.5rem;
}
.cat-row.cat-child .cat-name {
  font-weight: 500;
  font-size: .88rem;
}

.cat-children {
  background: rgba(0,0,0,.015);
  border-left: 3px solid var(--green-dark);
  margin-left: .75rem;
  border-radius: 0 0 0 6px;
}

.cat-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: .15rem .25rem;
  font-size: .7rem;
  color: var(--text-muted);
  line-height: 1;
  transition: color .15s;
  width: 24px;
  text-align: center;
}
.cat-toggle:hover { color: var(--green-dark); }

.cat-arrow {
  display: inline-block;
  transition: transform .2s ease;
}
.cat-arrow.open {
  transform: rotate(90deg);
}

.cat-row-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

.cat-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  padding: .15rem .3rem;
  border-radius: 4px;
  transition: background .12s;
  opacity: .6;
}
.cat-btn:hover { opacity: 1; background: rgba(0,0,0,.05); }

.cat-btn-delete:hover { background: rgba(230,57,70,.1); }

/* ---- Placeholder ---- */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  gap: .75rem;
  text-align: center;
}
.coming-soon .cs-icon { font-size: 3rem; }
.coming-soon h2 { font-size: 1.2rem; font-weight: 600; color: var(--text); }
.coming-soon p  { font-size: .88rem; max-width: 420px; }
