.app {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* ---- SIDEBAR ---- */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ---- Mode Toggle ---- */
.mode-sw {
  display: flex;
  flex-direction: row;
  padding: 3px;
  margin: 14px 14px 6px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  gap: 2px;
  border: 1px solid var(--border);
}

.mode-btn {
  flex: 1;
  padding: 7px 4px;
  background: transparent;
  border: none;
  color: var(--text-sec);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s var(--ease);
  letter-spacing: 0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mode-btn.on {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(155,21,21,0.3);
}

.mode-btn:hover:not(.on) {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

/* ---- Navigation ---- */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-ter);
  padding: 14px 20px 6px;
  letter-spacing: 1.2px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 20px;
}

.ni {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s var(--ease);
  gap: 10px;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.ni-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-ter);
  transition: color 0.2s var(--ease);
  flex-shrink: 0;
}

.ni-icon svg {
  width: 16px;
  height: 16px;
}

.ni-text {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-sec);
  flex: 1;
  transition: all 0.2s var(--ease);
}

.ni:hover {
  background: rgba(255,255,255,0.02);
}

.ni:hover .ni-text {
  color: var(--text);
}

.ni:hover .ni-icon {
  color: var(--text-sec);
}

.ni.on {
  border-left-color: var(--accent);
  background: var(--accent-subtle);
}

.ni.on .ni-text {
  color: var(--text);
  font-weight: 600;
}

.ni.on .ni-icon {
  color: var(--accent-bright);
}

/* ---- Sidebar Footer ---- */
.sb-foot-wrap {
  border-top: 1px solid var(--border);
}

.sb-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 0;
}

.sb-api-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-ter);
  padding: 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
}

.sb-api-badge.sb-api-ready {
  color: var(--green);
  border-color: rgba(45,212,191,0.15);
  background: rgba(45,212,191,0.05);
}

.sb-api-badge.sb-api-none {
  color: rgba(248,246,242,0.35);
  border-color: rgba(248,246,242,0.06);
}

.sb-api-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sb-api-dot-on {
  background: var(--green);
  box-shadow: 0 0 6px rgba(45,212,191,0.4);
}

.sb-api-dot-off {
  background: rgba(248,246,242,0.2);
}

.sb-api-dot-warn {
  background: var(--red);
  box-shadow: 0 0 6px rgba(239,68,68,0.4);
}

.sb-sync-badge {
  font-size: 10px;
  color: var(--text-ter);
}

.sb-foot {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
  margin: 0 8px 8px;
}
.sb-foot:hover {
  background: var(--bg3);
}

.sb-foot-logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sb-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  flex-shrink: 0;
}

.sb-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  flex-shrink: 0;
  object-fit: cover;
}

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

.sb-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-user-plan {
  font-size: 10px;
  color: var(--text-ter);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sign Out — icon only button */
.sb-signout-icon {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-ter);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
  padding: 0;
}

.sb-signout-icon:hover {
  background: rgba(155,21,21,0.1);
  border-color: rgba(155,21,21,0.3);
  color: var(--accent-bright);
}

.sync-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.sync-dot.syncing {
  background: var(--amber);
  animation: pulse 1s ease-in-out infinite;
}

.sync-dot.error {
  background: var(--red);
}

.sync-text {
  color: var(--text-sec);
  flex: 1;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.usr-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.usr-name-el {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.user-email {
  font-size: 10px;
  color: var(--text-ter);
  margin: 0;
}

/* ---- PANELS ---- */
.inp-panel {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.out-panel {
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-height: 0;
}

/* ---- Grids ---- */
.g5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.g4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.g3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.g2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.g1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.upload-grid {
  display: grid;
  gap: 6px;
}

.upload-grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.upload-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.upload-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.jewelry-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
