/* Microsoft Dynamics 365 / Fluent design language (inspired) */
:root {
  --d365-brand: #0078d4;
  --d365-brand-hover: #106ebe;
  --d365-brand-pressed: #005a9e;
  --d365-surface: #f3f2f1;
  --d365-surface-elevated: #ffffff;
  --d365-text-primary: #323130;
  --d365-text-secondary: #605e5c;
  --d365-border: #edebe9;
  --d365-shadow: 0 1.6px 3.6px rgba(0, 0, 0, 0.13), 0 0.3px 0.9px rgba(0, 0, 0, 0.11);
  --d365-font: "Segoe UI", "Segoe UI Web (West European)", -apple-system,
    BlinkMacSystemFont, "Roboto", "Helvetica Neue", sans-serif;
  --d365-nav-rail: 6px;
  --d365-nav-panel: 240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body.d365-shell {
  margin: 0;
  min-height: 100%;
  font-family: var(--d365-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--d365-text-primary);
  background: var(--d365-surface);
  -webkit-font-smoothing: antialiased;
}

.d365-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px 0 12px;
  background: var(--d365-surface-elevated);
  border-bottom: 1px solid var(--d365-border);
  box-shadow: var(--d365-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.d365-app-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.d365-app-bar__logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: linear-gradient(135deg, #0078d4 0%, #00bcf2 100%);
  flex-shrink: 0;
}

.d365-app-bar__titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.d365-app-bar__product {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--d365-brand);
}

.d365-app-bar__app-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--d365-text-primary);
}

.d365-app-bar__env {
  font-size: 12px;
  color: var(--d365-text-secondary);
}

.d365-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.d365-card {
  background: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  border-radius: 4px;
  box-shadow: var(--d365-shadow);
  padding: 24px 28px;
}

.d365-card h1 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 600;
  color: var(--d365-text-primary);
}

.d365-card p {
  margin: 0;
  color: var(--d365-text-secondary);
  font-size: 14px;
}

.d365-footer {
  margin-top: auto;
  padding: 12px 20px;
  font-size: 11px;
  color: var(--d365-text-secondary);
  text-align: center;
  border-top: 1px solid var(--d365-border);
  background: var(--d365-surface-elevated);
}

.d365-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.d365-card__lead {
  margin: 0 0 20px;
  color: var(--d365-text-secondary);
  font-size: 14px;
}

.d365-card--auth h1 {
  margin-bottom: 8px;
}

.d365-app-bar__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.d365-tenant-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}

.d365-tenant-switch__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--d365-text-secondary);
  white-space: nowrap;
}

.d365-select--compact {
  max-width: min(220px, 42vw);
  min-height: 30px;
  padding: 4px 8px;
  font-size: 13px;
}

.d365-app-bar__user {
  font-size: 13px;
  color: var(--d365-text-secondary);
}

.d365-app-bar__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
  vertical-align: middle;
  border: 1px solid var(--d365-border);
  background: var(--d365-surface-elevated);
}

.d365-app-bar__avatar:focus-visible {
  outline: 2px solid var(--d365-brand);
  outline-offset: 2px;
}

.d365-app-bar__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.d365-app-bar__avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  font-weight: 600;
  background: var(--d365-brand);
  color: #fff;
}

.d365-table-avatar {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--d365-border);
}

.d365-table-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  background: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  color: var(--d365-text-secondary);
}

.d365-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--d365-brand);
  text-decoration: none;
}

.d365-link:hover {
  color: var(--d365-brand-hover);
  text-decoration: underline;
}

.d365-link:focus-visible {
  outline: 2px solid var(--d365-brand);
  outline-offset: 2px;
}

.d365-link--standalone {
  font-size: 14px;
}

.d365-link--compact {
  font-size: 12px;
  white-space: nowrap;
}

.d365-form {
  margin-top: 4px;
}

.d365-field {
  margin-bottom: 16px;
}

.d365-field:last-of-type {
  margin-bottom: 20px;
}

.d365-label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--d365-text-primary);
}

.d365-field input[type="text"],
.d365-field input[type="password"],
.d365-field input[type="url"],
.d365-field input[type="email"] {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--d365-text-primary);
  background: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  border-radius: 2px;
}

.d365-field input:focus {
  outline: none;
  border-color: var(--d365-brand);
  box-shadow: 0 0 0 1px var(--d365-brand);
}

.d365-field__error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #a4262c;
}

.d365-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.d365-form--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.d365-form--inline .d365-field {
  flex: 1 1 260px;
  margin-bottom: 0;
}

.d365-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
}

.d365-btn--primary {
  color: #fff;
  background: var(--d365-brand);
  border-color: var(--d365-brand);
}

.d365-btn--primary:hover {
  background: var(--d365-brand-hover);
  border-color: var(--d365-brand-hover);
}

.d365-btn--primary:active {
  background: var(--d365-brand-pressed);
  border-color: var(--d365-brand-pressed);
}

.d365-alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 2px;
}

.d365-alert--error {
  color: #a4262c;
  background: #fde7e9;
  border: 1px solid #f1bbbc;
}

.d365-alert p {
  margin: 0;
}

.d365-alert p + p {
  margin-top: 4px;
}

/* ---- Layout with auto-hide side navigation ---- */

.d365-app-bar__start {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.d365-nav-fab {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  color: var(--d365-text-primary);
}

.d365-nav-fab:hover {
  background: rgba(0, 0, 0, 0.05);
}

.d365-nav-fab:focus-visible {
  outline: 2px solid var(--d365-brand);
  outline-offset: 2px;
}

.d365-nav-fab__icon {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.d365-body {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.d365-nav-backdrop {
  display: none;
}

.d365-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.d365-main {
  flex: 1;
}

.d365-main--narrow {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* Desktop / fine pointer: persistent sidebar, sticky below app bar */
@media (min-width: 769px) {
  .d365-nav-host {
    flex: 0 0 var(--d365-nav-panel);
    align-self: flex-start;
    position: sticky;
    top: 48px;
    width: var(--d365-nav-panel);
    max-height: calc(100vh - 48px);
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--d365-surface-elevated);
    border-right: 1px solid var(--d365-border);
    z-index: 20;
    scrollbar-gutter: stable;
  }

  .d365-nav-host::before {
    display: none;
  }

  .d365-side-nav {
    position: relative;
    z-index: 0;
    width: 100%;
    min-height: 0;
    background: var(--d365-surface-elevated);
  }
}

/* Narrow screens: overlay drawer (FAB); rail hover disabled */
@media (max-width: 768px) {
  .d365-nav-fab {
    display: inline-flex;
  }

  .d365-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: 48px;
    z-index: 190;
    background: rgba(0, 0, 0, 0.35);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  .d365-nav-backdrop[hidden] {
    display: none !important;
  }

  .d365-nav-host {
    position: fixed;
    top: 48px;
    left: 0;
    width: min(280px, 88vw);
    height: calc(100dvh - 48px);
    flex: 0 0 0 !important;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    overflow: visible;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .d365-nav-host.is-open {
    transform: translateX(0);
  }

  .d365-side-nav {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow-y: auto;
    background: var(--d365-surface-elevated);
    border-right: 1px solid var(--d365-border);
    box-shadow: var(--d365-shadow);
  }

  body.d365-nav-is-open {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .d365-nav-host {
    transition: none;
  }
}

.d365-side-nav__inner {
  padding: 12px 0 24px;
}

.d365-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.d365-nav-list li {
  margin: 0;
}

.d365-nav-group {
  margin: 0;
}

.d365-nav-details {
  margin: 0;
  padding: 0;
}

.d365-nav-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  margin: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--d365-text-primary);
  list-style: none;
  user-select: none;
}

.d365-nav-details__summary::-webkit-details-marker {
  display: none;
}

.d365-nav-details__summary-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.d365-nav-details__title {
  font-weight: 600;
}

.d365-nav-details__chevron {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.d365-nav-details[open] > .d365-nav-details__summary .d365-nav-details__chevron {
  transform: rotate(225deg);
  margin-top: 2px;
}

.d365-nav-details__summary:hover {
  background: rgba(0, 120, 212, 0.08);
  color: var(--d365-brand);
}

.d365-nav-details--highlight > .d365-nav-details__summary {
  color: var(--d365-brand);
}

.d365-nav-list--nested {
  margin: 2px 0 10px;
  padding: 0;
}

.d365-nav-list--nested .d365-nav-link {
  padding-left: 22px;
  margin-left: 8px;
  font-size: 13px;
  border-left: 2px solid transparent;
}

.d365-nav-list--nested .d365-nav-link.is-active {
  border-left-color: var(--d365-brand);
}

.d365-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 10px;
  border-radius: 4px;
  color: var(--d365-text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.d365-nav-link:hover {
  background: rgba(0, 120, 212, 0.08);
  color: var(--d365-brand);
}

.d365-nav-link.is-active {
  background: rgba(0, 120, 212, 0.12);
  color: var(--d365-brand);
  font-weight: 600;
}

.d365-nav-link__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-color: currentColor;
  opacity: 0.88;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-nav-link__icon--gear {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-nav-link__icon--person {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-nav-link__icon--people {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3zm-8 0c1.66 0 3-1.34 3-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3zm-8 0c1.66 0 3-1.34 3-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

/* Messages */
.d365-messages {
  max-width: 1180px;
  margin: 0 auto 16px;
  padding: 0 20px;
}

.d365-message {
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid var(--d365-border);
}

.d365-message:last-child {
  margin-bottom: 0;
}

.d365-message--success {
  background: #dff6dd;
  border-color: #92c353;
  color: #107c10;
}

.d365-message--error {
  background: #fde7e9;
  border-color: #f1bbbc;
  color: #a4262c;
}

.d365-message--warning {
  background: #fff4ce;
  border-color: #fde188;
  color: #8a6d3b;
}

.d365-message--info,
.d365-message--debug {
  background: #deecf9;
  border-color: #a6caf4;
  color: var(--d365-brand-pressed);
}

/* Employee form */
.d365-card--wide {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.d365-card--employee-form {
  max-width: 820px;
}

.d365-form-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--d365-border);
}

.d365-form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 8px;
  padding-bottom: 0;
}

.d365-form-section__title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--d365-text-primary);
}

.d365-form-section__hint {
  margin: -8px 0 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--d365-text-secondary);
}

.d365-select {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--d365-text-primary);
  background-color: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  border-radius: 2px;
}

.d365-select:focus {
  outline: none;
  border-color: var(--d365-brand);
  box-shadow: 0 0 0 1px var(--d365-brand);
}

.d365-textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--d365-text-primary);
  background: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  border-radius: 2px;
  resize: vertical;
  min-height: 72px;
}

.d365-textarea:focus {
  outline: none;
  border-color: var(--d365-brand);
  box-shadow: 0 0 0 1px var(--d365-brand);
}

.d365-card__subtitle {
  margin: 0 0 20px;
  color: var(--d365-text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

.d365-form--stacked .d365-form__actions {
  margin-top: 8px;
}

.d365-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

@media (max-width: 520px) {
  .d365-field-row {
    grid-template-columns: 1fr;
  }
}

.d365-fieldset {
  margin: 0 0 16px;
  padding: 0;
  border: none;
}

.d365-fieldset .d365-label {
  margin-bottom: 8px;
}

.d365-radio-group ul {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.d365-radio-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.d365-radio-group li {
  margin: 0;
}

.d365-radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}

.d365-input {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--d365-text-primary);
  background: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  border-radius: 2px;
}

.d365-input:focus {
  outline: none;
  border-color: var(--d365-brand);
  box-shadow: 0 0 0 1px var(--d365-brand);
}

.d365-help {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--d365-text-secondary);
}

.d365-help ul {
  margin: 4px 0 0;
  padding-left: 1.2em;
}

.d365-file-input {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  font-size: 13px;
}

.d365-form__actions .d365-link--standalone {
  margin-inline-start: 12px;
}

/* Employee list & edit */
.d365-card__header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.d365-card__header-row h1 {
  margin: 0 0 6px;
}

.d365-card--table-card {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.d365-empty {
  margin: 0;
  padding: 16px 0;
  color: var(--d365-text-secondary);
  font-size: 14px;
}

.d365-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.d365-table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.d365-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.d365-table th,
.d365-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--d365-border);
  vertical-align: top;
}

.d365-table th {
  font-weight: 600;
  color: var(--d365-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.d365-table tbody tr:hover {
  background: rgba(0, 120, 212, 0.04);
}

.d365-table__actions {
  white-space: nowrap;
  width: 1%;
}

.d365-btn--danger {
  color: #fff;
  background: #a4262c;
  border-color: #a4262c;
}

.d365-btn--danger:hover {
  background: #8b1a1a;
  border-color: #8b1a1a;
}

.d365-photo-preview-wrap {
  margin-bottom: 10px;
}

.d365-photo-preview {
  display: block;
  max-height: 140px;
  max-width: 220px;
  border-radius: 4px;
  border: 1px solid var(--d365-border);
  object-fit: cover;
}

.d365-form-section--attached {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--d365-border);
}

.d365-signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.d365-signature-tile {
  border: 1px solid var(--d365-border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--d365-surface-elevated);
}

.d365-signature-tile__img {
  aspect-ratio: 4 / 3;
  background: var(--d365-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.d365-signature-tile__img img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
}

.d365-signature-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.d365-signature-manage-card {
  border: 1px solid var(--d365-border);
  border-radius: 4px;
  padding: 12px;
  background: #faf9f8;
}

.d365-signature-manage-card .d365-signature-tile__img {
  margin-bottom: 10px;
  border-radius: 2px;
  border: 1px solid var(--d365-border);
  background: var(--d365-surface-elevated);
}

.d365-inline-form {
  padding: 8px;
  margin: 0;
}

.d365-nav-link__icon--list {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-nav-link__icon--health {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-nav-link__icon--sync {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-health-meta {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--d365-text-secondary);
}

.d365-health-meta p {
  margin: 6px 0;
}

.d365-pre {
  margin: 0 0 12px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.45;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  background: #faf9f8;
  border: 1px solid var(--d365-border);
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.d365-code {
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}

.d365-health-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}

.d365-health-status--ok {
  background: #dff6dd;
  color: #107c10;
  border: 1px solid #92c353;
}

.d365-health-status--fail {
  background: #fde7e9;
  color: #a4262c;
  border: 1px solid #f1bbbc;
}

.d365-health-status__detail {
  font-weight: 500;
  font-size: 13px;
}

.d365-nav-link__icon--building {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.d365-field--checkbox {
  margin-bottom: 16px;
}

.d365-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.d365-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--d365-brand);
}

.d365-checkbox-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--d365-brand);
}

.d365-radio-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.d365-upload-progress {
  margin: 20px 0 8px;
  padding: 14px 16px;
  background: var(--d365-surface-elevated);
  border: 1px solid var(--d365-border);
  border-radius: 4px;
}

.d365-upload-progress__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--d365-text-secondary);
}

.d365-upload-progress__pct {
  font-variant-numeric: tabular-nums;
  color: var(--d365-brand);
}

.d365-upload-progress__bar {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  border: none;
  accent-color: var(--d365-brand);
}

.d365-upload-progress__bar::-webkit-progress-bar {
  background: var(--d365-border);
  border-radius: 5px;
}

.d365-upload-progress__bar::-webkit-progress-value {
  background: var(--d365-brand);
  border-radius: 5px;
}

/* Card header actions */
.d365-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.d365-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.d365-pill--warn {
  background: #fde7e9;
  color: #a4262c;
  border: 1px solid #f1bbbc;
}

.d365-home-quicklinks {
  margin-top: 16px;
}

.d365-muted {
  color: var(--d365-text-secondary);
  font-weight: 400;
}

.d365-structure-section {
  margin-bottom: 28px;
}

.d365-structure-section__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
}

.d365-structure-branch {
  margin-bottom: 16px;
}

.d365-structure-branch__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.d365-structure-branch__title {
  margin: 0;
  font-size: 16px;
}

.d365-structure-branch__nested {
  margin-left: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--d365-border);
}

.d365-structure-positions {
  margin: 0 0 12px;
  padding-left: 1.25rem;
}

.d365-structure-positions li {
  margin-bottom: 6px;
}

.d365-structure-assignees {
  font-size: 13px;
  color: var(--d365-text-secondary);
}

.d365-structure-assignees--empty {
  font-style: italic;
}

.d365-structure-assign-list {
  margin: 0;
  padding-left: 1.25rem;
}

.d365-structure-assign-list li {
  margin-bottom: 10px;
}

.d365-structure-assign-list--muted {
  font-size: 13px;
  color: var(--d365-text-secondary);
}

.d365-pill--muted {
  background: #f3f2f1;
  color: var(--d365-text-secondary);
  border: 1px solid var(--d365-border);
}

.d365-link--danger {
  color: #a4262c;
}

.d365-nav-link__icon--structure {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l8 4v7.64l-8 4-8-4V8.18l8-4zM7 10h2v4H7v-4zm8 0h2v4h-2v-4z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l8 4v7.64l-8 4-8-4V8.18l8-4zM7 10h2v4H7v-4zm8 0h2v4h-2v-4z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

