:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;          /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;       /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);       /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field { position: relative; margin-bottom: 14px; }

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover { color: var(--primary); }

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error { color: #d52731; }
.success { color: #269f53; }

/* ---------- Logout button ---------- */
/* Tiny logout icon (top-left of the page) */
.logout-icon {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
}
.logout-icon i {
  font-size: 14px;   /* slightly larger than before */
  line-height: 1;
}

.logout-icon:hover { background: var(--primary-dark); }
.logout-icon:active { transform: translateY(1px); }


/* ---------- Mini FAB (bottom-left) ---------- */
.fab {
  position: fixed;
  bottom: 14px;
  left: 12px;                 /* bottom-left */
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px rgba(16,24,40,0.18);
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
  z-index: 1000;
}
.fab i { font-size: 16px; line-height: 1; }
.fab:hover { background: var(--primary-dark); transform: translateY(-1px); }
.fab:active { transform: translateY(0); }


/* Variant to pin a FAB to bottom-right */
.fab-right { left: auto; right: 12px; }

/* Bottom-right pill CTA — crisp text, no fake bold */
/* Bottom-right pill button (independent of .fab) */
.pill-fab {
  position: fixed;
  right: 12px;
  bottom: 14px;

  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;
  border-radius: 9999px;
  background: #ffffff;
  color: var(--primary);
  border: 1px solid rgba(13, 110, 253, .35);
  box-shadow: 0 8px 18px rgba(16,24,40,.12);
  text-decoration: none;

  /* Typography — force crisp rendering and avoid faux bold */
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 600;               /* 600 or 700 are both loaded; 600 looks cleaner */
  font-size: 14px;                /* fixed px looks better on Windows */
  letter-spacing: .01em;
  line-height: 1;
  text-transform: none;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), border-color var(--transition);
  z-index: 1000;
}

.pill-fab i { font-size: 16px; line-height: 1; }
.pill-fab span { white-space: nowrap; }

.pill-fab:hover {
  background: #f9fbff;
  border-color: rgba(13,110,253,.5);
  transform: translateY(-1px);
}

.pill-fab:active {
  transform: translateY(0);
}

/* Optional: solid blue variant — uncomment to use a filled look
.pill-fab {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}
*/


/* keep it on the bottom-right (uses your existing .fab-right) */
.fab-right { left: auto; right: 12px; }

/* icon + hover states */
#ndcvButton i { font-size: 16px; line-height: 1; }
#ndcvButton span { white-space: nowrap; }
#ndcvButton:hover { background: color-mix(in srgb, var(--primary) 10%, white); transform: translateY(-1px); }
#ndcvButton:active { transform: translateY(0); }


/* ---------- Modal ---------- */
.modal.hidden { display: none; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 1100;
}
.modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px rgba(16,24,40,0.16);
  max-height: 86vh;          /* NEW: never exceed the viewport */
  display: flex;             /* NEW */
  flex-direction: column;    /* NEW */
}

.modal-header, .modal-footer {
  padding: 14px 16px;
  display: flex;
  align-items: center;
}
.modal-header { justify-content: space-between; border-bottom: 1px solid #eef0f4; }
.modal-footer { justify-content: flex-end; border-top: 1px solid #eef0f4; }
.modal-body {
  padding: 16px;
  flex: 1 1 auto;  /* NEW: body takes remaining height between header & footer */
  overflow: auto;  /* NEW: scroll inside the body */
}


.icon-btn {
  background: transparent; border: 0; cursor: pointer; color: #64748b;
  border-radius: 10px; padding: 6px;
}
.icon-btn:hover { color: var(--primary); }

.input {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: .96rem;
  margin: 6px 0 12px;
}
.lbl { font-size: .92rem; color: #475569; font-weight: 600; }

.subtasks-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 0 8px;
}
.link-btn {
  background: transparent; border: 0; color: var(--primary); cursor: pointer;
  font-weight: 600; padding: 6px 8px; border-radius: 10px;
}
.link-btn:hover { text-decoration: underline; }

.subtask-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.subtask-row input { margin: 0; }
.subtask-row .remove {
  background: transparent; border: 0; color: #ef4444; padding: 6px 8px; border-radius: 10px; cursor: pointer;
}
.subtask-row .remove:hover { text-decoration: underline; }

.form-msg { min-height: 1.2em; margin-top: 6px; font-weight: 600; }
.form-msg.error { color: #d52731; }
.form-msg.success { color: #269f53; }

/* Limit the Chi tiết list height so Save button stays clickable */
#subtaskList {
  max-height: 40vh;   /* adjust to your taste */
  overflow-y: auto;   /* scroll only the list when it's long */
  padding-right: 6px; /* a bit of room for the scrollbar */
}

/* Cards for the "Xem nội dung công việc" popup */
.ndcv-results {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.ndcv-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: var(--card-bg);
}

.ndcv-card .title {
  font-weight: 700;
  margin-bottom: 4px;
}

.ndcv-card .meta {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 8px;
}

.ndcv-card .note {
  font-size: 0.92rem;
  margin-bottom: 8px;
  color: #475569;
}

.ndcv-card ul {
  list-style: none;
  padding-left: 16px;
  margin: 0;
}

.ndcv-card ul li {
  margin-bottom: 6px;
}

/* Report button (bottom-left) */
.ndcv-card .report-btn{
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: .86rem;
  letter-spacing: .02em;
  background: color-mix(in srgb, var(--accent) 14%, white);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
  box-shadow: 0 8px 18px rgba(16,24,40,.12);
  cursor: pointer;
}
.ndcv-card .report-btn:hover{
  background: color-mix(in srgb, var(--accent) 20%, white);
}
.ndcv-card .report-btn:disabled{
  opacity: .65;
  cursor: not-allowed;
}
.ndcv-card .report-btn i{
  font-size: .9rem;
  line-height: 1;
}


/* Ensure hidden elements never flash */
.fab[hidden] { display: none !important; }
#ndcvMain[hidden] { display: none !important; }

/* ===== NDCV main list ===== */
/* ===== NDCV main list (1-column) ===== */
#ndcvMainTitle{
  max-width: 800px;
  margin: 32px auto 12px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.01em;
}

#ndcvMainResults{
  max-width: 800px;
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: 1fr; /* one column */
  gap: 16px;
}





/* Card */
.ndcv-card{
  position: relative;
  background: #fff;
  border: 2px dotted var(--accent, #e5e7eb);
  border-radius: 18px;
  padding: 16px 18px 56px; /* extra bottom room for the timer */
  box-shadow: 0 8px 22px rgba(16,24,40,.06);
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}


.ndcv-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(16,24,40,.10);
}

/* Dotted border color variants */
.ndcv-card.v1{ --accent:#6366f1; } /* indigo */
.ndcv-card.v2{ --accent:#06b6d4; } /* cyan   */
.ndcv-card.v3{ --accent:#22c55e; } /* green  */
.ndcv-card.v4{ --accent:#f59e0b; } /* amber  */
.ndcv-card.v5{ --accent:#f43f5e; } /* rose   */


.ndcv-card .title{
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
}

/* Meta row: badge + date */
.ndcv-card .meta{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  color: #64748b;
  margin-bottom: 10px;
}

/* Header row: title on left, date + pill on right (same line) */
.ndcv-card .head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

/* Meta on MAIN list: inline to the right of the title */
#ndcvMainResults .ndcv-card .meta{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: #64748b;
  margin: 0;
}

#ndcvMainResults .ndcv-card .badge{
  padding: 3px 8px;
  font-size: .72rem;
}

#ndcvMainResults .ndcv-card .date{
  opacity: .85;
}


.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: .75rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
}

/* Fallback if the browser doesn't support color-mix */
@supports not (color: color-mix(in srgb, black, white)){
  .ndcv-card.v1 .badge{ background:rgba(99,102,241,.10); border-color:rgba(99,102,241,.25); color:#6366f1;}
  .ndcv-card.v2 .badge{ background:rgba(6,182,212,.10);  border-color:rgba(6,182,212,.25);  color:#06b6d4;}
  .ndcv-card.v3 .badge{ background:rgba(34,197,94,.10);  border-color:rgba(34,197,94,.25);  color:#22c55e;}
  .ndcv-card.v4 .badge{ background:rgba(245,158,11,.12); border-color:rgba(245,158,11,.25); color:#f59e0b;}
  .ndcv-card.v5 .badge{ background:rgba(244,63,94,.10);  border-color:rgba(244,63,94,.25);  color:#f43f5e;}
}


.ndcv-card .note{
  font-size: .92rem;
  color: #4b5563;
  margin: 0 0 10px;
}

/* Countdown pill (bottom-right of each card) */
.ndcv-card .timer{
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: .86rem;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--accent) 14%, white);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
  box-shadow: 0 8px 18px rgba(16,24,40,.12);
}

/* Timer when finished */
.ndcv-card .timer.expired{
  background: rgba(244,63,94,.10);
  color: #b91c1c;
  border-color: rgba(244,63,94,.28);
}


/* List */
.ndcv-card ul{ margin: 0; padding-left: 20px; }
.ndcv-card li{ margin: 6px 0; }
.ndcv-card li::marker{ color: var(--primary); }

/* Ensure hidden really hides */
.fab[hidden]{ display: none !important; }
#ndcvMain[hidden]{ display: none !important; }

/* ===== Choice/confirm popups ===== */
.hero-row {
  display: flex; gap: 12px; align-items: center; margin-bottom: 12px;
}
.hero-badge {
  width: 44px; height: 44px; border-radius: 9999px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, white);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, white);
  box-shadow: 0 6px 16px rgba(16,24,40,.08);
}
.hero-badge i { font-size: 18px; }
.hero-title { font-weight: 800; letter-spacing: -.01em; }
.hero-sub { color: #64748b; margin-top: 2px; }

.choice-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px;
}
@media (max-width: 520px){ .choice-grid { grid-template-columns: 1fr; } }

.btn-lg { padding: 16px; font-size: 1rem; }
.btn-outline {
  background: #fff; color: #0f172a; border: 1px solid #e5e7eb;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-soft {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, white);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, white);
}
.btn-soft:hover { background: color-mix(in srgb, var(--primary) 16%, white); }

.confirm-text { font-size: .98rem; color: #334155; margin: 4px 0 4px; }


/* ===== Inputs under each requirement ===== */
.req-list { list-style: disc; padding-left: 20px; margin: 0; }
.req-item { margin: 8px 0 12px; }
.req-text { margin: 0; color: #0f172a; }

.req-input-row {
  margin-top: 6px;
  position: relative;
}

.req-input {
  margin: 0;                            /* remove extra gap from .input */
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  font-size: .94rem;
  padding: 10px 12px;
}

/* Focus state uses the card’s accent color when available */
.ndcv-card .req-input:focus {
  border-color: var(--accent, var(--primary));
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--primary)) 18%, white);
  outline: none;
}

/* Disabled state (when user only 'Chỉ xem công việc') */
.req-input:disabled {
  color: #64748b;
  background: #f3f4f6;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: .85;
}

/* ===== Multiline inputs under each requirement ===== */
.req-input-row { margin-top: 6px; position: relative; }

.req-area {
  margin: 0;
  width: 100%;
  min-height: 38px;              /* small start height */
  max-height: 200px;             /* cap growth */
  line-height: 1.35;
  padding: 10px 12px;
  font-size: .94rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  resize: vertical;              /* allow manual grow if they want */
  overflow-y: hidden;            /* smoother autosize */
}

.ndcv-card .req-area:focus {
  border-color: var(--accent, var(--primary));
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--primary)) 18%, white);
  outline: none;
}

.req-area::placeholder { color: #9ca3af; }

.req-area:disabled {
  color: #64748b;
  background: #f3f4f6;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: .85;
}


/* ===== Report list: layout + cosmetics ===== */
.ndcv-card { overflow: hidden; } /* keeps sticky bits clean */

/* Turn the list into a responsive grid */
.ndcv-card .req-list {
  list-style: none;              /* remove bullets */
  padding-left: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  counter-reset: req;
}
@media (min-width: 920px) {
  .ndcv-card .req-list { grid-template-columns: 1fr 1fr; }
}

/* Each requirement looks like a mini card */
.ndcv-card .req-item {
  position: relative;
  border: 1px solid #eef0f4;
  background: #f9fafb;
  border-radius: 12px;
  padding: 12px 12px 10px 44px; /* room for number badge */
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

/* Number badge */
.ndcv-card .req-item::before {
  counter-increment: req;
  content: counter(req);
  position: absolute; left: 10px; top: 12px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 9999px;
  font-size: .80rem; font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
}

/* Title line + focus states */
.ndcv-card .req-text {
  font-weight: 600; color: #0f172a;
}

.ndcv-card .req-item:focus-within {
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 30%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, white);
}

/* “Done” look when user typed something */
.ndcv-card .req-item.done {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--accent) 32%, white);
}
.ndcv-card .req-item.done .req-text { color: #0b3d18; }

/* Progress pill in the header (right side) */
.ndcv-card .progress {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  border-radius: 9999px;
  font-weight: 700; font-size: .8rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
}
.ndcv-card .progress i { font-size: .95rem; line-height: 1; }

/* Small polish on the card header row so the progress fits nicely */
.ndcv-card .head { align-items: center; }
.ndcv-card .head .title { font-size: 1.08rem; }

/* Keep your action controls feeling like a bar at the bottom */
.ndcv-card .report-btn { bottom: 14px; }
.ndcv-card .timer      { bottom: 14px; }


/* Force single column for the requirement list on all screen sizes */
.ndcv-card .req-list {
  grid-template-columns: 1fr !important;
}

/* If a media query sets it to 2 columns, keep it 1 column anyway */
@media (min-width: 920px) {
  .ndcv-card .req-list { grid-template-columns: 1fr !important; }
}
