:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --ink: #1a2e24;
  --muted: #5a6f64;
  --line: #d7e3db;
  --brand: #0d5c3d;
  --brand-dark: #08452d;
  --brand-soft: #e8f3ed;
  --accent: #c9a227;
  --danger: #b42318;
  --ok: #0f7a45;
  --shadow: 0 10px 30px rgba(13, 92, 61, 0.08);
  --radius: 14px;
  --font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --drawer-w: min(420px, 100vw);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

body {
  background:
    radial-gradient(circle at top left, rgba(201, 162, 39, 0.12), transparent 40%),
    radial-gradient(circle at top right, rgba(13, 92, 61, 0.1), transparent 35%),
    var(--bg);
}

body.drawer-open {
  overflow: hidden;
}

/* display:flex/grid kuralları [hidden] özniteliğini ezmesin */
.app[hidden],
.gate[hidden],
.sync-banner[hidden],
.drawer[hidden],
.drawer-backdrop[hidden],
#contact-filter-wrap[hidden],
#lcv-filter-wrap[hidden],
#lcv-summary[hidden],
#empty[hidden],
#gate-error[hidden],
#drawer-msg[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13, 92, 61, 0.25);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

#gate-form .btn-primary {
  width: 100%;
}

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  white-space: nowrap;
}

.btn-outline:hover {
  background: var(--brand-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.65rem;
  font-size: 1.1rem;
}

.btn-ghost:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* Gate */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gate-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem 1.75rem;
  text-align: center;
}

.crest {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), #167a52);
  border: 3px solid var(--accent);
}

.gate-card h1 {
  margin: 0;
  font-size: 1.45rem;
}

.gate-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 600;
}

.gate-date {
  margin: 0.25rem 0 1.5rem;
  color: var(--brand);
  font-weight: 700;
}

#gate-form {
  display: grid;
  gap: 0.55rem;
  text-align: left;
}

#gate-form label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

#gate-form input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

#gate-form input:focus {
  outline: 2px solid rgba(13, 92, 61, 0.25);
  border-color: var(--brand);
}

.error {
  margin: 0.25rem 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
}

/* Sync banner */
.sync-banner {
  background: #fff7e6;
  color: #7a4d00;
  border-bottom: 1px solid #f0d9a0;
  padding: 0.7rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}

.sync-banner a {
  color: var(--brand-dark);
  font-weight: 700;
}

/* App shell */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: linear-gradient(120deg, var(--brand-dark), var(--brand));
  color: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.45rem);
  line-height: 1.3;
}

.subtitle {
  margin: 0.25rem 0 0;
  opacity: 0.9;
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secretary-field {
  display: grid;
  gap: 0.2rem;
  min-width: 140px;
}

.secretary-field label {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.secretary-field input {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  min-width: 140px;
}

.secretary-field input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.secretary-field input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  border-color: #fff;
}

.sync-status {
  align-self: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

.sync-status.is-live {
  background: rgba(15, 122, 69, 0.35);
  border-color: rgba(180, 255, 210, 0.55);
}

.topbar .btn-outline {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
}

.topbar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.35rem;
  max-width: 1200px;
  width: 100%;
  margin: 0.85rem auto 0;
  padding: 0 1.25rem;
}

.tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.tab:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.main {
  flex: 1;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  min-width: 180px;
}

.field.grow {
  flex: 1 1 240px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(13, 92, 61, 0.2);
  border-color: var(--brand);
}

.count-box {
  min-width: 88px;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  text-align: center;
  line-height: 1.15;
}

.count-box span {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
}

.count-box small {
  color: var(--muted);
  font-weight: 600;
}

.lcv-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
}

.chip strong {
  font-weight: 800;
  margin-right: 0.2rem;
}

.chip-pending {
  background: #f3f4f6;
}
.chip-coming {
  background: #e7f8ee;
  border-color: #b7e4c7;
}
.chip-not-coming {
  background: #fdecec;
  border-color: #f0c2c2;
}
.chip-maybe {
  background: #fff7e6;
  border-color: #f0d9a0;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

thead th {
  position: sticky;
  top: 0;
  background: #edf5f0;
  color: var(--brand-dark);
  text-align: left;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}

tbody td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid #eef3f0;
  vertical-align: middle;
  font-size: 0.95rem;
}

tbody tr:hover {
  background: #f7fbf8;
}

tbody tr.row-clickable {
  cursor: pointer;
}

tbody tr.row-clickable:focus {
  outline: 2px solid rgba(13, 92, 61, 0.35);
  outline-offset: -2px;
}

tbody tr:last-child td {
  border-bottom: none;
}

.cat-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-contact-none,
.status-lcv-pending {
  background: #f3f4f6;
  color: #4b5563;
}

.status-contact-will_contact {
  background: #fff7e6;
  color: #7a4d00;
}

.status-contact-contacted {
  background: #e7f8ee;
  color: #0f7a45;
}

.status-lcv-coming {
  background: #e7f8ee;
  color: #0f7a45;
}

.status-lcv-not_coming {
  background: #fdecec;
  color: #b42318;
}

.status-lcv-maybe {
  background: #fff7e6;
  color: #7a4d00;
}

.lcv-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.lcv-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.28rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
}

.lcv-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.lcv-btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

a.mail,
a.phone {
  color: var(--brand);
  text-decoration: none;
  word-break: break-all;
}

a.mail:hover,
a.phone:hover {
  text-decoration: underline;
}

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

.empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 1.5rem;
}

.footer p {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: #eef4f0;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.col-photo {
  width: 52px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.avatar-lg {
  width: 56px;
  height: 56px;
}

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

.avatar-fallback {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.02em;
}

.avatar-lg.avatar-fallback {
  font-size: 0.95rem;
}

.party-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}

.party-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.party-text {
  display: inline-block;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 20, 0.35);
  z-index: 40;
}

.drawer-backdrop[hidden],
.drawer[hidden] {
  display: none !important;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--drawer-w);
  height: 100vh;
  background: var(--surface);
  z-index: 50;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.drawer-head-main {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.drawer-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.drawer-body {
  padding: 1rem 1.1rem 1.5rem;
  display: grid;
  gap: 0.9rem;
}

.status-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
}

.status-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.radio-pill:has(input:checked) {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}

.drawer-updated {
  margin: 0;
  font-size: 0.85rem;
}

.drawer-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.drawer-actions .btn-primary {
  width: auto;
  min-width: 120px;
}

.drawer-msg {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.drawer-msg.is-ok {
  color: var(--ok);
}

.drawer-msg.is-err {
  color: var(--danger);
}

@media (max-width: 720px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .secretary-field {
    flex: 1;
  }

  .secretary-field input {
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .count-box {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }
}
