/* ============================================================
   Storehouse — arayuz stilleri
   Not: CSP "style-src 'self'" oldugu icin inline style kullanilmaz;
   tum gorsel tanimlar bu dosyada yer alir.
   ============================================================ */

:root {
  /* Zemin ve yuzeyler */
  --bg: #080b14;
  --surface: rgba(22, 29, 45, 0.72);
  --surface-solid: #161d2d;
  --surface-2: rgba(38, 48, 72, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Metin */
  --text: #e9eef8;
  --muted: #a3b0c8;
  --faint: #808ea8;

  /* Vurgu */
  --accent: #6d8cff;
  --accent-2: #a06dff;
  --accent-soft: rgba(109, 140, 255, 0.15);
  --grad: linear-gradient(135deg, #6d8cff 0%, #a06dff 100%);

  --danger: #ff5d67;
  --danger-soft: rgba(255, 93, 103, 0.13);
  --success: #35d6a0;
  --success-soft: rgba(53, 214, 160, 0.13);

  --radius: 16px;
  --radius-sm: 10px;
  --pill: 999px;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --glow: 0 6px 20px rgba(109, 140, 255, 0.35);

  /* Temaya gore degisen yardimci renkler */
  --hover: rgba(255, 255, 255, 0.05);
  --hover-strong: rgba(255, 255, 255, 0.09);
  --row-hover: rgba(255, 255, 255, 0.035);
  --thead-bg: #131a29;
  --row-hover-solid: #1c2436;
  --input-bg: rgba(8, 11, 20, 0.6);
  --input-bg-focus: rgba(8, 11, 20, 0.85);
  --sidebar-bg: rgba(11, 15, 25, 0.7);
  --glow-1: rgba(109, 140, 255, 0.20);
  --glow-2: rgba(160, 109, 255, 0.16);
  --glow-3: rgba(53, 214, 160, 0.08);
}

/* ---------------------------------------------------------
   Acik tema — sag ustteki dugmeyle secilir (public/js/theme.js)
   --------------------------------------------------------- */

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-2: rgba(15, 23, 42, 0.05);
  --border: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(15, 23, 42, 0.2);

  --text: #16203a;
  --muted: #4a5670;
  --faint: #667490;

  --accent: #3f62e0;
  --accent-2: #7c43e0;
  --accent-soft: rgba(63, 98, 224, 0.11);
  --grad: linear-gradient(135deg, #3f62e0 0%, #7c43e0 100%);

  --danger: #d92c3a;
  --danger-soft: rgba(217, 44, 58, 0.09);
  --success: #12915f;
  --success-soft: rgba(18, 145, 95, 0.1);

  --shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.14);
  --glow: 0 6px 18px rgba(63, 98, 224, 0.28);

  --hover: rgba(15, 23, 42, 0.045);
  --hover-strong: rgba(15, 23, 42, 0.08);
  --row-hover: rgba(15, 23, 42, 0.03);
  --thead-bg: #eef1f8;
  --row-hover-solid: #f1f4fb;
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --sidebar-bg: rgba(255, 255, 255, 0.82);
  --glow-1: rgba(63, 98, 224, 0.13);
  --glow-2: rgba(124, 67, 224, 0.10);
  --glow-3: rgba(18, 145, 95, 0.07);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="light"] input[type=date] { color-scheme: light; }

/* Koyu tema icin secilmis pastel metin renkleri acik zeminde okunmaz;
   acik temada koyulastirilmis karsiliklari kullanilir. */
:root[data-theme="light"] .badge-team,
:root[data-theme="light"] .conv-item.is-unread .conv-title,
:root[data-theme="light"] .secret-mask.is-revealed,
:root[data-theme="light"] .msg-sender,
:root[data-theme="light"] .th-custom,
:root[data-theme="light"] .badge-role-it { color: #2f4bbd; }

:root[data-theme="light"] .badge-role-superadmin,
:root[data-theme="light"] .flash-error { color: #a81a26; }

:root[data-theme="light"] .badge-role-hr,
:root[data-theme="light"] .badge-on,
:root[data-theme="light"] .badge-title-team_leader,
:root[data-theme="light"] .flash-success { color: #0b6e48; }

:root[data-theme="light"] .badge-title-supervisor,
:root[data-theme="light"] .notice { color: #8a5200; }
:root[data-theme="light"] .notice {
  background: rgba(255, 182, 72, 0.14);
  border-color: rgba(180, 120, 20, 0.35);
}

:root[data-theme="light"] .badge-title-manager { color: #6b2fb5; }

:root[data-theme="light"] .msg-mine .msg-bubble {
  background: linear-gradient(135deg, rgba(63, 98, 224, 0.14), rgba(124, 67, 224, 0.14));
  border-color: rgba(63, 98, 224, 0.3);
}

:root[data-theme="light"] .btn-danger { color: #a81a26; }
:root[data-theme="light"] .secret-input { color: var(--text); }

/* ---------------------------------------------------------
   Sagdan sola (Arapca) duzeltmeleri
   Flex ve metin yonu dir="rtl" ile kendiliginden donduğu icin
   yalnizca sabit yon veren kurallar burada duzeltilir.
   --------------------------------------------------------- */

[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .col-actions { right: auto; left: 0; box-shadow: 12px 0 14px -12px rgba(0, 0, 0, 0.9); }
[dir="rtl"] .unread-badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .sidebar-foot { margin-left: 0; }
[dir="rtl"] .msg-bubble { border-radius: 14px 14px 4px 14px; }
[dir="rtl"] .msg-mine .msg-bubble { border-radius: 14px 14px 14px 4px; }
[dir="rtl"] .msg-time { text-align: left; }
[dir="rtl"] .right { text-align: left; }
[dir="rtl"] .team-caret svg { transform: scaleX(-1); }
[dir="rtl"] select {
  background-position: left 12px center;
  padding-right: 13px;
  padding-left: 34px;
}

/* Arapca metin biraz daha buyuk okunur. */
[dir="rtl"] body { font-size: 15px; }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Arka plandaki yumusak isik lekeleri */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(760px 460px at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(700px 420px at 92% 4%, var(--glow-2), transparent 62%),
    radial-gradient(900px 600px at 50% 110%, var(--glow-3), transparent 65%);
  pointer-events: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

::selection { background: var(--accent-soft); }

/* ---------------------------------------------------------
   Ust serit ve tema dugmesi (sag ust)
   --------------------------------------------------------- */

.topstrip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 28px 0;
  max-width: 1400px;
  margin: 0 auto;
}

/* Dil secici: her dil ayri bir gonder dugmesi, JavaScript gerektirmez. */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.lang-option {
  padding: 0 11px;
  height: 36px;
  min-width: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.lang-option + .lang-option { border-inline-start: 1px solid var(--border); }
.lang-option:hover { background: var(--hover); color: var(--text); }
.lang-option.is-active { background: var(--accent-soft); color: var(--accent); }

.topstrip-bare { padding: 0 0 8px; max-width: 400px; width: 100%; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }

/* Koyu temada ay, acik temada gunes simgesi gosterilir. */
.theme-icon { display: none; }
.theme-icon-dark { display: flex; }
:root[data-theme="light"] .theme-icon-dark { display: none; }
:root[data-theme="light"] .theme-icon-light { display: flex; }

/* ---------------------------------------------------------
   Kenar cubugu (sidebar) yerlesimi
   --------------------------------------------------------- */

.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  flex: none;
  width: 244px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 16px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
}

.main { flex: 1; min-width: 0; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  overflow-y: auto;
}

.nav-group { display: flex; flex-direction: column; gap: 3px; }

.nav-group-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 12px 6px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.side-link svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.side-link:hover { background: var(--hover); color: var(--text); }

.side-link.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.side-link.is-active svg { opacity: 1; }

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-foot .user-chip { width: 100%; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.2px;
  color: var(--text);
}

.brand:hover { color: var(--text); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  flex: none;
}

.brand-mark svg { width: 19px; height: 19px; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-sub { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: 1.1px; text-transform: uppercase; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 14px 5px 5px;
  border-radius: var(--pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.user-chip-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip-role { font-size: 12px; color: var(--muted); line-height: 1.2; }
.user-chip-text { display: flex; flex-direction: column; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--pill);
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex: none;
}

.avatar-lg { width: 38px; height: 38px; font-size: 14px; }

/* ---------------------------------------------------------
   Yerlesim
   --------------------------------------------------------- */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-narrow { max-width: 560px; }
.card-tight { max-width: 480px; }
.card-flush { padding: 6px 8px 2px; }

h1 { font-size: 25px; margin: 0 0 5px; letter-spacing: -0.5px; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 14px; font-weight: 650; }
p.subtitle { color: var(--muted); margin: 0; font-size: 14px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.page-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 5px; }

.title-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  flex: none;
}
.title-icon svg { width: 20px; height: 20px; }
.page-title-row h1 { margin: 0; }

/* ---------------------------------------------------------
   Istatistik kutulari
   --------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.stat::after {
  content: "";
  position: absolute;
  top: 0; left: 18px; right: 18px;
  height: 2px;
  background: var(--grad);
  border-radius: 0 0 4px 4px;
  opacity: 0.75;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(109, 140, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.stat-icon svg { width: 19px; height: 19px; }

.stat-icon.tone-green { background: var(--success-soft); border-color: rgba(53, 214, 160, 0.3); }
.stat-icon.tone-red { background: var(--danger-soft); border-color: rgba(255, 93, 103, 0.3); }
.stat-icon.tone-violet { background: rgba(160, 109, 255, 0.14); border-color: rgba(160, 109, 255, 0.32); }

.stat-value { font-size: 23px; font-weight: 700; line-height: 1.1; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------------
   Tablo
   --------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 13px 11px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

thead th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

tbody tr { transition: background 0.14s ease; }
tbody tr:hover td { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: none; }

/* Islem sutunu, tablo yatay kaydirilsa bile sagda sabit kalir. */
.col-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface-solid);
  box-shadow: -12px 0 14px -12px rgba(0, 0, 0, 0.9);
}

thead .col-actions { background: var(--thead-bg); }
tbody tr:hover .col-actions { background: var(--row-hover-solid); }

/* Log detayinda "Alan: eski → yeni" satirlari alt alta okunsun. */
.log-detail { line-height: 1.6; min-width: 260px; }

/* Log'da sifre degisikligi: eski ve yeni deger yan yana, yildizla gizli. */
.secret-diff {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--row-hover);
  border: 1px solid var(--border);
}

.secret-diff-row { display: flex; flex-direction: column; gap: 5px; }
.secret-diff-label { font-weight: 650; color: var(--muted); font-size: 12px; }
.secret-diff-pair { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secret-diff-side { display: flex; align-items: center; gap: 6px; }
.secret-diff-arrow { color: var(--faint); }

/* Ek sutunlar formda ayri bir bolumde toplanir. */
.form-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--faint);
}
.form-section-title svg { width: 14px; height: 14px; }

.th-custom { color: #a6bcff; }

/* Odeme cuzdani hucresi: uzun adres tasmasin. */
.wallet-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

.wallet-address {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* ---------------------------------------------------------
   Yetki paneli
   --------------------------------------------------------- */

.perm-table th:first-child, .perm-table td:first-child { min-width: 260px; }
.perm-table .perm-cell { text-align: right; width: 120px; }

.perm-group-row th {
  background: var(--row-hover);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 1px;
  padding-top: 14px;
  padding-bottom: 10px;
}

.perm-name { font-weight: 600; font-size: 14px; }
.perm-hint { font-size: 12px; color: var(--faint); margin-top: 2px; }

.perm-switch { display: inline-flex; margin: 0; cursor: pointer; }
.perm-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.perm-track {
  width: 40px;
  height: 22px;
  border-radius: var(--pill);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.perm-knob {
  width: 16px;
  height: 16px;
  border-radius: var(--pill);
  background: var(--faint);
  transition: transform 0.16s ease, background 0.16s ease;
}

.perm-switch input:checked + .perm-track {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.perm-switch input:checked + .perm-track .perm-knob {
  transform: translateX(18px);
  background: var(--accent);
}
.perm-switch input:focus-visible + .perm-track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Varsayilandan farkli hucreler isaretlenir. */
.perm-switch.is-custom .perm-track { border-style: dashed; }

.perm-locked {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 22px;
  color: var(--faint);
  cursor: help;
}
.perm-locked svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------
   Servis genel bakisi ve ajan formundaki servis bolumleri
   --------------------------------------------------------- */

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 0;
  padding: 16px 18px;
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.service-card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }

.service-card-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.service-name { font-weight: 650; font-size: 14.5px; }
.service-count { font-size: 12px; color: var(--faint); margin-top: 2px; }
.service-card .team-caret { transform: rotate(-90deg); }
[dir="rtl"] .service-card .team-caret { transform: rotate(90deg); }

/* Ajan formunda her servis kendi acilir bolumunde */
.form-service {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px 2px;
  background: var(--row-hover);
}
.form-service[open] { padding-bottom: 14px; }

.form-service-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.form-service-head::-webkit-details-marker { display: none; }
.form-service-head .form-section-title { flex: 1; }
.form-service[open] .team-caret { transform: rotate(180deg); color: var(--accent); }
.form-service label:first-of-type { margin-top: 4px; }

/* ---------------------------------------------------------
   Dosya sunucusu
   --------------------------------------------------------- */

/* Buton icindeki kucuk sayac (ornegin belge sayisi). */
.count-pill {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  flex: none;
}
.file-icon svg { width: 16px; height: 16px; }

.upload-card { padding-top: 18px; }
.upload-summary {
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.upload-summary::-webkit-details-marker { display: none; }
.upload-card[open] .team-caret { transform: rotate(180deg); color: var(--accent); }
.upload-card[open] .upload-summary { margin-bottom: 6px; }

/* Kisi basina erisim seviyesi satiri */
.access-row { cursor: default; }
.access-row .access-level {
  width: auto;
  min-width: 170px;
  padding: 6px 30px 6px 10px;
  font-size: 12.5px;
  background-position: right 8px center;
}
[dir="rtl"] .access-row .access-level { background-position: left 8px center; padding: 6px 10px 6px 30px; }

/* Onizleme */
.preview-card { padding: 0; overflow: hidden; }

.preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--row-hover);
  min-height: 240px;
}

.preview-image {
  max-width: 100%;
  max-height: min(70vh, 720px);
  border-radius: var(--radius-sm);
  display: block;
}

.preview-media { max-width: 100%; max-height: min(70vh, 720px); border-radius: var(--radius-sm); }

.preview-frame {
  width: 100%;
  height: min(78vh, 900px);
  border: none;
  display: block;
  background: var(--surface-solid);
}

.preview-text {
  margin: 0;
  padding: 20px;
  max-height: min(72vh, 820px);
  overflow: auto;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  text-align: start;
}

.preview-card .empty-state { padding: 48px 20px; }

/* Form icinde tek satirlik onay kutusu. */
.pick-item-inline {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

/* Takimlar sayfasi */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}
.team-card { margin-bottom: 0; }
.team-name { font-size: 16px; margin: 0 0 2px; }

/* Baslik tiklanabilir: takim karti acilir / kapanir. */
.team-card-head {
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.team-card-head::-webkit-details-marker { display: none; }
.team-card-head:hover .team-name { color: #c3d0ff; }

.team-card-title { flex: 1; min-width: 0; }

.team-caret {
  display: flex;
  color: var(--faint);
  transition: transform 0.2s ease, color 0.16s ease;
}
.team-caret svg { width: 18px; height: 18px; }
.team-card[open] .team-caret { transform: rotate(180deg); color: var(--accent); }
.team-card-head:hover .team-caret { color: var(--text); }

/* Ajani olan takimda liste basligi ayirir; bos takim kompakt kalir. */
.team-card .team-agents { margin-top: 16px; }
.team-card .empty-state { padding: 14px 0 2px; text-align: left; }

.team-agents {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.team-agent {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.14s ease;
}
.team-agent:last-child { border-bottom: none; }
.team-agent:hover { background: var(--hover); color: var(--text); }
.team-agent-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }

/* Cok sutunlu ajan tablosu: daha dar bosluk, yatay kaydirma .table-wrap'te. */
.table-wide th, .table-wide td { padding: 12px 9px; font-size: 13.5px; }
.table-wide thead th { font-size: 11.5px; letter-spacing: 0.3px; }
.table-wide td:first-child, .table-wide th:first-child { padding-left: 14px; }
.table-wide td:last-child, .table-wide th:last-child { padding-right: 14px; }

.cell-person { display: flex; align-items: center; gap: 11px; }
.person-name { font-weight: 600; line-height: 1.25; white-space: nowrap; }
.person-sub { font-size: 12px; color: var(--faint); line-height: 1.25; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

/* ---------------------------------------------------------
   Butonlar
   --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { background: var(--hover-strong); border-color: rgba(255, 255, 255, 0.26); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7d99ff 0%, #ad7fff 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(109, 140, 255, 0.45);
}

.btn-violet {
  background: linear-gradient(135deg, #a06dff 0%, #d46dff 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px rgba(160, 109, 255, 0.35);
}
.btn-violet:hover {
  background: linear-gradient(135deg, #ae82ff 0%, #dc82ff 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(160, 109, 255, 0.45);
}

.btn-danger { background: var(--danger-soft); border-color: rgba(255, 93, 103, 0.42); color: #ff9ba1; }
.btn-danger:hover { background: rgba(255, 93, 103, 0.22); border-color: var(--danger); color: #ffb4b8; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-block { width: 100%; justify-content: center; padding: 11px 16px; font-size: 15px; }

form.inline { display: inline-flex; }

/* ---------------------------------------------------------
   Formlar
   --------------------------------------------------------- */

label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin: 16px 0 7px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

input[type=text], input[type=password], input[type=email], input[type=date], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input::placeholder, textarea::placeholder { color: var(--faint); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--input-bg-focus);
}

input[readonly] { color: var(--muted); }

/* Tarih alaninin takvim simgesi koyu temada gorunur kalsin. */
input[type=date] { color-scheme: dark; cursor: text; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

textarea { resize: vertical; min-height: 76px; }

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238c9ab4' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 13px;
  padding-right: 34px;
}

.actions { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }

.field-hint { font-size: 12px; color: var(--faint); margin: 6px 0 0; }

/* ---------------------------------------------------------
   Bildirimler
   --------------------------------------------------------- */

.flash {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid;
  animation: flash-in 0.28s ease both;
}

.flash svg { width: 17px; height: 17px; flex: none; }

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-error { background: var(--danger-soft); color: #ffa8ad; border-color: rgba(255, 93, 103, 0.45); }
.flash-success { background: var(--success-soft); color: #7cebc4; border-color: rgba(53, 214, 160, 0.45); }

/* ---------------------------------------------------------
   Giris ekrani
   --------------------------------------------------------- */

/* Ust bar olmayan sayfalarda (giris, hata) icerik dikeyde ortalanir. */
body.bare .container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px;
}

/* Giris ekraninda bildirim, kart genisligiyle hizali dursun. */
body.bare .flash {
  width: 100%;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 34px 32px 30px;
  box-shadow: var(--shadow-lg);
  animation: card-in 0.4s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 6px;
}

.login-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 34px rgba(109, 140, 255, 0.45);
  margin-bottom: 16px;
}
.login-mark svg { width: 30px; height: 30px; }

.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card .subtitle { margin-bottom: 8px; font-size: 13.5px; }

.login-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.login-foot svg { width: 13px; height: 13px; }

/* ---------------------------------------------------------
   Rozetler ve kucuk parcalar
   --------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--pill);
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

.badge svg { width: 12px; height: 12px; flex: none; }

/* Sifre sutununda rozet kullanildiginda monospace/harf araligi devralmasin. */
.secret-cell .badge { font-family: inherit; letter-spacing: 0; }

.badge-role-superadmin { color: #ffa8ad; border-color: rgba(255, 93, 103, 0.4); background: var(--danger-soft); }
.badge-role-it { color: #a6bcff; border-color: rgba(109, 140, 255, 0.4); background: var(--accent-soft); }
.badge-role-hr { color: #7cebc4; border-color: rgba(53, 214, 160, 0.4); background: var(--success-soft); }

.badge-team { color: #c3d0ff; border-color: rgba(109, 140, 255, 0.35); background: rgba(109, 140, 255, 0.1); }

/* Ajan unvanlari: kidem yukseldikce renk belirginlesir. */
.badge-title-agent { color: var(--muted); }
.badge-title-team_leader { color: #7cebc4; border-color: rgba(53, 214, 160, 0.4); background: var(--success-soft); }
.badge-title-supervisor { color: #ffd79a; border-color: rgba(255, 182, 72, 0.42); background: rgba(255, 182, 72, 0.12); }
.badge-title-manager { color: #d9b8ff; border-color: rgba(160, 109, 255, 0.45); background: rgba(160, 109, 255, 0.14); }

.mt-8 { margin-top: 8px; }

.badge-on { color: #7cebc4; border-color: rgba(53, 214, 160, 0.4); background: var(--success-soft); }
.badge-off { color: var(--faint); }

.dot { width: 6px; height: 6px; border-radius: var(--pill); background: currentColor; flex: none; }

.secret-cell { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 1px; }

/* Tabloda yildizla gizlenen sifre; tiklaninca acilir. */
.secret-mask {
  display: inline-block;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--muted);
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
  user-select: all;
  transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}
.secret-mask:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

.secret-mask.is-revealed {
  color: #c3d0ff;
  letter-spacing: 0.5px;
  background: rgba(109, 140, 255, 0.12);
  border-color: rgba(109, 140, 255, 0.45);
}

.secret-mask.is-error { color: #ffa8ad; border-color: var(--danger); }

/* input[readonly] kuralini gecmesi icin element + sinif birlikte hedeflenir. */
input.secret-input {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  cursor: text;
  border-color: rgba(109, 140, 255, 0.45);
  background: rgba(109, 140, 255, 0.08);
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.8px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.empty-state {
  text-align: center;
  padding: 54px 20px;
  color: var(--faint);
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.5; margin-bottom: 12px; }
.empty-state-title { font-size: 15px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 182, 72, 0.1);
  border: 1px solid rgba(255, 182, 72, 0.32);
  color: #ffd79a;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 4px 0 8px;
}
.notice svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

.error-code {
  font-size: 58px;
  font-weight: 800;
  letter-spacing: -2px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------
   Sohbet
   --------------------------------------------------------- */

.unread-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.avatar-group { background: linear-gradient(135deg, #35d6a0 0%, #6d8cff 100%); }
.avatar-group svg { width: 17px; height: 17px; }

/* --- Sohbet listesi --- */

.conv-list { display: flex; flex-direction: column; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.14s ease;
}
.conv-item:last-child { border-bottom: none; }
.conv-item:hover { background: var(--hover); color: var(--text); }

.conv-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.conv-title { font-weight: 650; font-size: 14.5px; }
.conv-time { font-size: 12.5px; color: var(--faint); flex: none; }

.conv-preview {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.conv-meta { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--faint); }
.conv-meta svg { width: 12px; height: 12px; }

.conv-item.is-unread .conv-title { color: #c3d0ff; }
.conv-item.is-unread .conv-preview { color: var(--text); font-weight: 550; }

/* --- Sohbet ekrani --- */

.chat-head-left { display: flex; align-items: center; gap: 14px; }
.chat-title { font-size: 20px; margin: 0 0 3px; }

.member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.chat-card { padding: 0; overflow: hidden; }

.msg-scroll {
  height: min(56vh, 520px);
  overflow-y: auto;
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}
.day-sep span {
  font-size: 11px;
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  padding: 3px 12px;
}

.msg { display: flex; gap: 9px; align-items: flex-end; max-width: 76%; }
.msg-mine { margin-left: auto; flex-direction: row-reverse; }

.msg-avatar { width: 26px; height: 26px; font-size: 11px; }

.msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 9px 13px 7px;
  min-width: 0;
}

.msg-mine .msg-bubble {
  background: linear-gradient(135deg, rgba(109, 140, 255, 0.24), rgba(160, 109, 255, 0.24));
  border-color: rgba(109, 140, 255, 0.4);
  border-radius: 14px 14px 4px 14px;
}

.msg-sender { font-size: 12.5px; font-weight: 700; color: #a6bcff; margin-bottom: 3px; }
.msg-text { font-size: 14px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-time { font-size: 11.5px; color: var(--faint); text-align: right; margin-top: 3px; }

.msg-form {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--row-hover);
}
.msg-form input[type=text] { flex: 1; }
.msg-form .btn { flex: none; }

/* --- Kisi secme listesi --- */

.pick-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  transition: background 0.14s ease;
}
.pick-item:last-child { border-bottom: none; }
.pick-item:hover { background: var(--hover); }
.pick-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }

.pick-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pick-name { font-weight: 600; line-height: 1.25; }
.pick-sub { font-size: 12px; color: var(--faint); line-height: 1.25; }

/* ---------------------------------------------------------
   Kucuk ekranlar
   --------------------------------------------------------- */

/* Dar ekranlarda kenar cubugu ust seride doner. */
@media (max-width: 1024px) {
  /* Kolon yerlesiminde .main iceriginin genisligine gore buyumemeli. */
  .app-shell { flex-direction: column; align-items: stretch; }
  .main { width: 100%; }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; overflow: visible; }
  .nav-group { flex-direction: row; gap: 6px; }
  .nav-group-title { display: none; }
  .side-link { padding: 7px 12px; border-radius: var(--pill); }

  .sidebar-foot {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-top: 0;
    border-top: none;
    margin-left: auto;
  }
  .sidebar-foot .user-chip { width: auto; }
  .sidebar-foot .btn-block { width: auto; }

  .container { padding: 22px 16px 60px; }
}

@media (max-width: 620px) {
  .brand-sub { display: none; }
  .user-chip-text { display: none; }
  .user-chip { padding: 5px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head-actions .btn { flex: 1; justify-content: center; }
}

/* --- Ajan tablosunda servis sutun gruplari ------------------------------- */
/* Baslik iki satirlidir: ustte servis adi (QoraTrade CRM), altta alan adi. */
.th-service {
  text-align: center;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border-strong);
}
.thead-sub th {
  padding-top: 4px;
  padding-bottom: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.th-sub { text-transform: none; letter-spacing: 0.3px; }
.th-service-start, .td-service-start { border-left: 1px solid var(--border-strong); }

/* Genis tablo sayfanin tamamini degil, yalnizca kendi kutusunu kaydirmali.
   Flex/grid cocuklari varsayilan olarak "min-width: auto" oldugu icin
   .table-wrap'in overflow'u tek basina yetmiyordu. */
.main, .container, .card, .table-wrap { min-width: 0; }
.table-wrap { max-width: 100%; }

/* Uzun e-posta / kullanici adlari sutunu sonsuza kadar genisletmesin. */
.table-wide .cell-clip {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Arama ve filtre cubugu
   --------------------------------------------------------- */

/* JavaScript kapaliysa cubuk hic cizilmez; liste tam haliyle kalir. */
.js-only { display: none; }
:root.has-js .js-only { display: flex; }

.filter-bar {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  min-width: 180px;
}
.filter-search svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
[dir="rtl"] .filter-search svg { left: auto; right: 11px; }

.filter-search input {
  width: 100%;
  margin: 0;
  padding-left: 34px;
  height: 38px;
}
[dir="rtl"] .filter-search input { padding-left: 12px; padding-right: 34px; }
.filter-search input::-webkit-search-cancel-button { filter: invert(0.6); }

.filter-select { display: flex; align-items: center; gap: 7px; }
.filter-select-label {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.2px;
  color: var(--muted);
  white-space: nowrap;
}
.filter-select select {
  margin: 0;
  height: 38px;
  padding: 0 30px 0 10px;
  min-width: 120px;
  max-width: 190px;
}
.filter-select[hidden] { display: none; }

.filter-clear { flex: none; }
.filter-clear[hidden] { display: none; }

.filter-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
[dir="rtl"] .filter-count { margin-left: 0; margin-right: auto; }

/* Filtre sonucu bos kaldiginda gosterilen satir. */
[data-filter-empty][hidden] { display: none; }

@media (max-width: 620px) {
  .filter-select { flex: 1 1 100%; }
  .filter-select select { max-width: none; flex: 1; }
  .filter-count { margin-left: 0; width: 100%; }
}

/* Genis tablolu sayfalar 1400px'e sikismaz; ekranin tamamini kullanir.
   Boylece sagdaki sutunlara ulasmak icin yatay kaydirmak gerekmez. */
.container-wide { max-width: none; }

/* Cok sutunlu tablolarda islem sutunu, okunacak veriden yer calmasin:
   dugmeler yalnizca ikon gosterir. Metin DOM'da kalir (ekran okuyucular ve
   fare ustune gelince cikan ipucu icin), sadece gozden gizlenir. */
.table-wide .row-actions .btn > span:not(.count-pill) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.table-wide .row-actions .btn {
  position: relative;
  padding-left: 9px;
  padding-right: 9px;
  gap: 0;
}
.table-wide .row-actions .btn .count-pill { margin-left: 5px; }

/* ---------------------------------------------------------
   Notlar (Google Keep tarzi tahta)
   --------------------------------------------------------- */

/* Yalnizca ekran okuyucular icin: gorsel olarak gizli, erisilebilir. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Not renkleri. Keep'teki gibi yumusak tonlar; koyu temada doygunluk
   dusuruluyor ki kartlar goz yormasin. Renk her zaman bir sinif olarak
   gelir, satir ici stil kullanilmaz (CSP). */
:root {
  --note-default: rgba(22, 29, 45, 0.72);
  --note-red:     #4a2b32;
  --note-orange:  #4d3524;
  --note-yellow:  #4a4526;
  --note-green:   #27402f;
  --note-teal:    #1f3f42;
  --note-blue:    #26374f;
  --note-purple:  #382c4d;
  --note-pink:    #46293d;
  --note-gray:    #2f3542;
}

:root[data-theme="light"] {
  --note-default: rgba(255, 255, 255, 0.9);
  --note-red:     #faafa9;
  --note-orange:  #f8c58a;
  --note-yellow:  #fdf1a0;
  --note-green:   #c3ecc8;
  --note-teal:    #b4e3e0;
  --note-blue:    #bcd8f5;
  --note-purple:  #d6c6f2;
  --note-pink:    #f4c8dd;
  --note-gray:    #dcdfe4;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --note-default: rgba(255, 255, 255, 0.9);
    --note-red:     #faafa9;
    --note-orange:  #f8c58a;
    --note-yellow:  #fdf1a0;
    --note-green:   #c3ecc8;
    --note-teal:    #b4e3e0;
    --note-blue:    #bcd8f5;
    --note-purple:  #d6c6f2;
    --note-pink:    #f4c8dd;
    --note-gray:    #dcdfe4;
  }
}

.note-c-default { background: var(--note-default); }
.note-c-red     { background: var(--note-red); }
.note-c-orange  { background: var(--note-orange); }
.note-c-yellow  { background: var(--note-yellow); }
.note-c-green   { background: var(--note-green); }
.note-c-teal    { background: var(--note-teal); }
.note-c-blue    { background: var(--note-blue); }
.note-c-purple  { background: var(--note-purple); }
.note-c-pink    { background: var(--note-pink); }
.note-c-gray    { background: var(--note-gray); }

/* --- Yazma kutusu ------------------------------------------------------- */

.note-composer { max-width: 620px; margin-bottom: 20px; padding: 0; }
.note-composer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  list-style: none;
  user-select: none;
}
.note-composer-head::-webkit-details-marker { display: none; }
.note-composer-head svg { width: 17px; height: 17px; }
.note-composer[open] .note-composer-head { padding-bottom: 4px; color: var(--text); }
.note-composer-form { padding: 0 20px 18px; }
.note-composer-form input[type="text"],
.note-composer-form textarea { margin-bottom: 10px; }
.note-composer-form textarea { resize: vertical; }
.note-composer-form .actions { margin-top: 14px; align-items: center; }

.note-pin-check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.note-pin-check input { width: auto; margin: 0; }

/* --- Renk secici -------------------------------------------------------- */

.note-colors { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 2px; }

.note-color {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.note-color:hover { transform: scale(1.12); }
.note-color input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.note-color-dot { display: none; }
.note-color-dot svg { width: 14px; height: 14px; }
/* Secili renk: icine onay isareti ve halka. */
.note-color:has(input:checked) {
  box-shadow: 0 0 0 2px var(--accent);
  border-color: transparent;
}
.note-color:has(input:checked) .note-color-dot { display: block; color: var(--text); }
/* :has() desteklenmezse en azindan onay isareti gorunsun (kardes secici). */
.note-color input:checked + .note-color-dot { display: block; color: var(--text); }
.note-color:focus-within { box-shadow: 0 0 0 2px var(--accent); }

/* --- Tahta -------------------------------------------------------------- */

.note-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
}
.note-section-title svg { width: 14px; height: 14px; }

/* Duvar orgusu: CSS columns ile, JavaScript gerekmez. */
.note-grid {
  columns: 240px 5;
  column-gap: 16px;
  margin-bottom: 26px;
}

.note-card {
  break-inside: avoid;
  page-break-inside: avoid;
  display: block;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.note-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.65); }
.note-card.is-pinned { border-color: var(--accent); }

.note-open {
  display: block;
  padding: 16px 16px 10px;
  color: inherit;
  text-decoration: none;
}
.note-title {
  margin: 0 0 7px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  word-break: break-word;
}
.note-body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  /* Cok uzun notlar tahtayi bozmasin: kartta ilk 12 satir gorunur. */
  display: -webkit-box;
  -webkit-line-clamp: 12;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 8px;
  min-height: 34px;
}
.note-date { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.note-actions { display: flex; gap: 2px; margin-left: auto; }
[dir="rtl"] .note-actions { margin-left: 0; margin-right: auto; }

.note-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}
.note-btn svg { width: 15px; height: 15px; }
/* Dugmeler normalde gizli, karta gelince cikar (Keep'teki gibi). Dokunmatik
   ekranda hover olmadigi icin orada her zaman gorunur. */
.note-card:hover .note-btn,
.note-btn:focus-visible { opacity: 1; }
.note-btn.is-on { opacity: 1; color: var(--accent); }
.note-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.note-btn-danger:hover { color: #ff8f9c; }

@media (hover: none) {
  .note-btn { opacity: 1; }
}

.note-edit-card textarea { resize: vertical; min-height: 180px; }

@media (max-width: 620px) {
  .note-grid { columns: 1; }
  .note-composer { max-width: none; }
}

/* Not kartindaki kucuk bilgi rozetleri (kiminle paylasildi / kimden geldi). */
.note-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 6px;
}
.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  color: var(--muted);
}
.note-chip svg { width: 12px; height: 12px; flex: none; }
.note-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="light"] .note-chip { background: rgba(15, 23, 42, 0.08); }

/* Paylasilan notlar kesik cerceveyle ayrilir: bu kart bana ait degil. */
.note-card.is-shared { border-style: dashed; }

/* Salt okunur not govdesi. */
.note-read {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 14.5px;
  margin: 14px 0 4px;
}

/* ---------------------------------------------------------
   Genis tabloda yatay kaydirma
   --------------------------------------------------------- */

/* Kaydirma cubugu HER ZAMAN gorunur olsun. Windows'ta ince/kaybolan
   cubuklar yuzunden tablonun kaydirilabildigi fark edilmiyordu. */
.table-wrap {
  scrollbar-width: auto;
  scrollbar-color: var(--accent) transparent;
  padding-bottom: 2px;
}
.table-wrap::-webkit-scrollbar { height: 14px; }
.table-wrap::-webkit-scrollbar-track {
  background: var(--row-hover);
  border-radius: var(--pill);
}
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: var(--pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background-clip: border-box; }

/* Tablonun ustunde duran kaydirma kolu: sag/sol dugmeleri ve konum cubugu.
   JavaScript ile doldurulur; tablo sigiyorsa hic gorunmez. */
.table-scroller {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: -6px;
}
:root.has-js .table-scroller.is-needed { display: flex; }

.table-scroller-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.table-scroller-btn svg { width: 16px; height: 16px; }
.table-scroller-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.table-scroller-btn:disabled { opacity: 0.35; cursor: default; }
.table-scroller-prev svg { transform: rotate(90deg); }
.table-scroller-next svg { transform: rotate(-90deg); }
[dir="rtl"] .table-scroller-prev svg { transform: rotate(-90deg); }
[dir="rtl"] .table-scroller-next svg { transform: rotate(90deg); }

/* Suruklenebilir konum cubugu (input[type=range] ile, ek JS kutuphanesi yok). */
.table-scroller-range {
  flex: 1;
  margin: 0;
  height: 6px;
  min-width: 80px;
  accent-color: var(--accent);
  cursor: grab;
}
.table-scroller-range:active { cursor: grabbing; }

.table-scroller-hint {
  font-size: 12.5px;
  color: var(--faint);
  white-space: nowrap;
}

/* Ilk sutun (kisi adi) yatay kaydirmada solda sabit kalir; 50 sutun arasinda
   satirin kime ait oldugu kaybolmasin. */
.table-wide .col-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-solid);
  box-shadow: 12px 0 14px -12px rgba(0, 0, 0, 0.9);
}
.table-wide thead .col-sticky { background: var(--thead-bg); z-index: 3; }
.table-wide tbody tr:hover .col-sticky { background: var(--row-hover-solid); }
[dir="rtl"] .table-wide .col-sticky {
  left: auto;
  right: 0;
  box-shadow: -12px 0 14px -12px rgba(0, 0, 0, 0.9);
}

/* Islem sutunu sagda sabit; baslikta iki satiri birden kapladigi icin
   z-index'i ust satirdan yuksek olmali. */
.table-wide thead .col-actions { z-index: 3; }

/* --- Toplu secim ve takim atamasi --------------------------------------- */

.col-pick {
  width: 34px;
  text-align: center;
  padding-left: 10px;
  padding-right: 4px;
}
.col-pick input { width: auto; margin: 0; cursor: pointer; }

.bulk-bar {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-color: var(--border-strong);
  transition: border-color 0.15s ease;
}
.bulk-bar.is-active { border-color: var(--accent); }
.bulk-bar > svg { width: 17px; height: 17px; color: var(--faint); flex: none; }

.bulk-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 96px;
}
.bulk-bar.is-active .bulk-count { color: var(--accent); }

.bulk-field { display: flex; align-items: center; gap: 8px; margin-left: auto; }
[dir="rtl"] .bulk-field { margin-left: 0; margin-right: auto; }
.bulk-field select { margin: 0; height: 36px; min-width: 190px; }

/* Pasif dugme, aktif olanla ayni gorunmemeli: hicbir sey secilmeden
   "Takima ata" tiklanabilir sanilmasin. */
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.btn:disabled:hover,
.btn[disabled]:hover { transform: none; }

/* ---------------------------------------------------------
   Tek tiklamayla kopyalama
   --------------------------------------------------------- */

.is-copyable { cursor: copy; }
/* Uzerine gelince kopyalanabilir oldugu belli olsun. */
.is-copyable:hover { background: var(--row-hover); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* Kopyalandiginda kisa bir yesil parlama. */
.is-copied,
.is-copyable.is-copied:hover {
  background: rgba(52, 199, 123, 0.22);
  box-shadow: inset 0 0 0 1px rgba(52, 199, 123, 0.55);
  transition: background 0.15s ease;
}
a.secret-mask.is-copied { border-radius: var(--radius-sm); }

/* Ekranin altinda kisa sureli bildirim. */
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  transform: translate(-50%, 12px);
  padding: 9px 16px;
  border-radius: var(--pill);
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.copy-toast.is-error { border-color: #ff8f9c; color: #ff8f9c; }

/* Pano yedek yolunda kullanilan gecici alan gorunmemeli. */
.copy-shadow {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .copy-toast { transition: none; }
  .is-copied { transition: none; }
}
