@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f7f2e8;
  --ink: #1e3b40;
  --muted: #5c6f72;
  --card: #e3ddcf;
  --accent: #d46a2e;
  --accent-soft: #f0c6a4;
  --mint: #8fb39d;
  --pink: #f2a3b3;
  --success: #5fcf6e;
  --shadow: 0 20px 50px rgba(31, 39, 36, 0.15);
}

.a11y {
  --bg: #ffffff;
  --ink: #0b0b0b;
  --muted: #2a2a2a;
  --card: #f1f1f1;
  --accent: #0b5fff;
  --accent-soft: #cfe1ff;
  --mint: #b9e1c5;
  --pink: #f5c3cd;
  --success: #2e9b49;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

*:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

html[dir='ltr'] input,
html[dir='ltr'] textarea,
html[dir='ltr'] select {
  direction: ltr;
  text-align: left;
}

html[dir='rtl'] input,
html[dir='rtl'] textarea,
html[dir='rtl'] select {
  direction: rtl;
  text-align: right;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, sans-serif;
  background: radial-gradient(circle at top left, #fff7ea 0%, var(--bg) 45%, #f3efe7 100%);
  color: var(--ink);
  min-height: 100vh;
}

.a11y body {
  background: #ffffff;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

#app {
  min-height: 100vh;
  padding: 36px 8vw 60px;
  position: relative;
  overflow-x: hidden;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(0.5px);
  opacity: 0.22;
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}

.a11y .orb {
  opacity: 0.08;
}

.orb--one {
  width: 240px;
  height: 240px;
  background: var(--mint);
  top: -60px;
  left: -40px;
}

.orb--two {
  width: 280px;
  height: 280px;
  background: var(--pink);
  bottom: 60px;
  right: -80px;
  animation-delay: -3s;
}

.orb--three {
  width: 180px;
  height: 180px;
  background: var(--accent-soft);
  top: 50%;
  left: 65%;
  animation-delay: -6s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) translateX(0px);
  }
  50% {
    transform: translateY(-18px) translateX(12px);
  }
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 28px;
}

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar__row--title {
  justify-content: flex-start;
}

.topbar__row--controls {
  justify-content: flex-end;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand__icon {
  width: 76px;
  height: 76px;
}

.brand__title {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: clamp(20px, 2.2vw, 26px);
  margin: 0;
  line-height: 1.1;
}

.brand__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.user {
  display: flex;
  align-items: center;
  gap: 20px;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  max-width: 520px;
  width: 100%;
}

.login-form__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.login-form__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.login-form__actions .btn--tiny {
  padding: 10px 16px;
  font-size: 13px;
}

.login-form__divider {
  width: 100%;
  height: 1px;
  background: rgba(31, 59, 64, 0.12);
}

.language {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.language__label {
  font-weight: 600;
}

.language__select {
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(31, 59, 64, 0.2);
  background: #fff7ea;
  color: var(--ink);
  font-family: inherit;
}

.language__select--ltr {
  direction: ltr;
  text-align: left;
}

.language__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(31, 59, 64, 0.2);
  border-top-color: var(--accent);
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

.pill {
  background: var(--card);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 39, 36, 0.2);
}

.btn--accent {
  background: var(--accent);
  color: #fff6f0;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--ink);
}

.btn--logout {
  padding-inline: 26px;
  margin-left: 6px;
}

.a11y .btn--ghost {
  border-width: 2px;
}

.btn--a11y {
  white-space: nowrap;
}

.a11y .language__select,
.a11y .search,
.a11y .member-input,
.a11y .member-filter,
.a11y .member-role-select,
.a11y .modal__input {
  border: 2px solid var(--ink);
  background: #ffffff;
}

.a11y .search {
  border-radius: 14px;
}

.card {
  background: var(--card);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.card--login {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card--login > h3,
.card--login > p {
  text-align: center;
}

.card--login .login-form {
  margin-left: auto;
  margin-right: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 10px;
}

.stats--loading,
.stats--error {
  grid-template-columns: 1fr;
}

.stat {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(31, 59, 64, 0.1);
  box-shadow: 0 4px 10px rgba(31, 39, 36, 0.08);
}

.stat__label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.stat__label--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat__value {
  font-size: 16px;
  font-weight: 600;
  margin-top: 3px;
}

.stat__note--inline {
  margin-top: 6px;
  font-size: 11px;
}

.info-btn {
  border: 1px solid rgba(31, 59, 64, 0.3);
  background: #fff7ea;
  color: var(--ink);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.info-btn:hover {
  box-shadow: 0 6px 12px rgba(31, 39, 36, 0.12);
}

.stats__note {
  margin: -2px 0 10px;
  font-size: 11px;
  color: var(--muted);
}

.stats__note--warn {
  color: var(--accent);
}

.toolbar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project {
  background: #fff7ec;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(31, 59, 64, 0.1);
  transition: transform 0.2s ease;
}

.project:hover {
  transform: translateY(-4px);
}

.project__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project__tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.btn--tiny {
  padding: 6px 10px;
  font-size: 11px;
}

.archived {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archived__header {
  font-weight: 700;
}

.project__title {
  font-weight: 700;
  font-size: 16px;
  flex: 1;
}

.project__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.project__meta {
  color: var(--muted);
  font-size: 12px;
}

.project__badge {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.project__consent {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--success);
  color: #0b3d1f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 6px 14px rgba(31, 39, 36, 0.12);
  flex: 0 0 auto;
  margin-left: auto;
}

.detail__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.detail__title {
  font-size: 24px;
  font-weight: 700;
}

.detail__address {
  color: var(--muted);
  font-size: 13px;
}

.photo-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-top: 18px;
}

.photo-card {
  background: #fff7ec;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(31, 59, 64, 0.1);
}

.photo-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #f4efe5;
}

.photo-card__footer {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-card__id {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.danger {
  background: #2d3b3e;
  color: #f6efe6;
  border: none;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.empty {
  color: var(--muted);
  margin-top: 20px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(120px, 0.5fr) minmax(220px, 0.7fr);
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(31, 59, 64, 0.12);
  align-items: center;
}

.member-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-name {
  font-weight: 600;
}

.member-id {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.member-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.member-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(31, 59, 64, 0.2);
  background: #fff7ea;
  font-family: inherit;
}

.member-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.member-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
}

.member-tag--status {
  background: var(--ink);
  color: #fff6f0;
}

.member-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  justify-content: end;
  justify-items: end;
  align-items: center;
}

.member-actions .btn,
.member-actions .danger {
  height: 32px;
  display: inline-flex;
  align-items: center;
}

.member-role-select {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(31, 59, 64, 0.2);
  background: #fff7ea;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  min-width: 120px;
  height: 32px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 26, 24, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal__card {
  background: #fff7ec;
  border-radius: 18px;
  padding: 20px;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
}

.a11y .modal__card {
  background: #ffffff;
}

.modal__card--wide {
  width: min(840px, 100%);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal__title {
  font-weight: 700;
  margin: 0 0 6px;
}

.modal__subtitle {
  margin: 0 0 16px;
  color: var(--muted);
}

.modal__label {
  display: block;
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.modal__label:first-of-type {
  margin-top: 0;
}

.modal__row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.modal__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 59, 64, 0.15);
  direction: inherit;
  text-align: inherit;
}

.modal__input.modal__input--email {
  text-align: start;
  unicode-bidi: plaintext;
}

.modal__editor {
  margin-top: 8px;
}

.modal__editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.modal__editor .ql-toolbar.ql-snow {
  border-radius: 12px 12px 0 0;
  border: 1px solid rgba(31, 59, 64, 0.15);
  background: #fffdf7;
}

.modal__editor .ql-container.ql-snow {
  border-radius: 0 0 12px 12px;
  border: 1px solid rgba(31, 59, 64, 0.15);
  border-top: 0;
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
}

.modal__editor .ql-editor {
  min-height: 160px;
  line-height: 1.5;
  font-family: inherit;
  font-size: 13px;
  background: #ffffff;
}

.modal__editor .ql-editor.ql-font-serif {
  font-family: 'Times New Roman', Georgia, serif;
}

.modal__editor .ql-editor.ql-font-monospace {
  font-family: 'Courier New', monospace;
}

.modal__editor .ql-editor.ql-font-sans-serif {
  font-family: 'Poppins', system-ui, sans-serif;
}

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='serif']::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='serif']::before {
  content: 'Serif';
  font-family: 'Times New Roman', Georgia, serif;
}

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='monospace']::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='monospace']::before {
  content: 'Monospace';
  font-family: 'Courier New', monospace;
}

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='sans-serif']::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='sans-serif']::before {
  content: 'Sans Serif';
  font-family: 'Poppins', system-ui, sans-serif;
}

.modal__editor .ql-editor.ql-blank::before {
  color: var(--muted);
}

.a11y .modal__editor .ql-toolbar.ql-snow,
.a11y .modal__editor .ql-container.ql-snow {
  border: 2px solid var(--ink);
  background: #ffffff;
}

.a11y .modal__editor .ql-toolbar.ql-snow .ql-stroke {
  stroke: var(--ink);
}

.a11y .modal__editor .ql-toolbar.ql-snow .ql-fill {
  fill: var(--ink);
}

.a11y .modal__editor .ql-toolbar.ql-snow .ql-picker {
  color: var(--ink);
}

.member-controls {
  display: flex;
  gap: 10px;
  margin: 12px 0 16px;
  align-items: center;
}

.member-filter {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 59, 64, 0.2);
  background: #fff7ea;
  color: var(--ink);
  font-family: inherit;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.invite__body {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 16px;
  align-items: center;
}

.invite__qr {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 16px;
  background: #fff7ea;
  border: 1px solid rgba(31, 59, 64, 0.12);
  min-height: 220px;
}

.invite__qr img {
  width: 220px;
  height: 220px;
}

.invite__placeholder {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 10px;
}

.invite__code {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invite__label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.invite__value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 16px;
  letter-spacing: 2px;
  background: #fff7ea;
  border-radius: 12px;
  padding: 10px 12px;
  display: inline-flex;
}

.invite__note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 28, 0.88);
  z-index: 20;
}

.lightbox__toolbar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 32px);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(244, 239, 229, 0.94);
  border: 1px solid rgba(31, 59, 64, 0.2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.lightbox__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 88px 24px 24px;
  overflow: hidden;
  cursor: grab;
}

.lightbox__stage:active {
  cursor: grabbing;
}

.lightbox__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  user-select: none;
  pointer-events: none;
}

@media (max-width: 720px) {
  .lightbox__toolbar {
    top: 12px;
    max-width: calc(100% - 24px);
    padding: 6px 10px;
  }

  .lightbox__stage {
    padding: 76px 16px 16px;
  }
}

.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 80px;
}

.boot__spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(31, 59, 64, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.boot__text {
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  #app {
    padding: 28px 6vw 50px;
  }
  .topbar {
    align-items: stretch;
  }
  .topbar__row {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar__row--controls {
    align-items: flex-start;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar__actions {
    justify-content: flex-start;
  }
  .member-row {
    grid-template-columns: 1fr;
  }
  .member-actions {
    justify-content: start;
    justify-items: start;
  }
  .member-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .member-filter {
    width: 100%;
  }
  .invite__body {
    grid-template-columns: 1fr;
  }
  .invite__qr img {
    width: 180px;
    height: 180px;
  }
}
