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

:root {
  --color-bg: #171717;
  --color-surface: #040404;
  --color-border: #272727;
  --color-border-focus: #697da2;
  --color-text: #e4e4e4;
  --color-text-secondary: #95979c;
  --color-active: #5188fc;
  --color-active-hover: #2f60e7;
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-error: #f87a7a;
  --color-error-bg: #5e2d2d;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(207, 207, 207, 0.05);
  --shadow-md: 0 4px 12px rgba(198, 198, 198, 0.08);
}

html {
  font-size: 16px;
}

body {
  font-family: Helvetica, Arial, sans-serif;
  background-color: var(--color-surface);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 80px 16px;
}

.container {
  width: 100%;
  max-width: 480px;
}

/* ---- Card ---- */

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
}

/* ---- Typography ---- */

h1 {
  font-size: 1.4rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
}

h2 {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 24px;
}

/* ---- Tabs ---- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 28px;
}

.tab {
  flex: 1;
  padding: 10px 0;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: Helvetica, Arial, sans-serif;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-active);
  border-bottom-color: var(--color-active);
}

/* ---- Header Bar ---- */

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.header-bar h1 {
  margin-bottom: 0;
}

/* ---- Form Elements ---- */

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.875rem;
  font-family: Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-active);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ---- Semantic Input States ---- */

input.invalid,
select.invalid {
  border-color: var(--color-error);
}

input.invalid:focus,
select.invalid:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

input.valid {
  border-color: var(--color-success);
}

input.valid:focus {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

/* ---- Helper & Error Text ---- */

.helper-text {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.error-msg {
  font-size: 0.75rem;
  color: var(--color-error);
  margin-top: 4px;
  display: none;
}

.error-msg.visible {
  display: block;
}

.error-msg.visible + .helper-text {
  display: none;
}

/* ---- Checkbox & Radio ---- */

.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-group-inline {
  flex-direction: row;
  gap: 20px;
}

.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-active);
  cursor: pointer;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: Helvetica, Arial, sans-serif;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background-color: var(--color-active);
  color: #ffffff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-active-hover);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  padding: 8px 16px;
  font-size: 0.8125rem;
}

.btn-outline:hover {
  background-color: var(--color-surface);
}

/* ---- Login Error ---- */

.login-error {
  background-color: var(--color-error-bg);
  color: var(--color-error);
  font-size: 0.8125rem;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: none;
}

.login-error.visible {
  display: block;
}

/* ---- Success Toast ---- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--color-success);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Section Divider ---- */

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 28px 0;
}

/* ---- Utilities ---- */

.hidden {
  display: none !important;
}

.mt-sm {
  margin-top: 8px;
}

.mt-md {
  margin-top: 16px;
}
