:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #2a2420;
  --muted: #7d726a;
  --line: #e7e0d6;
  --accent: #a07d4a;
  --accent-soft: #f2eadc;
  --danger: #b23b3b;
  --ok: #3f7d4f;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Jost", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(246, 243, 238, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.brand em { color: var(--accent); font-style: normal; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 120px;
}

h1, h2, h3 { font-family: "Cormorant Garamond", serif; font-weight: 600; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head p { margin: 2px 0 0; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

label.field { display: block; }
label.field > span {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="date"], input[type="url"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }

.prefix-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.prefix-input span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: .85rem;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prefix-input input { border: 0; border-radius: 0; min-width: 0; }
.prefix-input input:focus { box-shadow: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 13px; font-size: .88rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: #e3f0e6; color: var(--ok); }
.badge.warn { background: #fbeaea; color: var(--danger); }

/* Giriş */
.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login form { width: 100%; max-width: 360px; text-align: center; }
.login h1 { margin-bottom: 4px; }
.login .field { text-align: left; margin: 24px 0 14px; }
.login .btn { width: 100%; }

/* Etkinlik listesi */
.events { display: grid; gap: 12px; }
.event-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.event-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--accent-soft) center / cover no-repeat;
  display: grid;
  place-items: center;
  font-family: "Great Vibes", cursive;
  font-size: 1.6rem;
  color: var(--accent);
}
.event-card h3 { font-size: 1.3rem; }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .85rem; color: var(--muted); margin: 2px 0 8px; }
.event-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 720px) {
  .event-card { grid-template-columns: 64px 1fr auto; }
  .event-actions { grid-column: auto; }
}

.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* Tema seçici */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.theme-option { position: relative; cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; }
.theme-swatch {
  display: block;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  transition: border-color .2s;
}
.theme-option input:checked + .theme-swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch .dots { display: flex; justify-content: center; gap: 4px; margin-bottom: 8px; }
.theme-swatch .dots i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); }
.theme-swatch b { font-weight: 500; font-size: .88rem; }

/* Görseller */
.cover-box {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 420px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--accent-soft) center / cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}
.cover-box.has-image { border-style: solid; color: transparent; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.media-item {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  overflow: hidden;
  background: var(--accent-soft);
}
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tools {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  padding: 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.media-tools button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.upload-tile {
  aspect-ratio: 4 / 5;
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--accent);
  cursor: pointer;
  font-size: .88rem;
  padding: 8px;
  background: var(--accent-soft);
}
.file-hidden { display: none; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 42px; height: 24px; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

.qr-wrap { display: grid; gap: 18px; align-items: center; grid-template-columns: 1fr; }
.qr-wrap img { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
@media (min-width: 640px) { .qr-wrap { grid-template-columns: 200px 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { padding: 14px; border-radius: 12px; background: var(--accent-soft); }
.stat b { display: block; font-size: 1.5rem; font-family: "Cormorant Garamond", serif; }
.uploader-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }

.savebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.savebar-inner { width: 100%; max-width: 980px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%) translateY(20px);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: var(--danger); }

dialog {
  border: 0;
  border-radius: 18px;
  padding: 24px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(30, 22, 16, .4); }
dialog form > * + * { margin-top: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Google hesapları */
.account-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.account-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 8px 8px 14px; border: 1px solid var(--line); border-radius: 12px; font-weight: 500; word-break: break-all;
}

/* Drive bölümü */
.drive-status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 16px; border-radius: 12px; background: #eef5f0; border: 1px solid #d4e6d9;
}
.drive-status.warn { background: #fbf0f0; border-color: #f0d6d6; }
.drive-status p { margin: 2px 0 0; }
.drive-quota { color: #8a6a2e; }
.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; min-width: 0; }
.drive-help { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); }
.drive-help summary { cursor: pointer; font-weight: 500; }
.drive-help .steps { padding-left: 18px; }
.share-emails { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.share-emails button {
  font: inherit; font-size: .85rem; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: #fff; color: var(--ink);
}

/* Tema mini önizlemeleri */
.theme-mini {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  height: 78px; margin-bottom: 8px; border-radius: 8px; background: var(--b); color: var(--i);
  border: 1px solid rgba(0,0,0,.06);
}
.theme-mini .mini-names { font-family: "Great Vibes", cursive; font-size: 1.35rem; line-height: 1; }
.theme-mini .mini-names i { font-family: "Cormorant Garamond", serif; color: var(--a); font-size: .7em; padding: 0 2px; }
.theme-mini .mini-line { width: 34px; height: 1px; background: var(--a); }
.theme-mini .mini-btn { width: 56px; height: 9px; border-radius: 9px; background: var(--a); }
.theme-mini .mini-card { width: 70%; height: 6px; border-radius: 6px; background: var(--s); }

/* Düzenleme sayfası + canlı önizleme */
.container.wide { max-width: 1280px; }
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; width: 300px; margin-bottom: 10px; }
.preview-pane .hint { width: 300px; text-align: center; }
.phone {
  width: 300px; height: 626px; border: 10px solid #1d1a18; border-radius: 42px; overflow: hidden;
  background: #1d1a18; box-shadow: 0 30px 60px -30px rgba(0,0,0,.45);
}
.phone iframe { width: 390px; height: 844px; border: 0; display: block; transform: scale(0.7179); transform-origin: 0 0; background: #fff; }
.preview-fab {
  position: fixed; right: 16px; bottom: 84px; z-index: 6;
  padding: 12px 20px; border: 0; border-radius: 999px; background: var(--ink); color: #fff;
  font: inherit; font-weight: 500; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); cursor: pointer;
}
@media (min-width: 1100px) {
  .edit-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .preview-pane { position: sticky; top: 76px; }
  .preview-fab, .preview-close { display: none !important; }
}
@media (max-width: 1099px) {
  .preview-pane {
    position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 16px; background: rgba(30, 22, 16, .7); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .preview-pane.open { opacity: 1; pointer-events: auto; }
  .preview-pane .preview-head, .preview-pane .hint { color: #fff; }
  .preview-close { background: #fff; }
}
@media (max-height: 820px) { .phone { zoom: .85; } }
@media (max-height: 680px) { .phone { zoom: .7; } }

.steps { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: .9rem; }
.steps li + li { margin-top: 4px; }
code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; font-size: .85em; word-break: break-all; }
