/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F1F5F9;
  color: #1E293B;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 58px;
  gap: 4px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #1E293B;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  margin-right: 12px;
}
.nav-brand-icon { color: #2563EB; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  padding: 7px 13px;
  border-radius: 8px;
  color: #64748B;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-link:hover { background: #F1F5F9; color: #1E293B; }
.nav-link.active { background: #EFF6FF; color: #2563EB; font-weight: 600; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #1E293B;
  line-height: 1.2;
  white-space: nowrap;
}

.user-dept {
  font-size: 11px;
  color: #94A3B8;
  display: block;
  line-height: 1.2;
  white-space: nowrap;
}

.nav-logout {
  font-size: 13px;
  color: #94A3B8;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-logout:hover { color: #DC2626; background: #FEF2F2; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #475569;
  padding: 6px;
  border-radius: 6px;
  margin-left: 8px;
}
.nav-toggle:hover { background: #F1F5F9; }

/* ===== LAYOUT ===== */
.main-content { min-height: calc(100vh - 58px); }

.container    { max-width: 940px;  margin: 36px auto; padding: 0 20px; }
.container-lg { max-width: 1120px; margin: 36px auto; padding: 0 20px; }
.container-md { max-width: 870px;  margin: 36px auto; padding: 0 20px 60px; }

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid rgba(226,232,240,0.8);
}

.card h2 {
  font-size: 14px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 20px;
}

/* ===== SECTION TITLES ===== */
.section { margin-bottom: 24px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid #F1F5F9;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary { background: #2563EB; color: #fff; }
.btn-primary:hover { background: #1D4ED8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.btn-primary:active { transform: none; box-shadow: none; }
.btn-primary:disabled { background: #CBD5E1; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-download {
  background: #059669;
  color: #fff;
  text-decoration: none;
  margin-top: 16px;
  border: none;
  padding: 10px 22px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  transition: all 0.18s;
}
.btn-download:hover { background: #047857; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(5,150,105,0.3); }

.btn-pdf {
  background: #EEF2FF;
  color: #4338CA;
  text-decoration: none;
  margin-top: 16px;
  margin-left: 10px;
  border: none;
  padding: 10px 22px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  transition: all 0.18s;
}
.btn-pdf:hover { background: #4338CA; color: #fff; }

.btn-danger {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
  padding: 10px 20px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-danger:hover { background: #DC2626; color: #fff; }

.btn-sm { padding: 6px 14px !important; font-size: 12px !important; border-radius: 7px !important; }

/* ===== FORMS ===== */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

input[type=text],
input[type=password],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: #1E293B;
  background: #fff;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

input::placeholder,
textarea::placeholder { color: #CBD5E1; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: 0.4; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-ok       { background: #ECFDF5; color: #059669; }
.badge-warn     { background: #FFFBEB; color: #D97706; }
.badge-info     { background: #EFF6FF; color: #2563EB; }
.badge-mismatch { background: #FEF2F2; color: #DC2626; }
.badge-high     { background: #FEF2F2; color: #DC2626; }
.badge-medium   { background: #FFFBEB; color: #D97706; }
.badge-low      { background: #ECFDF5; color: #059669; }
.badge-unknown  { background: #F8FAFC; color: #94A3B8; }
.badge-dept     { background: #EFF6FF; color: #2563EB; }
.badge-admin    { background: #1E293B; color: #fff; }
.badge-off      { background: #F1F5F9; color: #94A3B8; }
.badge-inactive { background: #FEF2F2; color: #DC2626; }

/* ===== STATUS ROWS ===== */
.status-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 11px;
  margin-bottom: 10px;
  border: 1px solid;
}
.status-row.ok    { background: #ECFDF5; border-color: #A7F3D0; }
.status-row.warn  { background: #FFFBEB; border-color: #FDE68A; }
.status-row.error { background: #FEF2F2; border-color: #FECACA; }
.status-icon  { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.status-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; color: #1E293B; }
.status-text  { font-size: 13px; color: #64748B; line-height: 1.5; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
  vertical-align: middle;
  color: #1E293B;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAFA; }

.table-conditions { width: 100%; border-collapse: collapse; }
.table-conditions th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}
.table-conditions td { padding: 11px 12px; border-bottom: 1px solid #F1F5F9; font-size: 14px; }
.table-conditions tr:last-child td { border-bottom: none; }
.td-label { color: #64748B; width: 40%; font-size: 14px; }
.td-value  { font-weight: 600; color: #1E293B; }

.verif-table { width: 100%; border-collapse: collapse; }
.verif-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}
.verif-table td { padding: 10px 12px; border-bottom: 1px solid #F1F5F9; font-size: 13px; }
.verif-table tr:last-child td { border-bottom: none; }

/* ===== UPLOAD ZONES ===== */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.upload-zone {
  border: 2px dashed #CBD5E1;
  border-radius: 13px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: #FAFCFF;
}
.upload-zone:hover {
  border-color: #2563EB;
  background: #EFF6FF;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37,99,235,0.12);
}
.upload-zone.has-file {
  border-color: #059669;
  background: #ECFDF5;
  border-style: solid;
}
.upload-zone.required-label::after {
  content: 'обязательно';
  position: absolute;
  top: 10px; right: 12px;
  font-size: 10px;
  color: #DC2626;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.upload-zone.optional-label::after {
  content: 'необязательно';
  position: absolute;
  top: 10px; right: 12px;
  font-size: 10px;
  color: #94A3B8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.upload-zone input { display: none; }
.upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-zone h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: #1E293B; }
.upload-zone p  { font-size: 12px; color: #94A3B8; }
.upload-zone .file-name { font-size: 12px; color: #059669; font-weight: 600; margin-top: 8px; word-break: break-all; }

.project-name-row { margin-top: 16px; }
.project-name-row label { margin-bottom: 8px; }

/* ===== LOADER ===== */
.loader { display: none; text-align: center; padding: 52px; }
.spinner {
  width: 42px; height: 42px;
  border: 3px solid #E2E8F0;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader p { color: #64748B; font-size: 14px; font-weight: 500; }

.results { display: none; }

/* ===== RISK BANNER (JS-generated) ===== */
.risk-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 22px;
  border: 1px solid;
  flex-wrap: wrap;
}
.risk-banner.risk-high   { background: #FEF2F2; border-color: #FECACA; }
.risk-banner.risk-medium { background: #FFFBEB; border-color: #FDE68A; }
.risk-banner.risk-low    { background: #ECFDF5; border-color: #A7F3D0; }
.risk-banner-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.risk-banner-reason { font-size: 13px; color: #64748B; }

/* ===== OPERATIONAL CARDS ===== */
.op-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.op-card { padding: 13px 15px; border-radius: 10px; border: 1px solid; }
.op-card.op-warn  { background: #FFFBEB; border-color: #FDE68A; }
.op-card.op-alert { background: #FEF2F2; border-color: #FECACA; }
.op-card.op-ok    { background: #ECFDF5; border-color: #A7F3D0; }
.op-card:not(.op-warn):not(.op-alert):not(.op-ok) { background: #FAFAFA; border-color: #E2E8F0; }

.op-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.op-card-label  { font-size: 11px; font-weight: 700; color: #64748B; text-transform: uppercase; letter-spacing: 0.4px; }
.op-detail { font-size: 12px; color: #64748B; margin-top: 3px; line-height: 1.5; }
.op-ref    { font-size: 11px; color: #94A3B8; margin-top: 3px; }
.op-impact { font-size: 12px; color: #D97706; margin-top: 4px; }
.op-pill   { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11px; font-weight: 700; }

/* ===== SUMMARY BOX ===== */
.summary-box {
  background: #F8FAFC;
  border-radius: 10px;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #1E293B;
  white-space: pre-wrap;
  border: 1px solid #E2E8F0;
}

/* ===== SAVED BADGE ===== */
.saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 20px;
  font-size: 12px;
  color: #059669;
  font-weight: 600;
  margin-top: 16px;
}
.saved-badge a { color: #059669; text-decoration: none; font-weight: 700; }

/* ===== NOTES (inline in results) ===== */
.notes-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid #F1F5F9;
}
.notes-section label {
  font-size: 12px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.notes-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  line-height: 1.6;
  color: #1E293B;
}
.notes-textarea:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.notes-save-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.btn-save-notes {
  padding: 8px 20px;
  background: #2563EB;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-save-notes:hover { background: #1D4ED8; }
.notes-saved { font-size: 13px; color: #059669; display: none; font-weight: 500; }

/* ===== CHAT (inline in results) ===== */
.chat-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #F1F5F9;
}
.chat-section h3 { font-size: 14px; font-weight: 700; color: #1E293B; margin-bottom: 14px; }

/* ===== CHAT (standalone card - history_view) ===== */
.notes-card,
.chat-card {
  background: #fff;
  border-radius: 16px;
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid rgba(226,232,240,0.8);
}
.notes-card h2,
.chat-card h2 {
  font-size: 14px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}
.btn-save {
  padding: 9px 22px;
  background: #2563EB;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-save:hover { background: #1D4ED8; }

/* ===== CHAT MESSAGES (shared) ===== */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 0;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.chat-msg.user      { align-self: flex-end; background: #2563EB; color: #fff; border-radius: 12px 12px 2px 12px; }
.chat-msg.assistant { align-self: flex-start; background: #F1F5F9; color: #1E293B; border-radius: 12px 12px 12px 2px; border: 1px solid #E2E8F0; }
.chat-msg.assistant strong { color: #2563EB; }

.chat-input-row { display: flex; gap: 10px; }
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  line-height: 1.5;
  color: #1E293B;
}
.chat-input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.chat-send {
  padding: 10px 20px;
  background: #2563EB;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}
.chat-send:hover { background: #1D4ED8; }
.chat-send:disabled { background: #CBD5E1; cursor: not-allowed; }
.chat-typing { font-size: 12px; color: #94A3B8; padding: 4px 0; display: none; }

/* ===== ERROR BOX ===== */
.error-box { background: #FEF2F2; border: 1px solid #FECACA; border-radius: 11px; padding: 16px; color: #DC2626; font-size: 14px; }

/* ===== FLASH ===== */
.flash { padding: 12px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.flash.success { background: #ECFDF5; border: 1px solid #A7F3D0; color: #059669; }
.flash.error   { background: #FEF2F2; border: 1px solid #FECACA; color: #DC2626; }
.flash-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #DC2626; padding: 12px 16px; border-radius: 9px; margin-bottom: 20px; font-size: 14px; }

/* ===== HISTORY PAGE ===== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar h2 { font-size: 16px; font-weight: 700; color: #1E293B; flex: 1; margin: 0; text-transform: none; letter-spacing: 0; }

.filter-btn {
  padding: 6px 16px;
  border: 1.5px solid #E2E8F0;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
  color: #64748B;
  font-family: inherit;
}
.filter-btn:hover { border-color: #2563EB; color: #2563EB; }
.filter-btn.active { background: #1E293B; color: #fff; border-color: #1E293B; }
.filter-btn.f-high.active  { background: #DC2626; border-color: #DC2626; }
.filter-btn.f-med.active   { background: #D97706; border-color: #D97706; }
.filter-btn.f-low.active   { background: #059669; border-color: #059669; }

.search-box { padding: 8px 14px; border: 1.5px solid #E2E8F0; border-radius: 9px; font-size: 13px; outline: none; width: 220px; transition: all 0.18s; font-family: inherit; }
.search-box:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.project-name  { font-weight: 600; color: #1E293B; font-size: 13px; }
.file-name     { font-size: 12px; color: #94A3B8; margin-top: 2px; }
.notes-preview { font-size: 11px; color: #64748B; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }

.btn-sm { padding: 5px 13px; border: none; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: all 0.15s; font-family: inherit; }
.btn-view { background: #EFF6FF; color: #2563EB; }
.btn-view:hover { background: #2563EB; color: #fff; }
.btn-pdf  { background: #EEF2FF; color: #4338CA; }
.btn-pdf:hover { background: #4338CA; color: #fff; }
.btn-del  { background: #FEF2F2; color: #DC2626; }
.btn-del:hover { background: #DC2626; color: #fff; }

.empty-state { text-align: center; padding: 60px 20px; color: #94A3B8; }
.empty-state .icon { font-size: 48px; margin-bottom: 14px; }
.empty-state p { font-size: 15px; margin-bottom: 8px; color: #64748B; }
.empty-state a { color: #2563EB; text-decoration: none; font-size: 13px; }

/* ===== HISTORY VIEW META BAR ===== */
.meta-bar {
  background: #fff;
  border-radius: 14px;
  padding: 16px 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.05);
  border: 1px solid rgba(226,232,240,0.8);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.meta-item { font-size: 13px; color: #64748B; }
.meta-item strong { color: #1E293B; }

.btn-pdf-hdr {
  padding: 8px 18px;
  background: #4338CA;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-pdf-hdr:hover { background: #3730A3; color: #fff; }

/* ===== DASHBOARD ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.05);
  border: 1px solid rgba(226,232,240,0.8);
}
.stat-card .label { font-size: 11px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.stat-card .value { font-size: 36px; font-weight: 800; line-height: 1; }
.stat-card .sub   { font-size: 12px; color: #94A3B8; margin-top: 5px; }
.v-total  { color: #1E293B; }
.v-high   { color: #DC2626; }
.v-medium { color: #D97706; }
.v-low    { color: #059669; }

.risk-bar-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.05);
  border: 1px solid rgba(226,232,240,0.8);
}
.risk-bar-wrap h2 { font-size: 12px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 16px; }
.risk-bar-track { height: 18px; border-radius: 9px; background: #F1F5F9; overflow: hidden; display: flex; }
.risk-seg { height: 100%; transition: width 0.5s; }
.risk-seg.high   { background: #DC2626; }
.risk-seg.medium { background: #F59E0B; }
.risk-seg.low    { background: #059669; }
.risk-bar-legend { display: flex; gap: 20px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #64748B; }
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.cnt-bar-wrap { display: flex; align-items: center; gap: 8px; }
.cnt-bar { height: 6px; border-radius: 3px; background: #2563EB; min-width: 4px; }
.empty { color: #94A3B8; font-size: 13px; padding: 20px 0; text-align: center; }

/* ===== ADMIN ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 0; }

.checkboxes { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox-item { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; color: #1E293B; }
.checkbox-item input { width: 16px; height: 16px; cursor: pointer; accent-color: #2563EB; }

.modal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 18px; padding: 28px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-header h3 { font-size: 17px; font-weight: 700; color: #1E293B; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #94A3B8; line-height: 1; padding: 4px; }
.modal-close:hover { color: #1E293B; }
.modal-footer { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== CALCULATOR ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 0; }
.field label .req { color: #DC2626; margin-left: 2px; }
.field label .opt { color: #94A3B8; font-weight: 400; font-size: 11px; text-transform: none; letter-spacing: 0; margin-left: 4px; }

.employ-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.employ-row { display: flex; align-items: center; gap: 12px; }
.employ-row label { font-size: 13px; color: #1E293B; flex: 1; font-weight: 500; text-transform: none; letter-spacing: 0; }
.employ-row input { width: 90px; flex-shrink: 0; }
.employ-sum { margin-top: 14px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px; color: #1E293B; }
.sum-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.sum-ok  { background: #ECFDF5; color: #059669; }
.sum-err { background: #FEF2F2; color: #DC2626; }

.schedule-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.schedule-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 9px;
  transition: all 0.15s;
  background: #fff;
}
.schedule-option:hover { border-color: #2563EB; background: #EFF6FF; }
.schedule-option input[type=radio] { width: 16px; height: 16px; accent-color: #2563EB; flex-shrink: 0; }
.schedule-option.selected { border-color: #2563EB; background: #EFF6FF; }
.schedule-option span { font-size: 13px; color: #1E293B; }

.positions-list { display: flex; flex-direction: column; gap: 14px; }
.position-card { border: 1.5px solid #E2E8F0; border-radius: 12px; padding: 18px; position: relative; transition: border-color 0.15s; }
.position-card:hover { border-color: #BFDBFE; }
.position-card .pos-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.position-card .pos-num {
  background: #2563EB;
  color: #fff;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.position-card .pos-name-input { flex: 1; }
.btn-remove { background: none; border: none; color: #CBD5E1; font-size: 20px; cursor: pointer; padding: 2px 6px; line-height: 1; border-radius: 4px; transition: color 0.15s; }
.btn-remove:hover { color: #DC2626; }
.pos-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.month-toggle { font-size: 12px; color: #2563EB; cursor: pointer; text-decoration: underline; margin-top: 10px; display: inline-block; }
.months-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.months-grid .month-cell { display: flex; flex-direction: column; gap: 4px; }
.months-grid .month-cell span { font-size: 11px; color: #94A3B8; text-align: center; }
.months-grid .month-cell input { text-align: center; padding: 7px 4px; font-size: 13px; }
.btn-add-pos {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 2px dashed #CBD5E1;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: #64748B;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
  font-family: inherit;
}
.btn-add-pos:hover { border-color: #2563EB; color: #2563EB; background: #EFF6FF; }
.fot-row { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 14px; align-items: end; margin-bottom: 14px; }
.fot-row .fot-label { font-size: 13px; font-weight: 600; color: #1E293B; padding-bottom: 10px; }
.expense-section { margin-bottom: 16px; }
.expense-section h4 { font-size: 12px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.expense-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-bar { display: flex; justify-content: flex-end; margin-top: 8px; }
.btn-submit {
  padding: 13px 40px;
  background: #2563EB;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.btn-submit:hover { background: #1D4ED8; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,0.3); }
.btn-submit:disabled { background: #CBD5E1; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .two-col    { grid-template-columns: 1fr; }
  .fot-row    { grid-template-columns: 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .op-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .upload-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { width: 100%; }
  .navbar { padding: 0 14px; }
  .nav-links {
    display: none;
    position: absolute;
    top: 58px; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    flex-direction: column;
    padding: 10px;
    gap: 2px;
    z-index: 99;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  .nav-links.show { display: flex; }
  .nav-link { width: 100%; padding: 10px 14px; border-radius: 8px; }
  .nav-user  { display: none; }
  .nav-toggle { display: flex; }
  .card { padding: 18px; border-radius: 14px; }
  .months-grid { grid-template-columns: repeat(4, 1fr); }
}
