/* ============================================================
   Дизайн-система. Тёплая, профессиональная палитра.
   ============================================================ */
:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #f1f3f9;
  --text: #1a1f36;
  --text-muted: #6b7390;
  --text-faint: #9aa1bd;
  --border: #e6e9f2;
  --border-strong: #cbd0e0;

  --primary: #6366f1;        /* индиго */
  --primary-hover: #4f46e5;
  --primary-soft: #eef0ff;
  --primary-text: #ffffff;

  --accent: #ec4899;         /* розовый акцент */
  --success: #10b981;
  --success-soft: #d9f7ec;
  --warning: #f59e0b;
  --warning-soft: #fde68a;     /* амбер-200, насыщеннее для pending UI */
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --info: #0ea5e9;
  --info-soft: #e0f2fe;

  --shadow-sm: 0 1px 2px rgba(20, 25, 50, 0.04), 0 1px 3px rgba(20, 25, 50, 0.06);
  --shadow:    0 4px 12px rgba(20, 25, 50, 0.06), 0 1px 3px rgba(20, 25, 50, 0.04);
  --shadow-lg: 0 12px 32px rgba(20, 25, 50, 0.10), 0 4px 12px rgba(20, 25, 50, 0.06);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-sans: 'Inter', 'Noto Sans Armenian', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[lang="hy"] { font-family: 'Noto Sans Armenian', 'Inter', system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.55;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(236, 72, 153, 0.15), transparent 60%),
    linear-gradient(180deg, #fafbff, #eef0fb);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  border: 1px solid var(--border);
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 30px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.login-card p.hint { margin: 0 0 28px; color: var(--text-muted); }
.login-card .form-row { margin-bottom: 14px; }
.login-card .demo {
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary-hover);
  text-align: center;
}
.lang-toggle-floating {
  position: fixed; top: 20px; right: 20px;
  display: flex; gap: 4px;
  background: var(--bg-elev);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.lang-toggle-floating button {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}
.lang-toggle-floating button.active {
  background: var(--text);
  color: white;
}

/* ============================================================
   ОБЩИЕ КОМПОНЕНТЫ
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-secondary {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: white; border-color: var(--border-strong); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; justify-content: center; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  transition: border 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
textarea { min-height: 80px; resize: vertical; }
.form-row { margin-bottom: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .form-row { margin-bottom: 0; }
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 22px 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
  padding: 0 8px;
}
.sidebar .brand .logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  color: white;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.sidebar .brand .titles { line-height: 1.2; }
.sidebar .brand .titles .name { font-weight: 700; font-size: 15px; }
.sidebar .brand .titles .sub { font-size: 11px; color: var(--text-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
  cursor: pointer;
  text-align: start;
  width: 100%;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar .footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  margin-bottom: 10px;
}
.user-chip .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.user-chip .info { line-height: 1.2; min-width: 0; flex: 1; }
.user-chip .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .role { font-size: 11px; color: var(--text-muted); }

.lang-toggle {
  display: flex; gap: 4px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.lang-toggle button {
  flex: 1;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}
.lang-toggle button.active { background: var(--text); color: white; }

/* main content */
.main {
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.page-header p.subtitle { margin: 4px 0 0; color: var(--text-muted); }

/* Cards */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-header h3 { margin: 0; font-size: 16px; font-weight: 600; }

.stat-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 13px; color: var(--text-muted); font-weight: 500; padding-right: 56px; min-height: 40px; }
.stat-card .value { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-card .unit { font-size: 14px; color: var(--text-muted); margin-left: 6px; font-weight: 500; }
.stat-card .icon-bg {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
}
.stat-card.primary .icon-bg { background: var(--primary-soft); color: var(--primary-hover); }
.stat-card.success .icon-bg { background: var(--success-soft); color: var(--success); }
.stat-card.warning .icon-bg { background: var(--warning-soft); color: #92400e; }
.stat-card.info .icon-bg { background: var(--info-soft); color: var(--info); }

.dash-balance-card {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(99,102,241,0.25);
}
.dash-balance-card::before {
  content: '🏖️';
  position: absolute;
  font-size: 140px;
  right: -20px; top: -30px;
  opacity: 0.15;
}
.dash-balance-card .label { font-size: 14px; opacity: 0.9; font-weight: 500; }
.dash-balance-card .value { font-size: 56px; font-weight: 800; line-height: 1; margin: 8px 0; letter-spacing: -0.03em; }
.dash-balance-card .unit { font-size: 16px; opacity: 0.9; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: row; padding: 14px; flex-wrap: wrap; gap: 12px; }
  .sidebar .brand { margin-bottom: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-item { padding: 8px 12px; font-size: 13px; }
  .sidebar .footer { width: 100%; padding-top: 12px; border-top: 1px solid var(--border); }
  .main { padding: 18px; }
}

/* Таблица */
.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th, table.data td {
  padding: 12px 16px;
  text-align: start;
  border-bottom: 1px solid var(--border);
}
table.data th {
  background: var(--bg-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(99, 102, 241, 0.03); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-muted);
}
.badge.success { background: var(--success-soft); color: #047857; }
.badge.warning { background: var(--warning-soft); color: #92400e; }
.badge.danger  { background: var(--danger-soft);  color: #b91c1c; }
.badge.info    { background: var(--info-soft);    color: #0369a1; }
.badge.primary { background: var(--primary-soft); color: var(--primary-hover); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 25, 50, 0.45);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.15s;
}
.modal {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Toast */
.toast-host {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 2000;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideInRight 0.2s;
  min-width: 240px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   КАЛЕНДАРЬ
   ============================================================ */
.calendar-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
  gap: 14px;
}
.calendar-header h2 { margin: 0; font-size: 22px; font-weight: 700; text-transform: capitalize; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 0;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 8px;
  font-size: 13px;
  position: relative;
  display: flex; flex-direction: column;
  min-height: 80px;
  transition: all 0.15s;
  cursor: default;
}
.calendar-day.other-month { opacity: 0.35; }
.calendar-day .day-num { font-weight: 600; font-size: 14px; }
.calendar-day.today { border-color: var(--primary); border-width: 2px; }
.calendar-day.today .day-num { color: var(--primary); }
.calendar-day.weekend { background: var(--bg-soft); }
.calendar-day.holiday {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border-color: #fcd34d;
}
.calendar-day.holiday .holiday-name {
  font-size: 10px; color: #92400e; font-weight: 600;
  margin-top: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.calendar-day .events { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.calendar-day .event {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.calendar-day .event.pending { background: var(--warning-soft); color: #92400e; }

.calendar-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.calendar-legend .item { display: flex; align-items: center; gap: 6px; }
.calendar-legend .swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* списки заявок (чтоб мобильно тоже выглядело) */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
}
.req-item .icon-circle {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 18px;
}
.req-item .meta { font-size: 12px; color: var(--text-muted); }
.req-item .actions { display: flex; gap: 6px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state .emoji { font-size: 40px; margin-bottom: 8px; opacity: 0.6; }

/* search bar */
.search-bar {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.search-bar input { max-width: 360px; }

/* heading row */
.section { margin-bottom: 28px; }
.section h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }

/* small helpers */
.flex-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.spacer { flex: 1; }

.notif-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg-elev);
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notif-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.notif-card .notif-content { flex: 1; min-width: 0; }
.notif-card input[type="checkbox"] { margin-top: 4px; cursor: pointer; width: 16px; height: 16px; }
.notif-card .delete-btn { padding: 4px 8px; }
.notif-toolbar {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px;
  position: sticky; top: 0; z-index: 10;
}
.notif-toolbar label { margin: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* Timeline истории заявки */
.history-list {
  position: relative;
  padding-left: 24px;
  margin: 12px 0 0;
}
.history-list::before {
  content: '';
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.history-item {
  position: relative;
  padding: 8px 0;
}
.history-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 14px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--primary);
}
.history-item.created::before { border-color: var(--info); }
.history-item.approved::before { border-color: var(--success); background: var(--success); }
.history-item.rejected::before { border-color: var(--danger); background: var(--danger); }
.history-item.alt_proposed::before { border-color: var(--warning); }
.history-item.alt_accepted::before { border-color: var(--success); background: var(--success); }
.history-item.dates_changed::before { border-color: var(--primary); }
.history-item.deleted::before { border-color: var(--text-faint); background: var(--text-faint); }
.history-item .hist-action { font-weight: 600; font-size: 14px; }
.history-item .hist-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.history-item .hist-detail { font-size: 13px; color: var(--text); margin-top: 4px; padding: 6px 10px; background: var(--bg-soft); border-radius: 6px; }
.notif-card .notif-header {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-bottom: 8px;
}
.notif-card .subj { font-weight: 600; font-size: 14px; }
.notif-card .body { font-size: 13px; color: var(--text-muted); white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; background: var(--bg-soft); padding: 10px 12px; border-radius: var(--radius-sm); margin-top: 8px; }
.notif-card .when { font-size: 11px; color: var(--text-faint); }
