/* OAGENTEL Panel — işini bilen panel.
   Tasarım kuralları:
   - Net bilgi hiyerarşisi: sayfada tek bir birincil başlık, tek birincil aksiyon.
   - Az tıklama: giriş sonrası doğrudan ilk yetkili ekran açılır, ara menü yok.
   - Mobilde çalışır: 820px altında kenar çubuğu çekmeceye döner, tablolar karta.
   - Her grafik SABİT YÜKSEKLİKLİ, position:relative bir kapsayıcı içinde durur
     (eski panelde bu yoktu, Chart.js responsive ile sonsuz büyüyordu). */

:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1c2230;
  --line: #2a3242;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --accent: #c8a24a;
  --accent-soft: rgba(200, 162, 74, .14);
  --blue: #4a9eff;
  --green: #3fb950;
  --orange: #e3923a;
  --red: #f05d5d;
  --purple: #a77bdb;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* [hidden] kurali acik bir `display` tarafindan EZILIR (tarayici varsayilani
   [hidden]{display:none} dusuk oncelikli). .login-wrap'in display:grid'i
   bunu eziyordu: giris ekrani .hidden=true olmasina ragmen gorunur kaliyordu.
   Panelde gorunurluk `hidden` ozniteligiyle yonetildigi icin kural kesin olmali. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ============================ GİRİŞ ============================ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 50% -10%, rgba(200, 162, 74, .10), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px 26px;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  border-radius: 12px;
  background: var(--accent);
  color: #15181d;
  font-weight: 800;
  letter-spacing: .5px;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: .4px;
}

.login-sub {
  margin: 4px 0 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: .88rem;
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  margin-bottom: 5px;
  font-size: .8rem;
  color: var(--text-dim);
}
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-error {
  margin: 12px 0 0;
  padding: 9px 11px;
  background: rgba(240, 93, 93, .12);
  border: 1px solid rgba(240, 93, 93, .35);
  border-radius: var(--radius-sm);
  color: #ffb4b4;
  font-size: .85rem;
}

.login-legacy {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.login-legacy summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: .84rem;
}
.login-legacy summary:hover { color: var(--text); }
.hint { color: var(--text-dim); font-size: .78rem; margin: 10px 0 12px; }

/* ============================ DÜĞMELER ============================ */

.btn {
  padding: 9px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #232b3a; border-color: #3a4456; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #15181d;
  font-weight: 650;
}
.btn-primary:hover:not(:disabled) { background: #d6b05a; border-color: #d6b05a; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn-danger { color: #ffb4b4; border-color: rgba(240, 93, 93, .4); }

.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; padding: 4px 8px; color: var(--text);
}

/* ============================ ÜST ÇUBUK ============================ */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: rgba(22, 27, 34, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent); color: #15181d;
  font-weight: 800; font-size: .82rem;
}
.brand-text { min-width: 0; line-height: 1.25; }
.brand-text strong { display: block; font-size: .95rem; }
.brand-text small {
  display: block; color: var(--text-dim); font-size: .78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.chip {
  padding: 4px 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(200, 162, 74, .3);
  border-radius: 999px;
  font-size: .78rem;
  color: var(--accent);
  white-space: nowrap;
}

/* ============================ YERLEŞİM ============================ */

.shell {
  display: grid;
  grid-template-columns: 216px 1fr;
  min-height: calc(100vh - 53px);
}

.sidenav {
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  background: var(--surface);
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 2px;
  background: none; border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  color: var(--text-dim);
  font-size: .9rem;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-dot {
  width: 6px; height: 6px; flex: none;
  border-radius: 50%; background: currentColor; opacity: .55;
}
.nav-item .nav-count {
  margin-left: auto;
  padding: 1px 7px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: .74rem;
}
.nav-group-label {
  padding: 14px 11px 6px;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5d6b7d;
}

.screen-host { padding: 20px 22px 48px; min-width: 0; }

/* ============================ KARTLAR / IZGARA ============================ */

.page-head {
  display: flex; align-items: baseline; gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.page-head h2 { margin: 0; font-size: 1.15rem; }
.page-head .page-sub { color: var(--text-dim); font-size: .85rem; }
.page-head .page-actions { margin-left: auto; display: flex; gap: 8px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.one { grid-template-columns: 1fr; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.card > h3 {
  margin: 0 0 12px;
  font-size: .9rem;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: .02em;
}
.card.span2 { grid-column: 1 / -1; }

/* KPI */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); margin-bottom: 16px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.kpi .kpi-label { font-size: .75rem; color: var(--text-dim); margin-bottom: 4px; }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.kpi.gold { border-left-color: var(--accent); }
.kpi.blue { border-left-color: var(--blue); }
.kpi.green { border-left-color: var(--green); }
.kpi.orange { border-left-color: var(--orange); }
.kpi.red { border-left-color: var(--red); }

/* GRAFİK KAPSAYICISI — sabit yükseklik zorunlu.
   Eski panelde canvas doğrudan .card içindeydi ve CSS'te hiç kural yoktu;
   Chart.js responsive+maintainAspectRatio:false ile her resize olayında
   büyüyüp kendini tekrar tetikliyordu (sayfa kilitleniyordu). */
.chart-box { position: relative; height: 220px; width: 100%; }
.chart-box > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* Liste / satırlar */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.row.urgent { border-color: rgba(240, 93, 93, .45); background: rgba(240, 93, 93, .08); }
.row-main { min-width: 0; }
.row-title { font-size: .92rem; }
.row-meta { color: var(--text-dim); font-size: .78rem; margin-top: 2px; }
.row-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-dim);
  white-space: nowrap;
}
.tag.urgent { color: #ffb4b4; border-color: rgba(240, 93, 93, .45); }
.tag.open { color: var(--orange); border-color: rgba(227, 146, 58, .4); }
.tag.ok { color: var(--green); border-color: rgba(63, 185, 80, .4); }
.tag.room { color: var(--text); font-weight: 600; }

.room-badge {
  flex: none;
  min-width: 46px;
  padding: 6px 8px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .88rem;
}

/* Filtre şeridi */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: .84rem;
  color: var(--text-dim);
}
.filter.active { background: var(--accent-soft); border-color: rgba(200, 162, 74, .4); color: var(--accent); }

/* Tablo (mobilde karta döner) */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th {
  text-align: left; padding: 8px 10px;
  color: var(--text-dim); font-size: .76rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 46px; gap: 10px; align-items: center; font-size: .84rem; }
.bar-track { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-fill.green { background: var(--green); }
.bar-fill.red { background: var(--red); }
.bar-fill.blue { background: var(--blue); }
.bar-row .bar-val { text-align: right; color: var(--text-dim); }

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: .88rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.notice {
  padding: 11px 13px;
  background: var(--accent-soft);
  border: 1px solid rgba(200, 162, 74, .3);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: 14px;
}
.notice.warn { background: rgba(240, 93, 93, .1); border-color: rgba(240, 93, 93, .35); }
.notice code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Ekran izni seçiciler */
.screen-picker { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); }
.screen-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  cursor: pointer;
}
.screen-opt input { accent-color: var(--accent); }
.screen-opt.inherited { color: var(--text-dim); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: .87rem;
}
.toast.err { border-color: rgba(240, 93, 93, .5); color: #ffb4b4; }
.toast.ok { border-color: rgba(63, 185, 80, .5); }

.nav-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 24; }
.only-mobile { display: none; }

/* ============================ MOBİL ============================ */

@media (max-width: 820px) {
  body { font-size: 15px; }
  .only-mobile { display: block; }

  .shell { grid-template-columns: 1fr; }

  .sidenav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 25;
    width: 232px;
    transform: translateX(-100%);
    transition: transform .18s ease;
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  .sidenav.open { transform: none; }

  .screen-host { padding: 16px 16px 48px; }
  .topbar { padding: 10px 14px; }
  .topbar-right .btn { padding: 6px 9px; }
  .chip { display: none; }

  .grid { grid-template-columns: 1fr; }
  .chart-box { height: 190px; }

  /* Tablo -> kart */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 9px;
  }
  .tbl td { border: none; padding: 3px 0; }
  .tbl td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--text-dim);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: 6px;
  }
  .tbl .cell-actions { justify-content: flex-start; margin-top: 8px; }

  .row { grid-template-columns: auto 1fr; }
  .row-side { grid-column: 1 / -1; justify-content: flex-start; margin-top: 2px; }
  .bar-row { grid-template-columns: 92px 1fr 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidenav { transition: none; }
}

/* ===== Kullanım & Bütçe ekranı =====
   Bu ekranda bilinçli olarak CANVAS YOK: yüzdelik gösterim saf CSS ölçerle
   yapılır. Gerekçe: bu projede sarmalayıcısız bir Chart.js canvas'ı daha önce
   sonsuz büyüme bug'ına yol açtı. Buraya bir grafik eklenirse canvas DAİMA
   yüksekliği sabit .chart-box içine konur. */
.kpi.crit { border-left-color: var(--red); }
.notice.crit {
  background: rgba(240, 93, 93, .16);
  border-color: rgba(240, 93, 93, .5);
  color: var(--text);
}
.budget-meter {
  position: relative;
  height: 10px;
  width: 100%;
  background: rgba(255, 255, 255, .07);
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0 8px;
}
.budget-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 99px;
  transition: width .3s ease;
  min-width: 2px;
}
.budget-meter-fill.ok   { background: var(--green); }
.budget-meter-fill.mid  { background: var(--orange); }
.budget-meter-fill.warn { background: var(--orange); }
.budget-meter-fill.crit { background: var(--red); }
.rows .budget-meter { margin: 6px 0 0; }

/* Kilide kalan sure tahmini */
.forecast {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--green);
  background: rgba(255, 255, 255, .04);
}
.forecast.warn { border-left-color: var(--orange); }
.forecast.crit { border-left-color: var(--red); }
.forecast-head { font-size: .72rem; color: var(--text-dim); text-transform: uppercase;
                 letter-spacing: .04em; margin-bottom: 3px; }
.forecast-main { font-size: 1.05rem; font-weight: 600; }
.forecast-meta { font-size: .74rem; color: var(--text-dim); margin-top: 4px;
                 line-height: 1.5; }
.forecast-none { margin-top: 10px; font-style: italic; }

/* ===================== QR konsiyerji: konaklama & kod + ticket aksiyonlari
 * docs/QR_KONSIYERJ.md bolum 6 ve 9. Mevcut siniflarin UZERINE yazmaz,
 * yalniz eksik olanlari ekler.
 */

/* Ticket satirindaki tamamlama butonlari (departmanin kendi fiili). */
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.row-actions .btn { white-space: nowrap; }

/* SLA asimi veya tekrar acilma -> dikkat cekici kenar. `.row.urgent`tan
   ayri: aciliyet misafirin soyledigi sey, dikkat bizim olctugumuz sey. */
.row.attention { border-color: rgba(227, 146, 58, .5); }
.row.urgent.attention { border-color: rgba(240, 93, 93, .6); }

.tag.blue { color: #7fb7ff; border-color: rgba(88, 166, 255, .4); }
.tag.orange { color: var(--orange); border-color: rgba(227, 146, 58, .4); }
.tag.red { color: #ffb4b4; border-color: rgba(240, 93, 93, .45); }
.tag.green { color: var(--green); border-color: rgba(63, 185, 80, .4); }

/* Yan yana iki alan; dar ekranda alt alta. */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Kapatilmis konaklama satiri. */
.tbl tr.muted td { opacity: .55; }

/* Check-in kodu panosu — BIR KEZ gosterilir, bu yuzden gecici bir toast
   degil, kullanici kapatana kadar duran bir pano. */
.code-panel { margin-bottom: 18px; }
.code-big {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 700;
  letter-spacing: .18em;
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px dashed rgba(227, 146, 58, .55);
  border-radius: 10px;
  text-align: center;
  user-select: all;           /* tek dokunusla secilebilsin */
  word-break: break-all;
}
