body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f7fb;
  color: #1d2b4f;
}

.hidden {
  display: none !important;
}

#auth-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 18, 35, 0.58);
  backdrop-filter: blur(4px);
  padding: 24px;
}

.auth-box {
  width: min(900px, 100%);
  background: white;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(18, 38, 63, 0.18);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid #e4ebf5;
}

.auth-tab {
  flex: 1;
  padding: 18px;
  border: none;
  background: #f5f8ff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: #2a3c66;
}

.auth-tab.active {
  background: white;
  color: #0d47a1;
  border-bottom: 3px solid #0d47a1;
}

.auth-panel {
  display: none;
  padding: 28px;
}

.auth-panel.active {
  display: block;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-weight: 600;
  color: #1f2d4d;
}

.form-field small {
  color: #50627f;
  font-size: 0.88rem;
}

.form-field input,
.form-field select {
  border: 1px solid #d3dceb;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  background: #f9fbff;
}

.form-field input:focus,
.form-field select:focus {
  outline: 2px solid rgba(13, 71, 161, 0.18);
  border-color: #0d47a1;
}

.form-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #50627f;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #eaf2ff;
  color: #0d47a1;
  outline: none;
}

.auth-submit {
  grid-column: 1 / -1;
  background: #0d47a1;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

#auth-message {
  margin: 14px 28px 18px;
  min-height: 20px;
  color: #1f7a3d;
  font-weight: 600;
}

#auth-message.error {
  color: #b42318;
}

.auth-link {
  display: block;
  margin: 12px auto 0;
  border: 0;
  background: transparent;
  color: #0d47a1;
  cursor: pointer;
  text-decoration: underline;
}

#app-shell {
  display: block;
  min-height: 100vh;
}

.login-counter {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 99998;
  padding: 8px 12px;
  background: rgba(13, 71, 161, 0.96);
  color: white;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.24);
  font-size: 0.9rem;
  font-weight: 700;
}

.user-badge {
  position: fixed;
  right: 20px;
  top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(13, 71, 161, 0.96);
  color: white;
  border-radius: 999px;
  padding: 8px 14px 8px 18px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.24);
  z-index: 99998;
}

#user-name {
  white-space: nowrap;
  font-size: 0.95rem;
}

.settings-menu {
  position: relative;
}

.settings-button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: white;
  color: #0d47a1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-button:hover,
.settings-button:focus-visible {
  background: #eaf2ff;
  outline: none;
}

.settings-options {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 170px;
  padding: 6px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(18, 38, 63, 0.2);
}

.settings-options button {
  display: block;
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: #1d2b4f;
  text-align: center;
  font: inherit;
  cursor: pointer;
}

.settings-options button:hover {
  background: #eef4fc;
  color: #0d47a1;
}

.password-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 18, 35, 0.58);
  backdrop-filter: blur(4px);
  padding: 24px;
}

.password-box {
  position: relative;
  width: min(460px, 100%);
  padding: 28px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(18, 38, 63, 0.18);
}

.password-box h2 {
  margin: 0 0 22px;
  color: #1d2b4f;
}

.password-form {
  display: grid;
  gap: 18px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  color: #50627f;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

#password-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: #1f7a3d;
  font-weight: 600;
}

#password-message.error {
  color: #b42318;
}

#reset-password-message {
  min-height: 20px;
  margin-top: 14px;
  color: #1f7a3d;
  font-weight: 600;
}

#reset-password-message.error {
  color: #b42318;
}

.logout-button {
  border: none;
  background: white;
  color: #1d2b4f;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
