:root {
  --primary: #0f3b7a;
  --primary-dark: #0a2b5c;
  --secondary: #475569;
  --secondary-dark: #334155;
  --success: #0b6b4f;
  --success-dark: #08523d;
  --danger: #b91c1c;
  --danger-dark: #991b1b;
  --warning: #b45309;
  --warning-dark: #92400e;
  --info: #075985;
  --info-dark: #054a6b;
  --light: #f8fafc;
  --dark: #0b1c33;
  --border-color: #e9edf4;
  --border-light: #f0f2f5;
  --text-muted: #64748b;
  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --radius-xl: 40px;
  --shadow: 0 10px 25px -5px rgba(0,0,0,0.05), 0 2px 6px rgba(0,0,0,0.02);
  --shadow-hover: 0 20px 30px -8px rgba(0,0,0,0.08);
  --transition: all 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  background: #f5f7fb;
  padding: 24px 16px;
  color: var(--dark);
  overflow-x: hidden;
}

.rounded-0 { border-radius: 0 !important; }
.rounded { border-radius: var(--radius) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-pill { border-radius: 9999px !important; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.row--sm { max-width: 640px; margin-left: auto; margin-right: auto; }
.row--md { max-width: 820px; margin-left: auto; margin-right: auto; }
.row--lg { max-width: 1200px; margin-left: auto; margin-right: auto; }
.col { flex: 1 0 0%; padding: 0 12px; }
.col-1 { flex: 0 0 8.333%; } .col-2 { flex: 0 0 16.667%; } .col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.333%; } .col-5 { flex: 0 0 41.667%; } .col-6 { flex: 0 0 50%; }
.col-7 { flex: 0 0 58.333%; } .col-8 { flex: 0 0 66.667%; } .col-9 { flex: 0 0 75%; }
.col-10 { flex: 0 0 83.333%; } .col-11 { flex: 0 0 91.667%; } .col-12 { flex: 0 0 100%; }
@media (max-width:768px) {
  .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 { flex: 0 0 100%; }
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.box {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: 50px;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  margin: 4px 6px 4px 0;
  transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 12px rgba(15,59,122,0.18); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--warning-dark); }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: var(--info-dark); }
.btn-sm { padding: 6px 16px; font-size: 0.9rem; }
.btn-lg { padding: 14px 28px; font-size: 1.15rem; }
.btn-block { display: flex; width: 100%; margin-left: 0; margin-right: 0; }

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--dark);
  font-size: 0.95rem;
}
.form-control {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--dark);
  background-color: #fff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15,59,122,0.15);
}
.form-control::placeholder { color: #94a3b8; }
.form-control:disabled, .form-control[readonly] { background-color: #f1f5f9; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 12px;
  padding-right: 40px;
}
textarea.form-control { min-height: 100px; resize: vertical; }

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.input-group .form-control {
  flex: 1 1 auto;
  width: 1%;
  border-radius: var(--radius-sm);
}
.input-group-prepend,
.input-group-append {
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  font-size: 1rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.input-group-prepend {
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group-append {
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-group .form-control:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group .form-control:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
[dir="rtl"] .input-group-prepend {
  border-right: 1.5px solid var(--border-color);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
[dir="rtl"] .input-group-append {
  border-left: 1.5px solid var(--border-color);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
[dir="rtl"] .input-group .form-control:not(:first-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
[dir="rtl"] .input-group .form-control:not(:last-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
[dir="rtl"] select.form-control {
  background-position: left 16px center;
  padding-left: 40px;
  padding-right: 16px;
}

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-check-input {
  width: 1.2em; height: 1.2em; margin: 0; appearance: none;
  border: 1.5px solid var(--border-color); border-radius: 4px;
  background-color: #fff; transition: background 0.1s;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.form-check-input[type="checkbox"]:checked {
  background-color: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
  background-size: 80% 80%; background-position: center; background-repeat: no-repeat;
}
.form-check-input[type="radio"] { border-radius: 50%; }
.form-check-input[type="radio"]:checked {
  background-color: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3ccircle cx='12' cy='12' r='6' fill='%23fff'/%3e%3c/svg%3e");
  background-size: 70% 70%; background-position: center; background-repeat: no-repeat;
}
.form-check-input:focus { outline: 2px solid rgba(15,59,122,0.25); outline-offset: 2px; }
.form-check-label { cursor: pointer; }

.form-switch { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.form-switch .form-check-input {
  width: 2.8em; height: 1.5em; border-radius: 2em; background-color: #cbd5e1;
  border: none; position: relative;
}
.form-switch .form-check-input:checked { background-color: var(--primary); }
.form-switch .form-check-input::before {
  content: ""; position: absolute; width: 1.2em; height: 1.2em;
  border-radius: 50%; background-color: white; top: 0.15em; left: 0.15em;
  transition: transform 0.2s;
}
.form-switch .form-check-input:checked::before { transform: translateX(1.3em); }

[dir="rtl"] .form-switch .form-check-input::before {
  left: auto;
  right: 0.15em;
}
[dir="rtl"] .form-switch .form-check-input:checked::before {
  transform: translateX(-1.3em);
}
.form-range {
  width: 100%; height: 6px; appearance: none; background: transparent;
}
.form-range::-webkit-slider-runnable-track {
  height: 6px; background: var(--border-color); border-radius: 3px;
}
.form-range::-webkit-slider-thumb {
  appearance: none; width: 20px; height: 20px; margin-top: -7px;
  background: var(--primary); border-radius: 50%; border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.form-range::-moz-range-track { height: 6px; background: var(--border-color); border-radius: 3px; }
.form-range::-moz-range-thumb {
  width: 20px; height: 20px; background: var(--primary); border-radius: 50%;
  border: 2px solid white;
}
.is-valid { border-color: var(--success) !important; }
.is-invalid { border-color: var(--danger) !important; }
.valid-feedback { color: var(--success); font-size: 0.875rem; margin-top: 4px; }
.invalid-feedback { color: var(--danger); font-size: 0.875rem; margin-top: 4px; }
.form-text { color: var(--text-muted); font-size: 0.875rem; margin-top: 6px; }

.modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15,23,42,0.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; z-index: 1000;
}
.modal:target { display: flex; }
.modal-content {
  background: #fff; border-radius: 32px; padding: 32px; max-width: 520px;
  width: 90%; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 30px 50px -12px rgba(0,0,0,0.25); position: relative;
}
.modal-sm .modal-content { max-width: 400px; }
.modal-lg .modal-content { max-width: 720px; }
.modal-full .modal-content { max-width: 96%; width: 96%; height: 90vh; }
.close {
  position: absolute; top: 16px; right: 20px;
  font-size: 34px; line-height: 1;
  text-decoration: none; color: #94a3b8; transition: color 0.15s;
  background: none; border: none; cursor: pointer;
}
.close:hover { color: #0f172a; }

[dir="rtl"] .close {
  right: auto;
  left: 20px;
}
.alert {
  padding: 16px 20px; border-radius: 20px; margin-bottom: 20px;
  border: 1px solid transparent; background: #f8fafc; color: #1e293b;
  display: flex; align-items: center; gap: 12px;
}
.alert-success { background: #e3f9ed; border-color: #b6e6d2; color: #0b4635; }
.alert-error { background: #fee9e7; border-color: #fccac7; color: #a1201a; }
.alert-warning { background: #fff3e0; border-color: #ffdba6; color: #93480b; }
.alert-info { background: #e0f2fe; border-color: #b8dffb; color: #075985; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; margin-bottom: 16px; color: #0a1e3c; }
h1 { font-size: 2.2rem; } h2 { font-size: 1.8rem; margin-top: 32px; }
h3 { font-size: 1.4rem; } h4 { font-size: 1.2rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 12px; } .mb-1 { margin-bottom: 12px; }
.mt-2 { margin-top: 24px; } .mb-2 { margin-bottom: 24px; }
.mt-3 { margin-top: 36px; } .mb-3 { margin-bottom: 36px; }
.p-1 { padding: 12px; } .p-2 { padding: 24px; }
.p-8px {padding: 8px !important;}
.p-4px {padding: 4px !important;}
.bg-muted { background: #f9fbfd; }
hr { margin: 32px 0; border: 0; border-top: 1px solid #e2e8f0; }
code {
  background: #eef2ff; padding: 4px 12px; border-radius: 40px;
  font-size: 0.9rem; color: #1e40af; display: inline-block;
}

.visible-xs, .visible-sm, .visible-md, .visible-lg { display: none; }
.hidden-xs, .hidden-sm, .hidden-md, .hidden-lg { display: block; }
@media (max-width:575px) { .visible-xs { display: block; } .hidden-xs { display: none; } }
@media (min-width:576px) and (max-width:767px) { .visible-sm { display: block; } .hidden-sm { display: none; } }
@media (min-width:768px) and (max-width:991px) { .visible-md { display: block; } .hidden-md { display: none; } }
@media (min-width:992px) { .visible-lg { display: block; } .hidden-lg { display: none; } }

.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 0.25em solid var(--border-color);
  border-right-color: var(--primary);
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}
.spinner-border-sm { width: 1.2rem; height: 1.2rem; border-width: 0.2em; }
.spinner-border-lg { width: 3rem; height: 3rem; border-width: 0.3em; }

.spinner-grow {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  background-color: var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: spinner-grow 0.75s linear infinite;
}
.spinner-grow-sm { width: 1.2rem; height: 1.2rem; }
.spinner-grow-lg { width: 3rem; height: 3rem; }

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}
@keyframes spinner-grow {
  0% { transform: scale(0); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

.skeleton {
  background: linear-gradient(90deg, #e9edf4 25%, #f0f4f9 50%, #e9edf4 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
  min-height: 1em;
  color: transparent;
  pointer-events: none;
  user-select: none;
}
.skeleton-text { height: 1em; margin-bottom: 0.5rem; }
.skeleton-circle { border-radius: 50%; }
.skeleton-btn { height: 2.5rem; width: 100px; }
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress {
  display: flex;
  height: 1rem;
  overflow: hidden;
  background-color: #e9edf4;
  border-radius: 50px;
}
.progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  background-color: var(--primary);
  transition: width 0.6s ease;
  border-radius: 50px;
  font-size: 0.75rem;
}
.progress-bar-striped {
  background-image: linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);
  background-size: 1rem 1rem;
}
.progress-bar-animated { animation: progress-bar-stripes 1s linear infinite; }
@keyframes progress-bar-stripes {
  from { background-position: 1rem 0; }
  to { background-position: 0 0; }
}

.badge {
  display: inline-block;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 50px;
  background-color: var(--secondary);
}
.badge-primary { background-color: var(--primary); }
.badge-success { background-color: var(--success); }
.badge-danger { background-color: var(--danger); }
.badge-warning { background-color: var(--warning); color: #212529; }
.badge-info { background-color: var(--info); }
.badge-light { background-color: var(--light); color: #212529; }

[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

.btn-icon {
  padding: 10px;
  border-radius: 50%;
}
.btn-icon.btn-sm { padding: 6px; }
.btn-icon.btn-lg { padding: 14px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.direction-rtl { direction: rtl; }
.direction-ltr { direction: ltr; }