.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 240px;
  background: #0b1220;
  display: flex;
  flex-direction: column;
  float: left;
}

.main-pane {
  margin-left: 240px;
  padding: 28px 24px 48px;
  min-height: 100vh;
}

.nav-btn {
  width: 100%;
  text-align: left;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-active {
  background: #00a651;
  color: #fff;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  padding: 18px;
}

.stat {
  background: linear-gradient(180deg, #fff, #f8fafc);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

th {
  color: #64748b;
  font-weight: 600;
}

.store-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}
.store-chip.active {
  background: #00a651;
  color: #fff;
  border-color: #00a651;
}

.lang-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.lang-btn.active {
  background: #00a651;
  color: #fff;
  border-color: #00a651;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.toast {
  margin-bottom: 16px;
  border-radius: 12px;
  padding: 10px 12px;
  background: #ecfdf5;
  color: #065f46;
}

.toast.error {
  background: #fef2f2;
  color: #991b1b;
}

#kphone-ai.ai-hidden {
  display: none;
}

#kphone-ai-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 0;
  background: #0b1220;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
}

#kphone-ai-fab.hidden-fab {
  transform: scale(0.4);
  opacity: 0;
  pointer-events: none;
}

#kphone-ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  width: min(380px, 100vw);
  height: 100vh;
  background: #0b1220;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.22s ease;
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.25);
}

#kphone-ai-panel.open {
  transform: translateX(0);
}

.ai-head,
.ai-toolbar,
.ai-form,
.ai-chip {
  padding: 14px 16px;
}

.ai-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-kicker {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #34d399;
}

.ai-head h2 {
  font-size: 16px;
  margin-top: 4px;
}

.ai-head button,
.ai-toolbar button,
.ai-form button {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ai-head button {
  background: transparent;
  color: #94a3b8;
}

.ai-toolbar {
  display: flex;
  gap: 8px;
}

.ai-toolbar button {
  background: #1e293b;
  color: #e2e8f0;
}

.ai-toolbar button.active {
  background: #00a651;
  color: #fff;
}

.ai-chip {
  margin: 0 16px;
  border-radius: 10px;
  background: #111827;
  font-size: 12px;
  color: #94a3b8;
}

.ai-chip.has-target {
  color: #bbf7d0;
  background: #064e3b;
}

.ai-log {
  flex: 1;
  overflow: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-msg {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.ai-msg.user {
  background: #00a651;
  color: #fff;
  align-self: flex-end;
  max-width: 92%;
}

.ai-msg.assistant {
  background: #1e293b;
  align-self: flex-start;
  max-width: 92%;
}

.ai-form {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-form textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #020617;
  color: #fff;
  padding: 10px;
  resize: none;
}

.ai-form button {
  margin-top: 8px;
  width: 100%;
  background: #00a651;
  color: #fff;
  font-weight: 600;
}

.ai-hover {
  outline: 2px dashed #34d399 !important;
  outline-offset: 3px;
  cursor: copy;
}

.ai-selected {
  outline: 3px solid #00a651 !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(0, 166, 81, 0.18);
}

body.ai-picking {
  cursor: crosshair;
}

body.ai-panel-open .main-pane {
  padding-right: min(400px, 42vw);
}

@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    float: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sidebar nav {
    display: flex;
    gap: 6px;
    overflow: auto;
    padding-bottom: 10px;
    width: 100%;
  }

  .nav-btn {
    white-space: nowrap;
    width: auto;
  }

  .main-pane {
    margin-left: 0;
    padding: 16px;
  }

  body.ai-panel-open .main-pane {
    padding-right: 16px;
  }

  #kphone-ai-panel {
    width: 100vw;
  }
}
