/* ═══════════════════════════════════════════════════════
   ANBAR SİSTEMİ — dizayn
   ═══════════════════════════════════════════════════════ */

:root {
  /* Fon — dərin qrafit-göy */
  --bg-0: #0b1220;
  --bg-1: #0f172a;
  --bg-2: #141f36;
  --surface: #16213a;
  --surface-2: #1b2842;
  --line: rgba(148, 173, 216, 0.13);
  --line-soft: rgba(148, 173, 216, 0.07);

  /* Mətn */
  --text: #e9eef8;
  --text-2: #a9b8d4;
  --text-3: #6f83a6;

  /* Aksentlər */
  --accent: #4f7cff;
  --accent-2: #6d9bff;
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.14);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --blue-soft: rgba(79, 124, 255, 0.14);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 30px 70px -25px rgba(0, 0, 0, 0.75);
  --sidebar-w: 264px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-0);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.ta-right { text-align: right; }
.ta-center { text-align: center; }

svg { width: 100%; height: 100%; stroke-linecap: round; stroke-linejoin: round; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 173, 216, 0.18); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 173, 216, 0.3); background-clip: content-box; }

/* ═══════════ GİRİŞ EKRANI ═══════════ */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  background: var(--bg-0);
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1000px 600px at 15% 10%, rgba(79, 124, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 85% 90%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(700px 500px at 60% 30%, rgba(109, 155, 255, 0.1), transparent 60%);
  animation: floatBg 18s ease-in-out infinite alternate;
}

@keyframes floatBg {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.1) translateY(-20px); }
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(160deg, rgba(27, 40, 66, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 42px 38px 30px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  text-align: center;
  animation: rise 0.6s var(--ease);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  width: 62px; height: 62px;
  margin: 0 auto 20px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #7c5cff);
  color: #fff;
  padding: 15px;
  box-shadow: 0 14px 34px -10px rgba(79, 124, 255, 0.7);
}

.login-card h1 { font-size: 25px; font-weight: 700; letter-spacing: -0.4px; }
.login-sub { color: var(--text-3); font-size: 13.5px; margin-bottom: 28px; }
.login-card .field { text-align: left; }
.login-foot { margin-top: 24px; font-size: 11.5px; color: var(--text-3); }

.login-error {
  display: none;
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}
.login-error.show { display: block; animation: shake 0.4s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ═══════════ ƏSAS KARKAS ═══════════ */

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

/* ─── Yan menyu ─── */

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #101a2f 0%, #0c1424 100%);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 60;
  transition: transform 0.32s var(--ease);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; }

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  padding: 10px;
  background: linear-gradient(140deg, var(--accent), #7c5cff);
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(79, 124, 255, 0.75);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15.5px; letter-spacing: 1.4px; font-weight: 700; }
.brand-text span { font-size: 11.5px; color: var(--text-3); letter-spacing: 0.3px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }

.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  padding: 16px 12px 7px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  position: relative;
  transition: all 0.2s var(--ease);
}

.nav-item:hover { background: rgba(148, 173, 216, 0.07); color: var(--text); }

.nav-item.active {
  background: linear-gradient(100deg, rgba(79, 124, 255, 0.22), rgba(79, 124, 255, 0.06));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(79, 124, 255, 0.25);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.sidebar-foot { padding-top: 8px; border-top: 1px solid var(--line-soft); }
.sidebar-foot .nav-label { padding: 8px 12px 5px; }
.sidebar-foot .nav-item { padding: 9px 13px; font-size: 13.5px; }
.nav-item.logout:hover { background: var(--red-soft); color: #fca5a5; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.6);
  backdrop-filter: blur(3px);
  z-index: 55;
}
.sidebar-overlay.show { display: block; }

/* ─── Sağ hissə ─── */

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 18, 32, 0.8);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-title p { font-size: 13px; color: var(--text-3); }

.date-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.date-chip .ic { color: var(--accent-2); }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  padding: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(148, 173, 216, 0.09); color: var(--text); }

.burger { display: none; }

.content { padding: 26px 32px 60px; flex: 1; }

/* ═══════════ STATİSTİKA ═══════════ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
  animation: rise 0.5s var(--ease) backwards;
}
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }

.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(148, 173, 216, 0.25);
  box-shadow: 0 22px 46px -20px rgba(0, 0, 0, 0.8);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 15px;
  display: grid; place-items: center;
  padding: 13px;
  flex: 0 0 auto;
}
.stat-icon.blue { background: var(--blue-soft); color: var(--accent-2); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.orange { background: var(--orange-soft); color: var(--orange); }
.stat-icon.red { background: var(--red-soft); color: #f87171; }

.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.stat-value { font-size: 29px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; }
.stat-hint { font-size: 11.5px; color: var(--text-3); }

/* ═══════════ KARTLAR ═══════════ */

.page { display: none; animation: fade 0.35s var(--ease); }
.page.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.card-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.2px; }
.card-head p { font-size: 13px; color: var(--text-3); }
.card-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15); }
.search .ic { color: var(--text-3); }
.search input {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px 0;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  width: 190px;
}
.search input::placeholder { color: var(--text-3); }

/* ═══════════ DÜYMƏLƏR ═══════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6d6cff);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(79, 124, 255, 0.8);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 12px 26px -8px rgba(79, 124, 255, 0.95); }

.btn-success {
  background: linear-gradient(135deg, var(--green), #34d399);
  color: #04231a;
  box-shadow: 0 8px 20px -8px rgba(16, 185, 129, 0.75);
}
.btn-success:hover { filter: brightness(1.08); }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #fb923c);
  color: #2b1602;
  box-shadow: 0 8px 20px -8px rgba(245, 158, 11, 0.75);
}
.btn-warning:hover { filter: brightness(1.08); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
}
.btn-ghost:hover { background: rgba(148, 173, 216, 0.08); color: var(--text); }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 14.5px; }

/* ═══════════ FORMALAR ═══════════ */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field.inline { margin-bottom: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); }
.hint { font-size: 11.5px; color: var(--text-3); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}
textarea { resize: vertical; min-height: 62px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f83a6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}
select option { background: var(--bg-1); color: var(--text); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.65); cursor: pointer; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  padding: 20px 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line-soft);
}
.filters .field { margin-bottom: 0; }
.field-btns { flex-direction: row; align-items: flex-end; gap: 8px; }
.field-btns .btn { flex: 1; }

/* ═══════════ HESABAT — dövr seçimi ═══════════ */

.period {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.period-quick { display: flex; gap: 8px; flex-wrap: wrap; }

.period-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(79, 124, 255, 0.8);
}

.period-dates { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.period-dates .field { margin-bottom: 0; }
.period-dates input[type="date"] { width: auto; min-width: 150px; }
.period-dates select { width: auto; min-width: 190px; }

/* Məxaric formasında iki sahə (kimə verilib + işçi) alt-alta düzülür */
#expenseFields .field { margin-bottom: 16px; }

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.sum-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.sum-item span { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.sum-item strong { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 12px;
}
.section-title h3 { font-size: 14.5px; font-weight: 650; color: var(--text); }
.section-title span { font-size: 12px; color: var(--text-3); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  margin: 2px 3px 2px 0;
  background: rgba(148, 173, 216, 0.09);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.tag b { color: var(--text); font-weight: 650; }

.print-foot { display: none; }

/* ═══════════ CƏDVƏLLƏR ═══════════ */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
  text-align: left;
  padding: 13px 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-3);
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: middle;
}

.table tbody tr { transition: background 0.18s; }
.table tbody tr:nth-child(even) { background: rgba(148, 173, 216, 0.022); }
.table tbody tr:hover { background: rgba(79, 124, 255, 0.07); }
.table tbody tr:last-child td { border-bottom: none; }

.table .name { color: var(--text); font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.table .muted { color: var(--text-3); }

/* Qalıq vəziyyəti */
tr.row-empty { background: rgba(239, 68, 68, 0.09) !important; }
tr.row-empty:hover { background: rgba(239, 68, 68, 0.15) !important; }
tr.row-low { background: rgba(245, 158, 11, 0.08) !important; }
tr.row-low:hover { background: rgba(245, 158, 11, 0.14) !important; }

.qty-empty { color: #f87171 !important; }
.qty-low { color: #fbbf24 !important; }
.qty-ok { color: #34d399 !important; }

/* Dövr üzrə yekun sətri (hər ölçü vahidi üçün ayrıca) */
tr.total-row { background: rgba(79, 124, 255, 0.1) !important; }
tr.total-row:hover { background: rgba(79, 124, 255, 0.15) !important; }
tr.total-row td {
  font-weight: 800;
  color: var(--text);
  border-top: 2px solid var(--line);
  border-bottom: 1px solid var(--line-soft) !important;
  letter-spacing: 0.3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: #34d399; }
.badge-orange { background: var(--orange-soft); color: #fbbf24; }
.badge-red { background: var(--red-soft); color: #f87171; }
.badge-blue { background: var(--blue-soft); color: var(--accent-2); }
.badge-gray { background: rgba(148, 173, 216, 0.1); color: var(--text-3); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.act-btn {
  width: 32px; height: 32px;
  padding: 7px;
  display: grid; place-items: center;
  background: rgba(148, 173, 216, 0.07);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.18s;
}
.act-btn:hover { color: var(--accent-2); border-color: rgba(79, 124, 255, 0.4); background: var(--blue-soft); }
.act-btn.danger:hover { color: #f87171; border-color: rgba(239, 68, 68, 0.4); background: var(--red-soft); }

.empty-state { padding: 56px 24px; text-align: center; color: var(--text-3); }
.empty-state svg { width: 46px; height: 46px; margin-bottom: 12px; opacity: 0.35; }
.empty-state strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.empty-state span { font-size: 13px; }

/* ═══════════ MODAL ═══════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 150;
}
.modal-backdrop.show { display: flex; animation: fade 0.22s ease; }

.modal {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.32s var(--ease);
}
.modal-sm { max-width: 400px; }

@keyframes pop {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-size: 16.5px; font-weight: 650; }
.modal-body { padding: 22px 24px; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px 22px;
}

.confirm-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  padding: 14px;
  border-radius: 50%;
  background: var(--red-soft);
  color: #f87171;
  display: grid; place-items: center;
}
#confirmText { text-align: center; color: var(--text-2); font-size: 14.5px; }

/* ═══════════ BİLDİRİŞLƏR ═══════════ */

.toasts {
  position: fixed;
  top: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 17px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  color: var(--text);
  animation: slideIn 0.35s var(--ease);
}
.toast.out { animation: slideOut 0.3s var(--ease) forwards; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--orange); }
.toast .ic { margin-top: 1px; }
.toast.success .ic { color: var(--green); }
.toast.error .ic { color: #f87171; }
.toast.warning .ic { color: var(--orange); }
.toast.info .ic { color: var(--accent-2); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(110%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
  to { opacity: 0; transform: translateX(110%); }
}

/* ═══════════ ÇAT-BOT ═══════════ */

.chat { position: fixed; right: 24px; bottom: 24px; z-index: 120; }

.chat-fab {
  position: relative;
  width: 58px; height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), #7c5cff);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 16px;
  box-shadow: 0 14px 34px -8px rgba(79, 124, 255, 0.8);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
  margin-left: auto;
}
.chat-fab:hover { transform: scale(1.08) rotate(4deg); }
.chat-fab .chat-close-ic { display: none; }
.chat.open .chat-fab .chat-open-ic { display: none; }
.chat.open .chat-fab .chat-close-ic { display: block; }
.chat.open .chat-dot { display: none; }

.chat-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 12px; height: 12px;
  background: var(--green);
  border: 2px solid var(--bg-0);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
}

.chat-window {
  position: absolute;
  bottom: 72px; right: 0;
  width: 372px;
  height: 540px;
  max-height: calc(100vh - 120px);
  background: linear-gradient(170deg, var(--surface-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition: all 0.3s var(--ease);
}
.chat.open .chat-window { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(79, 124, 255, 0.08);
}
.chat-avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  padding: 9px;
  background: linear-gradient(140deg, var(--accent), #7c5cff);
  color: #fff;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.chat-title { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.chat-title strong { font-size: 14px; }
.chat-title span { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.online { width: 6px; height: 6px; background: var(--green); border-radius: 50%; display: inline-block; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; gap: 9px; max-width: 88%; animation: msgIn 0.3s var(--ease); }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-bubble {
  padding: 11px 14px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  color: var(--text);
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--accent), #6d6cff);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg-bubble b { color: inherit; font-weight: 700; }

.typing { display: flex; gap: 4px; padding: 14px; }
.typing i {
  width: 7px; height: 7px;
  background: var(--text-3);
  border-radius: 50%;
  animation: bounce 1.3s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-quick {
  display: flex;
  gap: 7px;
  padding: 0 14px 10px;
  flex-wrap: wrap;
  max-height: 116px;
  overflow-y: auto;
}
.chip {
  padding: 7px 13px;
  background: rgba(79, 124, 255, 0.12);
  border: 1px solid rgba(79, 124, 255, 0.3);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.green { background: var(--green-soft); border-color: rgba(16, 185, 129, 0.35); color: #34d399; }
.chip.green:hover { background: var(--green); color: #04231a; }
.chip.orange { background: var(--orange-soft); border-color: rgba(245, 158, 11, 0.35); color: #fbbf24; }
.chip.orange:hover { background: var(--orange); color: #2b1602; }

.chat-input {
  display: flex;
  gap: 9px;
  padding: 13px 14px;
  border-top: 1px solid var(--line-soft);
  background: rgba(11, 18, 32, 0.5);
}
.chat-input input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13.5px;
}
.chat-send {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  padding: 11px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6d6cff);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.2s, filter 0.2s;
}
.chat-send:hover { filter: brightness(1.12); transform: scale(1.06); }

/* ═══════════ ÇAP ═══════════ */

.print-head { display: none; }

@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .stats, .chat, .toasts, .no-print, .sidebar-overlay { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .page { display: none !important; }
  .page#page-report { display: block !important; }
  .card { border: none; box-shadow: none; background: #fff; }
  .print-head { display: block; text-align: center; margin-bottom: 16px; }
  .print-head h2 { font-size: 17px; color: #000; letter-spacing: 0.5px; }
  .print-head p { font-size: 13px; color: #333; }

  /* Hesabatın bölmələri */
  .report-summary {
    display: flex; gap: 22px; padding: 0 0 12px;
    border-bottom: 1px solid #999; margin-bottom: 6px;
  }
  .sum-item { background: none; border: none; padding: 0; }
  .sum-item span { color: #444; font-size: 10.5px; }
  .sum-item strong { color: #000; font-size: 12.5px; }

  .section-title { padding: 12px 0 6px; break-after: avoid; page-break-after: avoid; }
  .section-title h3 { font-size: 13px; color: #000; }
  .section-title span { color: #444; font-size: 11px; }
  .section-break { break-before: page; page-break-before: always; }

  .tag { background: none; border: none; padding: 0; margin: 0 8px 0 0; color: #000; font-size: 11px; }
  .tag b { color: #000; }

  .table-wrap { overflow: visible; }
  .table { font-size: 11.5px; page-break-inside: auto; }
  .table tr { page-break-inside: avoid; }
  .table thead { display: table-header-group; }

  .print-foot {
    display: flex; justify-content: space-between;
    margin-top: 26px; padding-top: 10px;
    font-size: 12px; color: #000;
    break-inside: avoid;
  }
  .table thead th { background: #eee !important; color: #000; border: 1px solid #999; padding: 7px 9px; }
  .table tbody td { color: #000; border: 1px solid #bbb; padding: 6px 9px; }
  .table tbody tr { background: #fff !important; }
  .table .name, .table .num { color: #000; }
  .qty-empty, .qty-low, .qty-ok { color: #000 !important; }
  tr.total-row { background: #e6e6e6 !important; }
  tr.total-row td { font-weight: 800; color: #000; border-top: 2px solid #666; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ═══════════ ADAPTİV ═══════════ */

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
  .main { margin-left: 0; }
  .burger { display: grid; }
  .content { padding: 20px; }
  .topbar { padding: 16px 20px; }
}

@media (max-width: 720px) {
  .topbar-title h1 { font-size: 17.5px; }
  .topbar-title p { display: none; }
  .date-chip { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 15px; gap: 12px; flex-direction: column; align-items: flex-start; }
  .stat-icon { width: 42px; height: 42px; padding: 11px; }
  .stat-value { font-size: 23px; }
  .stat-hint { display: none; }
  .card-head { padding: 18px; }
  .card-tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .card-tools .btn { flex: 1; }
  .grid-2 { grid-template-columns: 1fr; }
  .table thead th, .table tbody td { padding: 11px 14px; }
  .chat { right: 16px; bottom: 16px; }
  .chat-window { width: calc(100vw - 32px); right: -4px; height: 480px; }
  .filters { padding: 16px; }
  .period { padding: 16px; flex-direction: column; align-items: stretch; }
  .period-quick .chip { flex: 1; text-align: center; }
  .period-dates { flex-direction: column; align-items: stretch; }
  .period-dates input[type="date"] { width: 100%; }
  .period-dates select { width: 100%; }
  .period-dates .btn { width: 100%; }
  .report-summary { grid-template-columns: 1fr 1fr; padding: 16px; gap: 10px; }
  .section-title { padding: 18px 16px 10px; }
  .toasts { left: 16px; right: 16px; max-width: none; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}
