:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
  --input-bg: #ffffff;
  --hover-bg: #f8fafc;
}

/* === KARANLIK MOD === */
/* html.dark-mode aktif olunca palet otomatik geçer */
html.dark-mode {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 2px 6px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --input-bg: #0f172a;
  --hover-bg: #334155;
}
/* Dark mode'da temel beyaz arka planları override et */
html.dark-mode body { background: var(--bg); color: var(--text); }
html.dark-mode .auth-card,
html.dark-mode .card,
html.dark-mode .topbar,
html.dark-mode .modal,
html.dark-mode .system-card,
html.dark-mode .perm-row,
html.dark-mode .comment,
html.dark-mode .sparkline-wrap,
html.dark-mode .push-status,
html.dark-mode .mention-dropdown,
html.dark-mode .photo-card,
html.dark-mode .chat-sidebar,
html.dark-mode .chat-main,
html.dark-mode .chat-list-item,
html.dark-mode .chat-active-header,
html.dark-mode .chat-send-form,
html.dark-mode .stat-card,
html.dark-mode .trash-section,
html.dark-mode .pending-card,
html.dark-mode .perm-group,
html.dark-mode .scope-section {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}
html.dark-mode .btn-ghost { color: var(--text); border-color: var(--border); }
html.dark-mode .btn-ghost:hover { background: var(--hover-bg); }
html.dark-mode .topbar .role-badge { background: var(--bg); }
html.dark-mode .chat-list-item.active { background: rgba(59, 130, 246, 0.15); }
html.dark-mode .chat-msg { background: var(--card); border-color: var(--border); color: var(--text); }
html.dark-mode .chat-msg.mine { background: var(--primary); color: white; }
html.dark-mode .notif-item:hover, html.dark-mode .mention-item:hover { background: var(--hover-bg); }
html.dark-mode .modal-backdrop { background: rgba(0,0,0,0.7); }
html.dark-mode .toast { background: var(--card); color: var(--text); }
html.dark-mode .sparkline-wrap { background: var(--bg); }
html.dark-mode pre, html.dark-mode code { background: var(--bg); color: var(--text); }
html.dark-mode table { color: var(--text); }
html.dark-mode th, html.dark-mode td { border-color: var(--border); }
html.dark-mode .mention-pill { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
html.dark-mode .new-chat-user, html.dark-mode .new-chat-user-list { background: var(--card); border-color: var(--border); }
html.dark-mode .new-chat-user.selected { background: rgba(59, 130, 246, 0.18); }

/* Theme toggle butonu */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--hover-bg); }

/* Bildirim izni butonu — durumlara göre stil */
.notif-perm-btn {
  white-space: nowrap;
  animation: notifPermPulse 2.5s ease-in-out 1s 2;
}
.notif-perm-btn.notif-perm-denied {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  animation: none;
}
.notif-perm-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  animation: none;
}
@keyframes notifPermPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25); }
}
/* Mobilde daha kompakt */
@media (max-width: 480px) {
  .notif-perm-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 8px;
}
.auth-logo p { color: var(--muted); font-size: 14px; }

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tabs button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.auth-tabs button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-actions { margin-top: 20px; }
.form-actions .btn { width: 100%; justify-content: center; }

.error-msg {
  background: #fef2f2;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.info-msg {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* App layout */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .brand-icon {
  width: 40px; height: 40px;
  /* Logo PNG'si zaten şeffaf (RGBA) — arka plan ŞEFFAF, çerçeve/gölge yok ki
     karanlık temada beyaz kutu görünmesin. JS --brand-emblem-url'ü günceller. */
  background: transparent var(--brand-emblem-url, url('/brand-emblem.svg')) center/contain no-repeat;
  color: transparent;             /* harf yedeği görünmesin */
  border: none;
  font-size: 0;
  flex-shrink: 0;
}
.topbar .brand > span {
  font-family: 'Arial Black', Arial, Helvetica, sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: #e30613;
  text-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.topbar .brand .brand-sub {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  text-shadow: none;
  margin-left: 4px;
}
/* Karanlık temada logo arka planı şeffaf kalsın (beyaz kutu görünmesin) */

/* Login sayfası geniş marka logosu */
.auth-brand-logo {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto 14px;
}
.topbar .brand-sub {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}
@media (max-width: 640px) {
  .topbar .brand-sub { display: none; }
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.topbar .role-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
}
.topbar .role-badge.admin { background: #fef3c7; color: #92400e; }
.topbar .role-badge.manager { background: #dbeafe; color: #1e40af; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 24px;
  font-weight: 700;
}
.page-header .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  border: 1px solid var(--border);
}
.stat-card .label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 28px; font-weight: 700; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.site-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.05s;
}
.site-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.site-card h3 { font-size: 16px; margin-bottom: 6px; }
.site-card .location { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.site-card .counts {
  display: flex;
  gap: 12px;
  font-size: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.site-card .count-item { color: var(--muted); }
.site-card .count-item b { color: var(--text); font-weight: 600; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--card);
  border-radius: 12px;
  border: 1px dashed var(--border);
}
.empty .icon { font-size: 40px; margin-bottom: 8px; opacity: 0.5; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 17px; }
.modal-header .close {
  width: 30px; height: 30px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 20px;
}
.modal-header .close:hover { background: var(--bg); }
.modal-body { padding: 20px; overflow-y: auto; max-height: calc(90vh - 140px); }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Site detail */
.detail-section {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 16px;
}
.detail-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.detail-section h3 { font-size: 16px; }

.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
}
.item-row .item-main { flex: 1; }
.item-row .item-title { font-weight: 500; font-size: 14px; }
.item-row .item-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.item-row .item-actions { display: flex; gap: 6px; }

.status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-inprogress { background: #dbeafe; color: #1e40af; }
.status-done { background: #d1fae5; color: #065f46; }
.status-needed { background: #fef2f2; color: #991b1b; }
.status-ordered { background: #ede9fe; color: #5b21b6; }
.status-delivered { background: #d1fae5; color: #065f46; }

.priority-low { color: var(--muted); }
.priority-medium { color: var(--warning); }
.priority-high { color: var(--danger); font-weight: 600; }

.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chip {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  margin: 2px 2px 0 0;
  color: var(--text);
}

.status-sel {
  padding: 6px 8px;
  font-size: 12px;
  width: auto;
  border-radius: 6px;
}

#photo-modal { background: rgba(0,0,0,0.85); }

.pw-cell { transition: filter 0.15s; }

/* === İŞLEM GEÇMİŞİ (LOGLAR) === */
.logs-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.log-action-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.log-stat-pill {
  background: var(--card);
  border: 1px solid;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.log-stat-pill b { font-weight: 700; }

.log-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.log-detail {
  font-size: 13px;
  line-height: 1.5;
}

.log-tag {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  margin: 0 2px;
  color: var(--text);
  white-space: nowrap;
}
.log-tag.priority-high { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.log-tag.priority-medium { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.log-tag.priority-low { background: var(--bg); color: var(--muted); }

.log-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.log-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* === ROL ROZETLERİ (yeni roller) === */
.role-badge.patron       { background: #fce7f3; color: #9d174d; }
.role-badge.santiyeSefi  { background: #cffafe; color: #155e75; }
.role-badge.muhendis     { background: #ede9fe; color: #5b21b6; }
.role-badge.ustabasi     { background: #fef3c7; color: #92400e; }
.role-badge.muhasebe     { background: #d1fae5; color: #065f46; }
.role-badge.depocu       { background: #ffedd5; color: #9a3412; }

/* === ONAY BEKLEYEN ROZET === */
.pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warning);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  padding: 0 6px;
  height: 18px;
  margin-left: 4px;
}

/* === KİLİTLİ KULLANICI === */
.lock-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  letter-spacing: 0.5px;
}
.row-locked { background: #fef2f2; }
.row-locked:hover { background: #fee2e2; }

/* === ÇÖP KUTUSU === */
.trash-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  padding: 0 6px;
  height: 18px;
  margin-left: 4px;
}

.trash-section { margin-bottom: 24px; }
.trash-section h3 {
  font-size: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.muted-count {
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* === YETKİ MODALI === */
.perms-user-info { /* fallback if not styled inline */ }

.perm-group {
  margin-bottom: 16px;
}
.perm-group h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.perm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.1s, border-color 0.1s;
}
.perm-row:hover { background: var(--bg); }

.perm-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.perm-label { flex: 1; font-size: 14px; }
.perm-label .perm-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.perm-label code { font-size: 10px; }

.perm-default-on .perm-check { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.perm-default-off .perm-check { background: var(--card); color: #cbd5e1; border: 1px solid var(--border); }

.perm-added {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}
.perm-added .perm-check { background: var(--success); color: white; border: 1px solid var(--success); }
.perm-added .perm-meta { color: #15803d; }

.perm-removed {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  opacity: 0.7;
}
.perm-removed .perm-check { background: var(--danger); color: white; border: 1px solid var(--danger); }
.perm-removed .perm-meta { color: #b91c1c; }
.perm-removed .perm-label > div:first-child { text-decoration: line-through; }

.override-badge {
  background: var(--primary);
  color: white;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 2px;
}

/* === ŞANTİYE KAPSAMI === */
.scope-section {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), #f0fdf4);
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.scope-section h4 {
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.scope-help {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.scope-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scope-option:hover { border-color: var(--primary); }
.scope-option.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.scope-option input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.scope-title {
  font-weight: 600;
  font-size: 14px;
}
.scope-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.scope-assignments { margin-top: 12px; }
.scope-info-all {
  background: #d1fae5;
  color: #065f46;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.scope-info-assigned {
  background: var(--card);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.scope-info-warning {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* === MALZEME DETAY + SOHBET === */
.material-clickable { cursor: pointer; }
.material-clickable:hover { background: rgba(37,99,235,0.04); }

.delivery-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.material-detail-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 16px;
}
.material-detail-photo {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.delivery-section {
  background: linear-gradient(135deg, #f0fdf4, rgba(37, 99, 235, 0.1));
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}
.delivery-section h4 { font-size: 14px; margin-bottom: 10px; }
.delivery-progress-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 16px;
  overflow: hidden;
  position: relative;
}
.delivery-progress-fill {
  background: linear-gradient(90deg, #10b981, #059669);
  height: 100%;
  transition: width 0.3s;
}
.delivery-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 8px;
  color: var(--text);
  gap: 10px;
  flex-wrap: wrap;
}

.comments-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.comments-section h4 {
  font-size: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comments-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding: 4px;
}
.comments-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 20px;
}

.comment {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 10px;
  max-width: 90%;
}
.comment-mine {
  background: #dbeafe;
  align-self: flex-end;
  max-width: 90%;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.comment-header b { color: var(--text); font-size: 12px; }
.comment-time { flex: 1; }
.comment-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.comment-delete:hover { color: var(--danger); }
.comment-text {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-photo {
  margin-top: 6px;
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  cursor: zoom-in;
}

.comment-form {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.comment-form textarea {
  width: 100%;
  resize: vertical;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
}
.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.comment-photo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
}
.comment-photo-btn:hover { background: #e2e8f0; }
.comment-photo-name {
  font-size: 12px;
  color: var(--muted);
}

/* === FOTOĞRAF GALERİSİ === */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.photo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.05s;
}
.photo-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-type-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.photo-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.15s, transform 0.05s;
}
.photo-card:hover .photo-delete-btn { display: flex; }
.photo-delete-btn:hover {
  background: rgba(220, 38, 38, 1);
  transform: scale(1.05);
}
.photo-delete-btn:active { transform: scale(0.95); }
.photo-info { padding: 10px; }
.photo-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-meta {
  font-size: 12px;
  color: var(--text);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-meta-sm {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === SİSTEM DURUMU === */
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.system-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.system-card-wide { grid-column: 1 / -1; }
.system-card-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.system-card-value {
  font-size: 18px;
  font-weight: 600;
  margin-top: 6px;
}
.system-card-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.6;
}
.system-card-detail b { color: var(--text); }

.system-bar {
  width: 100%;
  height: 12px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.system-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s;
}
.system-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.system-bar-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* CPU/RAM zaman serisi grafiği */
.system-chart-card {
  padding: 16px 18px;
}
.sparkline-wrap {
  width: 100%;
  margin: 10px 0 6px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.sparkline {
  display: block;
  width: 100%;
  height: 180px;
}
/* OK (yeşil) */
.sparkline.ok .sparkline-line { stroke: #10b981; }
.sparkline.ok .sparkline-area { fill: rgba(16, 185, 129, 0.12); }
.sparkline.ok .sparkline-dot  { fill: #059669; stroke: white; stroke-width: 1.5; }
/* Warning (sarı) */
.sparkline.warning .sparkline-line { stroke: #f59e0b; }
.sparkline.warning .sparkline-area { fill: rgba(245, 158, 11, 0.14); }
.sparkline.warning .sparkline-dot  { fill: #d97706; stroke: white; stroke-width: 1.5; }
/* Danger (kırmızı) */
.sparkline.danger .sparkline-line { stroke: #ef4444; }
.sparkline.danger .sparkline-area { fill: rgba(239, 68, 68, 0.14); }
.sparkline.danger .sparkline-dot  { fill: #dc2626; stroke: white; stroke-width: 1.5; }

.sparkline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 4px;
}
.sparkline-stats b { color: var(--text); font-weight: 600; }

/* === BİLDİRİMLER === */
.notif-btn {
  position: relative;
  font-size: 16px;
}
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notif-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.notif-item:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
}
.notif-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.notif-item-header b { color: var(--text); font-size: 13px; }
.notif-item-time { flex: 1; text-align: right; }
.notif-item-body {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.notif-item-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 10px;
  color: var(--text);
}
.notif-item-text {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 6px;
}

/* Bildirim panelinde okunmamış vurgusu */
.notif-item.unread {
  background: linear-gradient(135deg, rgba(37,99,235,0.06), rgba(37,99,235,0));
  border-left: 3px solid var(--primary);
}
.notif-unread-pill {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
  font-weight: 600;
}
.notif-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 12px 4px 6px;
  font-weight: 600;
}

/* === @MENTION PILL === */
.mention-pill {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(37, 99, 235, 0.10);
  color: var(--primary);
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.96em;
}
.mention-pill.mention-self {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* === @MENTION AUTOCOMPLETE DROPDOWN === */
.mention-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  min-width: 220px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}
.mention-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-bottom: 1px solid var(--border);
}
.mention-item:last-child { border-bottom: 0; }
.mention-item:hover, .mention-item.active {
  background: rgba(37, 99, 235, 0.08);
}

/* === PUSH STATUS SATIRI (bildirim modal'ı içinde) === */
.push-status {
  background: linear-gradient(135deg, #f1f5f9, #f8fafc);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.push-status-line {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.push-status-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* === IMPERSONATION ÇUBUĞU === */
.impersonation-bar {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(245,158,11,0.3);
  position: sticky;
  top: 0;
  z-index: 50;
}
.impersonation-bar b { font-weight: 700; }
.impersonation-bar .btn {
  background: var(--card);
  color: #92400e;
  font-weight: 600;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.impersonation-bar .btn:hover { background: #fef3c7; }

/* === SOHBET — WHATSAPP TARZI === */
.chat-app {
  display: flex;
  height: calc(100vh - 53px);  /* topbar yüksekliği */
  background: var(--bg);
}
body:has(#impersonation-bar:not([style*="display:none"])) .chat-app {
  height: calc(100vh - 53px - 42px);  /* impersonation bar varsa */
}

.chat-sidebar {
  width: 340px;
  border-right: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-sidebar-header h3 { font-size: 16px; }

.chat-list {
  flex: 1;
  overflow-y: auto;
}
.chat-list-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.chat-list-item:hover { background: var(--bg); }
.chat-list-item.active { background: rgba(37, 99, 235, 0.1); }

.chat-list-avatar {
  width: 44px;
  height: 44px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.chat-list-content { flex: 1; min-width: 0; }
.chat-list-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.chat-list-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chat-list-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.chat-list-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.chat-list-preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chat-list-preview b { color: var(--text); font-weight: 500; }
.chat-hidden-badge {
  margin-top: 4px;
  font-size: 11px;
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  align-self: flex-start;
}
.chat-unread-dot {
  background: var(--primary);
  color: white;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f0f4f8 0%, #e2e8f0 100%);
  overflow: hidden;
}
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.chat-active-header {
  background: var(--card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.chat-active-avatar {
  width: 40px;
  height: 40px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.chat-active-title { font-weight: 600; font-size: 15px; }
.chat-active-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-viewall-tag {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-msg {
  background: var(--card);
  border-radius: 12px;
  padding: 8px 12px;
  max-width: 70%;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-msg.mine {
  background: #dcfce7;
  align-self: flex-end;
}
.chat-msg-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}
.chat-msg-text {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg-photo {
  margin-top: 4px;
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
}
.chat-msg-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
}
.chat-msg-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.chat-msg-del:hover { color: var(--danger); }

.chat-send-form {
  background: var(--card);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
}
.chat-send-form input[type="text"] {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}
.chat-photo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
}
.chat-photo-btn:hover { background: #e2e8f0; }

/* Yeni sohbet modalı */
.chat-type-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--card);
}
.chat-type-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}
.chat-type-option input { width: auto; }

.new-chat-user-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.new-chat-user {
  display: flex;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  align-items: center;
  gap: 10px;
}
.new-chat-user:last-child { border-bottom: none; }
.new-chat-user:hover { background: var(--bg); }
.new-chat-user.selected {
  background: rgba(37, 99, 235, 0.1);
}

/* === ŞANTİYE SOHBETİ: İŞE DÖNÜŞTÜRÜLDÜ === */
.forwarded-info {
  margin-top: 6px;
  padding: 6px 10px;
  background: #d1fae5;
  color: #065f46;
  border-radius: 6px;
  font-size: 12px;
}
.forwarded-info b { font-weight: 700; }

.forward-source {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* Admin table */
.table-wrap {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}
tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Monaco, Consolas, monospace; font-size: 13px; }

.warning-banner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  font-size: 14px;
  min-width: 220px;
  animation: slideIn 0.2s ease-out;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 4px;
}
.tabs-bar button {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs-bar button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

@media (max-width: 600px) {
  .container { padding: 16px; }
  .auth-card { padding: 28px 20px; }
  .topbar { padding: 10px 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* === ÇEVRİMİÇİ DURUMU === */
.online-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  border: 1.5px solid white;
  box-shadow: 0 0 0 1px var(--border);
}
.online-dot.online {
  background: #10b981;       /* yeşil */
  box-shadow: 0 0 0 1px #10b981, 0 0 6px rgba(16, 185, 129, 0.5);
  animation: onlinePulse 2.2s ease-in-out infinite;
}
.online-dot.offline {
  background: #94a3b8;       /* gri */
}
@keyframes onlinePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.85; }
}
html.dark-mode .online-dot { border-color: var(--card); }

/* Chat avatar üzerinde nokta — sağ alt köşede konumlandır */
.chat-list-avatar, .chat-active-avatar {
  position: relative;
}
.online-dot-overlay {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  margin-right: 0;
  border-width: 2px;
}
/* Çevrimiçi satırı — listede küçük etiket */
.online-status-text {
  font-size: 11px;
  color: var(--muted);
}
.online-status-text.online { color: #10b981; font-weight: 500; }

/* === KULLANIM KILAVUZU === */
.guide-btn { white-space: nowrap; }
.guide-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(37,99,235,0.10), rgba(37,99,235,0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
html.dark-mode .guide-hero { background: linear-gradient(135deg, rgba(59,130,246,0.16), rgba(59,130,246,0.04)); }
.guide-hero-icon { font-size: 36px; flex-shrink: 0; }
.guide-hero h2 { font-size: 17px; margin-bottom: 4px; color: var(--text); }
.guide-hero p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.guide-role {
  background: var(--primary);
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.guide-section { margin-bottom: 22px; }
.guide-section > h3 {
  font-size: 15px;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.guide-note {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.guide-grp { margin-bottom: 12px; }
.guide-grp h4 {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 4px;
}
.guide-grp ul, .guide-section > ul {
  margin: 0 0 0 18px;
  padding: 0;
}
.guide-grp li, .guide-section > ul li {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}
.guide-grp p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

/* === YAPAY ZEKA ASİSTANI === */
.ai-btn { white-space: nowrap; }
.ai-quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ai-chip {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.ai-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ai-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 2px;
}
.ai-msg { display: flex; gap: 8px; max-width: 100%; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-user .ai-msg-body {
  background: var(--primary);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  padding: 9px 13px;
  max-width: 80%;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-msg-ai .ai-msg-icon { font-size: 20px; flex-shrink: 0; }
.ai-msg-ai .ai-msg-body {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px 14px 14px 4px;
  padding: 9px 13px;
  max-width: 86%;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.ai-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  align-items: flex-end;
}
.ai-input-bar textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  font-size: 14px;
}
.ai-input-bar .btn { height: 42px; }
@media (max-width: 640px) {
  .ai-chip { font-size: 11px; padding: 5px 9px; }
  #ai-modal .modal { width: calc(100% - 12px); max-width: 100%; height: 90vh; }
}

/* === ŞANTİYE EXCEL TAKİP === */
.excel-doc-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--card);
}
.excel-doc-header { display: flex; align-items: flex-start; gap: 10px; }
.excel-doc-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}
.excel-doc-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.excel-label {
  background: rgba(37,99,235,0.12);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.excel-doc-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.excel-versions {
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.excel-versions summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}
.excel-version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.excel-version-row:last-child { border-bottom: none; }

/* Excel önizleme tablosu */
.excel-sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 2;
}
.excel-sheet-tab {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.excel-sheet-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}
.excel-table {
  border-collapse: collapse;
  font-size: 12px;
  width: max-content;
  background: var(--card);
}
html.dark-mode .excel-table { background: #1e293b; }
.excel-table td {
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  min-width: 60px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  vertical-align: middle;
}
html.dark-mode .excel-table td { border-color: #475569; color: #f1f5f9; }
.excel-table tr:first-child td { font-weight: 600; }
#excel-preview-content { background: var(--bg); }

/* Düzenleme modu */
.excel-table.excel-editing td {
  cursor: text;
  outline: none;
}
.excel-table.excel-editing td:hover {
  box-shadow: inset 0 0 0 2px rgba(37,99,235,0.35);
}
.excel-table.excel-editing td:focus {
  box-shadow: inset 0 0 0 2px var(--primary);
  background: rgba(37,99,235,0.06) !important;
}
.excel-table td.excel-cell-changed {
  box-shadow: inset 0 0 0 2px var(--warning);
  font-weight: 600;
}
.excel-table td.excel-cell-colored {
  box-shadow: inset 0 0 0 2px var(--success);
}
#excel-edit-status { white-space: nowrap; }

/* Renk paleti araç çubuğu */
.excel-color-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.excel-brush {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.excel-brush.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}
.excel-brush-color {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}
.excel-brush-color.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--primary);
}
.excel-brush-hint {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}
.excel-table.excel-editing td { cursor: pointer; }

@media (max-width: 640px) {
  .excel-doc-actions .btn { flex: 1 1 auto; }
}

/* === LOG SATIR SEÇİMİ === */
#logs-tbody tr.row-selected {
  background: rgba(37, 99, 235, 0.07);
}
#logs-tbody tr.row-selected td {
  border-color: rgba(37, 99, 235, 0.18);
}
html.dark-mode #logs-tbody tr.row-selected {
  background: rgba(59, 130, 246, 0.15);
}
#log-selection-bar {
  display: none;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* === TOPLU MALZEME SİPARİŞİ === */
.bulk-tab-btn {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.bulk-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.bulk-list-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.bulk-row {
  display: grid;
  grid-template-columns: 28px 2.2fr 1fr 1fr 1.5fr 36px;
  gap: 6px;
  align-items: center;
  background: var(--card);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.bulk-row-num {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.bulk-row input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.bulk-row-del {
  padding: 4px 6px !important;
  font-size: 13px;
}
@media (max-width: 640px) {
  .bulk-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .bulk-row-num { display: none; }
  .bulk-row .bulk-row-name { grid-column: 1 / 3; }
  .bulk-row .bulk-row-notes { grid-column: 1 / 2; }
  .bulk-row .bulk-row-del { grid-column: 2 / 3; }
}

/* === BATCH GRUPLAMA (toplu sipariş başlığı) === */
.material-batch-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--card);
}
.batch-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(37,99,235,0.06), rgba(37,99,235,0.02));
  border-bottom: 1px solid var(--border);
}
html.dark-mode .batch-header {
  background: linear-gradient(135deg, rgba(59,130,246,0.10), rgba(59,130,246,0.04));
}
.batch-header-photo {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.batch-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.batch-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.batch-items .item-row {
  border-left: 3px solid rgba(37,99,235,0.18);
}

/* === BROADCAST / TOPLU BİLDİRİM === */
.broadcast-form-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.radio-card {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}
.radio-card input[type="radio"] {
  width: auto;
  margin-top: 2px;
}
.broadcast-user-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.broadcast-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.broadcast-user-row:last-child { border-bottom: none; }
.broadcast-user-row:hover { background: var(--hover-bg); }
.broadcast-user-row.selected { background: rgba(37, 99, 235, 0.08); }
.broadcast-user-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.broadcast-history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.broadcast-history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.broadcast-history-text {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.broadcast-history-photo {
  max-width: 200px;
  max-height: 120px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  display: block;
}
.broadcast-history-stats {
  font-size: 11px;
  color: var(--muted);
}
.broadcast-notif-photo {
  max-width: 100%;
  max-height: 140px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
  border: 1px solid var(--border);
}

/* === MARKA / LOGO YÖNETİMİ === */
.brand-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.brand-upload-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.brand-upload-card h3 {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.brand-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}
.brand-preview {
  min-height: 140px;
  background: linear-gradient(45deg, #f8fafc 25%, transparent 25%), linear-gradient(-45deg, #f8fafc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f8fafc 75%), linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: white;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 12px;
  position: relative;
}
.brand-preview img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
}
.brand-preview-wide {
  min-height: 90px;
}
.brand-preview-wide img {
  max-height: 90px;
}
.brand-preview-empty {
  text-align: center;
  color: var(--muted);
}
.brand-preview-info {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: var(--success);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.brand-form input[type="file"] {
  font-size: 12px;
  padding: 6px;
}
html.dark-mode .brand-preview {
  background-color: var(--bg);
  background-image: linear-gradient(45deg, var(--border) 25%, transparent 25%), linear-gradient(-45deg, var(--border) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--border) 75%), linear-gradient(-45deg, transparent 75%, var(--border) 75%);
}

/* === İSTEK & ÖNERİ === */
.feedback-btn {
  white-space: nowrap;
}
.feedback-tab-btn {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.feedback-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.feedback-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--card);
}
.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.feedback-type {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  margin-right: 6px;
}
.feedback-status {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.feedback-time {
  font-size: 11px;
  color: var(--muted);
}
.feedback-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.feedback-text {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.feedback-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.feedback-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
}
.feedback-reply {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--success);
  border-radius: 6px;
  font-size: 13px;
}
.feedback-reply-header {
  font-weight: 600;
  color: var(--success);
  margin-bottom: 4px;
  font-size: 12px;
}

/* Admin feedback paneli için ek stiller */
.admin-feedback-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--card);
}
.admin-feedback-creator {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.admin-feedback-creator b { color: var(--text); }
.admin-feedback-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-feedback-reply-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-feedback-reply-form textarea {
  font-size: 13px;
  min-height: 60px;
}

/* === GÜN SONU RAPORLARI === */
.report-date-group {
  margin-bottom: 28px;
}
.report-date-header {
  font-size: 15px;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.report-site {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.report-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.report-workdone {
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  margin-bottom: 8px;
}
.report-notes {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
}
.report-notes b { color: var(--text); }
.report-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.report-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s;
  border: 1px solid var(--border);
}
.report-photo:hover { transform: scale(1.03); }
.report-filters input[type="date"], .report-filters select {
  height: 38px;
}

/* === MOBİL RESPONSIVE GENEL (≤780px) === */
@media (max-width: 780px) {
  /* Topbar — kompakt + flex-wrap */
  .topbar {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar .brand { font-size: 16px; }
  .topbar .brand-icon { width: 32px; height: 32px; font-size: 14px; }
  .topbar .user-info {
    gap: 6px;
    font-size: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .topbar .user-info > span:not(.role-badge):not(.notif-badge) {
    /* Kullanıcı adını gizle, sadece avatar/ikonlar kalsın */
    display: none;
  }
  .topbar .btn-sm { padding: 6px 8px; font-size: 12px; }
  .topbar .btn-sm:has(span:only-child) { padding: 4px 6px; }

  /* Container */
  .container { padding: 12px; max-width: 100%; }

  /* Kartlar tek sütun */
  .grid, .stats, .system-grid {
    grid-template-columns: 1fr !important;
  }

  /* Modal'lar tam ekran */
  .modal {
    width: calc(100% - 16px);
    max-width: 100%;
    margin: 8px;
    max-height: calc(100vh - 16px);
    border-radius: 12px;
  }
  .modal-body { max-height: calc(100vh - 200px); }

  /* Tab bar — yatay scroll */
  .tabs-bar {
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap;
  }
  .tabs-bar button {
    flex: 0 0 auto;
    font-size: 13px;
    padding: 10px 14px;
  }

  /* Auth — daha küçük padding */
  .auth-card { padding: 24px 18px; }

  /* Tablolar — yatay scroll */
  .table-wrap, .data-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 600px; }

  /* === Sohbet: WhatsApp tarzı TEK EKRAN (mobil) === */
  .chat-app {
    flex-direction: row;
    height: calc(100vh - 53px);
    height: calc(100dvh - 53px);
    position: relative;
    overflow: hidden;
  }
  body:has(#impersonation-bar:not([style*="display:none"])) .chat-app {
    height: calc(100dvh - 53px - 42px);
  }
  .chat-sidebar {
    position: absolute; inset: 0;
    width: 100%; max-height: none;
    border: 0; z-index: 1;
  }
  .chat-main {
    position: absolute; inset: 0; z-index: 2;
    transform: translateX(100%);
    transition: transform .24s ease;
    will-change: transform;
  }
  .chat-app.show-active .chat-main { transform: translateX(0); }
  .chat-mobile-back { display: inline-flex !important; }
  .chat-active-header {
    padding: 9px 10px; gap: 10px;
    position: sticky; top: 0; z-index: 3;
  }
  .chat-active-header .btn-sm { padding: 6px 9px; font-size: 12px; }
  .chat-active-title { font-size: 15px; }
  .chat-messages { padding: 12px 10px; }
  .chat-msg { max-width: 84%; }
  .chat-send-form { padding: 8px 10px; gap: 6px; }
  .chat-sidebar-header { padding: 12px 14px; }

  /* Dashboard kart düzeni */
  .site-card { padding: 14px; }

  /* Şantiye detayında flex column */
  .site-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .site-detail-actions { width: 100%; flex-wrap: wrap; }

  /* Bildirim panelindeki butonlar */
  .modal-footer {
    flex-wrap: wrap;
    gap: 6px;
  }
  .modal-footer .btn { flex: 1 1 auto; min-width: 110px; }

  /* Yorum (comment) padding'i azalt */
  .comment { padding: 8px 10px; }
  .comment-photo { max-width: 100%; }

  /* Form alanları */
  .form-row { flex-direction: column; gap: 12px; }
  .form-row > * { width: 100%; }

  /* Push status — telefonda dikey */
  .push-status { flex-direction: column; align-items: stretch; }
  .push-status-actions { justify-content: flex-end; }

  /* Sparkline — daha kısa */
  .sparkline { height: 140px; }

  /* Photo modal'da maksimum */
  #photo-large { max-width: 96vw !important; max-height: 86vh !important; }

  /* Site card'larda gereksiz boşluk kaldır */
  .badge { font-size: 10px; padding: 2px 6px; }

  /* Yetki listesi - daha kompakt */
  .perm-row { padding: 8px 10px; font-size: 13px; }
  .perm-row .perm-label > div:first-child { font-size: 13px; }
  .perm-row .perm-meta { font-size: 10px; }
}

/* === MOBİL DAR (≤480px) === */
@media (max-width: 480px) {
  .topbar { padding: 6px 8px; }
  .topbar .user-info { gap: 4px; }
  .topbar .role-badge { display: none; }  /* yer kazanmak için */
  .container { padding: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 22px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-sm { padding: 5px 8px; font-size: 12px; }
  .modal-header h3 { font-size: 15px; }
  .auth-card h1 { font-size: 20px; }
  /* Floating "yeni" butonları */
  .fab {
    bottom: 16px;
    right: 16px;
  }
}

/* Chat'te mobil "geri" butonu — defaultta gizli, mobil CSS'i göstermesi için */
.chat-mobile-back {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border: none; background: transparent; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--text);
  border-radius: 50%; padding: 0; margin-right: -2px;
}
.chat-mobile-back:hover { background: var(--hover-bg); }

/* ===================== KİŞİSEL DOSYA ALANI — macOS Finder ===================== */
.finder {
  position: relative;
  max-width: 1000px;
  margin: 18px auto 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  height: 74vh;
  min-height: 420px;
  overflow: hidden;
}
.finder-titlebar {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: linear-gradient(180deg, var(--hover-bg), var(--bg));
  border-bottom: 1px solid var(--border);
}
.finder-titlebar .tl { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.tl-r { background: #ff5f57; } .tl-y { background: #febc2e; } .tl-g { background: #28c840; }
.finder-title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--muted); pointer-events: none;
}
.finder-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--card); flex-wrap: wrap;
}
.finder-progress {
  padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.finder-progress[hidden] { display: none; }
.finder-progress-top {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.finder-progress-label {
  flex: 1; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.finder-progress-cancel {
  flex-shrink: 0; background: var(--danger); color: #fff; border: none;
  border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.finder-progress-cancel:hover { opacity: .9; }
.finder-progress-cancel:disabled { opacity: .5; cursor: default; }
.finder-progress-track {
  height: 8px; border-radius: 5px; background: var(--border); overflow: hidden;
}
.finder-progress-fill {
  height: 100%; width: 0%; background: var(--primary);
  border-radius: 5px; transition: width .15s ease;
}
.finder-tool {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background .12s;
}
.finder-tool:hover:not(:disabled) { background: var(--hover-bg); }
.finder-tool:disabled { opacity: .4; cursor: default; }
.finder-upload-btn { cursor: pointer; }
.finder-spacer { flex: 1; }
.finder-breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.finder-breadcrumb .crumb { color: var(--primary); cursor: pointer; padding: 2px 4px; border-radius: 5px; }
.finder-breadcrumb .crumb:hover { background: var(--hover-bg); }
.finder-breadcrumb .crumb-sep { color: var(--muted); }
.finder-body { flex: 1; overflow: auto; padding: 16px; }
.finder-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 6px;
}
.finder-item {
  position: relative; display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 14px 8px 10px; border-radius: 10px; cursor: default;
  border: 1px solid transparent; transition: background .1s, border-color .1s;
}
.finder-item:hover { background: var(--hover-bg); }
.finder-item:focus { outline: none; background: rgba(37,99,235,0.14); border-color: var(--primary); }
.finder-ico { font-size: 46px; line-height: 1; margin-bottom: 8px; user-select: none; }
.finder-name {
  font-size: 13px; color: var(--text); word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.finder-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.finder-actions {
  display: flex; gap: 4px; margin-top: 8px; opacity: 0; transition: opacity .12s;
}
.finder-item:hover .finder-actions, .finder-item:focus .finder-actions { opacity: 1; }
.finder-actions button {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 3px 7px; font-size: 12px; cursor: pointer; line-height: 1;
}
.finder-actions button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Taşı/Kopyala hedef klasör seçici ağacı */
.pick-tree {
  max-height: 48vh; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px; background: var(--bg);
}
.pick-row {
  display: flex; align-items: center; gap: 7px; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; color: var(--text); font-size: 14px;
  user-select: none;
}
.pick-row:hover { background: var(--hover-bg); }
.pick-row.sel { background: var(--primary); color: #fff; }
.pick-row.disabled { opacity: .4; cursor: not-allowed; }
.pick-row.disabled:hover { background: transparent; }
.pick-row .pick-ico { flex-shrink: 0; }

/* Bildirim kuralları kartları */
.nr-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  margin-bottom: 14px; background: var(--card);
}
.nr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.nr-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.nr-note {
  font-size: 12px; color: var(--muted); margin: 8px 0 0;
  background: var(--bg); border-radius: 6px; padding: 6px 9px;
}
.nr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.nr-sub { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.nr-list {
  border: 1px solid var(--border); border-radius: 8px; padding: 6px;
  background: var(--bg); max-height: 220px; overflow-y: auto;
}
.nr-list.nr-users { max-height: 260px; }
.nr-opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px;
  border-radius: 6px; font-size: 13px; color: var(--text); cursor: pointer;
}
.nr-opt:hover { background: var(--hover-bg); }
.nr-opt input { margin-top: 2px; flex-shrink: 0; }
.nr-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 680px) { .nr-cols { grid-template-columns: 1fr; } }

/* Şifreler ve Güvenlik modalı */
.sec-sect { margin: 4px 0; }
.sec-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.sec-userinfo {
  margin-bottom: 12px; padding: 10px; background: var(--bg);
  border-radius: 8px; font-size: 13px; color: var(--muted);
}
.sec-hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.sec-note { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.sec-sect .form-group { margin-bottom: 12px; }

/* Sistem grafiği zaman aralığı seçici */
.sys-range-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.sys-range-btn {
  padding: 7px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 600;
}
.sys-range-btn:hover { background: var(--hover-bg); }
.sys-range-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

.finder-empty, .finder-loading {
  height: 100%; min-height: 240px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--text);
}
.finder-loading { color: var(--muted); }
.finder-statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 14px; border-top: 1px solid var(--border);
  background: var(--bg); font-size: 12px; color: var(--muted);
}
.finder-quota { display: flex; align-items: center; gap: 8px; }
.finder-quota-bar {
  width: 140px; height: 7px; background: var(--border);
  border-radius: 999px; overflow: hidden;
}
.finder-quota-bar > div { height: 100%; width: 0; background: #34c759; transition: width .3s; }
.finder-quota-bar > div.q-warn { background: #febc2e; }
.finder-quota-bar > div.q-danger { background: #ff5f57; }
.finder-dropmask {
  position: absolute; inset: 40px 0 0 0; display: none;
  align-items: center; justify-content: center; font-size: 18px; font-weight: 600;
  color: var(--primary); background: rgba(37,99,235,0.12);
  border: 3px dashed var(--primary); border-radius: 0 0 12px 12px; z-index: 5;
}
.finder-dropmask.show { display: flex; }
.finder-hint { text-align: center; font-size: 12px; color: var(--muted); margin: 6px auto 24px; }
@media (max-width: 640px) {
  .finder { height: 80vh; margin: 10px; border-radius: 10px; }
  .finder-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .finder-ico { font-size: 38px; }
  .finder-title { display: none; }
}

/* ===== Kişisel dosya: Aç / Düzenle penceresi ===== */
.pf-window { max-width: 1100px; width: 94vw; height: 88vh; display: flex; flex-direction: column; }
.pf-body { flex: 1; overflow: auto; padding: 0; display: flex; flex-direction: column; background: var(--bg); }
.pf-loading { margin: auto; padding: 40px; color: var(--muted); }
.pf-hint { padding: 8px 14px; font-size: 12px; color: var(--muted); background: var(--card); border-bottom: 1px solid var(--border); }
.pf-img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; display: block; }
.pf-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.pf-text {
  flex: 1; width: 100%; border: 0; padding: 14px; resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.5; background: var(--card); color: var(--text);
}
.pf-text[readonly] { background: var(--bg); }
.pf-binary { margin: auto; text-align: center; padding: 40px; color: var(--text); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.pf-xls-tabs { display: flex; gap: 4px; padding: 8px 10px 0; background: var(--card); flex-wrap: wrap; }
.pf-tab {
  background: var(--bg); border: 1px solid var(--border); border-bottom: 0;
  color: var(--text); padding: 6px 12px; font-size: 12px; cursor: pointer;
  border-radius: 7px 7px 0 0;
}
.pf-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pf-xls-wrap { flex: 1; overflow: auto; padding: 10px; }
.pf-xls { border-collapse: collapse; font-size: 12px; background: var(--card); }
.pf-xls td {
  border: 1px solid var(--border); padding: 3px 7px; min-width: 64px; max-width: 320px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.pf-xls td[contenteditable="true"] { cursor: text; }
.pf-xls td[contenteditable="true"]:focus {
  outline: 2px solid var(--primary); outline-offset: -2px; overflow: visible;
  text-overflow: clip; background: var(--card);
}
.pf-xls td.pf-cell-ch { box-shadow: inset 0 0 0 2px var(--warning); }
@media (max-width: 640px) {
  .pf-window { width: 100vw; height: 92vh; max-width: 100vw; border-radius: 0; }
}

/* Sohbet dosya eki çipi — KENDİ yüzeyini taşır (balon rengine bağlı değil),
   böylece açık/koyu tema ve gelen/giden balon fark etmeksizin hep okunur. */
.chat-msg-file {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  padding: 8px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--primary); font-size: 13px; font-weight: 500;
  text-decoration: none; max-width: 100%; word-break: break-word;
}
.chat-msg-file:hover { background: var(--hover-bg); text-decoration: underline; }
.chat-msg-file.expired { color: var(--muted); cursor: default; font-style: italic; font-weight: 400; }

/* ===================== YANDAN AÇILAN MENÜ (off-canvas) ===================== */
.menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer; position: relative;
}
.menu-toggle:hover { background: var(--hover-bg); }
.menu-toggle .menu-dot {
  position: absolute; top: 5px; right: 5px; width: 10px; height: 10px;
  background: var(--danger); border-radius: 50%; display: none;
  border: 2px solid var(--card);
}
.menu-toggle.has-unread .menu-dot { display: block; }

/* Drawer TÜM ekran boyutlarında aynı davranır; eski topbar mobil kuralları
   (flex-wrap:wrap → buton kaybı, span/role gizleme) bunu BOZAMAZ. */
.topbar .user-info {
  /* top+bottom ile yükseklik garanti (dvh desteklenmese de) → mobilde kaydırır */
  position: fixed !important;
  top: 0 !important; right: 0 !important; bottom: 0 !important; left: auto !important;
  height: auto !important; max-height: none !important;
  width: min(330px, 86vw);
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 34px rgba(0,0,0,0.20);
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 6px;
  font-size: 14px;
  padding: 14px 16px 28px;
  transform: translateX(106%);
  transition: transform .22s ease;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 60;
}
.topbar .user-info.open { transform: translateX(0); }

.menu-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 55;
}
.menu-backdrop.open { opacity: 1; pointer-events: auto; }

.menu-close {
  position: absolute; top: 14px; right: 16px;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.menu-close:hover { background: var(--hover-bg); }

/* Drawer içinde HER eski/yeni aksiyon: tam genişlik dikey liste öğesi.
   ÖNEMLİ: Yetkiye göre JS ile gizlenen öğeler (style="display:none") drawer'da
   da gizli kalmalı — :not(...) ile flex kuralının dışında bırakıyoruz, yoksa
   "display:flex !important" inline gizlemeyi ezip yönetici panelini herkese gösterir. */
.topbar .user-info > .btn:not([style*="display:none"]):not([style*="display: none"]),
.topbar .user-info > a:not([style*="display:none"]):not([style*="display: none"]),
.topbar .user-info > button:not(.menu-close):not([style*="display:none"]):not([style*="display: none"]),
.topbar .user-info > .theme-toggle:not([style*="display:none"]):not([style*="display: none"]),
.topbar .user-info > label:not([style*="display:none"]):not([style*="display: none"]) {
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box;
  align-items: center;
  justify-content: flex-start !important;
  text-align: left;
  padding: 12px 14px !important;
  font-size: 15px !important;
  border-radius: 8px !important;
  height: auto !important;
  min-height: 0;
  flex-shrink: 0;
  margin: 0;
}
/* 780px medya kuralı #user-name span'ını gizliyordu — ID özgüllüğü daha
   yüksek olduğu için drawer'da geri görünür. */
.topbar .user-info #user-name {
  display: block !important;
  font-weight: 700; font-size: 16px;
  padding: 6px 14px; color: var(--text);
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
/* 480px medya kuralı .topbar .role-badge'i gizliyordu — drawer'da göster.
   (Kişiye özel rol gizleme JS inline display:none ile yapıldığından korunur.) */
.topbar .user-info .role-badge { align-self: flex-start; margin: 4px 14px 8px; }
.topbar .user-info .notif-btn { position: relative; }

/* Yan menü başlığındaki Gürbüz markası (giriş ekranıyla aynı) */
.topbar .user-info > .menu-brand {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; box-sizing: border-box;
  padding: 6px 8px 14px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.menu-brand-logo {
  display: block; width: 100%; max-width: 210px; height: auto; margin: 4px auto 6px;
}
.menu-brand-sub {
  font-size: 12px; color: var(--muted); text-align: center; font-weight: 500;
}
