/* HD Dijital Ofis — arayüz */
:root {
  --bg: #f5f0e8;
  --surface: #ffffff;
  --ink: #2a2521;
  --muted: #6f655c;
  --line: #e4dbcf;
  --gold: #b69b68;
  --gold-dark: #8c7448;
  --navy: #1f2838;
  --ok: #3f7d58;
  --ok-bg: #e6f2ea;
  --warn: #9a6a12;
  --warn-bg: #fbf0da;
  --bad: #a33a32;
  --bad-bg: #f8e4e1;
  --info-bg: #eaeef6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 37, 33, .06), 0 6px 20px rgba(42, 37, 33, .06);
  --c: var(--gold);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.boot { padding: 80px 20px; text-align: center; color: var(--muted); }

/* ---------- Üst çubuk ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1240px; margin: 0 auto; padding: 8px 18px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand img.hd { height: 34px; width: auto; }
.brand img.dz { height: 28px; width: auto; }
.brand span { font-weight: 700; color: var(--navy); letter-spacing: .2px; white-space: nowrap; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px; text-decoration: none;
  color: var(--ink); white-space: nowrap; font-weight: 500;
}
.nav a:hover { background: var(--bg); }
.nav a.on { background: var(--navy); color: #fff; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--bad); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge.soft { background: var(--gold); }
.logout { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; flex: none; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 18px 60px; }
h1 { font-size: 26px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 19px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 16px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ---------- Ortak bileşenler ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 9px 15px; border-radius: 10px; cursor: pointer; font-weight: 600;
  text-decoration: none; color: var(--ink); line-height: 1.2;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #2c3850; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input + .row, textarea + .row, select + .row, table + .row { margin-top: 10px; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stack > * + * { margin-top: 14px; }

label.f { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: #fffdf9; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(182, 155, 104, .18); }
textarea { resize: vertical; min-height: 90px; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--info-bg); color: var(--navy); white-space: nowrap;
}
.pill.awaiting, .pill.oneri, .pill.talep, .pill.taslak { background: var(--warn-bg); color: var(--warn); }
.pill.approved, .pill.onayli, .pill.onaylandi { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--bad-bg); color: var(--bad); }

.note { border-radius: 10px; padding: 10px 14px; font-size: 14.5px; }
.note.warn { background: var(--warn-bg); color: #5d430c; }
.note.bad { background: var(--bad-bg); color: #6d201b; }
.note.ok { background: var(--ok-bg); color: #24513a; }
.note.info { background: var(--info-bg); color: #26324a; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 100; max-width: min(92vw, 560px);
}
.toast.bad { background: var(--bad); }

/* ---------- Giriş ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(420px, 100%); text-align: center; }
.login .logos { display: flex; justify-content: center; align-items: center; gap: 16px; margin-bottom: 14px; }
.login .logos img { height: 40px; width: auto; }
.login form { text-align: left; margin-top: 16px; }
.login .btn { width: 100%; margin-top: 12px; }

/* ---------- Ofis ---------- */
.scene { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #ddd; }
.scene img { width: 100%; height: auto; }
.spot {
  position: absolute; width: 9%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 0; background: transparent; cursor: pointer; padding: 0;
}
.spot::after {
  content: attr(data-name); position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -4px);
  background: var(--navy); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 8px;
  white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none;
}
.spot:hover, .spot:focus-visible { box-shadow: 0 0 0 3px var(--c), 0 0 0 6px rgba(255, 255, 255, .6); outline: none; }
.spot:hover::after, .spot:focus-visible::after { opacity: 1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 26px; color: var(--navy); line-height: 1.2; }
.stat span { color: var(--muted); font-size: 14px; }
.stat.hot b { color: var(--bad); }
.quick textarea { min-height: 70px; }

.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.member {
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit;
  border-left: 4px solid var(--c);
}
.member img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.member b { display: block; }
.member span { font-size: 13px; color: var(--muted); line-height: 1.3; display: block; }

/* ---------- Ajan sayfası ---------- */
.agent-page { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.profile { position: sticky; top: 80px; border-top: 5px solid var(--c); }
.profile .portrait { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--bg); }
.profile.tall .portrait { aspect-ratio: 4 / 5; object-position: top; }
.profile h1 { margin-top: 12px; }
.profile .role { color: var(--muted); margin-bottom: 10px; }
.profile .what { font-size: 14px; }
.profile .row { margin-top: 12px; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 130px); min-height: 520px; padding: 0; overflow: hidden; }
.chat-head { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-head select { width: auto; max-width: 340px; padding: 7px 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; background: #fbf8f3; }
.msg { max-width: 82%; margin-bottom: 14px; }
.msg .bubble { padding: 11px 15px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
.msg.user { margin-left: auto; }
.msg.user .bubble { background: var(--navy); color: #fff; border-color: var(--navy); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { border-bottom-left-radius: 4px; border-left: 3px solid var(--c); }
.msg .who { font-size: 12.5px; color: var(--muted); margin: 0 4px 3px; }
.msg.user .who { text-align: right; }
.msg .tools { margin: 4px 2px 0; display: flex; gap: 8px; }
.msg .tools button { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 2px 4px; }
.msg .tools button:hover { color: var(--ink); }
.msg.hello .bubble { background: #fffdf8; font-style: italic; color: var(--muted); }
.typing .bubble { color: var(--muted); }
.typing .dots::after { content: "…"; animation: dots 1.2s steps(3, end) infinite; display: inline-block; overflow: hidden; vertical-align: bottom; width: 0; }
@keyframes dots { to { width: 1.2em; } }
.chips { margin-top: 10px; display: grid; gap: 6px; }
.chip {
  display: flex; gap: 8px; align-items: center; text-align: left; width: 100%;
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 7px 10px; cursor: pointer;
}
.chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.chip .t { flex: 1; font-size: 14px; }
.composer { border-top: 1px solid var(--line); padding: 12px; background: var(--surface); }
.composer textarea { min-height: 52px; max-height: 260px; resize: none; }
.composer .row { margin-top: 8px; }
.composer .hint { font-size: 12.5px; color: var(--muted); }
.chat-error { margin: 0 18px 10px; }

/* Biçimlendirilmiş metin */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.3em; }
.md li { margin: .15em 0; }
.md h3, .md h4, .md h5, .md h6 { margin: .9em 0 .4em; font-size: 1.02em; color: var(--navy); }
.md code { background: var(--bg); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md table { border-collapse: collapse; margin: 0 0 .8em; font-size: .94em; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--bg); }

/* ---------- Listeler ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.list { display: grid; gap: 8px; }
.item {
  display: flex; gap: 12px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; text-align: left; width: 100%;
  border-left: 4px solid var(--c);
}
.item:hover { border-color: var(--gold); }
.item img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }
.item .main { flex: 1; min-width: 0; }
.item .main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .main span { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- Randevular ---------- */
.day { margin-top: 18px; }
.day h3 { color: var(--gold-dark); font-size: 15px; text-transform: none; margin-bottom: 8px; }
.appt { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; }
.appt .time { font-weight: 700; color: var(--navy); }
.appt .warns { margin-top: 6px; display: grid; gap: 4px; }

/* ---------- Gelen mesajlar ---------- */
.inmsg .incoming { background: var(--bg); border-radius: 10px; padding: 10px 14px; white-space: pre-wrap; margin: 8px 0 12px; }
.inmsg textarea { min-height: 120px; }

/* ---------- Pencere ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(31, 40, 56, .45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 14px; overflow-y: auto;
}
.modal { width: min(760px, 100%); background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.modal-head h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-head .x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px 20px 20px; }
.output { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fffdf9; max-height: 55vh; overflow-y: auto; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.review { border-radius: 12px; padding: 12px 14px; }
.review.ok { background: var(--ok-bg); }
.review.bad { background: var(--warn-bg); }
.review b { display: block; margin-bottom: 4px; }

.md blockquote { margin: 0 0 .7em; padding: 8px 14px; border-left: 3px solid var(--gold); background: var(--bg); border-radius: 0 10px 10px 0; }
.modal.wide { width: min(1040px, 100%); }
.vpreview { display: block; width: auto; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 12px; box-shadow: var(--shadow); }

/* ---------- Ayarlar ---------- */
table.simple { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.simple td, table.simple th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.simple td.num, table.simple th.num { text-align: right; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .agent-page { grid-template-columns: 1fr; }
  .profile { position: static; display: grid; grid-template-columns: 96px 1fr; gap: 0 14px; align-items: start; }
  .profile .portrait, .profile.tall .portrait { width: 96px; aspect-ratio: 1; object-position: top; }
  .profile h1 { margin-top: 0; font-size: 22px; }
  .profile .what { display: none; }
  .profile .row { grid-column: 1 / -1; }
  .chat { height: 72vh; }
  .grid2 { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .brand img.dz { display: none; }
  .appt { grid-template-columns: 1fr; gap: 6px; }
  .msg { max-width: 94%; }
}
@media (max-width: 700px) {
  .topbar-in { padding: 8px 14px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .nav a { flex-direction: column; gap: 1px; padding: 6px 2px; font-size: 12px; border-radius: 8px; justify-content: center; position: relative; }
  .nav a .long { display: none; }
  .nav .badge { position: absolute; top: -2px; right: 2px; min-width: 17px; height: 17px; font-size: 11px; padding: 0 4px; }
  .topbar-in { justify-content: space-between; }
  main { padding-bottom: 90px; }
  .toast { bottom: 80px; }
}
