@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --sidebar: #1e3a5f;
  --sidebar-hover: #2a5080;
  --accent: #2980b9;
  --accent-light: #ebf5fb;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --text: #2c3e50;
  --muted: #7f8c8d;
  --border: #dfe6e9;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(30, 58, 95, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-brand small {
  opacity: 0.7;
  font-size: 0.75rem;
}

.sidebar nav {
  padding: 1rem 0;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.5rem;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar nav .nav-section {
  padding: 0.75rem 1.5rem 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.5;
}

.main {
  flex: 1;
  padding: 1.75rem 2rem;
  overflow-x: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.1s;
}

.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border-left: 4px solid var(--accent);
}

.stat-card.green { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.red { border-left-color: var(--danger); }

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table tr:hover td { background: #fafbfc; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.flash.success { background: #d5f5e3; color: #1e8449; }
.flash.error { background: #fadbd8; color: #922b21; }
.flash.warning { background: #fdebd0; color: #9a6700; border: 1px solid #f5cba7; }

.payment-alert-banner ul.alert-list,
.alert-list {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}

.payment-alert-banner li,
.alert-list li {
  margin: 0.35rem 0;
}

.promise-inline-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

tr.row-overdue { background: #fdf2f2; }
tr.row-due-today { background: #fef9e7; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-aktiv { background: #d5f5e3; color: #1e8449; }
.badge-isden_cixib { background: #fadbd8; color: #922b21; }
.badge-ayrilib { background: #fadbd8; color: #922b21; }
.badge-gozleme { background: #fdebd0; color: #b7950b; }
.badge-geldi { background: #d5f5e3; color: #1e8449; }
.badge-gelmedi { background: #fadbd8; color: #922b21; }
.badge-xeste { background: #fdebd0; color: #b7950b; }
.badge-tetil { background: #ebf5fb; color: #2471a3; }

.child-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  vertical-align: middle;
}

.child-avatar-lg {
  width: 80px;
  height: 80px;
}

.photo-upload-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-bar input,
.filter-bar select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--muted);
}

.actions { display: flex; gap: 0.4rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.doc-card .doc-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.doc-card .filter-bar {
  flex-wrap: wrap;
  margin-bottom: 0;
}

.doc-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 0.25rem;
}

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 0.5rem; }
  .sidebar nav a { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
  .sidebar nav .nav-section { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
  .page-header h2 { font-size: 1.2rem; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .btn { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
}

.att-row select { min-width: 120px; }

.inline-group-form select {
  min-width: 110px;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}
.att-row input[type=text] { min-width: 140px; }

.blocked-page {
  max-width: 520px;
  text-align: center;
  padding: 2.5rem 2rem;
}

.blocked-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.total-bar {
  background: var(--accent-light);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2980b9 100%);
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-brand h1 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
  color: var(--sidebar);
}

.login-brand p {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

.login-hint {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.sidebar-user {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
}

.sidebar-user strong {
  display: block;
  color: #fff;
}

.sidebar-user small {
  opacity: 0.75;
  color: #fff;
}

/* —— Maaşlar səhifəsi —— */
.salary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 1.25rem;
  align-items: start;
}

.salary-pay-panel {
  background: linear-gradient(180deg, #f8fafc 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
}

.salary-pay-panel.is-highlight {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.info-box {
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.info-box strong { color: #1e40af; }

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

table.salary-table { font-size: 0.86rem; }

table.salary-table th,
table.salary-table td { padding: 0.55rem 0.6rem; }

table.salary-table th.num,
table.salary-table td.num { text-align: right; white-space: nowrap; }

table.salary-table td.name-col { min-width: 120px; }

table.salary-table td.name-col small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.money-strong { font-weight: 700; color: var(--text); }

.money-muted { color: var(--muted); }

.stat-card .value .currency {
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.85;
  margin-left: 0.15rem;
}

.salary-form-stack .form-group { margin-bottom: 0.85rem; }

.salary-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

.payments-compact table { font-size: 0.84rem; }

.payments-compact th.num,
.payments-compact td.num { text-align: right; white-space: nowrap; }

@media (max-width: 1100px) {
  .salary-layout { grid-template-columns: 1fr; }
  .salary-pay-panel { position: static; }
}

/* —— Profil —— */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.profile-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-photo { flex-shrink: 0; }

.profile-meta { flex: 1; min-width: 240px; }

.profile-info-form .form-actions { margin-top: 0.5rem; }

.profile-stats { margin-top: 0.75rem; }

.profile-side .card { position: sticky; top: 1rem; }

@media (max-width: 960px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-side .card { position: static; }
}

/* —— Söhbət —— */
.nav-badge {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.chat-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 180px);
}

.chat-sidebar { margin-bottom: 0; padding: 1rem; }

.chat-group-list,
.chat-members {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chat-group-item {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 0.35rem;
  border: 1px solid transparent;
}

.chat-group-item:hover { background: var(--bg); }

.chat-group-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.chat-group-name { display: block; font-weight: 600; font-size: 0.9rem; }

.chat-group-item small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.chat-members li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.chat-members small { color: var(--muted); font-size: 0.75rem; }

.chat-member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.chat-main {
  margin-bottom: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.chat-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.chat-header-desc {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  min-height: 360px;
  max-height: calc(100vh - 320px);
}

.chat-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.chat-msg {
  max-width: 78%;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.chat-msg.mine {
  margin-left: auto;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.chat-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
}

.chat-msg-meta strong { font-size: 0.85rem; }

.chat-role {
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.chat-time { color: var(--muted); margin-left: auto; }

.chat-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  font-size: 0.92rem;
}

.chat-compose {
  display: block;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}

.chat-compose-main { display: flex; flex-direction: column; gap: 0.5rem; }

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-compose textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  max-height: 120px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
}

.chat-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.chat-attach-btn:hover { background: #eef2f7; }

.chat-preview {
  position: relative;
  display: inline-block;
  max-width: 200px;
}

.chat-preview img {
  max-width: 200px;
  max-height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.chat-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.chat-img-link { display: block; margin-bottom: 0.35rem; }

.chat-img-btn {
  display: block;
  margin-bottom: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.chat-img {
  max-width: 280px;
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  display: block;
}

.chat-msg.mine .chat-img { border-color: #93c5fd; }

.chat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chat-lightbox[hidden] { display: none !important; }

.chat-lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.chat-lightbox-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #1e293b;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.chat-lightbox-close:hover { background: #fff; }

body.chat-lightbox-open { overflow: hidden; }

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; min-height: auto; }
  .chat-sidebar { order: 2; }
  .chat-messages { max-height: 50vh; }
}
