:root {
  --forest: #315b43;
  --forest-dark: #244632;
  --leaf: #6d8a67;
  --orange: #dd762e;
  --orange-soft: #fff1e5;
  --ink: #27352d;
  --muted: #708077;
  --line: #e2e9e2;
  --surface: #fff;
  --paper: #f5f8f4;
  --danger: #a9463c;
  --shadow: 0 12px 34px rgba(32, 64, 43, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: 'DM Sans', 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.55; }
a { color: var(--forest); text-decoration: none; }
a:hover { color: var(--orange); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar { min-height: 70px; padding: 0 max(24px, calc((100% - 1420px) / 2)); display: flex; justify-content: space-between; align-items: center; gap: 18px; background: var(--forest); color: white; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: white; font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.brand:hover { color: white; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; color: #f2bd82; font-size: 22px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.user-name { color: rgba(255,255,255,.82); font-size: 13px; }
.language-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid rgba(255,255,255,.22); border-radius: 20px; }
.language-switch a { min-width: 35px; padding: 3px 8px; border-radius: 15px; color: rgba(255,255,255,.76); text-align: center; font-size: 11px; font-weight: 700; }
.language-switch a.selected { background: white; color: var(--forest); }
.main-nav { min-height: 49px; padding: 0 max(24px, calc((100% - 1420px) / 2)); display: flex; gap: 6px; align-items: stretch; overflow-x: auto; background: white; border-bottom: 1px solid var(--line); }
.main-nav a { position: relative; display: flex; align-items: center; padding: 0 15px; color: #64746a; white-space: nowrap; font-size: 13px; font-weight: 600; }
.main-nav a:hover, .main-nav a.active { color: var(--forest); }
.main-nav a.active::after { position: absolute; content: ''; left: 14px; right: 14px; bottom: 0; height: 3px; background: var(--orange); border-radius: 3px 3px 0 0; }
.page-shell { width: min(1420px, calc(100% - 48px)); min-height: calc(100vh - 155px); margin: 0 auto; padding: 36px 0 64px; }
.page-shell-auth { display: grid; place-items: center; min-height: calc(100vh - 135px); padding-top: 40px; padding-bottom: 52px; }
.site-footer { min-height: 48px; padding: 14px 24px; color: #88958c; text-align: center; font-size: 11px; }
.site-footer span { padding: 0 5px; color: var(--orange); }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); }
h1 { margin-bottom: 7px; font-family: 'Playfair Display', Georgia, serif; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.18; letter-spacing: -.025em; }
h2 { margin-bottom: 8px; font-family: 'Playfair Display', Georgia, serif; font-size: 23px; line-height: 1.25; }
h3 { margin-bottom: 4px; font-size: 15px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--orange); font-size: 10px; line-height: 1.4; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.page-heading p { margin-bottom: 0; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 33px 0 15px; }
.section-heading h2 { margin-bottom: 0; }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-size: 12px; line-height: 1.2; font-weight: 700; text-decoration: none; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--forest); color: white; box-shadow: 0 4px 10px rgba(49,91,67,.14); }
.button-primary:hover { background: var(--forest-dark); color: white; }
.button-secondary { border-color: #d6e0d6; background: white; color: var(--forest); }
.button-secondary:hover { border-color: var(--leaf); background: #f7faf6; color: var(--forest); }
.button-quiet { background: transparent; color: #738078; }
.button-quiet:hover { background: #edf2ec; color: var(--forest); }
.button-danger { border-color: #f0d6d2; background: #fff7f5; color: var(--danger); }
.button-danger:hover { background: #ffebe7; }
.button-small { min-height: 32px; padding: 7px 10px; font-size: 11px; }
.button-wide { width: 100%; min-height: 46px; margin-top: 3px; }
.inline-form { display: inline; }

.welcome-panel { position: relative; display: flex; min-height: 190px; align-items: center; justify-content: space-between; overflow: hidden; padding: 31px 40px; border: 1px solid #e1eadf; border-radius: 14px; background: linear-gradient(112deg, #f0f6ee, #fcfcf5 72%, #fff5e9); box-shadow: var(--shadow); }
.welcome-panel > div:first-child { max-width: 680px; }
.welcome-panel h1 { font-size: clamp(28px, 4vw, 42px); }
.welcome-panel p:last-child { max-width: 630px; margin-bottom: 0; color: #64746a; }
.welcome-leaf { position: absolute; right: 35px; bottom: -60px; color: rgba(91,132,92,.12); font-family: Georgia, serif; font-size: 260px; line-height: .9; transform: rotate(-18deg); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0 24px; }
.stat-card { position: relative; min-height: 147px; padding: 19px 22px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 5px 20px rgba(32,64,43,.035); }
.stat-card:hover { border-color: #c4d4c3; color: var(--forest); transform: translateY(-2px); }
.stat-card-accent { background: #fffaf4; border-color: #f0e4d5; }
.stat-icon { position: absolute; top: 16px; right: 20px; color: var(--leaf); font-size: 22px; }
.stat-card-accent .stat-icon { color: var(--orange); }
.stat-label, .stat-card small { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 10px 0 1px; color: var(--forest); font-family: 'Playfair Display', Georgia, serif; font-size: 38px; line-height: 1; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.action-card { display: flex; min-height: 112px; align-items: center; gap: 15px; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.action-card:hover { border-color: #bed1bd; box-shadow: var(--shadow); }
.action-card > span { align-self: flex-start; color: #d3a16f; font-size: 11px; font-weight: 700; }
.action-card div { flex: 1; }
.action-card p { margin: 0; color: var(--muted); font-size: 11px; }
.action-card b { color: var(--orange); font-size: 18px; }

.filter-bar { display: flex; align-items: flex-end; gap: 9px; margin-bottom: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.filter-bar label { min-width: 170px; }
.filter-bar .search-field { flex: 1; }
.filter-bar input, .filter-bar select { min-height: 39px; }
.compact-filter { display: inline-flex; margin-bottom: 16px; padding: 10px 12px; }
.compact-filter label { min-width: 155px; }
label { display: block; color: #48594e; font-size: 12px; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid #d9e2d9; border-radius: 7px; outline: none; background: #fff; color: var(--ink); font-size: 13px; transition: border .15s, box-shadow .15s; }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { border-color: #7c9b7b; box-shadow: 0 0 0 3px rgba(100,139,100,.12); }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; accent-color: var(--forest); vertical-align: middle; }
textarea { min-height: 94px; resize: vertical; }
input::placeholder { color: #a0aaa3; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 4px 15px rgba(37,64,45,.025); }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 11px 12px; background: #f2f6f1; color: #506157; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .035em; white-space: nowrap; }
.sort-link { display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.sort-link:hover { color: var(--orange); }
.sort-link span { color: var(--orange); font-size: 12px; }
.data-table td { padding: 11px 12px; border-top: 1px solid #edf1ec; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdf9; }
.data-table code { color: #4f6d58; font-size: 10px; white-space: nowrap; }
.collection-table { min-width: 1440px; }
.collection-table td { max-width: 230px; }
.collection-table .comments-cell { max-width: 220px; }
.latin-name { font-style: italic; }
.sequence-cell { color: var(--muted); }
.check-col { width: 52px; }
.empty-cell { padding: 30px !important; color: var(--muted); text-align: center; }
.table-toolbar, .selection-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 10px 2px; color: var(--muted); font-size: 11px; }
.bulk-actions { display: flex; align-items: flex-end; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.restriction-select { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.restriction-select select { width: auto; min-width: 120px; min-height: 32px; margin: 0; padding: 5px 7px; font-size: 10px; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; color: var(--muted); font-size: 12px; }
.pagination div { display: flex; gap: 5px; }
.text-action { padding: 0; border: 0; background: none; color: var(--forest); cursor: pointer; font-size: 11px; font-weight: 700; white-space: nowrap; }
.text-action:hover { color: var(--orange); }
.text-danger { color: var(--danger); }
.action-cell { white-space: nowrap; }
.action-cell form { margin-left: 10px; }
.status-pill { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.status-good { background: #e8f3e7; color: #437049; }
.status-muted { background: #eef0ed; color: #7c867f; }
.inline-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 16px 19px; border: 1px solid #e5ece3; border-radius: 10px; background: #f9fbf8; }
.inline-cta p { max-width: 720px; margin: 0; color: var(--muted); }

.form-panel, .panel, .selection-panel { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.form-panel { max-width: 960px; }
.narrow-panel { max-width: 700px; }
.form-intro { margin: 0 0 20px; padding: 12px 14px; border-left: 3px solid var(--orange); border-radius: 0 6px 6px 0; background: #fff8f1; color: #7b6754; font-size: 12px; }
.form-grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-field { grid-column: 1 / -1; }
.required { color: var(--orange); }
.field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.45; }
.check-label { display: flex; align-items: center; gap: 9px; margin: 18px 0; font-size: 12px; }
.check-label input { margin: 0; }
.restriction-field { display: flex; flex-wrap: wrap; gap: 18px; margin: 19px 0 5px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; }
.restriction-field legend { padding: 0 5px; color: #48594e; font-size: 11px; font-weight: 700; }
.radio-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.radio-label input { margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 17px; border-top: 1px solid #edf1ec; }
.code-input { text-transform: uppercase; }
.selection-panel { padding: 19px; }
.selection-panel .section-heading { margin: 0 0 13px; align-items: center; }
.selection-footer { margin: 13px 2px 0; }
.review-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.review-banner a { font-weight: 700; text-decoration: underline; }
.image-picker { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, 280px); gap: 18px; align-items: center; margin: 8px 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdf9; }
.image-picker-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.image-picker input[type=file] { width: 100%; margin-top: 8px; color: var(--muted); font-size: 11px; }
.image-preview-box { min-height: 94px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #cad7ca; border-radius: 8px; background: white; color: var(--muted); font-size: 11px; }
.image-preview-box img { display: block; max-width: 100%; max-height: 180px; object-fit: contain; }
.image-preview-box img[hidden] { display: none; }
.archive-section { margin-top: 32px; }
.archive-section .section-heading { margin-top: 0; }
.download-links { display: flex; gap: 13px; font-size: 11px; font-weight: 700; }
.back-link { margin-top: 18px; }

.account-create { margin-bottom: 26px; }
.account-create h2 { margin-bottom: 17px; font-size: 20px; }
.account-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); align-items: end; }
.account-submit { padding-bottom: 1px; }
.user-table { min-width: 880px; }
.user-table td { min-width: 110px; }
.user-table form { display: contents; }
.user-table select { min-width: 115px; padding: 7px 8px; }
.user-table input.password-reset { width: 170px; margin: 2px 0; padding: 7px; font-size: 11px; }
.compact-check { display: inline-flex; margin: 0; white-space: nowrap; }

.auth-card { width: min(430px, 100%); padding: 35px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 20px 65px rgba(38,72,48,.12); }
.auth-card-wide { width: min(590px, 100%); }
.auth-card h1 { margin-bottom: 9px; font-size: 30px; }
.auth-card > .muted { margin-bottom: 22px; }
.auth-flower { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 50%; background: #f0f6ef; color: var(--leaf); font-size: 26px; }
.stack-form { display: grid; gap: 16px; margin-top: 22px; }
.stack-form fieldset { margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.stack-form legend { padding: 0 5px; color: var(--forest); font-size: 12px; font-weight: 700; }
.stack-form label { margin-bottom: 5px; }
.stack-form .form-grid { margin-top: 12px; }
.optional { color: var(--muted); font-size: 10px; font-weight: 400; }

.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { padding: 11px 14px; border: 1px solid; border-radius: 8px; font-size: 12px; }
.flash-success { border-color: #cce3ca; background: #f0f8ee; color: #416d42; }
.flash-error { border-color: #efd1cc; background: #fff5f2; color: #9b4138; }
.flash-info { border-color: #d3e1ec; background: #f2f8fc; color: #42677f; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .action-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-shell { width: min(100% - 32px, 1420px); padding-top: 25px; }
  .welcome-panel { padding: 26px; }
  .welcome-leaf { right: 2px; font-size: 200px; }
}
@media (max-width: 650px) {
  .topbar { min-height: 62px; padding: 0 14px; }
  .brand { font-size: 12px; }
  .brand-mark { width: 30px; height: 30px; font-size: 19px; }
  .top-actions { gap: 8px; }
  .user-name { display: none; }
  .main-nav { padding: 0 8px; }
  .main-nav a { padding: 0 11px; font-size: 12px; }
  .page-shell { width: calc(100% - 28px); padding: 22px 0 42px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 19px; }
  .heading-actions { flex-wrap: wrap; }
  .stat-grid { grid-template-columns: 1fr; gap: 9px; }
  .stat-card { min-height: 115px; }
  .filter-bar { align-items: stretch; flex-wrap: wrap; }
  .filter-bar .search-field { flex-basis: 100%; }
  .filter-bar label { flex: 1; min-width: 135px; }
  .compact-filter { display: flex; }
  .two-col, .account-grid { grid-template-columns: 1fr; }
  .form-panel, .panel, .selection-panel { padding: 16px; }
  .welcome-panel { min-height: 165px; padding: 23px 19px; }
  .welcome-leaf { right: -15px; bottom: -35px; font-size: 155px; }
  .welcome-panel > div:first-child { z-index: 1; }
  .inline-cta { align-items: flex-start; flex-direction: column; }
  .auth-card { padding: 25px 21px; }
  .selection-panel .section-heading { align-items: flex-start; flex-direction: column; }
  .selection-panel .section-heading > .button { width: 100%; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .bulk-actions { width: 100%; justify-content: flex-start; }
  .image-picker, .image-picker-fields { grid-template-columns: 1fr; }
}
