:root {
  --bg: #0e0a0a;
  --surface: #181112;
  --surface-2: #221819;
  --border: #36282a;
  --border-strong: #4a3638;
  --text: #f2eae6;
  --muted: #a6948e;
  --red: #c8323c;
  --red-hover: #dd4049;
  --gold: #d8ad55;
  --danger: #e2545c;
  --success: #5fbf74;
  --radius: 12px;

  --warrior: #e8664f;
  --rogue: #5fc06c;
  --mage: #5b8eef;
  --priest: #e9c85c;
  --kurian: #b37fe2;

  --t-genel: #c8b9a8;
  --t-toplanti: #6aa0f0;
  --t-etkinlik: #5fc06c;
  --t-drop: #e2a843;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(200, 50, 60, .18), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 { margin: 0; font-family: Cinzel, Georgia, serif; letter-spacing: .02em; }
h1 { font-size: 28px; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 10, 10, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: Cinzel, serif; font-weight: 700; font-size: 20px; }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.main-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main-nav a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--red); }
.auth { display: flex; align-items: center; gap: 8px; }
.auth form { margin: 0; }
.admin-pill { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); border: 1px solid rgba(216, 173, 85, .4); padding: 3px 8px; border-radius: 999px; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; }

/* ---------- Common ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; color: var(--text); background: var(--surface-2);
  transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--red); }
.btn-primary:hover { background: var(--red-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: rgba(226, 84, 92, .45); color: var(--danger); }
.btn-danger:hover { background: rgba(226, 84, 92, .12); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; border: 1px solid; }
.flash-success { background: rgba(95, 191, 116, .1); border-color: rgba(95, 191, 116, .4); color: #a6e3b3; }
.flash-error { background: rgba(226, 84, 92, .1); border-color: rgba(226, 84, 92, .45); color: #f3a9ad; }

.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty p { margin: 4px 0; }
.empty h1 { margin-bottom: 8px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
input[type=text], input[type=password], input[type=search], input[type=datetime-local], select, textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 9px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 173, 85, .15); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); font-weight: 600; font-size: 14px; }
.seg input:checked + span { color: var(--bg); border-color: transparent; }
.seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.seg.type-genel input:checked + span { background: var(--t-genel); }
.seg.type-toplanti input:checked + span { background: var(--t-toplanti); }
.seg.type-etkinlik input:checked + span { background: var(--t-etkinlik); }
.seg.type-drop input:checked + span { background: var(--t-drop); }

.attendee-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.attendee-tools input { flex: 1 1 180px; width: auto; }
.attendee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; max-height: 280px; overflow-y: auto; padding: 2px; }
.attendee { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--bg); }
.attendee:hover { border-color: var(--border-strong); }
.attendee:has(input:checked) { border-color: var(--t-drop); background: rgba(226, 168, 67, .1); }
.attendee input { accent-color: var(--t-drop); margin: 0; }
.attendee-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendee[hidden] { display: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 14px; font-weight: 500; }
.tabs a:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--red); background: rgba(200, 50, 60, .12); }
.count { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-variant-numeric: tabular-nums; }

/* ---------- Announcements ---------- */
.composer { margin-bottom: 22px; }
.composer summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
.composer summary::-webkit-details-marker { display: none; }
.composer[open] summary { margin-bottom: 16px; }
.plus { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--red); font-size: 18px; line-height: 1; transition: transform .2s; }
.composer[open] .plus { transform: rotate(45deg); }

.ann-list { display: flex; flex-direction: column; gap: 14px; }
.ann { position: relative; border-left: 3px solid var(--t-genel); }
.ann.type-toplanti { border-left-color: var(--t-toplanti); }
.ann.type-etkinlik { border-left-color: var(--t-etkinlik); }
.ann.type-drop { border-left-color: var(--t-drop); }
.ann-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.ann-title { font-size: 20px; margin-bottom: 10px; overflow-wrap: anywhere; }
.ann-content { margin: 12px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; color: var(--bg); }
.badge-genel { background: var(--t-genel); }
.badge-toplanti { background: var(--t-toplanti); }
.badge-etkinlik { background: var(--t-etkinlik); }
.badge-drop { background: var(--t-drop); }

.event-when { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-weight: 500; flex-wrap: wrap; }
.when-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; }
.event-when.upcoming .when-label { background: rgba(95, 191, 116, .18); color: var(--success); }
.event-when.past { color: var(--muted); }
.event-when.past .when-label { background: var(--border); color: var(--muted); }

.drop-item { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.drop-item strong { font-size: 17px; color: var(--t-drop); }
.drop-attendees { display: flex; flex-direction: column; gap: 8px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.chip-left { opacity: .55; text-decoration: line-through; }

.ann-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ann-actions form { margin: 0; }

/* ---------- Jobs ---------- */
.job-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.job-dot.job-warrior, .job-badge.job-warrior { --job: var(--warrior); }
.job-dot.job-rogue, .job-badge.job-rogue { --job: var(--rogue); }
.job-dot.job-mage, .job-badge.job-mage { --job: var(--mage); }
.job-dot.job-priest, .job-badge.job-priest { --job: var(--priest); }
.job-dot.job-kurian, .job-badge.job-kurian { --job: var(--kurian); }
.job-dot { background: var(--job, var(--muted)); }
.job-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: var(--job); border: 1px solid color-mix(in srgb, var(--job) 45%, transparent); background: color-mix(in srgb, var(--job) 12%, transparent); white-space: nowrap; }

/* ---------- Members ---------- */
.member-add { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; }
.member-add .field { margin: 0; }
.member-add .grow { flex: 1 1 220px; }
.member-add select { min-width: 140px; }

.member-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.member { padding: 14px 16px; }
.member-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.member-name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-edit { margin-top: 10px; }
.member-edit summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.member-edit[open] summary { margin-bottom: 10px; }
.member-edit form { display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px; }
.member-edit .btn { width: 100%; }

/* ---------- Backup ---------- */
.auth .btn.active { background: var(--surface-2); }
.backup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card-title { font-size: 18px; margin-bottom: 6px; }
.card-title ~ p { margin: 0 0 14px; }
.warn { color: var(--danger); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .92em; }
.restore-form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.restore-form input[type=file] { color: var(--muted); max-width: 100%; }
.restore-form input[type=file]::file-selector-button { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
.backup-list { list-style: none; margin: 0; padding: 0; }
.backup-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.backup-list li span:first-child { flex: 1; }

/* ---------- Login ---------- */
.login-wrap { display: grid; place-items: center; padding: 24px 0; }
.login-card { width: 100%; max-width: 380px; padding: 28px; text-align: center; }
.login-card .field { text-align: left; }
.login-card h1 { font-size: 24px; margin-top: 8px; }
.login-card p { margin: 4px 0 20px; }
.login-logo { display: block; margin: 0 auto; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .header-inner { gap: 10px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .brand span { display: none; }
  .main-nav a { padding: 7px 10px; }
  .card { padding: 15px; }
  .ann-title { font-size: 18px; }
  .ann-head { flex-wrap: wrap; }
  .member-add .btn { width: 100%; }
}
