.account-page {
  min-height: 100vh;
}

.account-page.dark-theme {
  --ink: #f7f1e8;
  --muted: rgba(247, 241, 232, 0.68);
  --paper: #11100f;
  --surface: rgba(24, 23, 22, 0.9);
  --line: rgba(255, 255, 255, 0.14);
  --red-dark: #ff8a78;
  --teal: #78d8cf;
  background:
    radial-gradient(circle at 18% 0%, rgba(201, 49, 36, 0.2), transparent 34%),
    linear-gradient(180deg, #171514 0%, #0d0c0b 100%);
  color: var(--ink);
}

.account-page.dark-theme .topbar {
  background: rgba(12, 11, 10, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  font-weight: 900;
  min-height: 42px;
  padding: 9px 12px;
}

.theme-toggle:focus-visible,
.theme-toggle:hover,
.theme-toggle[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.theme-toggle-icon {
  border: 2px solid currentColor;
  border-radius: 999px;
  display: inline-block;
  height: 18px;
  overflow: hidden;
  position: relative;
  width: 18px;
}

.theme-toggle-icon::after {
  background: currentColor;
  border-radius: 999px;
  content: "";
  inset: 2px 2px 2px 8px;
  position: absolute;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-icon::after {
  inset: 2px;
}

.account-shell {
  display: grid;
  gap: 22px;
  margin: 0 auto;
  max-width: 1100px;
  padding: 118px clamp(16px, 4vw, 64px) 56px;
}

.account-hero {
  max-width: 720px;
}

.account-hero h1 {
  color: var(--ink);
  font-size: clamp(40px, 6vw, 72px);
  margin-bottom: 16px;
}

.account-hero p:not(.eyebrow) {
  color: var(--muted);
  font-size: 18px;
}

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

.account-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(18, 16, 14, 0.08);
  padding: clamp(18px, 3vw, 26px);
}

.account-page.dark-theme .account-card,
.account-page.dark-theme .client-chat-panel {
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.account-page.dark-theme .profile-avatar-row,
.account-page.dark-theme .vehicle-card,
.account-page.dark-theme .client-work-card,
.account-page.dark-theme .ghost-action,
.account-page.dark-theme .client-chat-close,
.account-page.dark-theme .client-chat-message {
  background: rgba(255, 255, 255, 0.06);
}

.account-page.dark-theme .avatar-preview,
.account-page.dark-theme .vehicle-avatar-preview {
  background: var(--red);
  color: #fff;
}

.account-page.dark-theme .admin-link {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.account-page.dark-theme .client-chat-message.client {
  background: var(--red);
  color: #fff;
}

.account-page.dark-theme input,
.account-page.dark-theme select,
.account-page.dark-theme textarea {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--ink);
}

.account-page.dark-theme input:focus,
.account-page.dark-theme select:focus,
.account-page.dark-theme textarea:focus {
  border-color: rgba(255, 138, 120, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 138, 120, 0.14);
}

.account-page.dark-theme input::placeholder,
.account-page.dark-theme textarea::placeholder {
  color: rgba(247, 241, 232, 0.44);
}

.account-card h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  margin-bottom: 16px;
}

.account-form {
  display: grid;
  gap: 14px;
}

.account-single-card {
  max-width: 560px;
}

.compact-form {
  padding: 0;
}

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

.profile-grid .wide {
  grid-column: 1 / -1;
}

.newsletter-opt-in {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
}

.newsletter-opt-in input {
  accent-color: var(--red);
  flex: 0 0 auto;
  min-height: 18px;
  padding: 0;
  width: 18px;
}

.newsletter-opt-in span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

.account-page.dark-theme .newsletter-opt-in {
  background: rgba(255, 255, 255, 0.06);
}

.profile-avatar-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.avatar-preview,
.vehicle-avatar-preview {
  align-items: center;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  overflow: hidden;
}

.avatar-preview {
  border-radius: 999px;
  height: 76px;
  position: relative;
  width: 76px;
}

.avatar-preview img,
.vehicle-avatar-preview img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.client-avatar-editor {
  flex: 0 0 auto;
}

.avatar-edit-btn {
  align-items: center;
  background: var(--red);
  border: 2px solid #fff;
  border-radius: 999px;
  bottom: 3px;
  box-shadow: 0 8px 18px rgba(18, 16, 14, 0.22);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  position: absolute;
  right: 3px;
  transition: transform 0.2s ease, background 0.2s ease;
  width: 30px;
  z-index: 2;
}

.avatar-edit-btn:hover,
.avatar-edit-btn:focus-within {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.avatar-edit-btn input {
  cursor: pointer;
  height: 100%;
  inset: 0;
  min-height: 0;
  opacity: 0;
  padding: 0;
  position: absolute;
  width: 100%;
}

.avatar-edit-btn svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
  width: 15px;
}

.account-page.dark-theme .avatar-edit-btn {
  border-color: #11100f;
}

.vehicles-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 4px;
}

.vehicles-head h3 {
  color: var(--ink);
  font-size: 22px;
  margin: 0 0 4px;
}

.vehicles-head p {
  color: var(--muted);
  margin: 0;
}

.add-vehicle-btn {
  flex: 0 0 auto;
}

.vehicles-list {
  display: grid;
  gap: 14px;
}

.vehicle-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.vehicle-card.is-primary {
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
}

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

.vehicle-card.is-collapsed {
  gap: 0;
  padding-block: 14px;
}

.vehicle-avatar-picker {
  align-items: center;
  display: flex;
}

.vehicle-avatar-preview {
  border-radius: 8px;
  flex: 0 0 auto;
  font-size: 13px;
  height: 68px;
  position: relative;
  width: 88px;
}

.vehicle-avatar-edit-btn {
  bottom: 4px;
  height: 28px;
  right: 4px;
  width: 28px;
}

.vehicle-avatar-edit-btn svg {
  height: 14px;
  width: 14px;
}

.vehicle-card-summary {
  flex: 1 1 auto;
  min-width: 0;
}

.vehicle-card-summary h4 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  margin: 0 0 8px;
}

.vehicle-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.vehicle-meta-item {
  background: rgba(24, 22, 20, 0.06);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 6px 9px;
}

.vehicle-edit-toggle {
  min-height: 38px;
  padding: 9px 12px;
}

.account-page.dark-theme .vehicle-meta-item {
  background: rgba(255, 255, 255, 0.08);
}

.vehicle-card-actions {
  align-items: flex-end;
  display: grid;
  gap: 7px;
  justify-items: end;
}

.vehicle-primary-badge {
  align-items: center;
  background: rgba(24, 22, 20, 0.06);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 28px;
  padding: 0 10px;
}

.vehicle-primary-badge.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal);
}

.primary-vehicle-btn {
  color: var(--teal);
  font-weight: 900;
}

.primary-vehicle-btn:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.75;
  text-decoration: none;
}

.text-action.danger {
  color: var(--red);
}

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

.vehicle-grid .wide {
  grid-column: 1 / -1;
}

.vehicle-filters-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.vehicle-filters-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.vehicle-filters-head strong {
  color: var(--ink);
}

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

.vehicle-filter-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 0;
}

.vehicle-filter-status.error {
  color: var(--red);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 54px;
}

.password-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
  color: var(--red-dark);
}

.password-toggle svg {
  display: block;
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 22px;
}

.account-message {
  min-height: 24px;
  color: var(--muted);
  font-weight: 800;
}

.account-message.success {
  color: var(--teal);
}

.account-message.error {
  color: var(--red);
}

.dev-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--red-dark);
  font-weight: 900;
  text-decoration: underline;
}

#account-status-card {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

#account-status-card[hidden],
#profile-panel[hidden],
#work-history-panel[hidden],
#auth-forms[hidden],
#forgot-password-panel[hidden],
#reset-password-panel[hidden],
#client-chat-widget[hidden],
#client-chat-panel[hidden],
#client-chat-badge[hidden] {
  display: none;
}

#account-status-card p {
  color: var(--muted);
  margin-bottom: 6px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.account-status-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.primary-link,
.ghost-action {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 900;
  min-height: 46px;
  padding: 12px 16px;
}

.primary-link {
  background: var(--red);
  border: 0;
  color: #fff;
  cursor: pointer;
}

.admin-link {
  background: var(--ink);
  color: #fff;
}

.admin-link[hidden],
.install-action[hidden],
.install-message[hidden] {
  display: none;
}

.install-action {
  text-align: left;
}

.ghost-action {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}

.install-message {
  max-width: 390px;
  text-align: right;
}

.install-message.success {
  color: var(--teal);
}

.install-message.error {
  color: var(--red);
}

.text-action {
  background: transparent;
  border: 0;
  color: var(--red-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  justify-self: flex-start;
  padding: 2px 0;
  text-decoration: underline;
}

.account-inline-message {
  color: var(--muted);
  font-weight: 800;
  margin: 0;
}

.account-inline-message.error {
  color: var(--red);
}

.client-works-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.client-work-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.client-work-card h3 {
  color: var(--ink);
  font-size: 22px;
  margin: 4px 0 0;
}

.work-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.work-amount {
  color: var(--teal);
  font-size: 18px;
}

.client-work-card p {
  color: var(--muted);
  margin: 0;
}

.work-document-link {
  color: var(--red-dark);
  font-weight: 900;
  text-decoration: underline;
}

.client-chat-widget {
  bottom: 22px;
  position: fixed;
  right: 22px;
  z-index: 30;
}

.client-chat-toggle {
  align-items: center;
  background: var(--red);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 16px 34px rgba(18, 16, 14, 0.2);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  height: 62px;
  justify-content: center;
  position: relative;
  width: 62px;
}

.client-chat-toggle.has-new-message {
  animation: clientChatPulse 1.2s ease-in-out infinite;
  box-shadow: 0 18px 44px rgba(218, 48, 37, 0.45), 0 0 0 8px rgba(218, 48, 37, 0.16);
}

.client-chat-toggle.has-new-message::after {
  align-items: center;
  background: #ffd23f;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #16110f;
  content: "!";
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  left: -4px;
  position: absolute;
  top: -4px;
  width: 22px;
}

@keyframes clientChatPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-2px) scale(1.04);
  }
}

.client-chat-toggle svg {
  fill: none;
  height: 30px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 30px;
}

.client-chat-badge {
  align-items: center;
  background: var(--ink);
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  padding: 0 6px;
  position: absolute;
  right: -3px;
  top: -3px;
}

.client-chat-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  bottom: 76px;
  box-shadow: 0 22px 60px rgba(18, 16, 14, 0.22);
  display: grid;
  gap: 12px;
  max-height: min(620px, calc(100vh - 120px));
  padding: 16px;
  position: absolute;
  right: 0;
  width: min(380px, calc(100vw - 32px));
}

.client-chat-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.client-chat-head strong,
.client-chat-head span {
  display: block;
}

.client-chat-head strong {
  color: var(--ink);
  font-size: 18px;
}

.client-chat-head span,
.client-chat-status,
.client-chat-empty {
  color: var(--muted);
  font-size: 13px;
}

.client-chat-close {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 24px;
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 36px;
}

.client-chat-messages {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.client-chat-message {
  display: grid;
  gap: 5px;
  justify-self: start;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f6f5;
  color: var(--ink);
}

.client-chat-message.client {
  justify-self: end;
  background: var(--ink);
  color: #fff;
}

.client-chat-message p {
  margin: 0;
  white-space: pre-line;
}

.client-chat-message span {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.7;
}

.client-chat-form {
  display: grid;
  gap: 10px;
}

.client-chat-form textarea {
  min-height: 86px;
}

.client-chat-status {
  min-height: 18px;
  margin: 0;
  font-weight: 800;
}

.client-chat-status.error {
  color: var(--red);
}

@media (max-width: 760px) {
  .account-grid,
  #account-status-card,
  .profile-grid,
  .vehicle-grid,
  .vehicle-filters-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid .wide,
  .vehicle-grid .wide {
    grid-column: auto;
  }

  .vehicles-head,
  .vehicle-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .vehicle-card-actions {
    justify-items: start;
  }

  #account-status-card {
    align-items: stretch;
    flex-direction: column;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .account-status-side {
    justify-items: start;
  }

  .install-message {
    max-width: none;
    text-align: left;
  }

  .client-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .client-chat-panel {
    bottom: 72px;
  }

  .theme-toggle {
    padding: 10px;
  }

  .theme-toggle-text {
    display: none;
  }
}
