/* İnşaat Stok — arayüz
   Palet: çelik lacivert (menü), beton gri (zemin), baret sarısı (vurgu),
   inşaat demiri pası (çıkış/kritik), şantiye yeşili (giriş). */
:root {
  --ink: #1E2A33;
  --ink-soft: #2C3B47;
  --concrete: #ECEEEF;
  --paper: #FFFFFF;
  --line: #D5D9DC;
  --muted: #66727C;
  --safety: #F5B800;
  --safety-deep: #D99F00;
  --rust: #B4532A;
  --site: #2F7D5B;
  --radius-sm: 4px;
  --radius-md: 8px;
  --sidebar-w: 248px;

  --bs-body-font-family: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-bg: var(--concrete);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-link-color: var(--ink);
  --bs-link-color-rgb: 30,42,51;
  --bs-link-hover-color: var(--rust);
  --bs-link-hover-color-rgb: 180,83,42;
}

body { font-size: 15.5px; -webkit-font-smoothing: antialiased; }

h1, h2, h3, h4, .display-num {
  font-family: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;
  letter-spacing: .01em;
}
h1 { font-size: 1.9rem; font-weight: 600; margin: 0; }
h2 { font-size: 1.35rem; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.text-muted, .muted { color: var(--muted) !important; }

/* ---------- Kabuk ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  color: #C9D2D9;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.15rem 1.25rem;
  color: #fff; text-decoration: none;
  font-family: "Barlow Condensed", sans-serif; font-size: 1.35rem; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand:hover { color: #fff; }
/* Uyarı şeridi: markanın tek gösterişli öğesi */
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: repeating-linear-gradient(-45deg, var(--safety) 0 6px, var(--ink) 6px 12px);
  box-shadow: inset 0 0 0 2px var(--safety);
}

.nav-group { padding: .9rem .75rem .25rem; }
.nav-group-title { font-size: .78rem; color: #8494A0; padding: 0 .6rem .35rem; }
.side-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .6rem; border-radius: var(--radius-sm);
  color: #C9D2D9; text-decoration: none; font-weight: 500;
  border-left: 3px solid transparent;
}
.side-link i { font-size: 1.05rem; opacity: .85; }
.side-link:hover { background: var(--ink-soft); color: #fff; }
.side-link.active { background: var(--ink-soft); color: #fff; border-left-color: var(--safety); }
.side-link:focus-visible { outline: 2px solid var(--safety); }

.sidebar-foot { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .9rem; }
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot .role { color: #8494A0; font-size: .82rem; }
.sidebar-foot a, .sidebar-foot button { color: #C9D2D9; }
.sidebar-foot a:hover, .sidebar-foot button:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 1.75rem 2rem 3rem; max-width: 1400px; width: 100%; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.page-head .crumb { font-size: .9rem; color: var(--muted); text-decoration: none; }
.page-head .crumb:hover { color: var(--rust); }

/* ---------- Yüzeyler ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); }
.panel + .panel { margin-top: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-body { padding: 1.1rem; }

/* Gösterge şeridi: ayrı kartlar yerine tek bir ölçü cetveli */
.gauge-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: 1.25rem; }
.gauge { padding: 1rem 1.15rem; border-right: 1px solid var(--line); }
.gauge:last-child { border-right: 0; }
.gauge .label { color: var(--muted); font-size: .88rem; }
.gauge .value { font-family: "Barlow Condensed", sans-serif; font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.gauge.is-key .value { border-bottom: 3px solid var(--safety); display: inline-block; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--muted); font-weight: 500; }
dl.facts dd { margin: 0; }

/* ---------- Butonlar ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--safety); --bs-btn-border-color: var(--safety); --bs-btn-color: var(--ink);
  --bs-btn-hover-bg: var(--safety-deep); --bs-btn-hover-border-color: var(--safety-deep); --bs-btn-hover-color: var(--ink);
  --bs-btn-active-bg: var(--safety-deep); --bs-btn-active-border-color: var(--safety-deep); --bs-btn-active-color: var(--ink);
  --bs-btn-disabled-bg: var(--safety); --bs-btn-disabled-border-color: var(--safety); --bs-btn-disabled-color: var(--ink); }
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: var(--ink-soft); --bs-btn-hover-border-color: var(--ink-soft); }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: #C3C9CD; --bs-btn-hover-bg: var(--concrete); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #AEB6BC; }
.btn-link-danger { color: var(--rust); background: none; border: 0; padding: 0; font-weight: 600; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 3px rgba(245,184,0,.45); border-color: var(--safety-deep); outline: none; }

/* ---------- Formlar ---------- */
.form-label { font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: #C3C9CD; }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.field-validation-error, .text-danger { color: var(--rust) !important; font-size: .88rem; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.input-validation-error { border-color: var(--rust) !important; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line); margin-top: 1.25rem; }
.form-hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

/* ---------- Tablolar ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table thead th { font-size: .82rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; background: #F6F7F8; }
.table td, .table th { padding: .6rem .8rem; }
.table td { vertical-align: middle; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table a { text-decoration: none; font-weight: 600; }
.table a:hover { text-decoration: underline; }

.qty-in { color: var(--site); font-weight: 600; }
.qty-out { color: var(--rust); font-weight: 600; }
.tag-in, .tag-out { display: inline-block; padding: .1rem .5rem; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600; }
.tag-in { background: #E3F1EA; color: var(--site); }
.tag-out { background: #F6E6DE; color: var(--rust); }

.badge-state { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #E7EAEC; color: var(--ink); white-space: nowrap; }
.badge-state.is-live { background: #FFF1C2; color: #6B5000; }
.badge-state.is-done { background: #E3F1EA; color: var(--site); }
.badge-state.is-off { background: #F6E6DE; color: var(--rust); }
.row-passive td { opacity: .55; }
.critical { color: var(--rust); font-weight: 700; }

.meter { height: 6px; background: #E7EAEC; border-radius: 3px; overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.meter.is-over > span { background: var(--rust); }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #AEB6BC; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); background: #FAFAFB; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.filters .form-control, .filters .form-select { width: auto; min-width: 150px; }
.filters .form-check { margin-bottom: .4rem; }

/* Ayarlar sayfası */
.settings-list a { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.settings-list a:last-child { border-bottom: 0; }
.settings-list a:hover { background: #FAFAFB; }
.settings-list .ico { width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--concrete); display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.settings-list .t { font-weight: 600; }
.settings-list .d { color: var(--muted); font-size: .9rem; }
.settings-list .c { margin-left: auto; font-family: "Barlow Condensed", sans-serif; font-size: 1.3rem; font-weight: 600; }

/* Fatura satırları */
.line-row { background: #FAFAFB; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; margin-bottom: .6rem; }
.line-row .form-label { font-size: .82rem; font-weight: 500; color: var(--muted); }
.line-total { font-family: "Barlow Condensed", sans-serif; font-size: 1.15rem; font-weight: 600; white-space: nowrap; }
.invoice-sum { display: grid; grid-template-columns: auto auto; gap: .25rem 1.5rem; justify-content: end; font-variant-numeric: tabular-nums; text-align: right; }
.invoice-sum .grand { font-family: "Barlow Condensed", sans-serif; font-size: 1.5rem; font-weight: 700; border-top: 2px solid var(--ink); padding-top: .25rem; }

.stock-hint { padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--concrete); font-size: .92rem; }
.stock-hint.is-low { background: #F6E6DE; color: var(--rust); }

.alert { border-radius: var(--radius-sm); border-width: 0 0 0 4px; }
.alert-success { background: #E3F1EA; border-color: var(--site); color: #1E5640; }
.alert-danger { background: #F6E6DE; border-color: var(--rust); color: #7A361A; }

/* ---------- Giriş ekranı ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(320px, 460px); background: var(--paper); }
.login-side { background: var(--ink); color: #C9D2D9; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; position: relative; overflow: hidden; }
.login-side::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: repeating-linear-gradient(-45deg, var(--safety) 0 18px, var(--ink) 18px 36px); }
.login-side h1 { color: #fff; font-size: 3.2rem; line-height: 1.02; max-width: 12ch; }
.login-side p { max-width: 42ch; font-size: 1.05rem; }
.login-form { padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { font-size: 1.6rem; }

/* ---------- Mobil ---------- */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 1045; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(30,42,51,.5); z-index: 1040; display: none; }
  .sidebar-backdrop.open { display: block; }
  .topbar { display: flex; align-items: center; gap: .75rem; background: var(--ink); color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 1030; }
  .topbar .brand { padding: 0; border: 0; font-size: 1.2rem; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; padding: .2rem; }
  .content { padding: 1.1rem 1rem 3rem; }
  h1 { font-size: 1.55rem; }
  .gauge { border-right: 0; border-bottom: 1px solid var(--line); }
  .gauge:last-child { border-bottom: 0; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { padding: 2rem 1.5rem 3rem; }
  .login-side h1 { font-size: 2.1rem; }
  .login-form { padding: 2rem 1.5rem; }
  .filters .form-control, .filters .form-select { flex: 1 1 140px; min-width: 0; }
  .page-head .btn { flex: 1 1 auto; }
}

/* Tabloları telefonda kart görünümüne çevir: td'lere data-label verilir */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td, .table-stack tfoot { display: block; width: 100%; }
  .table-stack tr { border-bottom: 1px solid var(--line); padding: .6rem 1rem; }
  .table-stack td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right !important; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; flex-shrink: 0; }
  .table-stack td:not([data-label])::before { content: none; }
  .table-stack td.cell-title { font-weight: 600; font-size: 1.02rem; justify-content: flex-start; text-align: left !important; }
  .table-stack td.cell-actions { justify-content: flex-end; padding-top: .45rem; }
  .table-stack tfoot tr { border-top: 2px solid var(--ink); }
  dl.facts { grid-template-columns: 1fr; gap: .1rem; }
  dl.facts dd { margin-bottom: .5rem; }
}

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

@media print {
  .sidebar, .topbar, .sidebar-backdrop, .filters, .page-head .btn, .cell-actions, .alert { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .panel, .gauge-strip { border: 0; }
  a { color: inherit; text-decoration: none; }
}

/* Hata yokken doğrulama özetini gizle */
.validation-summary-valid { display: none !important; }
