:root {
  --eucalyptus: #5e7875;
  --gold: #c5a059;
  --deep: #2f3e3c;
  --navy: #2d3848;
  --neutral: #e8eae6;
  --paper: #f7f6f2;
  --white: #ffffff;
  --danger: #8c3a32;
  --line: rgba(47, 62, 60, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--neutral);
  color: var(--navy);
  font-family: Montserrat, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
.shell { max-width: 480px; margin: 0 auto; padding: 28px 16px 48px; }
.page-client .shell { max-width: 760px; }
.page-admin .shell { max-width: 980px; }
.masthead {
  background: linear-gradient(160deg, var(--deep) 0%, #3f5855 100%);
  border-radius: 18px 18px 0 0;
  padding: 28px 0 12px;
  text-align: center;
}
.wordmark {
  display: block;
  max-width: min(420px, calc(100% - 40px));
  margin: 0 auto;
  line-height: 0;
  text-decoration: none;
}
.wordmark img { display: block; width: 100%; height: auto; }
.wordmark:hover { opacity: 0.88; }
.wordmark:focus-visible,
.back-home:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
.brand-tagline {
  margin: 4px 20px 0;
  color: #fff;
  font-family: Montserrat, "Segoe UI", sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  line-height: 1.35;
  text-transform: uppercase;
}
.mast-kicker {
  margin: 16px 20px 16px;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.gold-rule { height: 4px; background: var(--gold); }
.back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: calc(100% - 24px);
  margin: 6px auto 0;
  padding: 0 8px;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
  text-decoration: none;
  border-bottom: 2px solid var(--gold);
}
.back-home:hover { color: #fff; }
.main {
  background: transparent;
}
.card {
  background: var(--white);
  padding: 22px 20px 24px;
  margin-top: 16px;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(47, 62, 60, 0.06);
}
.page-narrow .main > .card:first-child {
  margin-top: 0;
  border-radius: 0 0 18px 18px;
}
.masthead + .main .card:first-child,
.topbar + .banner + .card,
.topbar + .card { margin-top: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 22px 4px 8px;
}
h1, h2, h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  color: var(--deep);
  margin: 0 0 8px;
}
h1 { font-size: 2.15rem; line-height: 1.1; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.2rem; margin-bottom: 4px; }
.lede { margin: 0 0 16px; color: var(--navy); }
.note { color: var(--eucalyptus); font-size: 0.86rem; margin: 12px 0 0; }
label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--eucalyptus);
}
.optional { letter-spacing: 0; text-transform: none; font-weight: 500; }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--navy);
  background: #fff;
  border: 1.5px solid rgba(94, 120, 117, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(197, 160, 89, 0.45);
  border-color: var(--gold);
}
.button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--deep);
  color: #fff;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #24312f; }
.button:disabled { opacity: 0.65; cursor: wait; }
.button.ghost {
  background: transparent;
  color: var(--deep);
  border: 1.5px solid var(--deep);
}
.button.danger {
  width: auto;
  min-height: 40px;
  margin-top: 0;
  padding: 8px 14px;
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.page-admin .button { width: auto; }
.page-admin #invite-form .button { width: 100%; }
.text-button {
  background: none;
  border: 0;
  color: var(--eucalyptus);
  font: inherit;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.error { min-height: 1.2em; color: var(--danger); margin: 10px 0 0; }
.path-preview { margin-top: 8px; }
.folder-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
}
.folder-status strong, .folder-name, .folder-path, .folder-hint { display: block; }
.folder-name { font-weight: 600; margin-top: 2px; }
.folder-path, .folder-hint { word-break: break-word; }
.folder-status a { display: inline-block; margin-top: 4px; color: var(--deep); }
.folder-status.found { background: #e5eeea; color: #1d4a32; }
.folder-status.missing { background: #f3e4e2; color: var(--danger); }
.folder-status.unconfigured { background: #f8f1de; color: #6d5420; }
.folder-status.checking { background: var(--paper); color: var(--eucalyptus); }
.folder-mark { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 1px; }
.spinner {
  width: 16px;
  height: 16px;
  margin: 3px;
  flex: 0 0 auto;
  border: 2px solid rgba(94, 120, 117, 0.35);
  border-top-color: var(--eucalyptus);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--navy);
}
.check-line input { width: auto; min-height: 0; margin: 0; }
.page-admin #invite-form .button:disabled { opacity: 0.55; cursor: not-allowed; }
.banner {
  background: #f8f1de;
  color: var(--deep);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}
.banner.warn { background: #f8ebe3; border-left-color: var(--danger); }
.code-panel { margin-top: 8px; }
.foot {
  text-align: center;
  color: var(--eucalyptus);
  font-size: 0.82rem;
  padding: 18px 8px 0;
}
.foot a { color: var(--deep); }
.grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.result {
  margin-top: 18px;
  padding: 14px;
  background: var(--paper);
  border-radius: 12px;
}
.result .path, .path { word-break: break-word; }
.batch {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.batch ul, .file-preview, .activity { list-style: none; padding: 0; margin: 8px 0 0; }
.batch li, .file-preview li, .activity li {
  display: flex;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.activity li { border-top: 1px solid var(--line); align-items: baseline; }
.activity li div { display: flex; flex-direction: column; }
.activity time, .muted { color: var(--eucalyptus); font-size: 0.82rem; }
.who { display: block; font-weight: 600; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--paper);
}
.pill-active { background: #e5eeea; color: var(--deep); }
.pill-invited { background: #f8f1de; color: #6d5420; }
.pill-revoked { background: #f3e4e2; color: var(--danger); }
.empty { color: var(--eucalyptus); }
.table-wrap { overflow-x: auto; }
table.clients { width: 100%; border-collapse: collapse; }
table.clients th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eucalyptus);
  padding: 8px;
}
table.clients td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: top; }
@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .shell { padding-top: 40px; }
  .wordmark { max-width: min(460px, calc(100% - 48px)); }
}
.drop-zone {
  position: relative;
  margin-top: 18px;
  padding: 8px;
  border-radius: 20px;
  background: var(--paper);
}
.drop-target {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 28px 18px 18px;
  border: 1.5px dashed rgba(94, 120, 117, 0.55);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(197, 160, 89, 0.18), transparent 58%),
    #fff;
  color: var(--deep);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.drop-target:focus-visible,
body.is-dropping .drop-target {
  border-style: solid;
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.28);
  outline: none;
}
body.is-dropping .drop-target { animation: dropPulse 1.1s ease-in-out infinite; }
@keyframes dropPulse {
  50% { box-shadow: 0 0 0 10px rgba(197, 160, 89, 0.16); }
}
.drop-mark { width: 48px; height: 48px; color: var(--eucalyptus); }
.drop-title {
  margin: 4px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 500;
}
.drop-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.drop-actions .button { width: auto; min-width: 168px; margin-top: 0; }
#file-input, #folder-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(47, 62, 60, 0.28);
  pointer-events: none;
}
.drop-veil strong {
  background: #fff;
  color: var(--deep);
  border: 2px solid var(--gold);
  border-radius: 999px;
  padding: 16px 28px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.6rem;
}
.overall { margin-top: 18px; }
.overall-label, .file-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--eucalyptus); font-size: 0.85rem; }
.bar {
  height: 8px;
  margin-top: 6px;
  background: #e4e6e1;
  border-radius: 999px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--eucalyptus), var(--deep));
  transition: width 0.2s ease;
}
.upload-rows { list-style: none; margin: 8px 0 0; padding: 0; }
.file-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.file-name { font-weight: 600; word-break: break-word; }
.file-error { color: var(--danger); margin: 6px 0 0; font-size: 0.86rem; }
.type-icon { width: 32px; height: 32px; color: var(--eucalyptus); }
.tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5eeea;
  color: var(--deep);
  font-weight: 700;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
#retry-all { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) {
  .drop-target, .bar > span, .drop-veil, body.is-dropping .drop-target, .spinner {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 719px) {
  table.clients thead { display: none; }
  table.clients tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 8px;
  }
  table.clients td {
    display: block;
    border: 0;
    padding: 6px 4px;
  }
  table.clients td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--eucalyptus);
  }
  table.clients td:last-child::before { content: none; }
  .activity li { flex-direction: column; align-items: flex-start; }
}
