/* akpaslaugos.lt — design system. System font stack only (no external
   fonts/scripts), CSS custom properties, mobile-first, WCAG AA contrast.

   Color tokens are SEMANTIC and CONTEXTUAL: components read --text,
   --heading, --outline-*, --ghost-* etc, never raw hex values. Any
   container that sits on a dark surface (cta-band, footer, admin header)
   gets the `.on-dark` class, which redefines those same variables for
   everything inside it — so a component like .btn--outline or a plain <p>
   automatically renders correctly regardless of which section it's used
   in, instead of carrying one hardcoded color that breaks on the "wrong"
   background. */

:root {
  /* Raw brand palette — only referenced by the token definitions below,
     never used directly in component rules. */
  --navy-900: #0b1f33;
  --navy-800: #102a45;
  --teal-600: #0b7a77;
  --teal-700: #086361;
  --teal-800: #06504e;
  --ink: #10181f;
  --slate-600: #46545f;
  --border-light: #dbe2e7;
  --border-dark: rgba(255, 255, 255, 0.3);

  /* Surfaces */
  --surface: #ffffff;
  --surface-alt: #f3f6f8;
  --surface-dark: var(--navy-900);

  /* Contextual text/border tokens — redefined inside .on-dark */
  --text: var(--slate-600);
  --heading: var(--navy-900);
  --border: var(--border-light);

  /* Links */
  --link: var(--teal-700);

  /* Primary CTA — dark enough teal to hold 4.5:1 with white text */
  --cta-bg: var(--teal-700);
  --cta-bg-hover: var(--teal-800);
  --cta-text: #ffffff;

  /* Outline / ghost buttons — contextual, flip inside .on-dark */
  --outline-border: var(--navy-900);
  --outline-text: var(--navy-900);
  --outline-hover-bg: var(--navy-900);
  --outline-hover-text: #ffffff;
  --ghost-text: var(--navy-900);
  --ghost-border: var(--border-light);
  --ghost-hover-bg: var(--surface-alt);

  /* Inputs */
  --input-bg: #ffffff;
  --input-text: var(--ink);
  --input-border: var(--border-light);
  --input-focus-border: var(--teal-700);
  --placeholder-text: var(--slate-600);

  /* Status */
  --color-danger: #b3261e;
  --color-danger-bg: #fbeceb;
  --color-success: #196b40;
  --color-success-bg: #e9f6ee;
  --color-warning-bg: #fdf3e3;
  --color-warning-text: #7a4a00;

  --focus-ring: var(--teal-700);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 51, 0.08);
  --shadow-md: 0 8px 24px rgba(11, 31, 51, 0.12);
  --container-w: 1180px;
  /* Admin is a data/work console, not a marketing page — it gets its own,
     much wider container so tables/filters/forms can actually use a large
     screen instead of being capped at the public site's narrow column. */
  --admin-container-w: 1720px;
}

/* Applied to any section/container that sits on the dark navy surface. */
.on-dark {
  /* Re-declaring `color` here (not just the --text variable) matters:
     inherited `color` is computed once by the nearest ancestor that sets
     it (body sets color:var(--text) using the LIGHT default) and that
     resolved value cascades down as-is. Without this line, plain elements
     with no color rule of their own (e.g. a bare <li>) would keep
     inheriting the light-surface color straight through a dark section. */
  color: var(--text);
  --surface: var(--surface-dark);
  --text: #c7d7e2;
  --heading: #ffffff;
  --border: var(--border-dark);
  --link: #bfe9e7;
  --outline-border: #ffffff;
  --outline-text: #ffffff;
  --outline-hover-bg: #ffffff;
  --outline-hover-text: var(--navy-900);
  --ghost-text: #ffffff;
  --ghost-border: var(--border-dark);
  --ghost-hover-bg: rgba(255, 255, 255, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--surface);
  line-height: 1.55;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--link); }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; color: var(--heading); margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); }
h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--text); max-width: 68ch; }
ul, ol { padding-left: 1.2em; }

.container { max-width: var(--container-w); margin: 0 auto; padding: 0 20px; }

.sr-only, .sr-only-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--navy-900);
  color: #fff; padding: 10px 16px; z-index: 1000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.on-dark :focus-visible { outline-color: #ffffff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm); font-weight: 600;
  text-decoration: none; cursor: pointer; border: 2px solid transparent;
  font-size: 0.98rem; line-height: 1.2; transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn--primary { background: var(--cta-bg); color: var(--cta-text); }
.btn--primary:hover { background: var(--cta-bg-hover); }
.btn--outline { background: transparent; color: var(--outline-text); border-color: var(--outline-border); }
.btn--outline:hover { background: var(--outline-hover-bg); color: var(--outline-hover-text); }
.btn--ghost { background: transparent; color: var(--ghost-text); border-color: var(--ghost-border); }
.btn--ghost:hover { background: var(--ghost-hover-bg); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: #8f1e18; }
.btn--lg { padding: 15px 26px; font-size: 1.05rem; }
.btn--sm { padding: 8px 14px; font-size: 0.85rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
@media (prefers-reduced-motion: no-preference) {
  .btn:active { transform: translateY(1px); }
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--border-light); position: sticky; top: 0; background: #fff; z-index: 100; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; }
.brand__logo { height: 42px; width: auto; }
.primary-nav ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; align-items: center; }
.primary-nav > ul a { color: var(--navy-900); text-decoration: none; font-weight: 600; }
.primary-nav > ul a[aria-current="page"] { color: var(--teal-700); }
.primary-nav { display: flex; align-items: center; gap: 28px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border-light); border-radius: 8px; padding: 8px 10px; }
.nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after {
  display: block; width: 22px; height: 2px; background: var(--navy-900); position: relative;
}
.nav-toggle__bar::before, .nav-toggle__bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bar::before { top: -7px; } .nav-toggle__bar::after { top: 7px; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .primary-nav {
    position: fixed; inset: 68px 0 0 0; background: #fff; flex-direction: column;
    align-items: flex-start; padding: 24px 20px; transform: translateY(-8px);
    opacity: 0; pointer-events: none; transition: opacity 0.15s ease, transform 0.15s ease;
    border-top: 1px solid var(--border-light); overflow-y: auto;
  }
  .primary-nav.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .primary-nav ul { flex-direction: column; gap: 18px; width: 100%; align-items: flex-start; }
}

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, var(--surface-alt), #fff); padding: 48px 0 56px; }
.hero__grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
.hero__lead { font-size: 1.1rem; max-width: 56ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.hero__note { font-size: 0.9rem; color: var(--text); }
.hero__media img { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); object-fit: cover; width: 100%; aspect-ratio: 4/3; }
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section--alt { background: var(--surface-alt); }
.section__lead { max-width: 640px; font-size: 1.05rem; }
.section__cta { margin-top: 28px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; margin-top: 28px; }
.card-grid--compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.service-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md);
  overflow: hidden; text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow 0.15s ease, transform 0.15s ease;
  height: 100%;
}
.service-card:hover { box-shadow: var(--shadow-md); }
@media (prefers-reduced-motion: no-preference) { .service-card:hover { transform: translateY(-3px); } }
.service-card img { aspect-ratio: 10/7; object-fit: cover; width: 100%; }
.service-card__body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.service-card__body h3, .service-card__body h2 { font-size: 1.1rem; margin-bottom: 6px; }
.service-card__body p { flex: 1; }
.service-card__link { color: var(--teal-700); font-weight: 600; margin-top: auto; }
.service-card--compact { padding: 16px 18px; }
.service-card--compact h3 { margin: 0; }

/* Neutral graphic placeholder used for services without a dedicated real
   work photo — deliberately not a photo, so it never implies a job we
   don't have documented, and each service gets its own icon (never the
   same generic "team at work" image repeated everywhere). */
.service-visual {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-900), var(--teal-700));
  aspect-ratio: 10/7; width: 100%;
}
.service-visual svg { width: 34%; height: 34%; color: #ffffff; opacity: 0.92; }
.service-detail__visual.service-visual { aspect-ratio: 4/3; border-radius: var(--radius-lg); }

.process__steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-top: 28px; }
.process__steps li { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 22px; }
.process__num {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--navy-900); color: #fff; font-weight: 700; margin-bottom: 10px;
}

.area__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; }
.area__contact ul { list-style: none; padding: 0; }
.area__contact li { margin-bottom: 6px; }
@media (max-width: 860px) { .area__grid { grid-template-columns: 1fr; } }

.faq__list details { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 12px; }
.faq__list summary { cursor: pointer; font-weight: 600; color: var(--heading); }
.faq__list p { margin-top: 10px; }

.cta-band { background: var(--surface); }
.cta-band__inner { text-align: center; }
.cta-band p { max-width: 56ch; margin-left: auto; margin-right: auto; }

.breadcrumbs { font-size: 0.85rem; color: var(--text); margin-bottom: 14px; }
.breadcrumbs a { color: var(--text); }
.page-hero { padding: 36px 0 12px; }

.service-detail__grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 36px; align-items: start; }
.service-detail__image { border-radius: var(--radius-lg); object-fit: cover; width: 100%; aspect-ratio: 4/3; }
.check-list { list-style: none; padding: 0; }
.check-list li { padding-left: 28px; position: relative; margin-bottom: 10px; }
.check-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--color-success); font-weight: 700; }
@media (max-width: 860px) { .service-detail__grid { grid-template-columns: 1fr; } }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.gallery-item { margin: 0; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-light); }
.gallery-item img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.gallery-item figcaption { padding: 10px 14px; font-size: 0.9rem; color: var(--text); }
.gallery-empty { text-align: center; color: var(--text); padding: 40px 20px; }

.legal-text h2 { margin-top: 1.6em; }
.legal-text p, .legal-text li { max-width: 72ch; }

/* ---------- Contact / form ---------- */
.contact-grid__inner { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 40px; align-items: start; }
.contact-info h2 { font-size: 1rem; margin-top: 1.2em; }
.contact-form-wrap { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm); }
@media (max-width: 860px) { .contact-grid__inner { grid-template-columns: 1fr; } }

.form-row { margin-bottom: 18px; }
.form-row label, .form-row__label-text { display: block; font-weight: 600; margin-bottom: 6px; color: var(--heading); }
.form-row input[type="text"], .form-row input[type="tel"], .form-row input[type="email"],
.form-row input[type="password"], .form-row select, .form-row textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  font: inherit; background: var(--input-bg); color: var(--input-text); min-height: 44px;
}
.form-row select { min-height: 44px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--input-focus-border); }
.form-row textarea { resize: vertical; min-height: 130px; }
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--placeholder-text); opacity: 1; }
.field-error { color: var(--color-danger); font-size: 0.85rem; margin: 6px 0 0; font-weight: 600; }
[aria-invalid="true"] { border-color: var(--color-danger) !important; }
.checkbox-label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--text); }
.checkbox-label input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; }
.hp-field { position: absolute; left: -9999px; top: -9999px; }

.form-alert { padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; }
.form-alert--error { background: var(--color-danger-bg); color: var(--color-danger); }
.form-alert--success { background: var(--color-success-bg); color: var(--color-success); }

.photo-picker__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photo-picker__previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-thumb { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-light); aspect-ratio: 1; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb__remove {
  position: absolute; top: 4px; right: 4px; background: rgba(11,31,51,0.82); color: #fff; border: 2px solid #fff;
  border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: 15px; line-height: 1;
}
.photo-picker__status { font-size: 0.85rem; color: var(--text); margin-top: 8px; }
.form-submitting-status { font-size: 0.9rem; color: var(--teal-700); min-height: 1.2em; font-weight: 600; }
#submit-btn[disabled] { opacity: 0.7; cursor: progress; }

.success-page__inner { text-align: center; max-width: 560px; margin: 40px auto; }
.success-icon { color: var(--color-success); margin-bottom: 16px; }
.success-page__number { font-size: 1.1rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); padding: 48px 0 12px; margin-top: 40px; }
.site-footer__inner { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 32px; padding-bottom: 24px; }
.site-footer__logo { height: 38px; width: auto; margin-bottom: 12px; }
.site-footer__heading { font-size: 1rem; margin-bottom: 12px; }
.site-footer__list { list-style: none; padding: 0; margin: 0; }
.site-footer__list li { margin-bottom: 8px; }
.site-footer__list a { color: var(--text); text-decoration: none; }
.site-footer__list a:hover, .site-footer__list a:focus-visible { text-decoration: underline; color: #ffffff; }
.site-footer__bottom { border-top: 1px solid var(--border-dark); padding-top: 14px; font-size: 0.85rem; color: var(--text); }
@media (max-width: 700px) { .site-footer__inner { grid-template-columns: 1fr; } }

/* ---------- Mobile sticky CTA bar ---------- */
.mobile-cta { display: none; }
@media (max-width: 700px) {
  .mobile-cta {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    border-top: 1px solid var(--border-light); background: #fff; box-shadow: 0 -4px 14px rgba(11,31,51,0.12);
    padding: 10px max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
    gap: 10px;
  }
  .mobile-cta__btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 10px; border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; font-size: 0.95rem;
    min-height: 46px;
  }
  .mobile-cta__btn--call { background: var(--surface-alt); color: var(--navy-900); border: 1px solid var(--border-light); }
  .mobile-cta__btn--quote { background: var(--cta-bg); color: #fff; }
  body { padding-bottom: 78px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Admin ---------- */
.admin-body { background: var(--surface-alt); }
.admin-header { background: var(--surface); }
.admin-header__inner { max-width: var(--admin-container-w); margin: 0 auto; padding: 12px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; color: var(--heading); }
.admin-main { width: 100%; max-width: var(--admin-container-w); margin: 0 auto; padding: 28px 20px 80px; }
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.admin-login__card { background: #fff; border-radius: var(--radius-lg); padding: 32px; max-width: 380px; width: 100%; box-shadow: var(--shadow-md); text-align: center; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; background: #fff; border: 1px solid var(--border-light); padding: 18px; border-radius: var(--radius-md); margin-bottom: 22px; }
.admin-filters .form-row { margin-bottom: 0; min-width: 180px; }
.admin-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); }
.admin-table-wrap:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -2px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.admin-table--compact th, .admin-table--compact td { white-space: normal; }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; background: var(--surface-alt); color: var(--navy-900); }
.status-badge--new { background: #dcebf7; color: #0d3f61; }
.status-badge--contacted { background: var(--color-warning-bg); color: var(--color-warning-text); }
.status-badge--in_progress { background: #dfe6fb; color: #29337d; }
.status-badge--completed { background: var(--color-success-bg); color: var(--color-success); }
.status-badge--rejected { background: var(--color-danger-bg); color: var(--color-danger); }
.admin-pagination { display: flex; gap: 8px; margin-top: 16px; }
.admin-pagination a { padding: 6px 12px; border: 1px solid var(--border-light); border-radius: 6px; text-decoration: none; color: var(--navy-900); }
.admin-pagination a.is-active { background: var(--navy-900); color: #fff; }
.admin-detail-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 22px; margin: 22px 0; align-items: start; }
/* min-width: 0 stops a long unbroken value (long email, long address with
   no spaces) from forcing its grid track — and the whole page — wider than
   the viewport; without it, a CSS grid item defaults to auto/min-content,
   which can exceed the track's intended size. */
.admin-detail-grid > * { min-width: 0; }
@media (max-width: 900px) { .admin-detail-grid { grid-template-columns: 1fr; } }
.admin-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 22px; min-width: 0; }
.admin-card h2, .admin-card h3 { margin-top: 1.4em; }
.admin-card h2:first-child, .admin-card h3:first-child { margin-top: 0; }
.def-list { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 1.4em; }
.def-list dt { color: var(--text); font-weight: 600; }
.def-list dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.admin-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.inline-form select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--input-text); }
.danger-zone { border: 1px dashed var(--color-danger); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 16px; }
.danger-zone summary { color: var(--color-danger); font-weight: 700; cursor: pointer; }
.danger-zone form { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.danger-zone input { padding: 8px 10px; border: 1px solid var(--input-border); border-radius: 6px; min-height: 40px; }
.admin-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.admin-photo-grid__item { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-light); aspect-ratio: 1; }
.admin-photo-grid__item img { width: 100%; height: 100%; object-fit: cover; }
.admin-nav { display: flex; gap: 18px; }
.admin-nav a { color: var(--heading); text-decoration: none; font-weight: 600; padding: 4px 2px; border-bottom: 2px solid transparent; }
.admin-nav a:hover { border-bottom-color: var(--border-light); }
.admin-nav a.is-active { border-bottom-color: currentColor; }
.admin-main__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.admin-main--narrow { max-width: 720px; }
.admin-gallery-preview { margin-top: 10px; }
.admin-gallery-preview img[hidden] { display: none; }
.admin-gallery-preview img:not([hidden]) { display: block; max-width: 220px; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-light); object-fit: cover; }
.admin-gallery-form input[type="file"] { display: block; margin-top: 4px; }
.admin-gallery-form input[type="number"] { max-width: 140px; }

/* Below this width there usually isn't room for every table column plus
   its action buttons side by side. Rather than relying only on horizontal
   scroll (easy to miss — a user can be left thinking there are no action
   buttons at all), each row becomes its own card: the header row is
   dropped and every cell instead gets a bold label taken from its
   `data-label` attribute. The horizontal-scroll wrapper (.admin-table-wrap)
   is still kept as a fallback for any content that's wider still. */
@media (max-width: 900px) {
  .admin-table-wrap { overflow-x: visible; border: none; background: none; }
  .admin-table, .admin-table thead, .admin-table tbody, .admin-table tr, .admin-table td {
    display: block; width: 100%;
  }
  .admin-table thead { display: none; }
  .admin-table tr {
    background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md);
    margin-bottom: 12px; padding: 14px;
  }
  .admin-table td {
    border: none; padding: 7px 0; white-space: normal; overflow-wrap: anywhere;
    display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right;
  }
  .admin-table td[data-label]::before {
    content: attr(data-label); font-weight: 600; color: var(--heading); text-align: left; margin-right: auto;
    flex-shrink: 0; white-space: nowrap;
  }
}

/* ---------- Gallery admin list: cards / CSS Grid, not a table ---------- */
/* A table with 7 data columns plus an actions column doesn't have enough
   room at "in-between" desktop widths (confirmed broken at 1593x953) — the
   actions column would get squeezed into the horizontally-scrolling table
   wrapper and effectively disappear. Each gallery item is instead its own
   grid row/card: minmax(0, ...) lets the text columns shrink and wrap, while
   the actions column has a genuine minmax(...,auto) floor so it can never
   be squeezed below a usable width, and its own buttons still wrap via
   flex-wrap if the card itself is ever narrower than all three at once. */
.gallery-admin-list { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.gallery-admin-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1.3fr) minmax(0, 1fr) minmax(230px, auto);
  gap: 10px 20px;
  align-items: center;
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md);
  padding: 16px 18px;
}
.gallery-admin-card__thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.gallery-admin-card__info { min-width: 0; }
.gallery-admin-card__title { margin: 0 0 4px; font-size: 1.02rem; overflow-wrap: anywhere; }
.gallery-admin-card__caption { margin: 0; color: var(--text); font-size: 0.9rem; overflow-wrap: anywhere; }
.gallery-admin-card__meta { min-width: 0; margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 0.85rem; align-content: center; }
.gallery-admin-card__meta-row { display: contents; }
.gallery-admin-card__meta dt { color: var(--text); font-weight: 600; }
.gallery-admin-card__meta dd { margin: 0; overflow-wrap: anywhere; }
.gallery-admin-card__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-content: center; min-width: 0; }
.gallery-admin-card__actions .inline-form { margin: 0; }
.gallery-admin-empty { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 24px; text-align: center; color: var(--text); }

@media (max-width: 900px) {
  .gallery-admin-card { grid-template-columns: 1fr; gap: 10px; }
  .gallery-admin-card__thumb { width: 100%; height: auto; aspect-ratio: 16/9; }
  .gallery-admin-card__meta { grid-template-columns: auto 1fr; }
  .gallery-admin-card__actions { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .gallery-admin-card__actions { flex-direction: column; align-items: stretch; }
  .gallery-admin-card__actions .btn { width: 100%; }
}
