/* Olleb UI: yan menü + üst bar ve ortak ekran kalıpları. Renkler yalnızca olleb-design.css token'larından. */

/* ---------- İskelet ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar { width: 250px; flex-shrink: 0; background: var(--primary-dark); color: #fff; padding: 22px 0 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
/* Koyu temada --primary-dark açık maviye dönüyor; beyaz yazı okunmasın diye menü zemini koyu kalır. */
@media (prefers-color-scheme: dark) { .sidebar { background: var(--bg); border-right: 1px solid var(--border); } }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 22px 22px; }
.sidebar-brand-icon, .sidebar-link .ico { fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sidebar-brand-icon { width: 26px; height: 26px; stroke: var(--accent); stroke-width: 1.8; }
.sidebar-brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 17px; letter-spacing: 0.02em; line-height: 1.2; }
.sidebar-brand-sub { font-size: 12px; color: var(--accent); }
.sidebar-nav { flex: 1; }
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 10px 22px; color: rgba(255, 255, 255, 0.85);
  text-decoration: none; font-size: 14.5px; font-weight: 500; border-left: 3px solid transparent; }
.sidebar-link .ico { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; opacity: 0.85; }
.sidebar-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.sidebar-link.active { background: rgba(255, 255, 255, 0.1); border-left-color: var(--accent); color: #fff; }
.sidebar-footer { padding: 16px 22px 0; font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, 0.55); }
.sidebar-footer strong { display: block; color: #fff; font-size: 13px; }
.sidebar-logout { all: unset; cursor: pointer; color: #fff; font-weight: 600; }
.sidebar-logout:hover { text-decoration: underline; }

.app-main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 24px; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-family: var(--font-heading); font-size: 18px; color: var(--primary-dark); }
.app-content { padding: 24px; max-width: 1400px; }
.menu-toggle { all: unset; display: none; cursor: pointer; font-size: 22px; line-height: 1; padding: 6px 8px; border-radius: 8px; color: var(--primary-dark); }

@media (max-width: 768px) {
  .menu-toggle { display: inline-block; }
  .sidebar { position: fixed; left: -260px; z-index: 20; transition: left 0.2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.4); }
  .app-content { padding: 16px; }
}

/* Giriş ekranı (menüsüz) */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; color: var(--primary); }
.login-brand .sidebar-brand-icon { width: 34px; height: 34px; }
.login-brand .sidebar-brand-name { font-size: 24px; }
.login-brand .sidebar-brand-sub { color: var(--ink-soft); }

/* ---------- Liste ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.list-head h1 { margin: 0; }
.list-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.filter-search { flex: 1 1 240px; max-width: 420px; }
.quick-dates { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.quick-dates button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.quick-dates button.on, .quick-dates button:hover { background: var(--primary); color: #fff; }

/* Tasarım sistemi tabloyu display:block yapıyor; kaydırmayı .table-wrap üstlensin, tablo tam genişlikte kalsın. */
.table-wrap { overflow-x: auto; }
.table-wrap > table { display: table; width: 100%; }
.report-table tbody tr[data-href] { cursor: pointer; }
.report-table tbody tr[data-href]:hover td { background: var(--surface-alt); }
.report-table .nowrap { white-space: nowrap; }
.report-table td.empty { color: var(--ink-soft); text-align: center; padding: 28px 12px; }
.report-table tr.inactive td { color: var(--ink-soft); }
.report-table tr.inactive td strong { text-decoration: line-through; text-decoration-color: var(--border); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.row-actions form { display: inline; margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select { min-width: 160px; }
.inline-form input[type="number"] { width: 80px; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 0; }

/* Renkli çerçeveli butonlar: satırdaki ikincil aksiyonlar (Pasife al / Aktifleştir / Şifre sıfırla) */
.btn-outline-primary, .btn-outline-danger, .btn-outline-success {
  all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-main); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 7px;
  border: 1.5px solid currentColor; cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.btn-outline-primary { color: var(--primary); border-color: var(--accent); }
.btn-outline-danger { color: var(--danger); }
.btn-outline-success { color: var(--success); }
.btn-outline-primary:hover { background: var(--accent-soft); color: var(--primary); text-decoration: none; }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-outline-success:hover { background: var(--success-soft); }
.btn-outline-primary .ico, .btn-outline-danger .ico, .btn-outline-success .ico, .btn-primary .ico, .btn-success .ico, .btn-secondary .ico {
  width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Ana butonlar: biraz derinlik, dokunmada tutarlı yükseklik */
.btn-primary, .btn-success { box-shadow: 0 1px 2px rgba(15, 36, 56, 0.18); }
.btn-success:hover { opacity: 1; filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(58, 125, 68, 0.25); }
.btn-primary:hover, .btn-success:hover { text-decoration: none; color: #fff; }
.btn-block { width: 100%; min-height: 46px; }
.btn-link { all: unset; cursor: pointer; font-size: 13px; color: var(--ink-soft); text-decoration: underline; }
.btn-link:hover { color: var(--primary); }

/* ---------- Form ---------- */
.md-form { max-width: 880px; margin-bottom: 18px; }
.md-form.narrow { max-width: 440px; }
.md-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.md-grid .md-wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .md-grid { grid-template-columns: 1fr; } }
.md-form h2 { font-size: 18px; margin-bottom: 14px; }
.md-help { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.req { color: var(--danger); }
/* Aktif/pasif anahtarı (checkbox yerine) */
.md-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; text-transform: none; letter-spacing: 0;
  font-size: 14px; font-weight: 500; color: var(--ink); margin: 10px 0; align-self: end; position: relative; }
.md-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.md-switch-track { width: 40px; height: 22px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; flex-shrink: 0; }
.md-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.md-switch input:checked + .md-switch-track { background: var(--success); }
.md-switch input:checked + .md-switch-track::after { left: 21px; }
.md-switch input:focus-visible + .md-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.md-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Dashboard ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.kpi-sub { font-size: 12.5px; color: var(--ink-soft); }
.kpi-sub.good { color: var(--success); }
.kpi-sub.bad { color: var(--danger); }
.kpi-value { font-size: 30px; font-weight: 700; font-family: var(--font-heading); line-height: 1.1; }
.panel h2 { font-size: 16px; margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
@media (max-width: 760px) { .kpi-value { font-size: 24px; } .kpi { padding: 12px 14px; } }

/* ---------- Makine panosu ---------- */
.status-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; font-size: 14px; }
.status-summary .badge { font-size: 12.5px; padding: 5px 12px; }
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.machine-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success);
  border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.machine-card.is-running { border-left-color: var(--primary); }
.machine-card.is-down { border-left-color: var(--danger); }
.machine-card.is-maint { border-left-color: var(--warning); }
.machine-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.machine-job { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.machine-progress { height: 8px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.machine-progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.machine-progress.late span { background: var(--danger); }

/* ---------- Görev detayı (operatör) ---------- */
dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(15, 36, 56, 0.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 18px; font-size: 14px; }
.kv dt { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; padding-top: 2px; }
.kv dd { margin: 0; white-space: pre-line; }
.section-title { font-size: 15px; margin: 18px 0 8px; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* Sahada dokunmatik ekran: operatör satırları ve aksiyonları ≥48px */
.touch td { height: 56px; }
.touch-actions button { min-height: 48px; }

/* ---------- Makine detayı / arıza-bakım ---------- */
.machine-link { color: inherit; min-width: 0; }
.machine-link:hover { text-decoration: none; color: var(--primary); }
.machine-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: flex-end; }
.durus-open { border-left: 4px solid var(--danger); }
.durus-open.is-maint { border-left-color: var(--warning); }
.durus-forms .card + .card { margin-top: 0; }
.kpi-value small { font-size: 14px; font-weight: 600; }

/* ---------- Raporlar ---------- */
.report-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
.report-grid .panel + .panel { margin-top: 0; }
@media (max-width: 900px) { .report-grid { grid-template-columns: 1fr; } }
.rate-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--surface-alt); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.rate-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }

/* ---------- Kalite kontrol ---------- */
.plain-fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
legend.label { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; padding: 0; margin-bottom: 6px; }
/* Uygun / Uygun değil: dokunmatik için büyük, radyo tabanlı iki parçalı seçim */
.seg { display: flex; border: 1.5px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg label { flex: 1; margin: 0; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); position: relative; }
.seg label + label { border-left: 1.5px solid var(--border); }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; background: var(--surface-alt); }
.seg label:first-child input:checked + span { background: var(--success-soft); color: var(--success); font-weight: 600; }
.seg label:last-child input:checked + span { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.durus-open.is-ok { border-left-color: var(--success); }

/* ---------- Bildirimler ---------- */
.topbar-title { flex: 1; min-width: 0; }
.notification-bell { position: relative; display: inline-flex; padding: 8px; border-radius: 8px; color: var(--primary-dark); }
.notification-bell:hover { background: var(--surface-alt); }
.notification-bell .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.notification-count[hidden] { display: none; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list li.new { background: var(--accent-soft); border-radius: 7px; padding-left: 10px; padding-right: 10px; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--accent); }
.notif-dot.uyari { background: var(--warning); }
.notif-dot.hata { background: var(--danger); }
.notif-body { flex: 1; min-width: 0; }
.notif-body a { color: var(--ink); font-weight: 500; }

/* ---------- QR etiketleri (yazdırma) ---------- */
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-label { background: #fff; color: #000; border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 14px; text-align: center; break-inside: avoid; }
.qr-label img { width: 160px; height: 160px; display: block; margin: 0 auto 8px; }
.qr-label .qr-code { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }
.qr-label .qr-sub { font-size: 12px; color: #333; }
@media print {
  .sidebar, .topbar, .list-head-actions, .no-print, .alert { display: none !important; }
  .app-content { padding: 0; max-width: none; }
  body { background: #fff; }
  .qr-label { border-color: #999; }
}
