:root {
  --green-900: #0b3d2e;
  --green-700: #166534;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --slate-900: #172018;
  --slate-500: #64748b;
  --slate-300: #cbd5d0;
  --border: #dce7df;
  --bg: #f8faf8;
  --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  height: 100vh;
  overflow: hidden; /* Prevent body scroll, we scroll inside content */
}

/* --- LAYOUT --- */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0b3d2e, #14532d);
  color: white;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header .logo {
  font-size: 24px;
}
.sidebar-header h2 { font-size: 18px; }
.close-btn {
  display: none;
  background: none; border: none;
  color: white; font-size: 24px; cursor: pointer;
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: 0.2s;
}
.nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.nav-link.active {
  background: var(--green-600);
  color: white;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 10px 0;
}
.nav-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.5);
  font-weight: 700;
  padding: 0 14px;
  margin-bottom: 5px;
}

/* --- MAIN CONTENT --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 25px;
  background: white;
  border-bottom: 1px solid var(--border);
  height: 70px;
}
.menu-btn {
  display: none;
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  color: var(--green-700);
}
.top-bar h1 {
  font-size: 20px;
  color: var(--green-700);
  flex: 1;
}

.lang-switcher {
  display: flex; gap: 4px; background: #eef3ef;
  padding: 4px; border-radius: 10px;
}
.lang-switcher button {
  border: none; background: transparent;
  padding: 6px 10px; border-radius: 7px;
  font-size: 12px; font-weight: 700; color: var(--slate-500); cursor: pointer;
}
.lang-switcher button.active {
  background: white; color: var(--green-700);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* --- REST OF YOUR STYLES (unchanged from before) --- */
.welcome { margin-bottom: 20px; }
.welcome h2 { font-size: 22px; margin-bottom: 6px; color: var(--green-900); }
.welcome p { color: var(--slate-500); font-size: 15px; }

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.panel h3 { color: var(--green-700); margin-bottom: 14px; font-size: 16px; }

.crop-input {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--slate-300);
  border-radius: 12px; font-size: 15px;
  font-family: inherit; outline: none;
}
.crop-input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.crop-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--slate-300); background: var(--bg);
  padding: 7px 13px; border-radius: 20px;
  font-size: 13px; cursor: pointer; transition: 0.15s;
}
.chip:hover { background: var(--green-100); border-color: var(--green-500); color: var(--green-700); }

.problem-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.problem-grid button {
  border: 1px solid var(--slate-300); background: var(--bg);
  padding: 11px 8px; border-radius: 10px; cursor: pointer;
  font-size: 13px; text-align: left; transition: 0.15s;
}
.problem-grid button:hover { background: var(--green-100); border-color: var(--green-500); }

textarea {
  width: 100%; min-height: 90px; resize: vertical; padding: 12px;
  border: 1px solid var(--slate-300); border-radius: 10px;
  font-family: inherit; font-size: 14px; outline: none;
}
textarea:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }

.photo-upload { margin-top: 12px; }
.photo-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px dashed var(--slate-300);
  border-radius: 10px; cursor: pointer;
  font-size: 13px; color: var(--slate-500);
}
.photo-label:hover { border-color: var(--green-500); color: var(--green-700); }
.photo-preview { margin-top: 10px; }
.thumb {
  position: relative; display: inline-block;
  border-radius: 10px; overflow: hidden; border: 2px solid var(--green-500);
}
.thumb img { display: block; max-width: 120px; max-height: 120px; }
.thumb-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.65);
  color: white; font-size: 16px; cursor: pointer;
}

.primary {
  width: 100%; margin-top: 14px;
  padding: 13px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--green-600), var(--green-700));
  color: white; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: 0.2s;
}
.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(22, 163, 74, 0.3); }
.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.ghost {
  background: transparent; border: 1px solid var(--slate-300);
  color: var(--slate-500); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; font-size: 13px;
}
.ghost.small { font-size: 12px; padding: 5px 10px; margin-top: 8px; }

.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.msg { display: flex; gap: 8px; align-items: flex-start; animation: fadeIn 0.3s ease; }
.msg.user { justify-content: flex-end; }
.msg .avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--green-600); color: white;
  border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 16px;
}
.bubble {
  max-width: 82%; padding: 12px 15px;
  border-radius: 14px; line-height: 1.55; font-size: 14px;
}
.msg.user .bubble { background: var(--green-600); color: white; border-bottom-right-radius: 4px; }
.msg.ai .bubble { background: white; border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.msg.ai .bubble p { margin: 6px 0; }
.msg.ai .bubble strong { color: var(--green-700); }
.msg.ai .bubble ul { margin: 6px 0 6px 20px; }

.safety { text-align: center; margin-top: 20px; color: var(--slate-500); font-size: 12px; }

/* --- MOBILE RESPONSIVE --- */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.hidden { display: none; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .close-btn { display: block; }
  .menu-btn { display: block; }
  .top-bar h1 { font-size: 18px; }
  .content-area { padding: 15px; }
  .problem-grid { grid-template-columns: 1fr; }
}