/* Add at the top: */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --color-bg: #f3f1ea;
  --color-surface: #fffdf8;
  --color-surface-muted: #f7f3eb;
  --color-border: #ded6c8;
  --color-text: #283229;
  --color-text-muted: #667264;
  --color-primary: #4f7f38;
  --color-primary-dark: #3d6729;
  --color-secondary: #d9822b;
  --color-secondary-dark: #b96b1d;
  --color-accent: #2f7f8f;
  --color-danger: #c94d3f;
  --color-danger-dark: #a83c30;
  --color-success-bg: #e5f3df;
  --color-success-text: #2f5f2b;
  --color-error-bg: #f9e3df;
  --color-error-text: #8a2f25;
  --shadow-soft: 0 10px 30px rgba(50, 62, 39, 0.08);
  --shadow-card: 0 8px 24px rgba(53, 64, 42, 0.1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --content-width: 720px;
  --content-width-wide: 880px;
}

/* ==== GLOBALT ==== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Work Sans', sans-serif;
  color: var(--color-text);
  background:
    radial-gradient(circle at top left, rgba(217, 130, 43, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(79, 127, 56, 0.14), transparent 24%),
    linear-gradient(180deg, #f6f3eb 0%, var(--color-bg) 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body {
  line-height: 1.6;
}

img {
  max-width: 100%;
}

h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

p {
  margin: 0 0 1rem;
}

ul, ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}

/* ==== FLEX-LAYOUT ==== */
.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==== INNEHÅLL ==== */
.content-container {
  flex: 1;
  width: min(100% - 2rem, var(--content-width));
  padding: 2rem 0 3rem;
  margin: 0 auto;
}

.content-container--wide {
  width: min(100% - 2rem, var(--content-width-wide));
}

.container,
.surface-panel,
.auth-panel {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem;
}

.surface-panel,
.auth-panel {
  padding: 2rem;
}

.auth-panel {
  max-width: 560px;
  margin: 2.5rem auto;
}

.section-intro {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.section-heading {
  margin-top: 1.15rem;
  margin-bottom: 0.4rem;
}

.meta-text {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.text-link {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.text-link:hover {
  color: var(--color-primary-dark);
}

.status-message,
.flash-message,
.msg {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.status-message--success,
.flash-message,
.msg.success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border-color: rgba(47, 95, 43, 0.15);
}

.status-message--error,
.msg.error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border-color: rgba(138, 47, 37, 0.15);
}

.status-message--warning {
  background: rgba(217, 130, 43, 0.12);
  color: var(--color-secondary-dark);
  border-color: rgba(217, 130, 43, 0.25);
}

/* ==== HEADER ==== */
header {
  background:
    linear-gradient(135deg, rgba(61, 103, 41, 0.96), rgba(79, 127, 56, 0.96)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  color: white;
  text-align: center;
  width: 100%;
  padding: 0;
  box-shadow: 0 8px 24px rgba(29, 53, 17, 0.18);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: min(100% - 2rem, 1100px);
  margin: 0 auto;
  padding: 1rem 0 0.85rem;
}

.header-row img {
  height: 52px;
}

.site-title,
.header-row h1,
header h1 {
  font-size: clamp(1.9rem, 3vw, 2.45rem);
  margin: 0;
  color: white;
  font-family: 'Patrick Hand', cursive;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  flex: 1 1 auto;
  min-width: 0;
}

/* ==== FOOTER ==== */
footer {
  background: #315224;
  color: white;
  text-align: center;
  padding: 1.2rem 0;
  font-size: 0.9rem;
  width: 100%;
}

/* ==== NAVIGATION ==== */
nav {
  background: rgba(255, 249, 239, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(79, 127, 56, 0.12);
  padding: 0 1rem;
}

ul.navbar {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  padding: 0;
  margin: 0 auto;
  width: min(100%, 1100px);
}

ul.navbar li {
  display: inline;
}

ul.navbar a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.2rem 0.85rem;
  border-radius: 999px;
  transition: all 0.2s ease-in-out;
}

ul.navbar a:hover {
  color: var(--color-primary-dark);
  background: rgba(79, 127, 56, 0.12);
}

ul.navbar a.active {
  background: rgba(79, 127, 56, 0.14);
  color: var(--color-primary-dark);
}

/* ==== FORMULÄR ==== */
form {
  background: var(--color-surface);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(122, 107, 82, 0.12);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

input, textarea, select, button {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.8rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-family: inherit;
}

input,
textarea,
select {
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(47, 127, 143, 0.6);
  box-shadow: 0 0 0 4px rgba(47, 127, 143, 0.12);
}

button {
  background-color: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease-in-out;
}

button:hover {
  background-color: var(--color-primary-dark);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ==== FRUKTKORT ==== */
.fruit-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid rgba(122, 107, 82, 0.12);
  padding: 1.15rem;
  margin-bottom: 1.15rem;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.fruit-card img, .image-placeholder {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.fruit-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.fruit-card-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.card-action-row {
  width: 100%;
  margin-top: 0.85rem;
}

.card-action-row .btn,
.card-action-row button {
  width: auto;
}

.detail-block {
  width: 100%;
}

.detail-row {
  margin-bottom: 0.45rem;
}

.detail-meta {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.empty-note {
  margin-top: 1rem;
  color: var(--color-text-muted);
}

.filter-select {
  min-width: 180px;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 1rem;
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
  outline: none;
  margin-top: 0.35rem;
  margin-bottom: 0.8rem;
}

.filter-empty {
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.pagination-status {
  color: var(--color-text-muted);
}

.ads-grid {
  display: grid;
  gap: 1.25rem;
}

.dashboard-shell {
  display: grid;
  gap: 1.5rem;
}

.dashboard-hero {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(79, 127, 56, 0.14), rgba(217, 130, 43, 0.1));
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.dashboard-hero-media img {
  width: 100%;
  display: block;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.dashboard-kicker {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(79, 127, 56, 0.14);
  color: var(--color-primary-dark);
  font-size: 0.9rem;
  font-weight: 700;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1rem;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  box-shadow: var(--shadow-soft);
}

.stat-card-label {
  display: block;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.stat-card-value {
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.stat-card-note {
  margin-top: 0.45rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.dashboard-panels {
  display: grid;
  gap: 1.25rem;
}

.chat-shell {
  display: grid;
  gap: 1.25rem;
}

.chat-overview {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.chat-overview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  color: var(--color-text-muted);
  margin-top: 0.9rem;
}

.chat-layout {
  display: grid;
  gap: 1rem;
}

.chat-thread {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(247, 243, 235, 0.95));
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1rem;
  min-height: 360px;
  max-height: 560px;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), var(--shadow-soft);
}

.chat-empty {
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
}

.chat-message {
  display: flex;
  margin-bottom: 0.85rem;
}

.chat-message:last-child {
  margin-bottom: 0;
}

.chat-message--mine {
  justify-content: flex-end;
}

.chat-message--theirs {
  justify-content: flex-start;
}

.chat-bubble {
  width: min(100%, 480px);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-soft);
}

.chat-message--mine .chat-bubble {
  background: linear-gradient(135deg, rgba(79, 127, 56, 0.95), rgba(61, 103, 41, 0.95));
  color: #fff;
  border-bottom-right-radius: 6px;
}

.chat-message--theirs .chat-bubble {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-bottom-left-radius: 6px;
}

.chat-author {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.chat-message--mine .chat-author,
.chat-message--mine .chat-timestamp {
  color: rgba(255, 255, 255, 0.82);
}

.chat-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-timestamp {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.chat-composer {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-soft);
}

.chat-composer form {
  margin: 0;
}

.chat-composer textarea {
  min-height: 110px;
  resize: vertical;
}

.dashboard-panel {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.dashboard-panel h3 {
  margin-bottom: 0.35rem;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.activity-list li {
  padding: 0.95rem 0;
  border-top: 1px solid rgba(122, 107, 82, 0.12);
}

.activity-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.activity-title {
  display: block;
  margin-bottom: 0.2rem;
}

.activity-meta {
  color: var(--color-text-muted);
}

.activity-status {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.form-page {
  max-width: 760px;
  margin: 0 auto;
}

.form-page-intro {
  margin-bottom: 1.25rem;
}

.form-panel {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.form-panel form {
  margin-bottom: 0;
}

.form-panel label {
  display: block;
  margin-top: 0.8rem;
  font-weight: 600;
}

.form-panel label:first-of-type {
  margin-top: 0;
}

.form-hint {
  display: block;
  margin-top: 0.15rem;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.is-hidden {
  display: none;
}

.form-actions {
  margin-top: 1rem;
}

.image-preview-card {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.image-preview-card p {
  margin-bottom: 0.6rem;
}

.image-preview-card img {
  display: block;
  width: 100%;
  max-width: 320px;
  max-height: 220px;
  object-fit: cover;
  border-radius: 14px;
}

/* ==== PRIS ==== */
.price-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.5rem;
}

.price-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  margin-top: 0 !important;
}

.price-option input {
  width: auto;
}

.price-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: rgba(217, 130, 43, 0.14);
  color: var(--color-secondary-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ==== BILDUPPLADDNING (FLERA BILDER) ==== */
.image-dropzone {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  background: var(--color-surface-muted);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.image-dropzone:hover,
.image-dropzone.is-dragover {
  border-color: var(--color-primary);
  background: rgba(79, 127, 56, 0.08);
}

.image-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview-row,
.image-gallery-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.image-preview-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.image-gallery-edit-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.image-gallery-edit-item img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.image-remove-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: 0 !important;
}

.image-remove-label input {
  width: auto;
}

/* ==== ANNONSDETALJ ==== */
.ad-detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ad-detail-gallery img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.ad-summary-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid rgba(122, 107, 82, 0.12);
  padding: 1.15rem;
  margin-bottom: 1.15rem;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: inherit;
  width: 100%;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ad-summary-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.ad-summary-card img,
.ad-summary-card .image-placeholder {
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.application-grid {
  display: grid;
  gap: 1.1rem;
}

.application-card {
  max-width: 620px;
  margin: 0 auto;
}

.application-card img {
  width: 100%;
  display: block;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.application-card-body {
  width: 100%;
}

.application-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.application-status {
  font-weight: 700;
  color: var(--color-primary-dark);
}

.inline-action-form {
  margin-top: 0.75rem;
}

.inline-action-form form,
.inline-action-form {
  box-shadow: none;
}

.inline-action-form button + button {
  margin-top: 0.5rem;
}

.feedback-panel {
  max-width: 680px;
  margin: 0 auto;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.data-table th,
.data-table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(122, 107, 82, 0.12);
}

.data-table th {
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-weight: 700;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.admin-shell {
  display: grid;
  gap: 1.5rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.admin-section {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.owned-fruit-card {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.owned-fruit-card .fruit-card-header {
  justify-content: flex-start;
  margin-bottom: 0.45rem;
}

.owned-fruit-card .image-placeholder {
  height: 200px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 0.75rem;
  align-items: stretch;
}

.action-buttons form,
.action-buttons a {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 220px;
  margin: 0;
  display: flex;
  box-sizing: border-box;
  padding: 0;
  height: 100%;
}

.action-buttons form {
  background: none;
  box-shadow: none;
  border: 0;
}

.action-buttons a {
  background: rgba(47, 127, 143, 0.12);
  color: var(--color-accent) !important;
  border: 1px solid rgba(47, 127, 143, 0.18);
  box-shadow: none;
}

.action-buttons a:hover {
  background: rgba(47, 127, 143, 0.18);
}

.application-list {
  padding-left: 1.2rem;
  text-align: left;
  margin-top: 0.35rem;
}

.application-list li {
  margin-bottom: 0.7rem;
}

.application-form {
  margin-top: 0.4rem;
}

.application-form button + button {
  margin-top: 0.5rem;
}

.flash-inline {
  margin-bottom: 1rem;
}

.image-placeholder {
  height: 180px;
  background: linear-gradient(135deg, #f3efe6, #ebe5d7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #948771;
  font-size: 2rem;
}

/* ==== BADGES ==== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-left: 6px;
  color: white;
}

.badge.green { background-color: #4caf50; }
.badge.red   { background-color: #f44336; }

/* ==== HAMBURGERMENY ==== */
.hamburger {
  display: none;
  font-size: 2rem;
  cursor: pointer;
  color: white;
  background: none;
  border: none;
  flex-shrink: 0;
  margin-right: 1rem;
  -webkit-tap-highlight-color: transparent;
}

.heading-break {
  display: none;
}

/* ==== MOBILANPASSNING ==== */
@media (max-width: 768px) {
  .header-row {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 0.85rem 0;
    text-align: left;
  }

  .header-row img {
    height: 60px;
  }

  .header-row h1 {
    font-size: 1.6rem;
  }

  .hamburger {
    display: block;
  }

  ul.navbar {
    display: none;
    flex-direction: column;
    background-color: rgba(255, 249, 239, 0.98);
    gap: 0.5rem;
    padding: 1rem 0;
    margin: 0;
  }

  ul.navbar.show {
    display: flex;
  }

  ul.navbar li {
    display: block;
    text-align: center;
  }

  ul.navbar li[style*="pointer-events"] {
    display: none; /* döljer '|' i mobil */
  }

  .content-container {
    width: min(100% - 1rem, var(--content-width));
    padding: 1rem 0 2rem;
  }
  .heading-break {
    display: inline;
  }
}

@media (max-width: 640px) {
  .container,
  .surface-panel,
  .auth-panel,
  .form-wrapper,
  form,
  .modal-content {
    padding: 1.2rem;
  }

  .chat-card {
    padding: 1rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .action-buttons {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .action-buttons form,
  .action-buttons a,
  .card-action-row .btn,
  .card-action-row button {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .dashboard-actions {
    flex-direction: column;
  }
}

@media (min-width: 900px) {
  .dashboard-hero {
    grid-template-columns: 1.15fr 0.85fr;
  }

  .dashboard-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-wrapper {
  max-width: 500px;
  width: 100%;
  margin: 2rem auto;
  padding: 1.75rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(122, 107, 82, 0.12);
}

.heading-light {
  font-weight: 400;
}
.heading-bold {
  font-weight: 700;
}

.btn,
.action-buttons a,
.action-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
.action-buttons a:hover,
.action-buttons button:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff !important;
  box-shadow: 0 10px 18px rgba(79, 127, 56, 0.2);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff !important;
  box-shadow: 0 10px 18px rgba(217, 130, 43, 0.2);
}

.btn-secondary:hover {
  background: var(--color-secondary-dark);
  color: #fff;
}

.btn-accent {
  background: rgba(47, 127, 143, 0.12);
  color: var(--color-accent) !important;
  border: 1px solid rgba(47, 127, 143, 0.18);
  box-shadow: none;
}

.btn-accent:hover {
  background: rgba(47, 127, 143, 0.18);
}

.btn-danger,
.delete-ad-btn {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover,
.delete-ad-btn:hover {
  background: var(--color-danger-dark);
}

.btn-muted {
  background: #ece7dc;
  color: var(--color-text);
}

.btn-muted:hover {
  background: #ddd5c5;
}

/* Ikonknapp för meddelanden (nav-genväg till chattar) */
.meddelanden-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  width: 56px;
  min-width: 0;
  flex-shrink: 0;
  font-size: 2em;
  font-weight: bold;
  text-decoration: none;
  box-sizing: border-box;
  position: relative;
  background: rgba(47, 127, 143, 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(47, 127, 143, 0.18);
  transition: background 0.2s, box-shadow 0.2s;
}

.meddelanden-btn:hover {
  background: rgba(47, 127, 143, 0.18);
}

/* Optional: reduce padding on small screens */
@media (max-width: 500px) {
  .content-container {
    padding: 0.25rem;
  }
  form {
    padding: 0.5rem;
  }
}

@media (max-width: 600px) {
  .content-container {
    max-width: 100%;
    padding: 0.5rem;
  }
  form {
    max-width: 100%;
    padding: 0.5rem;
  }
}

.meddelanden-ikon {
  font-size: 1em;
  display: block;
  margin: 0 auto;
}

.meddelanden-badge {
  position: absolute;
  top: 8px;
  right: 18px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  padding: 2px 7px;
  font-size: 0.7em;
  font-weight: bold;
  line-height: 1;
}

.chat-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.chat-card {
  background: var(--color-surface);
  border: 1px solid rgba(122, 107, 82, 0.12);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: var(--color-text);
  gap: 1rem;
}

.chat-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.chat-card .fruit-type {
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 0.35rem;
}

.chat-card .last-message-time {
  color: var(--color-text-muted);
  font-size: 0.95em;
  white-space: nowrap;
}

.chat-card.unread {
  border-color: rgba(79, 127, 56, 0.35);
}

.chat-card-status {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background-color: rgba(28, 26, 22, 0.42);
  padding: 1rem;
}

.modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--color-surface);
  margin: 7vh auto;
  padding: 2rem 1.5rem 1.5rem;
  border: 1px solid rgba(122, 107, 82, 0.12);
  width: min(100%, 420px);
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-card);
  animation: modalIn 0.18s;
}

.modal-content form {
  margin: 0;
}

.modal-content p:last-child {
  margin-bottom: 0;
}

.modal-form {
  box-shadow: none;
  border: 0;
  padding: 0;
  background: transparent;
}

.modal-input {
  margin-top: 0.35rem;
}

.modal-actions {
  width: 100%;
}

.modal-actions .btn,
.modal-actions button {
  width: 100%;
}

.modal-btn-group,
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.modal-close {
  color: #8f8575;
  position: absolute;
  right: 16px;
  top: 10px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover,
.modal-close:focus {
  color: var(--color-danger);
}

@keyframes modalIn {
  from { transform: scale(0.97) translateY(30px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ==== INDEX / STARTSIDA ==== */
.index-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
  padding: 2.5rem 0 3.5rem;
}

.index-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-dark);
  background: rgba(79, 127, 56, 0.1);
  border: 1px solid rgba(79, 127, 56, 0.22);
  padding: 0.3em 0.9em;
  border-radius: 99px;
  margin-bottom: 1.25rem;
}

.index-hero p {
  color: var(--color-text-muted);
}

.index-hero p strong {
  color: var(--color-text);
}

.index-groups {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1.5rem 0 2rem;
}

.index-group {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.index-group-icon {
  font-size: 1.6rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.index-group-body strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.index-group-body p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.index-auth {
  position: sticky;
  top: 2rem;
}

.index-auth .auth-panel {
  margin: 0;
}

.index-auth-footer {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
}

.index-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.index-divider::before,
.index-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

@media (max-width: 700px) {
  .index-layout {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding: 1.5rem 0 2.5rem;
  }

  .index-auth {
    position: static;
  }
}
