/* Explicit hidden attribute rule — do not rely on browser default stylesheet */
[hidden] { display: none !important; }

/* ===== Custom properties ===== */
:root {
  --green: #2d5a27;
  --green-hover: #256020;
  --parchment: #f5f0e0;
  --parchment-border: #e0d8c0;
  --text-dark: #2a2010;
  --text-muted: #7a6a40;
  --card-radius: 8px;
}

/* ===== Reset ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  background: var(--parchment);
}

/* ===== Shared components ===== */
.btn-primary {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--green-hover); }

.btn-ghost {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.65);
  padding: 6px 12px;
  font-size: 0.8em;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.field-label {
  display: block;
  font-size: 0.7em;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 14px;
  margin-bottom: 5px;
}

.field-input {
  width: 100%;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--parchment-border);
  border-radius: 6px;
  font-size: 0.9em;
  color: var(--text-dark);
}
.field-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(45, 90, 39, 0.25);
}

.error-msg {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(200, 50, 50, 0.1);
  border: 1px solid rgba(200, 50, 50, 0.2);
  border-radius: 6px;
  color: #c03030;
  font-size: 0.85em;
}

/* ===== Login page ===== */
.login-page {
  min-height: 100vh;
  background: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo {
  width: 400px;
  height: 400px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-title {
  font-size: 1.6em;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.login-tagline {
  font-size: 0.7em;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.login-form { width: 100%; }

.login-submit {
  width: 100%;
  margin-top: 20px;
}

/* ===== App page layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--green);
  display: flex;
  flex-direction: column;
  padding: 20px 16px 16px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  justify-content: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 16px;
}
.sidebar-logo img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  object-fit: contain;
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
}

.sidebar-email {
  font-size: 0.7em;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Content area */
.content {
  flex: 1;
  margin-left: 200px;
  background: var(--parchment);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-header {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--parchment-border);
  flex-shrink: 0;
}

.content-title {
  font-size: 1em;
  font-weight: 700;
  color: var(--text-dark);
}

/* ===== Card grid ===== */
.session-grid {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-content: start;
}

/* Session card */
.session-card {
  aspect-ratio: 1;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  background: #e8dcc8;
  cursor: pointer;
  transition: opacity 0.15s;
}
.session-card:hover { opacity: 0.88; }

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: #f0e8d0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  opacity: 0.3;
}

.card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  color: #fff;
  font-size: 0.68em;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(3px);
}
.card-badge.active { background: rgba(42, 100, 36, 0.85); }
.card-badge.closed { background: rgba(70, 60, 40, 0.78); }
.card-badge.draft  { background: rgba(110, 95, 20, 0.82); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-dot.active { background: #7de87d; }
.badge-dot.closed { background: #bbb; }
.badge-dot.draft  { background: #e8e060; }

.card-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(245, 240, 224, 0.92);
  font-size: 0.8em;
  padding: 6px 8px;
  color: var(--text-dark);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 0.9em;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
}

@media (max-width: 600px) {
  .session-grid { grid-template-columns: 1fr; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .session-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Session detail header ===== */
.session-header {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--parchment-border);
  flex-shrink: 0;
  background: var(--parchment);
}

.breadcrumb {
  color: var(--green);
  text-decoration: none;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
}
.breadcrumb:hover { text-decoration: underline; }

.session-header-sep {
  color: var(--parchment-border);
  font-size: 1.2em;
}

.session-title {
  font-weight: 700;
  color: var(--text-dark);
  flex: 1;
  font-size: 0.95em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.btn-ghost-dark {
  background: transparent;
  border: 1px solid var(--parchment-border);
  border-radius: 5px;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.82em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost-dark:hover { background: rgba(0,0,0,0.04); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text-dark); background: rgba(0,0,0,0.05); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--parchment-border);
  border-radius: 5px;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 0.82em;
  cursor: pointer;
}
.btn-outline:hover { background: rgba(0,0,0,0.04); }
.btn-danger {
  background: #c03030;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #a02828; }

/* ===== Upload progress bar ===== */
.upload-progress {
  padding: 6px 24px;
  background: #fff;
  border-bottom: 1px solid var(--parchment-border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.upload-progress-track {
  flex: 1;
  height: 4px;
  background: var(--parchment-border);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.2s;
}

.upload-progress-text {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Image grid and drop zone ===== */
.image-grid {
  flex: 1;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  overflow-y: auto;
  position: relative;
}

/* ===== Image tile ===== */
.img-tile {
  height: 140px;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #e8dcc8;
  cursor: grab;
}
.img-tile:active { cursor: grabbing; }

.img-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-tile-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #b0a080;
  font-size: 0.72em;
}

.img-tile-placeholder svg {
  opacity: 0.5;
}

/* Hover overlay */
.img-tile-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.15s;
  border-radius: 5px;
}
.img-tile:hover .img-tile-overlay { background: rgba(0,0,0,0.32); }
.img-tile:hover .img-tile-actions { opacity: 1; }
.img-tile:hover .img-tile-drag { opacity: 1; }

.img-tile-drag {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 26px;
  height: 26px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: grab;
}

.img-tile-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.img-tile-btn {
  width: 26px;
  height: 26px;
  background: rgba(0,0,0,0.3);
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
}
.img-tile-btn:hover { background: rgba(0,0,0,0.5); }
.img-tile-btn.delete:hover { background: rgba(180,40,40,0.6); }

/* Rename popover */
.rename-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid var(--parchment-border);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 100;
  width: 200px;
}

.rename-popover input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--parchment-border);
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.rename-popover input:focus {
  outline: none;
  border-color: var(--green);
}

.rename-popover-actions {
  display: flex;
  gap: 5px;
}

/* Delete confirm overlay on tile */
.img-tile-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 5px;
}

.img-tile-confirm p {
  color: #fff;
  font-size: 0.75em;
  font-weight: 600;
}

.img-tile-confirm-btns {
  display: flex;
  gap: 5px;
}

.img-tile-confirm-btns button {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75em;
  cursor: pointer;
  border: none;
}

.img-tile-confirm-btns .yes {
  background: rgba(180,40,40,0.85);
  color: #fff;
}

.img-tile-confirm-btns .no {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}

/* SortableJS ghost + chosen */
.sortable-ghost { opacity: 0.38; border: 2px dashed var(--green); }
.sortable-chosen { box-shadow: 0 0 0 2px var(--green); }

/* Drop overlay */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(45,90,39,0.1);
  border: 3px dashed var(--green);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--green);
  z-index: 50;
  pointer-events: none;
}

.drop-overlay-label {
  font-size: 1em;
  font-weight: 700;
}

.drop-overlay-sub {
  font-size: 0.78em;
  color: var(--text-muted);
}

/* ===== Settings modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42,32,16,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--parchment-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 0.95em;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.modal-body {
  padding: 16px 18px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--parchment-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Picker (voting style / theme) */
.picker-row {
  display: flex;
  gap: 8px;
}

.picker-option {
  flex: 1;
  border: 2px solid var(--parchment-border);
  border-radius: 7px;
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--text-muted);
  transition: border-color 0.1s, background 0.1s;
}
.picker-option.selected {
  border-color: var(--green);
  background: rgba(45,90,39,0.06);
  color: var(--green);
}
.picker-option.selected svg { stroke: var(--green); }

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  margin-top: 8px;
  border-top: 1px solid #f0e8d4;
}

.toggle-label {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-dark);
}

.toggle-sub {
  font-size: 0.72em;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle-btn {
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: var(--parchment-border);
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-btn::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-btn[aria-checked="true"] {
  background: var(--green);
}
.toggle-btn[aria-checked="true"]::after {
  transform: translateX(16px);
}

/* Share modal add row + list */
.share-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.share-add-row .field-input {
  flex: 1;
}

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--parchment-border);
}

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

.share-row-name {
  font-size: 0.9em;
  font-weight: 500;
}

.share-row-copy {
  padding: 4px 12px;
  font-size: 0.82em;
  white-space: nowrap;
}

/* ===== Session tabs ===== */
.session-tabs {
  padding: 0 24px;
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--parchment-border);
  flex-shrink: 0;
  background: var(--parchment);
}

.session-tab {
  padding: 10px 20px;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.session-tab:hover { color: var(--text-dark); }
.session-tab.active {
  color: var(--text-dark);
  font-weight: 600;
  border-bottom-color: var(--green);
}
