:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --ink: #173029;
  --muted: #66766f;
  --brand: #173f35;
  --brand-2: #2f6b57;
  --brand-3: #dce9e1;
  --accent: #c99047;
  --danger: #a83f3f;
  --border: #dfe6e1;
  --shadow: 0 18px 50px rgba(28, 56, 47, 0.09);
  --radius: 18px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 107, 87, .24);
  outline-offset: 2px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  background:
    radial-gradient(circle at 15% 10%, rgba(201, 144, 71, .13), transparent 28%),
    linear-gradient(145deg, #153c33 0%, #1f4f40 45%, #122e28 100%);
}

.auth-story {
  color: #fff;
  padding: clamp(38px, 6vw, 86px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.auth-story::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  right: -190px;
  bottom: -210px;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018);
}

.brand-lockup { position: relative; z-index: 1; }
.brand-name { font-size: clamp(31px, 4vw, 52px); font-weight: 760; letter-spacing: -1.6px; margin: 0; }
.brand-tag { margin-top: 9px; font-size: 13px; letter-spacing: 2.2px; text-transform: uppercase; color: #cfe0d7; }

.auth-copy { max-width: 650px; position: relative; z-index: 1; padding: 60px 0; }
.auth-copy h1 { font-size: clamp(42px, 5vw, 72px); line-height: .98; letter-spacing: -2.6px; margin: 0 0 24px; max-width: 760px; }
.auth-copy p { font-size: 18px; line-height: 1.7; color: #dbe8e1; max-width: 590px; margin: 0; }
.auth-pill { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #e6efe9; font-size: 12px; margin-bottom: 24px; text-transform: uppercase; letter-spacing: 1.2px; }
.auth-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8fcaad; box-shadow: 0 0 0 5px rgba(143,202,173,.12); }
.auth-story-footer { color: #abc3b8; font-size: 13px; position: relative; z-index: 1; }

.auth-panel {
  min-height: 100vh;
  background: #f7f9f7;
  padding: clamp(28px, 5vw, 68px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card { width: min(100%, 510px); background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: clamp(28px, 4vw, 44px); box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 30px; letter-spacing: -.8px; }
.auth-card > p { margin: 10px 0 26px; color: var(--muted); line-height: 1.55; }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #edf2ee; border-radius: 12px; padding: 4px; margin-bottom: 28px; }
.auth-tab { border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 10px 12px; font-weight: 650; }
.auth-tab.active { background: #fff; color: var(--brand); box-shadow: 0 2px 12px rgba(22,57,47,.08); }

.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { font-size: 13px; font-weight: 680; color: #365148; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #d9e2dc;
  background: #fbfcfb;
  color: var(--ink);
  border-radius: 11px;
  padding: 13px 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #6f9c89; background: #fff; box-shadow: 0 0 0 4px rgba(47,107,87,.08); outline: none; }
.field-help { font-size: 12px; color: #7d8a85; }

.btn { border: 0; border-radius: 11px; padding: 12px 16px; font-weight: 720; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(23,63,53,.18); }
.btn-primary:hover { background: #1f5143; }
.btn-secondary { background: #e9f0eb; color: var(--brand); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: #345148; }
.btn-danger { background: #f7e7e7; color: var(--danger); }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .58; cursor: not-allowed; transform: none; }

.auth-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 2px; }
.link-btn { border: 0; padding: 0; background: transparent; color: var(--brand-2); font-weight: 650; font-size: 13px; }

.notice { margin: 14px 0 0; padding: 12px 14px; border-radius: 11px; font-size: 13px; line-height: 1.45; }
.notice.success { background: #eaf5ed; color: #285b3b; border: 1px solid #cee4d4; }
.notice.error { background: #faecec; color: #8b3232; border: 1px solid #efcccc; }
.notice.info { background: #edf3f6; color: #31586b; border: 1px solid #d7e4e9; }

.loading-screen { min-height: 100vh; display: grid; place-items: center; background: #f4f6f3; color: var(--brand); }
.loading-mark { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #dfe8e2; border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); background: #f4f6f3; }
.sidebar { background: #153b31; color: #fff; padding: 26px 20px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar-brand { padding: 3px 10px 25px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand strong { display: block; font-size: 24px; letter-spacing: -.7px; }
.sidebar-brand span { display: block; color: #9fc0b1; font-size: 11px; letter-spacing: 1.7px; margin-top: 5px; }
.nav-list { display: grid; gap: 7px; margin-top: 26px; }
.nav-item { border: 0; width: 100%; text-align: left; background: transparent; color: #cfe0d7; padding: 12px 13px; border-radius: 11px; font-weight: 640; display: flex; align-items: center; gap: 10px; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: #fff; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.nav-item.active .nav-dot { background: #d6a15e; border-color: #d6a15e; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.09); padding: 18px 10px 0; }
.sidebar-user strong, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span { color: #a9c0b6; font-size: 12px; margin-top: 3px; }
.sidebar .btn { margin-top: 13px; width: 100%; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; }
.topbar { min-height: 77px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 34px; position: sticky; top: 0; z-index: 5; }
.topbar-title strong { display: block; font-size: 17px; }
.topbar-title span { display: block; margin-top: 3px; font-size: 11px; letter-spacing: 1.3px; color: #7b8a84; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #dfeae3; color: var(--brand); display: grid; place-items: center; font-weight: 800; }

.content { padding: 34px; max-width: 1480px; margin: 0 auto; }
.hero { background: linear-gradient(120deg, #183f34 0%, #285f4d 100%); color: #fff; border-radius: 24px; padding: clamp(28px, 4vw, 46px); display: grid; grid-template-columns: 1.45fr .55fr; gap: 26px; box-shadow: var(--shadow); }
.hero-eyebrow { font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase; color: #b9d1c5; font-weight: 760; }
.hero h1 { font-size: clamp(30px, 4vw, 50px); line-height: 1.02; letter-spacing: -1.5px; max-width: 780px; margin: 13px 0 15px; }
.hero p { color: #d5e5dc; font-size: 16px; line-height: 1.7; max-width: 730px; margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.hero .btn-primary { background: #fff; color: var(--brand); box-shadow: none; }
.hero .btn-secondary { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.16); }
.hero-aside { display: flex; align-items: stretch; }
.circular-score { width: 100%; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.07); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; justify-content: center; }
.circular-score b { font-size: 38px; letter-spacing: -1px; }
.circular-score span { color: #c5d9cf; margin-top: 7px; line-height: 1.45; font-size: 13px; }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 34px 0 16px; }
.section-head h2 { margin: 0; font-size: 23px; letter-spacing: -.5px; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 18px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.stat small { color: var(--muted); display: block; }
.stat strong { display: block; font-size: 28px; margin-top: 7px; letter-spacing: -.8px; }
.stat span { display: block; color: #728078; font-size: 12px; margin-top: 5px; }

.profile-banner { margin-top: 18px; background: #fff8eb; border: 1px solid #f0dfbc; border-radius: 16px; padding: 17px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.profile-banner strong { display: block; color: #6b4a20; }
.profile-banner span { display: block; color: #876b47; font-size: 13px; margin-top: 3px; }

.market-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.search-box { flex: 1 1 320px; min-width: 240px; position: relative; }
.search-box input, .market-tools select { width: 100%; border: 1px solid var(--border); border-radius: 11px; background: #fff; padding: 12px 13px; color: var(--ink); }
.market-tools select { width: auto; min-width: 180px; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.material-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: 0 8px 22px rgba(30,56,48,.045); }
.material-top { min-height: 115px; background: #e9efeb; padding: 18px; display: flex; justify-content: space-between; align-items: flex-start; }
.material-icon { width: 49px; height: 49px; border-radius: 15px; display: grid; place-items: center; font-size: 20px; background: #d7e4dc; color: var(--brand); }
.badge { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .25px; background: #e5efe8; color: #315d4b; }
.badge.donation { background: #f7ead8; color: #7a5728; }
.badge.demo { background: #edf0f2; color: #607078; }
.material-body { padding: 18px; }
.material-body h3 { margin: 0; font-size: 18px; line-height: 1.35; }
.material-company { margin: 5px 0 15px; color: #6e7d76; font-size: 13px; }
.material-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; border-top: 1px solid #edf0ee; border-bottom: 1px solid #edf0ee; padding: 13px 0; }
.material-meta small { color: #7c8983; display: block; font-size: 11px; }
.material-meta strong { display: block; margin-top: 3px; font-size: 14px; }
.material-desc { font-size: 13px; line-height: 1.6; color: #637069; min-height: 62px; margin: 14px 0; }
.material-foot { display: flex; justify-content: space-between; gap: 10px; color: #738078; font-size: 12px; }

.empty-panel { background: #fff; border: 1px dashed #cdd9d2; border-radius: 18px; padding: 34px; text-align: center; color: var(--muted); }
.empty-panel h3 { margin: 0 0 8px; color: var(--ink); }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 22px; }
.panel h3 { margin-top: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(10,28,23,.5); display: grid; place-items: center; padding: 18px; }
.modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 20px; border: 1px solid var(--border); box-shadow: 0 25px 80px rgba(12,31,25,.22); padding: 26px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.modal-head h2 { margin: 0; font-size: 23px; }
.modal-head p { color: var(--muted); margin: 5px 0 0; font-size: 13px; }
.close-btn { width: 36px; height: 36px; border: 1px solid var(--border); background: #fff; border-radius: 10px; font-size: 20px; color: #687770; }

.mobile-nav-toggle { display: none; }

.market-search-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; }
.catalog-link { display: block; margin-top: 24px; text-align: center; font-size: 14px; font-weight: 650; color: var(--brand-2); }
.public-catalog .hero { grid-template-columns: 1fr; }
.topbar a.btn { text-decoration: none; font-size: 13px; }
.market-query-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.market-query-row .btn { min-height: 48px; }
.market-help, .market-demo-note { color: var(--muted); font-size: 13px; line-height: 1.6; }
.market-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.market-filter-grid .field { min-width: 0; }
.market-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.market-summary p { margin: 0; font-size: 14px; font-weight: 650; }
.material-category { color: var(--brand-2); font-size: 12px; }
[hidden] { display: none !important; }
@media (max-width: 1100px) { .market-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .market-search-panel { padding: 18px; }
  .market-query-row, .market-filter-grid { grid-template-columns: minmax(0, 1fr); }
  .market-summary { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 1020px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { min-height: 44vh; }
  .auth-panel { min-height: 56vh; }
  .app-shell { grid-template-columns: 88px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .sidebar-brand strong { font-size: 17px; }
  .sidebar-brand span, .nav-item .label, .sidebar-user strong, .sidebar-user span { display: none; }
  .nav-item { justify-content: center; }
  .sidebar .btn { font-size: 0; }
  .sidebar .btn::after { content: "↪"; font-size: 17px; }
  .hero { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .auth-story { padding: 30px 24px; min-height: 38vh; }
  .auth-copy { padding: 44px 0 20px; }
  .auth-copy h1 { font-size: 39px; }
  .auth-panel { padding: 24px 16px; align-items: flex-start; }
  .auth-card { border-radius: 18px; padding: 25px 20px; }
  .field-row { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { padding: 0 18px; min-height: 68px; }
  .content { padding: 20px 15px 34px; }
  .stats { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .profile-banner { align-items: flex-start; flex-direction: column; }
  .mobile-nav-toggle { display: inline-flex; }
}

