:root {
  --bg: #f6f7f5; --card: #fff; --text: #1d2a22; --muted: #66756b; --line: #dde3df;
  --brand: #0b6623; --brand-2: #e6f2ea; --danger: #b42318; --warn: #b54708; --ok: #067647;
  --st-talep: #e4e7ec; --st-odeme: #fde68a; --st-avans: #bfdbfe; --st-onay: #86efac; --st-konak: #4ade80; --st-tamam: #d1d5db; --st-iptal: #fecaca; --ext: #c4b5fd;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 1.4rem; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 16px 0 8px; }
small, .hint { color: var(--muted); }
.hint { font-size: .9em; }

.top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: var(--brand); color: #fff; padding: 10px 16px; }
.top a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.top a.active, .top a:hover { background: rgba(255,255,255,.15); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top .count { background: #fff; color: var(--brand); border-radius: 999px; padding: 0 7px; font-size: .8em; font-weight: 700; margin-left: 2px; }
.work h2 .n { color: var(--muted); font-weight: 400; }
.top .who { display: flex; gap: 8px; align-items: center; font-size: .9em; }
.top .who .link { color: #fff; }

button, .btn { font: inherit; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--brand); }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; text-decoration: underline; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 100%; }
label { display: block; margin: 6px 0; }
label.radio { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar h1 { margin: 0; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.flash.ok { background: #ecfdf3; border: 1px solid #abefc6; }
.flash.hata { background: #fef3f2; border: 1px solid #fecdca; }
.flash ul { margin: 0; padding-left: 18px; }
.ok { color: var(--ok); } .warn { color: var(--warn); }
.empty { color: var(--muted); }
.copy { width: 100%; font-family: ui-monospace, monospace; }
.wide { width: 100%; }
pre.preview { white-space: pre-wrap; background: #f6f7f5; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: inherit; }
code { background: #f0f3f1; padding: 1px 4px; border-radius: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
.action { border-top: 1px solid var(--line); padding: 10px 0; margin: 0; }
.action p { margin: 0 0 6px; }
details.action summary { cursor: pointer; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.grid.narrow { max-width: 520px; grid-template-columns: 1fr; }
.grid > button, .grid > .hint { grid-column: 1 / -1; justify-self: start; }
fieldset { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 8px; padding-left: 24px; }
.villa-pick { list-style: none; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }

.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list th, .list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { background: #f0f3f1; font-weight: 600; font-size: .9em; }
.list tr.muted { color: var(--muted); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 12px; }
.tabs a { padding: 6px 10px; border-radius: 6px; text-decoration: none; border: 1px solid var(--line); background: #fff; }
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.counts { display: flex; gap: 16px; flex-wrap: wrap; margin: 0; }

.badge { font-size: .75rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.st-talep { background: var(--st-talep); }
.st-odeme-bekleniyor { background: var(--st-odeme); }
.st-avans-alindi { background: var(--st-avans); }
.st-onaylandi { background: var(--st-onay); }
.st-konaklamada { background: var(--st-konak); }
.st-tamamlandi { background: var(--st-tamam); }
.st-iptal, .st-reddedildi, .st-suresi-doldu { background: var(--st-iptal); }
.ext { background: var(--ext); }

.legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .85em; }
.legend .cell { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); }
.cal-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.cal { border-collapse: collapse; min-width: 100%; font-size: .85em; }
.cal th, .cal td { border: 1px solid var(--line); padding: 0; }
.cal thead th { padding: 4px; min-width: 56px; font-weight: 500; text-align: center; }
.cal thead th.we { background: #f6f7f5; }
.cal thead th.today { background: var(--brand-2); font-weight: 700; }
.cal th.room { text-align: left; padding: 4px 8px; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 1; font-weight: 500; }
.cal tr.villa th { text-align: left; padding: 6px 8px; background: #f0f3f1; position: sticky; left: 0; }
.cal td.cell { height: 28px; }
.cal td.cell a { display: block; height: 100%; padding: 4px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; max-width: 56px; }
.cal td.ext { font-size: .8em; padding: 4px; color: #3b0764; }

.tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.task { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.task header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.task p { margin: 6px 0; }
.task.pr-acil { border-left-color: var(--danger); }
.task.pr-yarin { border-left-color: var(--warn); }
.task.done { opacity: .7; border-left-color: var(--ok); }
.badge.pr-acil { background: #fee4e2; color: var(--danger); }
.badge.pr-yarin { background: #fef0c7; color: var(--warn); }
.badge.pr-normal { background: #eef2f6; }
button.big { width: 100%; padding: 12px; font-size: 1.05rem; }
h2.today-h { color: var(--brand); }

.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; margin-bottom: 8px; }
.channel { border: 1px solid var(--line); border-left: 6px solid var(--ok); border-radius: 10px; padding: 10px 12px; }
.channel.err { border-left-color: var(--danger); }
.channel.muted { border-left-color: var(--line); opacity: .75; }
.channel header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.channel p { margin: 6px 0; }
.channel .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge.ok-b { background: #dcfae6; color: var(--ok); }
details.help ol { padding-left: 20px; }

form.inline.wrap { flex-wrap: wrap; align-items: flex-end; }
input.n { width: 5.5em; }
form.rules fieldset { margin: 0 0 12px; padding: 8px 12px; }
form.rules legend { font-weight: 600; padding: 0 4px; }
form.rules label.radio { flex-wrap: wrap; }
.quote { margin-top: 12px; }
dl.sum { margin-top: 10px; max-width: 520px; }
dl.sum dd { text-align: right; }

.auth { max-width: 380px; margin: 10vh auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.auth h1 { font-size: 1.2rem; }
.auth input { width: 100%; }
.auth button { width: 100%; margin-top: 8px; background: var(--brand); color: #fff; border-color: var(--brand); }
.history { margin: 0; padding-left: 18px; }
.history li { margin: 4px 0; }
.history time { color: var(--muted); }

/* ---- Telefon ---- */
@media (max-width: 700px) {
  main { padding: 10px; }
  h1 { font-size: 1.2rem; }

  /* Üst çubuk: 1. satır marka + kullanıcı, 2. satır yana kaydırılabilen tek satır menü */
  .top { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 10px 0; }
  .top .brand { font-size: .95rem; align-self: center; }
  .top .who { grid-column: 2; grid-row: 1; font-size: .8rem; }
  .top .who span { display: none; }
  .top nav { grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 6px; }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a { white-space: nowrap; flex: 0 0 auto; padding: 8px 10px; }

  /* Dokunma hedefleri ve iOS'ta odaklanınca yakınlaştırmayı önlemek için 16px yazı */
  input, select, textarea, button, .btn { font-size: 16px; }
  button, .btn { min-height: 40px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }

  /* Tablolar kart olur; her hücre başlığını yanında gösterir */
  .list { border: 0; background: none; }
  .list thead { display: none; }
  .list tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 4px 0; }
  .list td { display: block; border: 0; padding: 4px 10px; }
  .list td[data-label] { display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: right; }
  .list td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85em; text-align: left; flex: 0 0 auto; }
  .list td[data-label=""]::before { content: none; }
  .list td.na { display: none; }
  .work .empty-sections { color: var(--muted); font-size: .9em; }

  .toolbar > div { display: flex; gap: 6px; flex-wrap: wrap; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs a { white-space: nowrap; }
  .cal thead th { min-width: 46px; }
  .cal td.cell a { max-width: 46px; }
  .card { padding: 10px 12px; }
  dl { grid-template-columns: 1fr; gap: 0 0; }
  dt { margin-top: 6px; font-size: .85em; }
  .rooms { padding-left: 0; grid-template-columns: 1fr 1fr; }
  form.inline { flex-wrap: wrap; }
  .tasks { grid-template-columns: 1fr; }
  /* Form alanları etiketin altında, tam genişlikte */
  form:not(.inline) label:not(.radio) > :is(input, select, textarea) { display: block; width: 100%; margin-top: 4px; }
  label.radio select { width: 100%; }
  /* İşaret kutusu açıklamasının yanında kalsın; uzun açıklama kendi içinde satır atlar */
  label.radio:has(> input[type="checkbox"]) { flex-wrap: nowrap; align-items: flex-start; }
  label.radio > input[type="checkbox"] { flex: 0 0 auto; margin-top: 2px; }
  /* Fiyat kuralları: cümle içindeki sayı kutuları satırda aksın */
  form.rules label.radio:has(> input[type="checkbox"]) { display: block; line-height: 2.4; }
  form.rules label.radio > input[type="checkbox"] { vertical-align: middle; margin: 0 6px 0 0; }
  form.rules:not(.inline) label:not(.x) > input.n { display: inline-block; width: 5em; margin: 0 4px; }
}
