:root {
  --auth-card: #f6f3e6;
  --auth-shadow: 0 22px 60px rgba(0, 0, 0, 0.12);
}

.profile-shell {
  padding-top: 40px;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  align-items: start;
}

.auth-hero {
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 24px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}

.auth-hero h1 {
  color: #121110;
}

.security-list {
  display: grid;
  gap: 10px;
}

.security-list div {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
}

.security-list strong {
  display: block;
  color: #121110;
}

.auth-card {
  background: var(--auth-card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--auth-shadow);
  display: grid;
  gap: 18px;
}

.auth-card[hidden],
.profile-panel[hidden] {
  display: none !important;
}

body.signed-in #auth-hero {
  display: none !important;
}

.auth-tabs {
  display: flex;
  gap: 10px;
}

.tab {
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.04);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  color: #121110;
}

.tab.active {
  border-color: var(--accent);
  background: rgba(211, 165, 80, 0.12);
}

.auth-form {
  display: none;
  grid-template-columns: 1fr;
  gap: 14px;
}

.auth-form.active {
  display: grid;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #121110;
}

.auth-form label.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.auth-form input,
.auth-form textarea {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

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

.password-field input {
  flex: 1;
}

.password-field .toggle-password {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

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

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.auth-message {
  min-height: 22px;
  color: var(--danger);
  font-weight: 600;
}

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

.profile-panel {
  background: var(--auth-card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--auth-shadow);
  display: grid;
  gap: 18px;
}

.profile-main {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px;
  align-items: start;
}

.profile-preview {
  background: var(--auth-card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.preview-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.profile-preview-body {
  max-height: 72vh;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-header h2 {
  color: #121110;
}

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

.panel-grid label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #121110;
}

.panel-grid input,
.panel-grid textarea {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

.panel-grid .wide {
  grid-column: 1 / -1;
}

.panel-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(18, 17, 16, 0.9);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(211, 165, 80, 0.4);
  box-shadow: var(--auth-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 16, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  z-index: 70;
}

.preview-overlay.active {
  display: flex;
}

.signin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 16, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  z-index: 75;
}

.signin-overlay.active {
  display: flex;
}

.signin-modal {
  width: min(420px, 92vw);
  background: var(--auth-card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  box-shadow: var(--auth-shadow);
  padding: 22px;
  display: grid;
  gap: 12px;
}

.signin-modal h3 {
  margin: 0;
  color: #121110;
}

.signin-modal p {
  margin: 0;
  color: var(--muted);
}

.signin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-modal {
  width: min(860px, 92vw);
  max-height: 85vh;
  background: var(--auth-card);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  box-shadow: var(--auth-shadow);
  position: relative;
  overflow: hidden;
}

.preview-content {
  padding: 24px;
  display: grid;
  gap: 18px;
  max-height: 85vh;
  overflow-y: auto;
}

.preview-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.preview-photo {
  height: 320px;
  border-radius: 18px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--stroke);
}

.preview-summary h3 {
  margin: 0;
  color: #121110;
}

.preview-meta {
  color: var(--muted);
  margin: 6px 0 0;
}

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

.preview-tags span {
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 12px;
  color: #121110;
}

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

.preview-card {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.03);
}

.preview-card h4 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #121110;
}

.profile-editor {
  display: grid;
  gap: 22px;
}

.editor-section {
  display: grid;
  gap: 16px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.03);
}

.editor-section h3 {
  margin: 0;
  color: #121110;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.photo-tools {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.photo-slot {
  position: relative;
  border-radius: 14px;
  border: 1px dashed var(--stroke);
  background: rgba(0, 0, 0, 0.04);
  height: 140px;
  display: grid;
  place-items: center;
  color: #7b7468;
  font-size: 12px;
}

.photo-slot.has-photo {
  cursor: grab;
}

.photo-slot.dragging {
  opacity: 0.65;
  cursor: grabbing;
}

.photo-slot.drag-over {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(211, 165, 80, 0.12);
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.photo-slot .remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  cursor: pointer;
}

button.small {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .panel-header {
    flex-direction: column;
  }

  .profile-main {
    grid-template-columns: 1fr;
  }

  .profile-preview-body {
    max-height: 60vh;
  }
}
