/* ==========================================================================
   GELEX HUB — Modal (generic + login + onboarding) — mỏng hơn cũ
   Override radius/padding. Giữ đỏ GELEX.
   ========================================================================== */

/* ---------- Generic modal overlay ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in var(--ease) 150ms;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}

.modal {
  position: relative;
  width: min(400px, 100%);
  padding: 22px 22px 20px;
  border-radius: var(--radius-xl);   /* 16 (cũ 20) */
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  animation: pop-in var(--ease-spring) 240ms;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--ease) 140ms, color var(--ease) 140ms;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.task-row:focus-visible,
.cal-task:focus-visible,
.wt-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.modal-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.modal-head strong { font-size: 16px; font-weight: 600; }
.modal-sub { font-size: 12px; color: var(--text-dim); }

.modal-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--surface-2); padding: 3px; border-radius: var(--radius); }
.modal-tabs button {
  flex: 1;
  padding: 7px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 140ms, color var(--ease) 140ms;
}
.modal-tabs button:hover { color: var(--text); }
.modal-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.modal-form { display: flex; flex-direction: column; gap: 10px; }
.modal-form input,
.modal-form select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color var(--ease) 150ms, box-shadow var(--ease) 150ms;
}
.modal-form input::placeholder { color: var(--text-faint); }
.modal-form input:focus,
.modal-form select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.modal-label { font-size: 11.5px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.modal-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.modal-check input { width: auto; height: auto; }

.modal-preview { display: flex; justify-content: center; margin: 4px 0 2px; }
.modal-preview .app-ic { width: 56px; height: 56px; }

.modal-error { color: var(--danger); font-size: 12.5px; min-height: 0; }
.modal-submit {
  margin-top: 4px;
  height: 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 150ms;
}
.modal-submit:hover { background: var(--brand-dark); }
.modal-submit:active { transform: scale(0.99); }

.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.modal-btn {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--ease) 140ms;
}
.modal-btn:hover { background: var(--surface-2); }
.modal-btn.danger { background: var(--danger-light); border-color: rgba(225, 29, 72, 0.3); color: var(--danger); }
.modal-btn.danger:hover { background: rgba(225, 29, 72, 0.16); }

/* Nút xoá trong form: KHÔNG dùng nền/chữ đỏ đậm như nút Lưu ngay phía trên —
   --brand (#d8232a) và --danger (#dc2626) gần như trùng nhau, hai khối đỏ chồng
   nhau thì không phân biệt được đâu là hành động chính, đâu là hành động phá huỷ.
   Dùng nền hồng nhạt + chữ đỏ đậm, theo đúng mẫu .modal-btn.danger ở trên. */
.modal-submit.danger {
  background: #fef2f2;
  background-image: none;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 600;
}
.modal-submit.danger:hover { background: #fee2e2; filter: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(10px);
  z-index: 300;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 25, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease) 220ms, transform var(--ease) 220ms;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast .toast-action {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  margin-left: 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--ease) 120ms;
}
.toast .toast-action:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- Cheatsheet ---------- */
.cs-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cs-row span { color: var(--text-dim); }
.cs-row kbd, .cs-row code {
  display: inline-block; min-width: 24px; text-align: center;
  padding: 3px 7px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font: inherit; font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text); font-weight: 600;
}

/* ==========================================================================
   LOGIN SCREEN — radius 28→20, padding mỏng hơn
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in var(--ease) 220ms;
}

.login-card {
  width: min(440px, 100%);
  padding: 30px 28px 26px;
  border-radius: var(--radius-xl);    /* 16 (cũ 28) */
  background: var(--surface);
  border: 1px solid var(--border);
  animation: pop-in var(--ease-spring) 300ms;
  box-shadow: var(--shadow-xl);
}

.login-hero {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  overflow: hidden;
}
.login-wordmark {
  display: block;
  width: 100%;
  max-width: 290px;
  height: auto;
  max-height: 50px;
  object-fit: contain;
  flex: none;
}

.login-ms-btn { margin-top: 2px; }
.login-local-head { display: flex; flex-direction: column; margin: 16px 0 12px; }
.login-local-head h2 { font-size: 15px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--ease) 150ms, box-shadow var(--ease) 150ms;
}
.login-form input::placeholder { color: var(--text-faint); }
.login-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.login-error {
  color: var(--danger);
  font-size: 12.5px;
  background: var(--danger-light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.login-submit {
  margin-top: 4px;
  height: 44px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 150ms;
}
.login-submit:hover { background: var(--brand-dark); }
.login-submit:active { transform: scale(0.99); }

.modal-sep {
  display: flex; align-items: center; text-align: center;
  color: var(--text-faint); font-size: 12px; margin: 14px 0 10px;
}
.modal-sep::before, .modal-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.modal-sep::before { margin-right: 12px; }
.modal-sep::after { margin-left: 12px; }
.modal-sep[hidden] { display: none; }
.login-sep { display: flex; align-items: center; text-align: center; color: var(--text-faint); font-size: 12px; margin: 14px 0 10px; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-sep::before { margin-right: 12px; }
.login-sep::after { margin-left: 12px; }
.login-sep[hidden] { display: none; }

.ms-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease) 140ms, border-color var(--ease) 140ms;
}
.ms-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.ms-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.ms-btn svg { flex: none; }

.login-card .ms-btn {
  width: 100%;
  justify-content: center;
  height: 46px;
  border-color: var(--border);
}

.login-foot { display: none; }
