@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700&display=swap");
@import url("/branding/brand-colors.css");

:root {
  --bg0: var(--rkt-green-100);
  --bg1: #f4f7f7;
  --ink: var(--rkt-green-900);
  --muted: var(--rkt-green-700);
  --brand: var(--rkt-green-900);
  --brand-soft: var(--rkt-green-800);
  --accent: var(--rkt-green-800);
  --line: var(--rkt-green-300);
  --card: rgba(255, 255, 255, 0.96);
  --danger: #9b1c1c;
  --ok: var(--rkt-green-800);
  --radius: 14px;
  --shadow: 0 10px 28px rgba(0, 67, 70, 0.08);
  font-family: "Montserrat", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 8% -8%, #d5e1e2 0%, transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

body {
  font-size: 17px;
  line-height: 1.45;
  font-weight: 500;
  -webkit-text-size-adjust: 100%;
}

.shell {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 24px 18px 48px;
}

.shell.wide { width: min(720px, 100%); }

.brand-header {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-logo {
  display: block;
  width: min(220px, 68vw);
  height: auto;
  max-height: 56px;
}

.brand-logo.compact {
  width: min(168px, 52vw);
  max-height: 44px;
}

.brand-kicker {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rkt-green-700);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4.5vw, 1.85rem);
  line-height: 1.2;
  color: var(--brand);
  font-weight: 700;
}

.lead, .muted { color: var(--muted); margin: 0 0 16px; font-weight: 500; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.topbar-brand {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.topbar-actions .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.card-form.stack { gap: 18px; }

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
}

input, select, button, textarea {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus {
  outline: 3px solid rgba(0, 67, 70, 0.22);
  border-color: var(--brand);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
}

.btn {
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: var(--brand);
  color: var(--rkt-white);
}

.btn.primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--brand);
}

fieldset {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  margin: 0;
  padding: 12px;
}

legend {
  padding: 0 6px;
  font-weight: 700;
}

.optional { color: var(--muted); font-weight: 500; }
.required { color: var(--brand-soft); }

.ort-wrap {
  position: relative;
  display: grid;
  gap: 8px;
}

.orte-suggest {
  list-style: none;
  margin: 0;
  padding: 6px;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.orte-suggest li {
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}

.orte-suggest li:hover,
.orte-suggest li[aria-selected="true"] {
  background: var(--rkt-green-100);
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.photo-preview .thumb {
  position: relative;
}

.photo-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.photo-preview .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 32px;
  width: 32px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(0, 67, 70, 0.8);
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

.sig-idle {
  display: grid;
  gap: 12px;
  padding: 8px 4px;
}

.sig-idle p {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.sig-preview {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
}

.sig-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--rkt-green-900);
  color: var(--rkt-white);
  overscroll-behavior: none;
}

.sig-overlay-inner {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding:
    max(10px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}

@media (orientation: portrait) {
  .sig-overlay.is-open .sig-overlay-inner {
    width: 100dvh;
    height: 100dvw;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
  }
}

.sig-overlay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
}

.sig-overlay-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sig-overlay-brand img {
  height: 28px;
  width: auto;
  display: block;
}

.sig-overlay-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.sig-rotate-hint {
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--rkt-green-700);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.sig-canvas-host {
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

#signature {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  caret-color: transparent;
  background: #fff;
  border: 2px solid var(--rkt-green-500);
  border-radius: 12px;
}

.sig-overlay-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  min-height: 64px;
}

.sig-overlay-actions .btn {
  min-height: 56px;
}

.sig-overlay-actions .btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: #f4faf6;
}

.sig-overlay-actions .btn.primary {
  background: var(--rkt-white);
  color: var(--rkt-green-900);
}

.error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fde8e8;
  color: var(--danger);
  border: 1px solid #f0b4b4;
}

.flash {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #e4eeef;
  color: var(--ok);
  border: 1px solid var(--rkt-green-300);
}

.page-foot {
  margin-top: 18px;
  color: var(--rkt-green-700);
  font-size: 0.82rem;
  text-align: center;
}

.section-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand);
}

.preview-line { margin: 8px 0 0; }

.admin-confirm {
  display: none !important;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--rkt-green-500);
  background: #eef4f4;
  gap: 10px;
}

.admin-confirm.is-open {
  display: grid !important;
}

.admin-confirm-text { margin: 0; font-weight: 600; }

.admin-only {
  display: none !important;
}

.admin-only.is-visible {
  display: inline-flex !important;
}

.created-box {
  border-color: var(--rkt-green-700);
  box-shadow: 0 0 0 3px rgba(0, 67, 70, 0.12);
}

.created-box[hidden] {
  display: none !important;
}

.password-once-warn {
  margin: 0;
  color: #9b1c1c;
  font-weight: 700;
}

.share-text {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #f4f7f7;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.4;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.user-row-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.user-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand);
  padding: 6px 0;
}

.user-details-body {
  display: grid;
  gap: 6px;
  padding-top: 8px;
}

.user-details-body p {
  margin: 0;
}

.btn.danger {
  background: #9b1c1c;
  color: #fff;
  border-color: #9b1c1c;
}

.role-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--rkt-green-100);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}

.role-pill.inactive {
  background: #fde8e8;
  color: var(--danger);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.filter-grid .filter-span { grid-column: 1 / -1; }

.filter-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.archiv-results { display: grid; gap: 18px; margin-top: 8px; }

.archiv-group-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--brand);
}

.archiv-list { display: grid; gap: 10px; }

.archiv-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.archiv-card-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.archiv-card-meta {
  text-align: right;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.archiv-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.archiv-card-actions a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.detail-overlay[hidden] { display: none !important; }

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 67, 70, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.detail-panel {
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 16px 16px 8px 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.detail-top h2 {
  margin: 0;
  font-size: 1.15rem;
}

.detail-grid p { margin: 0 0 6px; }

.detail-sig {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.detail-fotos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.detail-fotos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.detail-actions { display: grid; }

.detail-actions a.btn {
  text-decoration: none;
  text-align: center;
}
