/* RepairBill v2 — App Shell Layout */

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Sidebar ─── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: var(--accent-fg);
  font-family: 'Cabinet Grotesk', sans-serif;
  flex-shrink: 0;
}

.sidebar-logo h1 {
  font-size: 17px;
  letter-spacing: -0.03em;
}

.sidebar-logo h1 span {
  color: var(--accent);
}

.sidebar-logo .version {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 1px;
  display: block;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 20px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 0 12px 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r);
  font-family: 'Satoshi', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-align: left;
  position: relative;
}

.nav-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-btn .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-btn .badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav-btn.active .badge {
  background: rgba(212,245,34,0.2);
  color: var(--accent);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.sidebar-user:hover { background: var(--surface2); }

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-3);
}

.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.sync-indicator.ok { background: var(--success); }
.sync-indicator.err { background: var(--danger); }
.sync-indicator.busy { background: var(--warn); animation: pulse 1s infinite; }

/* ─── Main Content Area ─── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Page header */
.page-header {
  height: var(--header-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  flex-shrink: 0;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-title {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Cabinet Grotesk', sans-serif;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.breadcrumb span { color: var(--text-2); }

.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all var(--dur) var(--ease);
}
.header-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Page content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Mobile Bottom Nav ─── */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 500;
  height: var(--mobile-nav);
  padding: 0;
}

.mobile-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  padding: 0 4px;
}

.mn-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--r);
  color: var(--text-3);
  font-family: 'Satoshi', sans-serif;
  font-size: 10px;
  font-weight: 500;
  transition: color var(--dur) var(--ease);
  position: relative;
}

.mn-btn .icon { font-size: 20px; }
.mn-btn.active { color: var(--accent); font-weight: 600; }
.mn-btn .mn-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Voice button (centre raised) */
.mn-btn.voice-btn {
  position: relative;
  top: -12px;
}
.mn-btn.voice-btn .icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(212,245,34,0.25);
}

/* ─── Responsive ─── */

/* Tablet: sidebar collapses to icons */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-logo h1,
  .sidebar-logo .version,
  .nav-label,
  .nav-btn span:not(.icon):not(.badge),
  .sidebar-user-info {
    display: none;
  }
  .sidebar-logo {
    justify-content: center;
    padding: 16px 8px;
  }
  .nav-btn {
    justify-content: center;
    padding: 10px;
  }
  .nav-btn .icon { margin: 0; }
  .nav-btn .badge {
    position: absolute;
    top: 4px;
    right: 8px;
    margin: 0;
  }
  .nav-btn.active::before { display: none; }
  .sidebar-user { justify-content: center; padding: 8px; }
  .sidebar-footer { padding: 8px; }
}

/* Mobile: sidebar hidden, bottom nav shows */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .page-content {
    padding: 16px;
    padding-bottom: calc(var(--mobile-nav) + 16px);
  }
  .page-header { padding: 0 16px; }
}
