/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.3s ease;
}

/* About Modal — centered, no scroll */
#aboutModal {
  overflow: hidden;
  justify-content: center;
  align-items: center;
}

#aboutModal .modal-content {
  margin: 0;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  padding: 24px 28px;
  overflow: hidden;
  box-sizing: border-box;
  text-align: center;
}

#aboutModal .modal-content h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

#aboutModal .modal-content p {
  margin: 0 0 10px;
  font-size: 14px;
}

#aboutVideo {
  width: 45%;
  max-width: 180px;
  margin: 10px auto;
  border-radius: 8px;
  display: block;
}

#aboutModal .about-developer-info {
  margin-top: 14px;
  padding-top: 14px;
}

#aboutModal .about-developer-info .developer-name {
  margin-bottom: 8px;
  font-size: 14px;
}

#aboutModal .about-developer-info .contact-item {
  margin: 4px 0;
  font-size: 13px;
}

/* Tablet */
@media (max-width: 768px) {
  #aboutModal .modal-content {
    max-width: 380px;
    padding: 20px 22px;
  }

  #aboutVideo {
    width: 40%;
    max-width: 150px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  #aboutModal .modal-content {
    width: 92%;
    max-width: none;
    padding: 18px 16px;
  }

  #aboutModal .modal-content h3 {
    font-size: 15px;
  }

  #aboutVideo {
    width: 35%;
    max-width: 120px;
    margin: 8px auto;
  }

  #aboutModal .about-developer-info {
    margin-top: 10px;
    padding-top: 10px;
  }

  #aboutModal .about-developer-info .contact-item {
    font-size: 12px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: rgba(255, 255, 255, 0.5);
  margin: 10% auto;
  padding: 30px;
  border: 1px solid #ddd;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease;
  position: relative;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  line-height: 20px;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: #000;
}

.modal-content h2 {
  margin-top: 0;
  color: #333;
}

.modal-content p {
  color: #666;
  line-height: 1.6;
}

/* About Modal Styles — base fallbacks (overridden by #aboutModal rules above) */

.about-developer-info {
    border-top: 1px solid #ddd;
    text-align: center;
}

.about-developer-info .developer-name {
    font-weight: bold;
}

.about-developer-info .contact-icon {
    margin-right: 8px;
    color: #04AA6D;
}

.about-developer-info .contact-link-email {
    color: #04AA6D;
    text-decoration: none;
}

.about-developer-info .contact-link-phone {
    color: #333;
    text-decoration: none;
}

/* ============================================
   CALENDAR MODAL
   ============================================ */

.calendar-modal .modal-content {
    width: auto;
    max-width: 520px;
    max-height: 90vh;
    padding: 14px;
    margin: 80px auto 4% auto;
    background-color: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-modal .close {
    display: none;
}

.calendar-modal .calendar-ok-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.calendar-modal .calendar-ok-btn:hover {
    background: #0056b3;
}

.calendar-modal .calendar-ok-btn:active {
    background: #004494;
}

.calendar-modal #calendarContainer {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* Стилі для календаря в модальному вікні */
.calendar-modal .calendar-container {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.calendar-modal .calendar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.calendar-modal .calendar-controls label {
    font-weight: 500;
    color: #333;
    margin-right: 2px;
    font-size: 12px;
}

.calendar-modal .calendar-controls select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
}

.calendar-modal .calendar-controls button {
    padding: 4px 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.calendar-modal .calendar-controls button:hover {
    background: #0056b3;
}

.calendar-modal .calendar-scale {
    display: none; /* Приховуємо масштаб - не потрібен в модалці */
}

.calendar-modal .calendar-wrapper {
    border-radius: 6px;
    overflow: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
}

.calendar-modal .calendar-table {
    width: 100%;
    max-width: 420px;
    min-width: 240px;
    margin: 0 auto;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar-modal .calendar-table th {
    background: #007bff;
    color: white;
    padding: 4px 0;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    width: calc(100% / 7);
    box-sizing: border-box;
}

.calendar-modal .calendar-table td {
    padding: 0;
    text-align: center;
    border: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 12px;
    vertical-align: middle;
    width: calc(100% / 7);
    min-width: 34px;
    height: 32px;
    line-height: 32px;
    box-sizing: border-box;
}

.calendar-modal .calendar-table td:hover {
    background: #e3f2fd;
}

.calendar-modal .calendar-table td.today {
    background: #28a745;
    color: white;
    font-weight: bold;
}

.calendar-modal .calendar-table td.prev-month,
.calendar-modal .calendar-table td.next-month {
    color: #aaa;
    background: #f9f9f9;
}

/* Мобільна адаптація */
@media (max-width: 480px) {
    .calendar-modal .modal-content {
        margin: 60px 10px 10px 10px;
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        padding: 12px;
        border-radius: 8px;
    }
    
    .calendar-modal .calendar-controls {
        padding: 6px;
        gap: 5px;
    }
    
    .calendar-modal .calendar-controls label {
        font-size: 11px;
    }
    
    .calendar-modal .calendar-controls select {
        padding: 3px 5px;
        font-size: 11px;
    }
    
    .calendar-modal .calendar-controls button {
        padding: 3px 8px;
        font-size: 11px;
    }
    
    .calendar-modal .calendar-table th {
        padding: 4px 0;
        font-size: 11px;
        width: calc(100% / 7);
    }
    
    .calendar-modal .calendar-table td {
        font-size: 12px;
        min-width: 28px;
        height: 26px;
        line-height: 26px;
        width: calc(100% / 7);
        box-sizing: border-box;
    }
}

/* ============================================
   LOOKUP FILTER MODAL STYLES
   (перенесено з inline стилів content.js)
   ============================================ */

.lookup-filter-modal .modal-content {
    max-width: 600px;
    max-height: 80vh;
}

.lookup-filter-modal h3 {
    margin-bottom: 15px;
}

.lookup-filter-search {
    margin-bottom: 10px;
}

.lookup-search-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.lookup-filter-list {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.lookup-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.lookup-item:hover {
    background-color: #f5f5f5;
}

.lookup-item.selected {
    background-color: #e3f2fd;
}

.lookup-filter-buttons {
    margin-top: 15px;
    text-align: right;
}

.lookup-clear-btn,
.lookup-cancel-btn {
    padding: 8px 16px;
    margin-right: 10px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.lookup-clear-btn:hover,
.lookup-cancel-btn:hover {
    background: #f5f5f5;
}

.lookup-apply-btn {
    padding: 8px 16px;
    margin-right: 10px;
    cursor: pointer;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
}

.lookup-apply-btn:hover {
    background: #1976D2;
}

/* ============================================
   PATIENT SELECTION MODAL
   ============================================ */

.patient-select-modal .modal-content {
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    padding: 0;
    margin: 5% auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.patient-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #007bff;
    color: white;
}

.patient-select-header h3 {
    margin: 0;
    font-size: 18px;
}

.patient-select-header .close {
    color: white;
    font-size: 24px;
    line-height: 1;
}

.patient-select-header .close:hover {
    color: #f0f0f0;
}

.patient-select-filters {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.patient-select-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.patient-select-field {
    flex: 1;
}

.patient-select-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.patient-select-field input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.btn-search-modal {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-search-modal:hover {
    background: #0056b3;
}

.btn-clear-modal {
    padding: 8px 16px;
    background: #fff;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-clear-modal:hover {
    background: #dc3545;
    color: white;
}

.patient-select-info {
    padding: 20px;
    text-align: center;
    color: #666;
}

.patient-select-info.error {
    color: #dc3545;
}

.patient-select-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
    max-height: 400px;
}

.patient-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.patient-result-item:hover {
    background: #e3f2fd;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.patient-result-item .patient-icon {
    width: 40px;
    height: 40px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 18px;
    color: #666;
}

.patient-result-item .patient-icon.male {
    background: #e3f2fd;
    color: #1976d2;
}

.patient-result-item .patient-icon.female {
    background: #fce4ec;
    color: #c2185b;
}

.patient-result-item .patient-info {
    flex: 1;
}

.patient-result-item .patient-fio {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 3px;
}

.patient-result-item .patient-details {
    font-size: 13px;
    color: #666;
}

.patient-result-item .patient-select-arrow {
    color: #bbb;
    font-size: 16px;
}

.patient-result-item:hover .patient-select-arrow {
    color: #007bff;
}

/* Patient select wrapper в фільтрах */
.patient-select-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.patient-select-wrapper input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fafafa;
    cursor: pointer;
}

.btn-select-patient,
.btn-clear-patient {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-select-patient {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-select-patient:hover {
    background: #0056b3;
}

.btn-clear-patient {
    background: #fff;
    color: #dc3545;
}

.btn-clear-patient:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.filter-group-patient {
    min-width: 280px;
}

/* No results message */
.patient-no-results {
    text-align: center;
    padding: 30px;
    color: #666;
}

.patient-no-results i {
    font-size: 40px;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

/* Loading state */
.patient-loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.patient-loading i {
    font-size: 24px;
    margin-bottom: 10px;
}

@media (max-width: 600px) {
    .patient-select-modal .modal-content {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .patient-select-row {
        flex-wrap: wrap;
    }

    .patient-select-field {
        flex: 1 1 100%;
    }

    .btn-search-modal {
        width: 100%;
        margin-top: 10px;
    }
}

/* ============================================
   EMPLOYEE SELECTION MODAL
   ============================================ */

.employee-select-modal .modal-content {
    max-width: 850px;
    width: 95%;
    max-height: 85vh;
    padding: 0;
    margin: 5% auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.employee-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #28a745;
    color: white;
}

.employee-select-header h3 {
    margin: 0;
    font-size: 18px;
}

.employee-select-header .close {
    color: white;
    font-size: 24px;
    line-height: 1;
}

.employee-select-header .close:hover {
    color: #f0f0f0;
}

.employee-select-filters {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.employee-select-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.employee-select-row:last-child {
    margin-bottom: 0;
}

.employee-select-row-selects {
    align-items: flex-start;
}

.employee-select-row-selects .employee-select-field {
    display: flex;
    flex-direction: column;
}

.employee-select-row-selects select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.employee-select-row-selects select:focus {
    border-color: #28a745;
    outline: none;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.15);
}

.employee-select-row-selects select[multiple] {
    min-height: 120px;
}

.employee-filter-label {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    text-align: center;
}

.employee-select-field-active {
    max-width: none;
    flex: 1;
}

.employee-select-field-wide {
    flex: 2;
}

.employee-select-field-active select {
    padding: 6px 8px;
}

.employee-select-row-actions {
    justify-content: flex-start;
    gap: 10px;
}

.employee-select-field {
    flex: 1;
}

.employee-select-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.employee-select-field input:focus {
    border-color: #28a745;
    outline: none;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.15);
}

.employee-select-info {
    padding: 20px;
    text-align: center;
    color: #666;
}

.employee-select-info.error {
    color: #dc3545;
}

.employee-select-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
    max-height: 400px;
}

.employee-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.employee-result-item:hover {
    background: #e8f5e9;
    border-color: #28a745;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.1);
}

.employee-result-item .employee-icon {
    width: 40px;
    height: 40px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 18px;
    color: #666;
}

.employee-result-item .employee-icon.male {
    background: #e3f2fd;
    color: #1976d2;
}

.employee-result-item .employee-icon.female {
    background: #fce4ec;
    color: #c2185b;
}

.employee-result-item .employee-info {
    flex: 1;
}

.employee-result-item .employee-fio {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 3px;
}

.employee-result-item .employee-details {
    font-size: 13px;
    color: #666;
}

.employee-result-item .employee-select-arrow {
    color: #bbb;
    font-size: 16px;
}

.employee-result-item:hover .employee-select-arrow {
    color: #28a745;
}

/* Employee select wrapper в фільтрах */
.employee-select-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.employee-select-wrapper input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fafafa;
    cursor: pointer;
}

.btn-select-employee,
.btn-clear-employee {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-select-employee {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-select-employee:hover {
    background: #218838;
}

.btn-clear-employee {
    background: #fff;
    color: #dc3545;
}

.btn-clear-employee:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.filter-group-employee {
    min-width: 280px;
}

/* No results message */
.employee-no-results {
    text-align: center;
    padding: 30px;
    color: #666;
}

.employee-no-results i {
    font-size: 40px;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

/* Loading state */
.employee-loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.employee-loading i {
    font-size: 24px;
    margin-bottom: 10px;
}

@media (max-width: 600px) {
    .employee-select-modal .modal-content {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .employee-select-row {
        flex-wrap: wrap;
    }

    .employee-select-field {
        flex: 1 1 100%;
    }

    .employee-select-row-selects .employee-select-field {
        flex: 1 1 45%;
    }

    .employee-select-field-active {
        max-width: none;
    }
}

/* ============================================
   SCHEDULE ADD MODAL
   ============================================ */

.schedule-add-modal .modal-content {
    max-width: 420px;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.schedule-add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
}

.schedule-add-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.schedule-add-header h3 i {
    color: #667eea;
    margin-right: 6px;
}

.schedule-add-header .close {
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    line-height: 22px;
}

.schedule-add-header .close:hover {
    color: #fff;
}

.schedule-add-body {
    padding: 16px 20px;
}

.schedule-add-duty-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.schedule-add-duty-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.schedule-add-duty-item:hover {
    background: #f5f7ff;
    border-color: #c5cae9;
}

.schedule-add-duty-item input[type="radio"] {
    accent-color: #667eea;
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.schedule-add-duty-item input[type="radio"]:checked ~ .schedule-add-duty-label {
    font-weight: 700;
}

.schedule-add-duty-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.schedule-add-duty-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 28px;
}

.schedule-add-duty-name {
    font-size: 13px;
    color: #777;
}

/* Інлайн поле тривалості у рядку duty id=0 */
.schedule-add-duty-duration {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}

.schedule-add-duty-duration input[type="number"] {
    width: 64px;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.schedule-add-duty-duration input[type="number"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

/* Інлайн поле часу у рядку duty id=1 */
.schedule-add-duty-time {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    gap: 4px;
}

.schedule-add-duty-time-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.schedule-add-duty-time input[type="time"],
.schedule-add-duty-time input#scheduleAddTotalTime {
    width: 90px;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.schedule-add-duty-time input[type="time"]:focus,
.schedule-add-duty-time input#scheduleAddTotalTime:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.schedule-add-duty-time-label {
    font-size: 11px;
    color: #888;
    margin-right: 2px;
}

.schedule-add-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: #f9f9fb;
    border-top: 1px solid #eee;
}

.btn-schedule-add-ok {
    padding: 8px 20px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-schedule-add-ok:hover {
    background: #5a6fd6;
}

.btn-schedule-add-ok:active {
    background: #4e60c2;
}

.btn-schedule-add-cancel {
    padding: 8px 16px;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-schedule-add-cancel:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* ============================================
   SCHEDULE DELETE MODAL
   ============================================ */

.schedule-delete-header {
    background: linear-gradient(135deg, #2e1a1a 0%, #3e1616 100%) !important;
}

.schedule-delete-header h3 i {
    color: #ea6666 !important;
}

.btn-schedule-delete-ok {
    padding: 8px 20px;
    background: #ea6666;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-schedule-delete-ok:hover {
    background: #d65a5a;
}

.btn-schedule-delete-ok:active {
    background: #c24e4e;
}

/* ============================================
   VACATION EDIT MODAL
   ============================================ */

.vacation-edit-modal .modal-content {
    max-width: 600px;
    width: 95%;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin: 8% auto;
}

.vacation-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a2e1a 0%, #163e21 100%);
    color: #fff;
}

.vacation-edit-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.vacation-edit-header h3 i {
    color: #66ea8e;
    margin-right: 6px;
}

.vacation-edit-header .close {
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    line-height: 22px;
}

.vacation-edit-header .close:hover {
    color: #fff;
}

.vacation-edit-period {
    padding: 10px 20px;
    background: #f8f9fa;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.vacation-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 20px;
    background: #f0f4f0;
    border-bottom: 1px solid #e0e0e0;
}

.vac-edit-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.vac-edit-action-btn:hover:not(:disabled) {
    background: #e8f5e9;
    border-color: #4caf50;
}

.vac-edit-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.vac-edit-action-btn.vac-btn-delete {
    background: #fff5f5;
    border-color: #e0a0a0;
    color: #c62828;
}

.vac-edit-action-btn.vac-btn-delete:hover:not(:disabled) {
    background: #ffebee;
    border-color: #ef5350;
}

.vac-edit-action-btn .vac-edit-type-color {
    margin-right: 0;
}

.vacation-edit-body {
    padding: 16px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.vacation-edit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vacation-edit-table thead th {
    background: #f0f0f0;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.vacation-edit-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.vacation-edit-table tbody tr:hover {
    background: #f5fdf7;
}

.vacation-edit-table tbody tr.vac-row-selected {
    background: #c8e6c9;
}

.vacation-edit-table tbody tr.vac-row-selected:hover {
    background: #a5d6a7;
}

.vacation-edit-table tbody tr.vac-edit-row-new {
    background: #fffde7;
}

.vacation-edit-table tbody tr.vac-edit-row-new:hover {
    background: #fff9c4;
}

.vacation-edit-table tbody tr.vac-edit-row-new.vac-row-selected {
    background: #f0f4c3;
}

/* Рядок позначений на видалення */
.vacation-edit-table tbody tr.vac-row-marked-delete {
    background: #ffebee;
    opacity: 0.7;
}

.vacation-edit-table tbody tr.vac-row-marked-delete td {
    text-decoration: line-through;
    color: #999;
}

.vacation-edit-table tbody tr.vac-row-marked-delete td.vac-edit-row-icon {
    text-decoration: none;
}

.vacation-edit-table tbody tr.vac-row-marked-delete:hover {
    background: #ffcdd2;
}

.vacation-edit-table tbody tr.vac-row-marked-delete.vac-row-selected {
    background: #ef9a9a;
    opacity: 1;
}

/* Іконки стану рядків */
.vac-edit-row-icon {
    width: 30px;
    text-align: center;
    padding: 4px !important;
}

.vac-icon-delete {
    color: #e53935;
    font-size: 14px;
}

.vac-icon-new {
    color: #1565c0;
    font-size: 14px;
}

.vac-edit-input-yvac {
    width: 65px;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
    margin-left: 6px;
    color: #555;
}

.vac-edit-input-yvac:focus {
    border-color: #4caf50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.vac-edit-input-date {
    width: 130px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}

.vac-edit-input-date:focus {
    border-color: #4caf50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.vac-edit-input-days {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

.vac-edit-input-days:focus {
    border-color: #4caf50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.vac-edit-type {
    display: flex;
    align-items: center;
    gap: 8px;
}

td.vac-edit-type {
    display: table-cell;
}

.vac-edit-type-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.12);
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 6px;
}

.vac-edit-date {
    white-space: nowrap;
    color: #555;
}

.vac-edit-days {
    text-align: center;
    font-weight: 600;
    color: #333;
}

.vac-edit-empty {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

.vacation-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: #f9f9fb;
    border-top: 1px solid #eee;
}

.btn-vacation-edit-apply {
    padding: 8px 20px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-vacation-edit-apply:hover:not(:disabled) {
    background: #388e3c;
}

.btn-vacation-edit-apply:active:not(:disabled) {
    background: #2e7d32;
}

.btn-vacation-edit-apply:disabled,
.btn-vacation-edit-cancel:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-vacation-edit-cancel {
    padding: 8px 16px;
    background: #fff;
    color: #e65100;
    border: 1px solid #e65100;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-vacation-edit-cancel:hover:not(:disabled) {
    background: #fff3e0;
    border-color: #bf360c;
}

.btn-vacation-edit-close {
    padding: 8px 16px;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-vacation-edit-close:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

@media (max-width: 600px) {
    .vacation-edit-modal .modal-content {
        margin: 0;
        max-height: 100vh;
        height: auto;
        border-radius: 0;
        width: 100%;
    }

    .vacation-edit-actions {
        padding: 8px 12px;
        gap: 4px;
    }

    .vac-edit-action-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .vacation-edit-body {
        max-height: 60vh;
        padding: 10px 12px;
    }

    .vacation-edit-table {
        font-size: 12px;
    }

    .vacation-edit-table thead th,
    .vacation-edit-table tbody td {
        padding: 6px 8px;
    }

    .vac-edit-input-date {
        width: 110px;
        font-size: 11px;
    }

    .vac-edit-input-days {
        width: 50px;
        font-size: 11px;
    }
}

/* ============================================
   PATIENT EDIT MODAL
   ============================================ */

.patient-edit-modal .modal-content {
    max-width: 480px;
    width: 95%;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin: 6% auto;
}

.patient-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a2535 0%, #1e3a5f 100%);
    color: #fff;
}

.patient-edit-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.patient-edit-header h3 i {
    color: #66b8ea;
    margin-right: 6px;
}

.patient-edit-header .close {
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    line-height: 22px;
    cursor: pointer;
}

.patient-edit-header .close:hover {
    color: #fff;
}

.patient-edit-body {
    padding: 20px;
}

.patient-edit-field {
    margin-bottom: 14px;
}

.patient-edit-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.patient-edit-field label .required {
    color: #dc3545;
}

.patient-edit-field input[type="text"],
.patient-edit-field input[type="date"],
.patient-edit-field select,
.patient-edit-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.patient-edit-field input:focus,
.patient-edit-field select:focus,
.patient-edit-field textarea:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

.patient-edit-row {
    display: flex;
    gap: 14px;
}

.patient-edit-row .patient-edit-field {
    flex: 1;
}

.patient-edit-error {
    display: none;
    padding: 8px 12px;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #dc3545;
    font-size: 13px;
    margin-top: 6px;
}

.patient-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.btn-patient-edit-save {
    padding: 8px 20px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-patient-edit-save:hover:not(:disabled) {
    background: #357abd;
}

.btn-patient-edit-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-patient-edit-cancel {
    padding: 8px 20px;
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-patient-edit-cancel:hover {
    background: #f0f0f0;
}

/* ============================================
   Employee Add Modal (two-step wizard)
   ============================================ */
.employee-add-modal .modal-content {
    max-width: 520px;
    width: 95%;
    padding: 0;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    margin: 1.5% auto;
}

.employee-add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a3520 0%, #2d5a3d 100%);
    color: #fff;
}

.employee-add-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.employee-add-header h3 i {
    color: #7dcea0;
    margin-right: 6px;
}

.employee-add-header .close {
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    line-height: 22px;
    cursor: pointer;
}

.employee-add-header .close:hover {
    color: #fff;
}

.employee-add-step {
    padding: 10px 16px;
}

.employee-add-step-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #2d5a3d;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.employee-add-person-info {
    font-weight: 400;
    font-size: 13px;
    color: #2d5a3d;
    margin-left: auto;
}

.employee-add-search-row {
    display: flex;
    gap: 6px;
}

.employee-add-search-row input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    min-width: 0;
}

.employee-add-search-row input:focus {
    border-color: #2d5a3d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(45,90,61,0.15);
}

.btn-emp-add-search {
    padding: 6px 12px;
    background: #2d5a3d;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-emp-add-search:hover {
    background: #3d7a52;
}

.employee-add-info {
    padding: 6px 10px;
    font-size: 12px;
    color: #888;
    text-align: center;
}

.employee-add-results {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 4px;
}

.emp-add-result-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 3px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 12px;
}

.emp-add-result-item:hover {
    background: #f0f7f2;
    border-color: #7dcea0;
}

.emp-add-result-item i {
    color: #2d5a3d;
    margin-right: 8px;
    font-size: 14px;
}

.emp-add-result-item .emp-add-result-details {
    color: #888;
    font-size: 12px;
    margin-left: auto;
}

.emp-add-result-item.emp-already-employee {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f8f8;
}

.emp-add-result-item.emp-already-employee:hover {
    background: #f8f8f8;
    border-color: #e0e0e0;
}

.employee-add-create-divider {
    text-align: center;
    position: relative;
    margin: 6px 0;
}

.employee-add-create-divider span {
    background: #fff;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 1;
}

.employee-add-create-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid #ddd;
}

.employee-add-create-fields {
    padding: 4px 0 0;
}

.btn-emp-add-create {
    width: 100%;
    padding: 7px;
    background: #f0f7f2;
    color: #2d5a3d;
    border: 1px dashed #7dcea0;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 6px;
}

.btn-emp-add-create:hover {
    background: #e0f0e5;
    border-color: #2d5a3d;
}

.employee-add-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.employee-add-row {
    display: flex;
    gap: 10px;
}

.employee-add-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.employee-add-field label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-bottom: 2px;
}

.employee-add-field label .required {
    color: #dc3545;
}

.employee-add-field select,
.employee-add-field input {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.employee-add-field select:focus,
.employee-add-field input:focus {
    border-color: #2d5a3d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(45,90,61,0.15);
}

.employee-add-error {
    display: none;
    padding: 6px 10px;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    color: #dc3545;
    font-size: 12px;
    margin-top: 6px;
}

.employee-add-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.btn-emp-add-back {
    padding: 6px 14px;
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-emp-add-back:hover {
    background: #f0f0f0;
}

.btn-emp-add-save {
    padding: 6px 16px;
    background: #2d5a3d;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-emp-add-save:hover:not(:disabled) {
    background: #3d7a52;
}

.btn-emp-add-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-emp-add-cancel {
    padding: 6px 16px;
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-emp-add-cancel:hover {
    background: #f0f0f0;
}

/* ============================================
   Employee Edit Modal
   ============================================ */
.employee-edit-modal .modal-content {
    max-width: 520px; width: 95%; padding: 0;
    background: #fff; border-radius: 10px; overflow: hidden; margin: 1.5% auto;
}
.employee-edit-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a2535 0%, #2d4a5a 100%); color: #fff;
}
.employee-edit-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #fff; }
.employee-edit-header h3 i { color: #7db8ce; margin-right: 6px; }
.employee-edit-header .close { color: rgba(255,255,255,0.6); font-size: 22px; line-height: 22px; cursor: pointer; }
.employee-edit-header .close:hover { color: #fff; }
.employee-edit-step { padding: 10px 16px; }
.employee-edit-step-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 8px; }
.step-badge-edit { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background: #2d4a5a; color: #fff; border-radius: 50%; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.employee-edit-person-info { font-weight: 600; font-size: 13px; color: #2d4a5a; }
.employee-edit-search-row { display: flex; gap: 6px; }
.employee-edit-search-row input { flex: 1; padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; font-family: inherit; min-width: 0; }
.employee-edit-search-row input:focus { border-color: #2d4a5a; outline: none; box-shadow: 0 0 0 2px rgba(45,74,90,0.15); }
.btn-emp-edit-search { padding: 6px 12px; background: #2d4a5a; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-emp-edit-search:hover { background: #3d6a7a; }
.employee-edit-info { padding: 6px 10px; font-size: 12px; color: #888; text-align: center; }
.employee-edit-results { max-height: 180px; overflow-y: auto; margin-top: 4px; }
.emp-edit-result-item { display: flex; align-items: center; padding: 6px 10px; border: 1px solid #e0e0e0; border-radius: 5px; margin-bottom: 3px; cursor: pointer; font-size: 12px; }
.emp-edit-result-item:hover { background: #f0f4f7; border-color: #7db8ce; }
.emp-edit-result-item i { color: #2d4a5a; margin-right: 8px; font-size: 14px; }
.emp-edit-result-item .emp-edit-result-details { color: #888; font-size: 12px; margin-left: auto; }
.employee-edit-fields { display: flex; flex-direction: column; gap: 8px; }
.employee-edit-row { display: flex; gap: 10px; }
.employee-edit-field { flex: 1; display: flex; flex-direction: column; }
.employee-edit-field label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 2px; }
.employee-edit-field label .required { color: #dc3545; }
.employee-edit-field select, .employee-edit-field input { padding: 5px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.employee-edit-field select:focus, .employee-edit-field input:focus { border-color: #2d4a5a; outline: none; box-shadow: 0 0 0 2px rgba(45,74,90,0.15); }
.employee-edit-error { display: none; padding: 6px 10px; background: #fff5f5; border: 1px solid #f5c6cb; border-radius: 5px; color: #dc3545; font-size: 12px; margin-top: 6px; }
.employee-edit-footer { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: #f8f9fa; border-top: 1px solid #eee; }
.btn-emp-edit-back { padding: 6px 14px; background: #fff; color: #555; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-emp-edit-back:hover { background: #f0f0f0; }
.btn-emp-edit-save { padding: 6px 16px; background: #2d4a5a; color: #fff; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-emp-edit-save:hover { background: #3d6a7a; }
.btn-emp-edit-save:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-emp-edit-cancel { padding: 6px 16px; background: #fff; color: #555; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-emp-edit-cancel:hover { background: #f0f0f0; }

/* ============================================
   Mcard Add Modal (two-step wizard)
   ============================================ */
.mcard-add-modal .modal-content {
    max-width: 520px; width: 95%; padding: 0;
    background: #fff; border-radius: 10px; overflow: hidden; margin: 1.5% auto;
}
.mcard-add-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a2025 0%, #2d3e5a 100%); color: #fff;
}
.mcard-add-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #fff; }
.mcard-add-header h3 i { color: #7db0ce; margin-right: 6px; }
.mcard-add-header .close { color: rgba(255,255,255,0.6); font-size: 22px; line-height: 22px; cursor: pointer; }
.mcard-add-header .close:hover { color: #fff; }
.mcard-add-step { padding: 10px 16px; }
.mcard-add-step-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 8px; }
.step-badge-mcard { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background: #2d3e5a; color: #fff; border-radius: 50%; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.mcard-add-person-info { font-weight: 400; font-size: 13px; color: #2d3e5a; margin-left: auto; }
.mcard-add-search-row { display: flex; gap: 6px; }
.mcard-add-search-row input { flex: 1; padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; font-family: inherit; min-width: 0; }
.mcard-add-search-row input:focus { border-color: #2d3e5a; outline: none; box-shadow: 0 0 0 2px rgba(45,62,90,0.15); }
.btn-mcard-add-search { padding: 6px 12px; background: #2d3e5a; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-mcard-add-search:hover { background: #3d5a7a; }
.mcard-add-info { padding: 6px 10px; font-size: 12px; color: #888; text-align: center; }
.mcard-add-results { max-height: 150px; overflow-y: auto; margin-top: 4px; }
.mcard-add-result-item { display: flex; align-items: center; padding: 6px 10px; border: 1px solid #e0e0e0; border-radius: 5px; margin-bottom: 3px; cursor: pointer; font-size: 12px; }
.mcard-add-result-item:hover { background: #f0f2f7; border-color: #7db0ce; }
.mcard-add-result-item i { color: #2d3e5a; margin-right: 8px; font-size: 14px; }
.mcard-add-result-item .mcard-add-result-details { color: #888; font-size: 12px; margin-left: auto; }
.mcard-add-create-divider { text-align: center; position: relative; margin: 6px 0; }
.mcard-add-create-divider span { background: #fff; padding: 0 10px; font-size: 12px; color: #999; position: relative; z-index: 1; }
.mcard-add-create-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid #ddd; }
.mcard-add-create-fields { padding: 4px 0 0; }
.btn-mcard-add-create { width: 100%; padding: 7px; background: #f0f2f7; color: #2d3e5a; border: 1px dashed #7db0ce; border-radius: 5px; font-size: 12px; cursor: pointer; margin-top: 6px; }
.btn-mcard-add-create:hover { background: #e0e5f0; border-color: #2d3e5a; }
.mcard-add-fields { display: flex; flex-direction: column; gap: 8px; }
.mcard-add-row { display: flex; gap: 10px; }
.mcard-add-field { flex: 1; display: flex; flex-direction: column; }
.mcard-add-field label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 2px; }
.mcard-add-field label .required { color: #dc3545; }
.mcard-add-field select, .mcard-add-field input { padding: 5px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.mcard-add-field select:focus, .mcard-add-field input:focus { border-color: #2d3e5a; outline: none; box-shadow: 0 0 0 2px rgba(45,62,90,0.15); }
.mcard-add-error { display: none; padding: 6px 10px; background: #fff5f5; border: 1px solid #f5c6cb; border-radius: 5px; color: #dc3545; font-size: 12px; margin-top: 6px; }
.mcard-add-footer { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: #f8f9fa; border-top: 1px solid #eee; }
.btn-mcard-add-back { padding: 6px 14px; background: #fff; color: #555; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-mcard-add-back:hover { background: #f0f0f0; }
.btn-mcard-add-save { padding: 6px 16px; background: #2d3e5a; color: #fff; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-mcard-add-save:hover { background: #3d5a7a; }
.btn-mcard-add-save:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-mcard-add-cancel { padding: 6px 16px; background: #fff; color: #555; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-mcard-add-cancel:hover { background: #f0f0f0; }

/* ======================================== */
/* Mcard Action Modals (edit/transfer/icu/discharge) */
/* ======================================== */
.mcard-action-modal .modal-content {
    max-width: 520px; width: 95%; margin: 8% auto; border-radius: 10px; overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.35); animation: modalFadeIn 0.2s ease;
}
.mcard-action-modal-sm .mcard-action-body { min-height: auto; }
.mcard-action-modal-sm { max-width: 400px !important; }
.mcard-action-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: linear-gradient(135deg, #1a2025 0%, #2d3e5a 100%);
}
.mcard-action-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #fff; }
.mcard-action-header h3 i { color: #7db0ce; margin-right: 6px; }
.mcard-action-header .close { color: rgba(255,255,255,0.6); font-size: 22px; line-height: 22px; cursor: pointer; }
.mcard-action-header .close:hover { color: #fff; }
.mcard-action-header-transfer { background: linear-gradient(135deg, #1a2520 0%, #2d5a3e 100%); }
.mcard-action-header-transfer h3 i { color: #7dceb0; }
.mcard-action-header-icu { background: linear-gradient(135deg, #251a20 0%, #5a2d3e 100%); }
.mcard-action-header-icu h3 i { color: #ce7db0; }
.mcard-action-header-discharge { background: linear-gradient(135deg, #25201a 0%, #5a4a2d 100%); }
.mcard-action-header-discharge h3 i { color: #cebc7d; }
.mcard-action-body { padding: 12px 16px; }
.mcard-action-patient {
    font-size: 13px; font-weight: 600; color: #2d3e5a; padding: 8px 10px;
    background: #f0f2f7; border-radius: 6px; margin-bottom: 10px;
}
.mcard-action-patient i { margin-right: 6px; }
.mcard-action-fields { display: flex; flex-direction: column; gap: 8px; }
.mcard-action-row { display: flex; gap: 10px; }
.mcard-action-field { flex: 1; display: flex; flex-direction: column; }
.mcard-action-field label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 2px; }
.mcard-action-field label .required { color: #dc3545; }
.mcard-action-field label.mcard-icu-check { font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.mcard-action-field label.mcard-icu-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.mcard-action-field select, .mcard-action-field input {
    padding: 5px 8px; border: 1px solid #ccc; border-radius: 5px;
    font-size: 13px; font-family: inherit; box-sizing: border-box;
}
.mcard-action-field select:focus, .mcard-action-field input:focus {
    border-color: #2d3e5a; outline: none; box-shadow: 0 0 0 2px rgba(45,62,90,0.15);
}
.mcard-action-error {
    display: none; padding: 6px 10px; background: #fff5f5; border: 1px solid #f5c6cb;
    border-radius: 5px; color: #dc3545; font-size: 12px; margin-top: 6px;
}
.mcard-action-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 10px 16px; background: #f8f9fa; border-top: 1px solid #eee;
}
.btn-mcard-action-save {
    padding: 6px 16px; background: #2d3e5a; color: #fff; border: none;
    border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-mcard-action-save:hover { background: #3d5a7a; }
.btn-mcard-action-save:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-mcard-icu { background: #5a2d3e; }
.btn-mcard-icu:hover { background: #7a3d5a; }
.btn-mcard-discharge { background: #5a4a2d; }
.btn-mcard-discharge:hover { background: #7a6a3d; }
.btn-mcard-action-cancel {
    padding: 6px 16px; background: #fff; color: #555; border: 1px solid #ccc;
    border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-mcard-action-cancel:hover { background: #f0f0f0; }

/* ================================
   Consultation Modals
   ================================ */
.consult-edit-modal .modal-content,
.consult-accept-modal .modal-content,
.consult-done-modal .modal-content,
.consult-delete-modal .modal-content {
    max-width: 520px;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.consult-accept-modal .modal-content,
.consult-done-modal .modal-content,
.consult-delete-modal .modal-content {
    max-width: 420px;
}

.consult-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
}

.consult-edit-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.consult-edit-header h3 i {
    color: #667eea;
    margin-right: 6px;
}

.consult-edit-header .close {
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    line-height: 22px;
    cursor: pointer;
}

.consult-edit-header .close:hover {
    color: #fff;
}

.consult-edit-body {
    padding: 16px 20px;
}

.consult-edit-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.consult-edit-row .consult-edit-field {
    flex: 1;
}

.consult-edit-field {
    margin-bottom: 12px;
}

.consult-edit-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.consult-edit-field label .required {
    color: #e74c3c;
}

.consult-edit-field select,
.consult-edit-field input[type="text"],
.consult-edit-field textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.consult-edit-field select:focus,
.consult-edit-field input[type="text"]:focus,
.consult-edit-field textarea:focus {
    border-color: #667eea;
    outline: none;
    background: #fff;
}

.consult-edit-field textarea {
    resize: vertical;
    min-height: 60px;
}

.consult-mcard-select-wrapper {
    display: flex;
    gap: 4px;
    align-items: center;
}

.consult-mcard-select-wrapper input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    box-sizing: border-box;
}

.consult-mcard-select-wrapper .btn-select-mcard,
.consult-mcard-select-wrapper .btn-clear-mcard {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.15s;
}

.consult-mcard-select-wrapper .btn-select-mcard:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.consult-mcard-select-wrapper .btn-clear-mcard:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

/* Mcard search dropdown */
.consult-mcard-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10001;
}

.consult-mcard-dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.consult-mcard-dropdown-item:hover {
    background: #f0f4ff;
}

.consult-mcard-dropdown-item:last-child {
    border-bottom: none;
}

.consult-edit-error {
    display: none;
    padding: 8px 12px;
    background: #fff3f3;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #c0392b;
    font-size: 13px;
    margin-top: 8px;
}

.consult-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.btn-consult-save {
    padding: 8px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-consult-save:hover {
    opacity: 0.9;
}

.btn-consult-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-consult-cancel {
    padding: 8px 16px;
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-consult-cancel:hover {
    background: #f0f0f0;
}

@media (max-width: 600px) {
    .consult-edit-modal .modal-content {
        max-width: 95%;
        margin: 10% auto;
    }
    .consult-edit-row {
        flex-direction: column;
        gap: 0;
    }
}
