:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1f2b24;
  --muted: #6b7280;
  --border: #e7e9ed;
  --accent: #1fa35a;
  --accent-contrast: #ffffff;
  --danger: #d64545;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Google Sans", Roboto, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-icon {
  width: 24px;
  height: 24px;
}

.topbar nav {
  display: flex;
  gap: 1.25rem;
}

.topbar nav a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar nav a:hover {
  color: var(--text);
}

.topbar nav a.button,
.topbar nav a.button:hover {
  color: var(--accent-contrast);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-block {
  margin-bottom: 1.75rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1rem;
}

.button.small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.button.pill {
  border-radius: 999px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.9rem;
}

.tile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  aspect-ratio: 1 / 1;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tile-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.tile-card.active {
  border-color: var(--accent);
  background: rgba(31, 163, 90, 0.08);
}

.tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.tile-icon i,
.tile-icon svg {
  width: 32px;
  height: 32px;
}

.tile-label {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.summary-line {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -0.5rem 0 1.25rem;
}

.home-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.home-toolbar .icon-button {
  border: 1px solid var(--border);
  background: var(--surface);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.grid.small {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-image {
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  background-color: var(--border);
}

.card-body {
  padding: 0.75rem 0.9rem;
}

.card-body h3,
.card-body h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.card-body h4 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-body h4 i {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.usage-total {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.usage-total-value {
  font-size: 2rem;
  font-weight: 700;
}

.usage-total-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.usage-pending {
  align-items: center;
}

.usage-pending i {
  width: 20px;
  height: 20px;
  color: var(--muted);
  animation: spin 1s linear infinite;
}

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

.usage-breakdown {
  margin-bottom: 1.5rem;
}

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0 1.75rem;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: "Google Sans", Roboto, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  box-shadow: 0 0 0 6px rgba(31, 163, 90, 0.12);
}

.profile-name {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}

.profile-email-pill {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-section-label {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}

.profile-list-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.profile-list-row:last-child {
  border-bottom: none;
}

.profile-list-row:hover {
  background: var(--bg);
}

.profile-list-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.profile-list-icon i,
.profile-list-icon svg {
  width: 18px;
  height: 18px;
}

.profile-list-text {
  flex: 1;
}

.profile-list-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.profile-list-row-danger .profile-list-text,
.profile-list-row-danger .profile-list-icon {
  color: var(--danger);
}

.profile-edit-card {
  max-width: 480px;
}

.profile-edit-notice {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.profile-edit-subheading {
  margin: 1.5rem 0 0.25rem;
  font-size: 0.95rem;
}

.profile-edit-hint {
  margin: 0 0 1rem;
}

.profile-edit-actions {
  justify-content: flex-end;
}

.card-body p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.button:hover {
  box-shadow: var(--shadow-sm);
}

.button.danger {
  background: var(--danger);
}

.button.outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.button.outline:hover {
  border-color: var(--muted);
}

.button.outline.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}

.button.outline.danger:hover {
  border-color: var(--danger);
}

.nav-cta {
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  color: var(--muted);
}

.auth-card {
  max-width: 400px;
  width: 100%;
  margin: 4rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  text-align: center;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  text-align: left;
}

.auth-header h1 {
  margin: 0;
}

.auth-header-text .auth-subtitle {
  margin: 0.15rem 0 0;
}

.auth-header .auth-back-btn {
  flex-shrink: 0;
  margin: 0;
}

.auth-header-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(31, 163, 90, 0.12);
}

.auth-header-icon[hidden] {
  display: none;
}

.auth-header-icon img {
  width: 32px;
  height: 32px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1.5rem;
}

.auth-card form {
  text-align: left;
}

.input-icon {
  position: relative;
  margin-top: 0.35rem;
}

.input-icon-glyph {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.input-icon-glyph svg,
.input-icon-glyph i {
  width: 100%;
  height: 100%;
}

.input-icon input {
  margin-top: 0;
  padding-left: 2.5rem;
}

.input-icon.with-toggle input {
  padding-right: 2.5rem;
}

.password-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg,
.password-toggle i {
  width: 18px;
  height: 18px;
}

.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0;
}

.social-auth {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.social-auth[hidden] {
  display: none;
}

.social-btn {
  width: 100%;
  justify-content: center;
}

.social-btn img,
.social-btn i {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.auth-back-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.auth-back-btn[hidden] {
  display: none;
}

.auth-back-btn:hover {
  color: var(--text);
}

.auth-back-btn i {
  width: 16px;
  height: 16px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.25rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.nav-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: "Google Sans", Roboto, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
}

label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

button {
  font-family: inherit;
}

.post-form {
  max-width: 520px;
}

label[for="image-input"] {
  margin-bottom: 0;
}

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

.file-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0 1rem;
}

.file-input-name {
  font-size: 0.85rem;
  color: var(--muted);
}

.preview {
  max-width: 220px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: block;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.post-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2rem;
}

.post-detail-image {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
  max-height: 520px;
}

.post-detail-body h1 {
  margin-top: 0;
}

.post-detail-body .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
}

.actions form {
  margin: 0;
}

.related h2 {
  font-size: 1.1rem;
}

.relate-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.relate-form select {
  margin-top: 0;
  flex: 1;
  max-width: 320px;
}

.relate-form input[type="text"] {
  margin-top: 0;
  flex: 1;
  min-width: 180px;
}

.related-card {
  position: relative;
}

.related-card form {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  margin: 0;
}

.related-card .icon-button {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 999px;
  padding: 0.3rem;
}

.related-card .icon-button:hover {
  background: var(--danger);
  color: #fff;
}

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

.error {
  background: rgba(214, 69, 69, 0.12);
  color: var(--danger);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.flash-messages {
  margin-bottom: 1.25rem;
}

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.flash.error {
  background: rgba(214, 69, 69, 0.12);
  color: var(--danger);
}

.flash.success {
  background: rgba(31, 163, 90, 0.12);
  color: var(--accent);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1;
}

.chip i,
.chip svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  stroke-width: 2px;
}

.chip.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.chip.small {
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
}

.label-color-red { --label-rgb: 229, 72, 77; }
.label-color-orange { --label-rgb: 242, 141, 74; }
.label-color-amber { --label-rgb: 217, 168, 30; }
.label-color-green { --label-rgb: 43, 161, 94; }
.label-color-teal { --label-rgb: 20, 168, 154; }
.label-color-blue { --label-rgb: 59, 111, 224; }
.label-color-indigo { --label-rgb: 99, 102, 241; }
.label-color-purple { --label-rgb: 168, 85, 247; }
.label-color-pink { --label-rgb: 227, 74, 152; }

.chip[class*="label-color-"]:not(.label-color-none) {
  background: rgba(var(--label-rgb), 0.14);
  border-color: rgba(var(--label-rgb), 0.4);
  color: rgb(var(--label-rgb));
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.color-swatch {
  position: relative;
  display: inline-flex;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgb(var(--label-rgb, 155, 157, 163));
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-swatch.label-color-none {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.color-swatch.label-color-none::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.color-swatch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.color-swatch:has(input:checked) {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px rgb(var(--label-rgb, 107, 114, 128));
}

.label-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.search-form .input-icon {
  flex: 1;
  min-width: 200px;
  margin-top: 0;
}

.search-form input[type="search"] {
  margin-top: 0;
}

.date-range-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.date-range-field input[type="date"] {
  margin-top: 0;
  width: auto;
  padding: 0.5rem 0.6rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.inline-form input {
  margin-top: 0;
  width: auto;
  flex: 1;
  max-width: 280px;
}

.label-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.label-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.5rem 0.75rem;
}

.label-list li > .chip {
  margin-top: 0.4rem;
}

.label-list .inline-form {
  flex: 1;
  margin-bottom: 0;
}

.label-list .inline-form input {
  max-width: none;
}

.label-list .color-picker {
  flex-basis: 100%;
  margin: 0.15rem 0 0;
}

.label-list .icon-button {
  margin-top: 0.15rem;
}

.icon-button {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
}

.icon-button:hover {
  background: var(--bg);
  color: var(--text);
}

.icon-button.danger:hover {
  color: var(--danger);
}

.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.9rem 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.dropdown-toggle:hover {
  border-color: var(--muted);
}

.dropdown-toggle i {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.dropdown-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
}

.dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 220px;
  overflow-y: auto;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  margin: 0;
}

.dropdown-option:hover {
  background: var(--bg);
}

.dropdown-option input {
  width: auto;
  margin: 0;
}

.dropdown-empty {
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  margin: 0;
}

.dropdown-add {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.5rem;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 0 0 6px 6px;
}

.dropdown-add:hover {
  background: var(--bg);
}

.dropdown-add i {
  width: 15px;
  height: 15px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
}

.modal-card h3 {
  margin: 0 0 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Bottom-sheet variant of .modal-overlay/.modal-card, used for the Home
   screen's quick Add Folder / Add Label popups to match the mobile app's
   bottom-sheet pattern. Other modals (logout confirm, post-form new-label)
   keep the plain centered .modal-card look untouched. */
.sheet-overlay {
  align-items: center;
  padding: 1rem;
}

.sheet-card {
  max-width: 420px;
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.5rem;
  animation: sheet-up 0.2s ease-out;
}

@keyframes sheet-up {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sheet-header h3 {
  margin: 0;
  font-size: 1rem;
}

.sheet-cancel {
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  width: 42px;
  text-align: left;
}

.sheet-header-spacer {
  width: 42px;
}

.sheet-description {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.sheet-card input[type="text"] {
  margin-top: 0;
  margin-bottom: 0.75rem;
  border-radius: 10px;
}

.sheet-select-field {
  position: relative;
  margin-bottom: 0.75rem;
}

.sheet-select-field i,
.sheet-select-field svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.sheet-select-field select {
  margin-top: 0;
  padding-left: 2.5rem;
  border-radius: 10px;
}

.sheet-card .color-picker {
  margin-bottom: 0.75rem;
}

.photo-source-options {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  margin: 0.25rem 0 0.5rem;
}

.photo-source-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex: 1;
  aspect-ratio: 1 / 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.photo-source-option:hover {
  border-color: var(--accent);
  background: rgba(31, 163, 90, 0.06);
}

.photo-source-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(31, 163, 90, 0.12);
  color: var(--accent);
  flex-shrink: 0;
}

.photo-source-icon i,
.photo-source-icon svg {
  width: 18px;
  height: 18px;
}

.sheet-submit {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
}

.sheet-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.post-submit {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .post-detail {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .topbar nav {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    width: 100%;
  }

  .nav-user {
    display: none;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .container {
    padding: 1.25rem 1rem 3rem;
  }

  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form .input-icon {
    min-width: 0;
  }

  .pagination {
    gap: 1rem;
  }
}

/* Brand pages: landing (logged-out visitors — see web.gallery), plus
   login/signup, which share the same "always light" gradient hero
   treatment so the whole logged-out experience feels like one system
   instead of the marketing page looking different from the forms a
   visitor lands on next. */

.brand-main {
  max-width: none;
  margin: 0;
  padding: 0;
}

.brand-hero {
  /* These vars duplicate :root's values — kept scoped here since the
     gradient below needs two fully OPAQUE color stops, not an alpha-
     transparent green fading to a solid color (a partially transparent
     first stop lets whatever's behind this element show through at that
     point, which caused a "black gradient" before this was opaque). */
  color-scheme: light;
  --landing-bg: #f5f6f8;
  --landing-surface: #ffffff;
  --landing-text: #1f2b24;
  --landing-muted: #6b7280;
  --landing-border: #e7e9ed;
  --landing-accent: #1fa35a;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem 4rem;
  color: var(--landing-text);
  background: linear-gradient(180deg, #e0eee8 0%, var(--landing-bg) 65%);
}

.landing-badge {
  width: 64px;
  height: 64px;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(31, 163, 90, 0.12);
  color: var(--landing-accent);
}

.landing-badge-inner {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--landing-surface);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.1);
}

.landing-badge-inner i,
.landing-badge-inner img {
  width: 22px;
  height: 22px;
}

.landing-wordmark {
  margin: 0 0 1.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--landing-muted);
}

.landing-hero h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
}

.landing-hero h1 .accent {
  display: block;
  color: var(--landing-accent);
}

.landing-subtitle {
  max-width: 460px;
  margin: 0 0 2rem;
  color: var(--landing-muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  background: var(--landing-accent);
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.landing-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.16);
}

.landing-cta i {
  width: 16px;
  height: 16px;
  color: #ffffff;
}

.landing-link-button {
  background: none;
  border: none;
  padding: 0.4rem 0.25rem;
  color: var(--landing-accent);
  font-size: 0.9rem;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.landing-mini-divider {
  width: 40px;
  height: 1px;
  background: var(--landing-border);
  margin: 1.5rem auto 0;
}

.landing-switch {
  margin: 1.1rem 0 0;
  font-size: 0.9rem;
  color: var(--landing-muted);
}

.landing-beta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.5rem;
}

/* .button/.button.outline default to the app's global theme variables
   (--accent, --text, ...), which follow dark mode — override to the
   brand pages' fixed local variables instead, same reasoning as every
   other .landing- or .brand- prefixed rule: these pages never switch to
   a dark palette. */
.brand-hero .button {
  background: var(--landing-accent);
  color: #ffffff;
}

.brand-hero .button.outline {
  background: var(--landing-surface);
  color: var(--landing-text);
  border-color: var(--landing-border);
}

/* The install-instructions modal is nested inside .brand-hero (for the
   --landing-* custom property inheritance below) but .modal-card itself
   reads the app's global --surface, which still follows dark mode. */
.brand-hero .modal-card {
  background: var(--landing-surface);
  color: var(--landing-text);
  text-align: left;
}

/* login/signup: .auth-card and its form controls default to the app's
   global theme vars (--surface, --border, --muted, --text, --danger, ...),
   which follow dark mode — override to the brand pages' fixed local
   variables, same reasoning as every other .brand-hero rule above. */
.brand-hero .auth-card {
  margin: 1.5rem 0 0;
  background: var(--landing-surface);
  border-color: var(--landing-border);
}

.brand-hero .auth-subtitle,
.brand-hero .auth-switch,
.brand-hero label {
  color: var(--landing-muted);
}

.brand-hero .auth-submit {
  border-radius: 999px;
}

.brand-hero .error {
  background: rgba(214, 69, 69, 0.12);
  color: #d64545;
}

.brand-hero input,
.brand-hero textarea,
.brand-hero select {
  border-color: var(--landing-border);
  background: var(--landing-bg);
  color: var(--landing-text);
}

.brand-hero input:focus,
.brand-hero textarea:focus,
.brand-hero select:focus {
  border-color: var(--landing-accent);
}

.brand-hero .input-icon-glyph,
.brand-hero .password-toggle {
  color: var(--landing-muted);
}

.brand-hero .password-toggle:hover {
  color: var(--landing-text);
}

.brand-hero .auth-back-btn {
  color: var(--landing-muted);
}

.brand-hero .auth-back-btn:hover {
  color: var(--landing-text);
}

.landing-beta-modal h3 {
  font-size: 1.15rem;
}

.landing-beta-modal ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.landing-beta-modal li + li {
  margin-top: 0.5rem;
}

.landing-beta-modal a {
  color: var(--landing-accent);
  text-decoration: underline;
}

.landing-beta-note {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--landing-muted);
}
