/* ==========================================
   PROFILE MODULE - STANDALONE DARK THEME
   ========================================== */

html,
body {
  color-scheme: dark;
  height: 100%;
}

html {
  overflow: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: auto;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.profile-scroll-area::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.profile-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.profile-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.profile-scroll-area::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

body.profile-modal-open {
  overflow: hidden;
}

body.profile-modal-open .profile-scroll-area {
  overflow: hidden;
}

.profile-shell {
  display: grid;
  gap: 22px;
}

.page-header {
  margin-bottom: 0;
}

.profile-header-note {
  max-width: 320px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.65;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.profile-card,
.profile-history-card {
  min-width: 0;
}

.profile-hero-card {
  padding: 28px;
  min-height: 180px;
  display: flex;
  align-items: center;
}

.profile-hero-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.profile-identity-copy {
  min-width: 0;
}

.profile-overline {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-name {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.profile-meta {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.profile-meta-divider {
  color: var(--text-muted);
}

.profile-hero-aside {
  display: grid;
  justify-items: end;
  gap: 10px;
  text-align: right;
}

.profile-role-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.profile-role-badge,
.profile-context-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.profile-role-badge {
  border-color: rgba(59, 130, 246, 0.24);
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
}

.profile-context-badge {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.profile-hero-caption {
  margin: 0;
  max-width: 280px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.65;
}

.card-header {
  align-items: flex-start;
}

.card-title-group {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.55;
}

.card-icon--notes {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.card-icon--vacation {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.card-icon--history {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
}

.password-form {
  display: grid;
  gap: 12px;
}

.password-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.password-actions .btn-action {
  flex: 1 1 220px;
}

.form-feedback {
  min-height: 20px;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.form-feedback.success {
  color: #4ade80;
}

.form-feedback.error {
  color: #f87171;
}

.profile-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-note-card {
  width: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.profile-note-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.profile-note-card:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.profile-note-card--add {
  justify-content: center;
  border-style: dashed;
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.06);
  color: #93c5fd;
}

.profile-note-card--add:hover {
  border-color: rgba(59, 130, 246, 0.34);
  background: rgba(59, 130, 246, 0.1);
}

.profile-note-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.profile-note-description {
  margin: 0;
  font-size: 0.84rem;
  color: inherit;
  line-height: 1.6;
}

.profile-note-preview {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

.profile-note-meta {
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.vacation-readonly {
  display: grid;
  gap: 14px;
}

.vacation-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.vacation-metric,
.vacation-progress,
.absence-type-breakdown,
.history-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.vacation-metric {
  padding: 14px;
}

.vacation-metric-label,
.absence-type-header,
.history-label,
.history-amount-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vacation-metric-value {
  margin-top: 8px;
  color: var(--text-primary);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.vacation-progress {
  padding: 16px;
}

.vacation-progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.vacation-progress-row strong {
  color: var(--text-primary);
  font-size: 0.96rem;
}

.vacation-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.vacation-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.absence-type-breakdown {
  padding: 16px;
}

.absence-type-header {
  margin-bottom: 12px;
}

.absence-type-list {
  display: grid;
  gap: 8px;
}

.absence-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.absence-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.absence-type-icon {
  color: var(--absence-accent, #60a5fa);
}

.absence-type-values {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.absence-type-values strong {
  color: var(--text-primary);
  font-size: 0.82rem;
}

.absence-type-values span {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.history-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.history-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.history-period {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-closed {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.history-amount-wrap {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.history-amount {
  color: #34d399;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.history-details {
  display: grid;
  gap: 8px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.86rem;
  color: var(--text-primary);
}

.history-row span:first-child {
  color: var(--text-secondary);
}

.history-row strong {
  font-weight: 600;
}

.history-empty,
.profile-loading,
.profile-state {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
}

.profile-history-card .profile-loading,
.profile-note-grid .profile-loading,
.vacation-readonly .profile-loading {
  padding: 4px 2px;
}

.profile-modal {
  padding: 20px;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.profile-modal-content {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.profile-modal-content--compact {
  width: min(560px, 100%);
}

.profile-modal-meta,
.profile-modal-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.65;
}

.profile-modal textarea {
  min-height: 220px;
  resize: vertical;
}

.profile-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-modal-footer--end {
  justify-content: flex-end;
}

.profile-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

#noteDeleteButton {
  display: none;
}

@media (max-width: 1180px) {
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-header-note {
    max-width: none;
  }

  .profile-hero-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-hero-aside {
    width: 100%;
    justify-items: start;
    text-align: left;
  }

  .profile-role-badges {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .profile-shell {
    gap: 18px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero-card {
    padding: 22px;
  }

  .profile-identity {
    align-items: flex-start;
  }

  .profile-note-grid,
  .vacation-metrics {
    grid-template-columns: 1fr;
  }

  .profile-modal {
    padding: 14px;
  }

  .profile-modal-content {
    max-height: calc(100vh - 28px);
  }

  .profile-modal-footer,
  .profile-modal-actions,
  .profile-modal-footer--end {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .profile-modal-actions {
    margin-left: 0;
  }

  .profile-modal .btn-action,
  .profile-modal #noteDeleteButton {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .profile-avatar {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    font-size: 1.2rem;
  }

  .history-card-header,
  .absence-type-row,
  .history-row,
  .vacation-progress-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-amount-wrap,
  .absence-type-values {
    justify-items: start;
    text-align: left;
  }
}
