﻿:root {
  color-scheme: light;
  --ink: #12241f;
  --muted: #5d7068;
  --line: #dce8df;
  --line-strong: #c2d3c7;
  --soft: #f3f8f4;
  --surface: rgba(255, 255, 255, 0.9);
  --paper: #ffffff;
  --green: #1d8c59;
  --green-dark: #123b2b;
  --gold: #c28724;
  --blue: #2f6c9e;
  --amber: #f2b84b;
  --nav-bg: linear-gradient(135deg, #10231b 0%, #163c2d 100%);
  --shadow: 0 24px 60px rgba(18, 36, 29, 0.14);
  --shadow-soft: 0 12px 30px rgba(18, 36, 29, 0.08);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(36, 131, 91, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(52, 103, 168, 0.12), transparent 24%),
    linear-gradient(180deg, #f9fcf8 0%, #f3f7f2 100%);
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 86px;
  padding: 16px 28px;
  background: var(--nav-bg);
  color: #f7fbf8;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  box-shadow: 0 16px 36px rgba(18, 36, 29, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: #50b47f; color: #092117;
  font-weight: 900; font-size: 18px;
}

.brand h1, .brand p, h3, h4, p { margin: 0; }
.brand h1 { font-size: 18px; line-height: 1.2; }
.brand p { margin-top: 6px; color: #c7d8cb; font-size: 13px; }

.nav-list {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; min-width: 0; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; white-space: nowrap;
}

.nav-item {
  flex: 0 0 auto; width: auto; min-width: max-content;
  height: 48px; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: #d2e7d6; background: transparent;
  display: inline-grid; grid-template-columns: 30px auto;
  align-items: center; gap: 8px; padding: 0 12px; text-align: left;
  white-space: nowrap; transition: background 180ms var(--ease), transform 180ms var(--ease);
}

.nav-item.active, .nav-item:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.24); }
.nav-item.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 999px; background: var(--amber); }
.nav-item { position: relative; }
.nav-item:hover { transform: translateY(-2px); }
.nav-item.active { transform: translateY(-2px); }
.nav-item.active::after { box-shadow: 0 0 0 4px rgba(242,184,75,0.12); }

.nav-icon {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 10px;
  background: rgba(80,180,127,0.18); font-size: 12px;
}

.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.icon-btn, .profile-btn {
  border: 1px solid rgba(255,255,255,0.16); border-radius: 8px;
  color: #f7fbf8; background: rgba(255,255,255,0.08);
}
.icon-btn { position: relative; width: 46px; height: 46px; display: grid; place-items: center; font-weight: 900; }
.profile-btn { min-height: 46px; display: grid; grid-template-columns: 34px auto; align-items: center; gap: 10px; padding: 6px 10px 6px 7px; text-align: left; transition: background 180ms var(--ease), transform 180ms var(--ease); }
.profile-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.14); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: #092117; background: #83dc9a; font-weight: 900; font-size: 12px; }
.profile-btn strong, .profile-btn small { display: block; line-height: 1.1; }
.profile-btn small { margin-top: 4px; color: #bfd6c8; font-size: 12px; }

main { padding: 32px; min-width: 0; }

.view { display: none; }
.view.active { display: grid; gap: 24px; animation: viewIn 420ms var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.primary-btn, .secondary-btn, .ghost-btn, .copilot-form button {
  min-height: 46px; border-radius: 14px; border: 1px solid transparent; padding: 0 18px; font-weight: 800;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}
.primary-btn, .copilot-form button { background: linear-gradient(135deg, var(--green) 0%, #3ca96f 100%); color: white; box-shadow: 0 14px 28px rgba(36,131,91,0.2); }
.secondary-btn { background: var(--paper); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-soft); }
.ghost-btn { background: rgba(255,255,255,0.94); color: var(--ink); border-color: rgba(18,36,29,0.08); }
.primary-btn:hover, .secondary-btn:hover, .ghost-btn:hover, .copilot-form button:hover { transform: translateY(-2px); box-shadow: 0 18px 34px rgba(18,36,29,0.15); }
.primary-btn:active, .secondary-btn:active, .ghost-btn:active { transform: translateY(0); }

.hidden { display: none !important; }
.small-btn { min-height: 38px; padding: 0 12px; font-size: 13px; }

.welcome-hero { min-height: calc(100vh - 190px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr); gap: 28px; align-items: center; }
.welcome-copy { display: grid; gap: 22px; }
.welcome-copy h2 { font-size: clamp(34px, 4.5vw, 68px); line-height: 1.04; text-wrap: balance; margin: 0; }
.welcome-copy p { max-width: 760px; color: var(--muted); line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.welcome-visual { position: relative; min-height: 540px; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: linear-gradient(135deg, rgba(36,131,91,0.12), rgba(47,108,158,0.1)); box-shadow: var(--shadow-soft); }
.floating-card { position: absolute; display: grid; gap: 8px; width: min(260px, calc(100% - 40px)); padding: 18px; border: 1px solid rgba(255,255,255,0.85); border-radius: 18px; background: rgba(255,255,255,0.92); box-shadow: var(--shadow); transition: transform 400ms var(--ease); }
.floating-card:hover { transform: translateY(-6px) scale(1.02); }
.floating-card strong { font-size: 24px; }
.card-a { top: 38px; left: 34px; animation: floatPin 5s ease-in-out infinite; }
.card-b { right: 34px; top: 210px; animation-delay: 500ms; }
.card-c { left: 64px; bottom: 46px; animation-delay: 900ms; }
@keyframes floatPin { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

.role-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.role-preview { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-soft); padding: 24px; display: grid; gap: 12px; transition: transform 180ms var(--ease), box-shadow 180ms var(--ease); }
.role-preview:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-soft); }

.label, .eyebrow { display: inline-block; color: var(--green-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.label { color: var(--muted); }

.auth-view { min-height: calc(100vh - 170px); place-items: center; }
.auth-card { width: min(900px, 100%); display: grid; gap: 22px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,0.94); box-shadow: var(--shadow-soft); padding: 28px; animation: viewIn 500ms var(--ease) both; }
.auth-card h2 { margin: 0; font-size: clamp(28px, 3vw, 44px); }
.auth-card form { display: grid; gap: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid label, .seller-form label { display: grid; gap: 8px; color: var(--ink); font-weight: 800; }
.form-grid input, .form-grid select, .form-grid textarea, .seller-form input, .seller-form select, .seller-form textarea {
  min-height: 48px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--ink); background: white; transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .seller-form input:focus, .seller-form select:focus, .seller-form textarea:focus {
  border-color: rgba(36,131,91,0.45); box-shadow: 0 0 0 4px rgba(36,131,91,0.1); outline: none;
}
textarea { resize: vertical; min-height: 94px; }
.full-field { grid-column: 1 / -1; }
.check-field { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 10px !important; min-height: 44px; }
.check-field input { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); }
.auth-switch { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.auth-switch button { border: 0; padding: 0; color: var(--green-dark); background: transparent; font-weight: 900; transition: color 180ms var(--ease); }
.auth-switch button:hover { color: var(--green); text-decoration: underline; }

.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px; background: rgba(255,255,255,0.78); border: 1px solid rgba(220,230,223,0.82); border-radius: 24px; box-shadow: var(--shadow-soft); backdrop-filter: blur(16px); }
.dashboard-header h2 { font-size: clamp(26px, 3vw, 44px); margin: 0; }

.photo-preview { max-width: 200px; max-height: 200px; border-radius: 8px; object-fit: cover; display: block; border: 1px solid var(--line); }

.market-toolbar { display: grid; grid-template-columns: 2fr repeat(4, minmax(150px, 220px)); gap: 14px; padding: 18px 22px; background: rgba(255,255,255,0.78); border: 1px solid rgba(220,230,223,0.82); border-radius: 24px; box-shadow: var(--shadow-soft); backdrop-filter: blur(16px); }
.market-toolbar input, .market-toolbar select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; color: var(--ink); background: white; font-size: 14px; }

.buyer-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr); gap: 20px; align-items: start; }
.seller-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: 20px; align-items: start; }
.content-stack { display: grid; gap: 16px; }
.dashboard-card { border: 1px solid var(--line); border-radius: 24px; padding: 18px; background: var(--surface); box-shadow: var(--shadow-soft); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { font-size: 18px; margin: 0; }
.panel-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; background: rgba(36,131,91,0.1); color: var(--green-dark); font-size: 12px; font-weight: 800; }
.map-shell { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.map-shell iframe { display: block; width: 100%; min-height: 280px; border: 0; background: #eef4ee; }

.marketplace-list { display: grid; gap: 16px; }
.market-card { border: 1px solid var(--line); border-radius: 20px; padding: 18px; background: rgba(255,255,255,0.95); box-shadow: var(--shadow-soft); transition: transform 180ms var(--ease), box-shadow 180ms var(--ease); animation: cardIn 400ms var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.market-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.market-card-top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.market-card-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; color: var(--muted); }
.market-card-body div { display: grid; gap: 6px; }
.market-card-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; }

.market-summary { display: grid; gap: 16px; }
.summary-card { border: 1px solid var(--line); border-radius: 20px; padding: 18px; background: rgba(255,255,255,0.95); box-shadow: var(--shadow-soft); display: grid; gap: 12px; transition: transform 180ms var(--ease); }
.summary-card:hover { transform: translateY(-2px); }
.metric-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: center; }
.metric-mini-grid div { background: var(--soft); padding: 12px; border-radius: 12px; }
.metric-mini-grid strong { font-size: 24px; display: block; }
.metric-mini-grid span { font-size: 12px; color: var(--muted); }

.dashboard-copilot { background: rgba(255,255,255,0.9); backdrop-filter: blur(14px); padding: 24px; display: grid; align-content: start; }
.mini-chat-log { min-height: 120px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.mini-copilot-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 12px; }
.mini-copilot-form input { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 13px; }
.mini-copilot-form button { font-size: 13px; min-height: 40px; }

.image-drop { position: relative; min-height: 160px; border: 2px dashed #aac7ba; border-radius: 8px; display: grid; place-items: center; margin: 8px 0; overflow: hidden; background: linear-gradient(45deg, rgba(36,131,91,0.08), transparent), #eef7f2; transition: border-color 180ms var(--ease), transform 180ms var(--ease); }
.image-drop:hover { border-color: var(--green); transform: translateY(-2px); }
.image-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-drop img { max-width: 100%; max-height: 100%; object-fit: cover; display: none; }
.image-drop img.has-image { display: block; }
.image-drop span { color: var(--green-dark); font-weight: 900; pointer-events: none; }

.ai-result { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: rgba(255,255,255,0.92); font-size: 14px; line-height: 1.6; transition: opacity 300ms var(--ease); }
.ai-result.large { min-height: 200px; padding: 24px; font-size: 15px; }

.ai-results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.calc-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: white; text-align: center; transition: transform 180ms var(--ease); }
.calc-card:hover { transform: translateY(-2px); }
.calc-card .label { display: block; font-size: 11px; }
.calc-card strong { display: block; font-size: 18px; margin-top: 4px; }

.activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.activity-list p { padding: 8px 12px; background: var(--soft); border-radius: 8px; font-size: 13px; margin: 0; }

.status-pill { white-space: nowrap; border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 800; }
.status-pill.active { background: #e6f4eb; color: var(--green-dark); }
.status-pill.pending { background: #fef3e0; color: #8a5a10; }
.status-pill.accepted { background: #d4edda; color: #155724; }
.status-pill.rejected { background: #f8d7da; color: #721c24; }
.status-pill.settled { background: #cce5ff; color: #004085; }
.status-pill.confirmed { background: #d4edda; color: #155724; }
.status-pill.in-transit { background: #fff3cd; color: #856404; }

.empty-state { color: var(--muted); padding: 22px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }

.toast { position: fixed; right: 28px; bottom: 28px; transform: translateY(120%); transition: transform 240ms var(--ease), opacity 240ms var(--ease); border-radius: 16px; padding: 14px 18px; color: white; background: #13221d; box-shadow: var(--shadow); z-index: 20; opacity: 0; }
.toast.show { transform: translateY(0); opacity: 1; }

.reveal-ready { opacity: 0; transform: translateY(14px); }
.view.active .reveal-ready { animation: revealUp 560ms var(--ease) both; animation-delay: var(--delay, 0ms); }
@keyframes revealUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.btn-animate { transition: transform 150ms var(--ease), box-shadow 150ms var(--ease); }
.btn-animate:hover { transform: translateY(-2px) scale(1.02); }
.btn-animate:active { transform: translateY(0) scale(0.98); }

.slide-enter { animation: slideInRight 300ms var(--ease) both; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

.fade-enter { animation: fadeIn 350ms var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.scale-enter { animation: scaleIn 300ms var(--ease) both; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

.glow-pulse { animation: glowPulse 2.4s ease-in-out infinite; }
@keyframes glowPulse { 0%,100%{box-shadow:0 14px 28px rgba(36,131,91,0.2)} 50%{box-shadow:0 14px 40px rgba(36,131,91,0.35)} }

.shimmer { background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%); background-size: 200% 100%; animation: shimmer 1.8s infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-header { grid-template-columns: auto minmax(0, 1fr) auto; }
  .welcome-hero { grid-template-columns: 1fr; }
  .role-preview-grid { grid-template-columns: 1fr; }
  .buyer-layout, .seller-layout { grid-template-columns: 1fr; }
  .market-toolbar { grid-template-columns: 1fr 1fr; }
  .ai-results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  main { padding: 16px; }
  .app-header { position: static; grid-template-columns: 1fr auto; padding: 14px; gap: 10px; }
  .brand { grid-template-columns: 44px 1fr; }
  .brand-mark { width: 44px; height: 44px; }
  .nav-list { order: 3; justify-content: flex-start; }
  .market-toolbar { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .metric-mini-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-results-grid { grid-template-columns: 1fr 1fr; }
  .header-tools { gap: 6px; }
  .profile-btn span:last-child { display: none; }
}

.seller-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.seller-form { display: grid; gap: 18px; }
.seller-panels .summary-card { padding: 18px; }

.image-preview-thumb { width: 100px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }