:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #315be8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #111827;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }

.app { min-height: 100vh; }

.screen { display: none; }
.screen.active { display: block; }

.login-screen {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(49, 91, 232, 0.35), transparent 36%),
    linear-gradient(135deg, #0f172a, #020617);
}

.login-screen.active { display: grid; }

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}

.language-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}

.language-row label { margin-bottom: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.logo {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: block;
  margin: 16px 0 8px;
  color: #374151;
  font-weight: 800;
  font-size: 13px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 13px 14px;
  outline: none;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 91, 232, 0.10);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 900;
  cursor: pointer;
  width: 100%;
}

.btn.primary {
  background: var(--primary);
  color: white;
  margin-top: 22px;
}

.btn.primary.no-margin { margin-top: 0; }

.btn.secondary {
  background: #f8fafc;
  color: #334155;
  border: 1px solid var(--border);
}

.btn.success {
  background: var(--success);
  color: white;
  margin-top: 18px;
}

.btn.danger {
  background: var(--danger);
  color: white;
  margin-top: 18px;
}

.link-btn {
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.time-screen {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 14px 88px;
}

.top {
  min-height: 96px;
  background: var(--dark);
  color: white;
  margin: -18px -14px 16px;
  padding: 24px 18px 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
}

.top h2 {
  margin: 4px 0;
  font-size: 28px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.small-lang {
  width: 74px;
  height: 42px;
  padding: 0 10px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  border-color: rgba(255,255,255,.16);
}

.eyebrow {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.avatar {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.status-card, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-card h3 {
  margin: 5px 0 0;
  font-size: 21px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.neutral {
  background: #f1f5f9;
  color: #475569;
}

.badge.sent {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge.ok {
  background: #ecfdf5;
  color: #047857;
}

.badge.err {
  background: #fef2f2;
  color: #b91c1c;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.time-field {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.time-field input {
  padding-right: 58px;
  min-height: 52px;
  cursor: pointer;
  caret-color: transparent;
  background: #fff;
}

.clock-btn {
  position: absolute;
  right: 7px;
  width: 42px;
  height: 42px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(49, 91, 232, 0.18);
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}

.clock-btn span {
  font-size: 24px;
  line-height: 1;
  transform: translateY(-1px);
}

.time-field:hover .clock-btn,
.clock-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.06);
  box-shadow: 0 12px 24px rgba(49, 91, 232, 0.28);
}

.clock-btn:active { transform: scale(0.98); }

.summary {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.summary strong { font-size: 22px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.section-head h3 { margin: 0; }

.week-list { display: grid; gap: 8px; }

.week-list > div {
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  cursor: pointer;
}

.week-list > div:last-child { border-bottom: 0; }
.week-list > div:hover { background: #f8fafc; }

.week-list span { font-weight: 800; }
.week-list strong { font-size: 15px; }

.week-list b {
  font-size: 11px;
  border-radius: 999px;
  padding: 5px 8px;
  white-space: nowrap;
}

.ok { background: #ecfdf5; color: #047857; }
.wait { background: #eff6ff; color: #1d4ed8; }
.draft { background: #fffbeb; color: #b45309; }

/* Fazė 3: savaitės navigacija */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.week-nav #weekRange {
  font-weight: 900;
  font-size: 15px;
}

.week-nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
}
.week-nav-center #weekNumber {
  font-weight: 900;
  font-size: 17px;
}
.week-nav-center #weekRange {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-arrow {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  flex: 0 0 auto;
}

.nav-arrow:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.week-current {
  width: 100%;
  margin-bottom: 14px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

/* Fazė 3: back knopf registravimo ekrane */
.back-btn {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 2px;
}
.back-btn:hover { color: #fff; }

/* Fazė 3: HMS action-row */
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 4px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  cursor: pointer;
}
.action-row:last-child { border-bottom: 0; }
.action-row:hover { color: var(--primary); }
.action-row .chev { color: var(--muted); font-size: 18px; }

/* Fazė 3: profilio eilutės */
.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.profile-row span { color: var(--muted); font-size: 13px; font-weight: 800; }
.profile-row strong { font-size: 14px; text-align: right; }

/* Fazė 3: informacinė dėžutė (read-only diena) */
.note-box {
  display: none;
  margin-bottom: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
}
.note-box.show { display: block; }
.note-box.info { background: #eff6ff; color: #1d4ed8; }
.note-box.warn { background: #fffbeb; color: #b45309; }
.note-box.err { background: #fef2f2; color: #b91c1c; }

/* Fazė 3: toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 13px 18px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
  max-width: calc(100% - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b91c1c; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(492px, calc(100% - 28px));
  background: #111827;
  border-radius: 22px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
  z-index: 10;
}

.bottom-nav.hidden { display: none; }

.bottom-nav button {
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 12px 8px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
}

.bottom-nav button.active {
  background: var(--primary);
  color: white;
}

.picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .46);
  display: none;
  align-items: end;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.picker-backdrop.active {
  display: flex;
}

.picker {
  width: min(492px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.34);
  padding: 18px;
  max-height: min(720px, calc(100vh - 32px));
}

.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.picker-head h3 {
  margin: 4px 0 0;
  font-size: 30px;
}

.close-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 26px;
  cursor: pointer;
}

.picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.picker-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

.picker-list {
  height: 300px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding-right: 2px;
}

.picker-list.minutes {
  height: auto;
  overflow: visible;
}

.picker-option {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 13px;
  min-height: 42px;
  font-weight: 900;
  cursor: pointer;
  color: #334155;
}

.picker-option.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.picker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 780px) {
  .time-screen { padding-top: 28px; }
  .top {
    margin-left: 0;
    margin-right: 0;
    border-radius: 26px;
  }
  .picker-backdrop { align-items: center; }
}

@media (max-width: 390px) {
  .week-list > div { grid-template-columns: 1fr auto; }
  .week-list b { grid-column: 1 / -1; width: fit-content; }
}

/* Fazė 2: kelių projektų dienos blokai */
.project-block {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfcfe;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.block-title {
  font-weight: 800;
  font-size: 13px;
  color: #374151;
}

.block-remove {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #b91c1c;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.block-remove:hover { background: #fef2f2; }

/* Fazė 3.1: dienos data prie savaitės dienos + šiandienos žymė */
.week-list .day-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.week-list .day-label span { font-weight: 800; }
.week-list .day-label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.week-day.day-today {
  background: #eef3ff;
  border-radius: 12px;
}

/* HMS gating: projekto užrakto dėžutė */
.hms-lock {
  margin-top: 10px;
  padding: 14px;
  border-radius: 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.hms-lock-title { font-weight: 800; font-size: 13px; color: #92400e; }
.hms-lock-sub { font-size: 12px; color: #b45309; margin-top: 6px; font-weight: 700; }
.hms-lock-list {
  margin: 8px 0 12px;
  padding-left: 18px;
  font-size: 13px;
  color: #78350f;
}
.hms-lock-list li { margin-bottom: 4px; }

/* --- Login: šalies pasirinkimas + telefonas + PIN --- */
.country-row { display: flex; gap: 10px; margin-bottom: 6px; }
.country-btn {
  flex: 1; padding: 12px; border: 2px solid var(--border, #e5e7eb); border-radius: 12px;
  background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; color: #334155;
}
.country-btn.active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.phone-input { display: flex; align-items: stretch; gap: 8px; }
.phone-prefix {
  display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; background: #f8fafc; font-weight: 700; color: #475569; font-size: 15px;
}
.phone-input input { flex: 1; }
.login-msg { font-size: 13px; margin-top: 10px; min-height: 18px; color: #64748b; text-align: center; }
.login-hint { font-size: 12px; color: #94a3b8; text-align: center; margin-top: 12px; }
.btn.secondary { background: #f1f5f9; color: #334155; border: 1px solid var(--border, #e5e7eb); margin-bottom: 10px; }
.picker-close { background: none; border: 0; font-size: 24px; cursor: pointer; color: #64748b; line-height: 1; }

/* --- HMS-gjennomgang (scroll-to-bottom + quiz) --- */
.hms-rev-content {
  max-height: 46vh; overflow-y: auto; border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 14px; background: #fafafa;
}
.hms-rev-group { font-weight: 800; margin: 14px 0 6px; font-size: 14px; color: #0f172a; }
.hms-rev-group:first-child { margin-top: 0; }
.hms-rev-item { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.hms-rev-item strong { display: block; font-size: 14px; }
.hms-rev-item p { margin: 4px 0 0; font-size: 13px; color: #475569; }
.hms-scroll-hint { text-align: center; font-size: 12px; color: #b45309; background: #fef3c7; border-radius: 8px; padding: 8px; margin-top: 10px; }
.hms-scroll-hint.done { color: #166534; background: #dcfce7; }
.hms-read-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 14px; cursor: pointer; }
.hms-read-row input { width: 20px; height: 20px; margin-top: 1px; }
.hms-quiz-q { margin-bottom: 16px; }
.hms-quiz-q .q-text { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.hms-quiz-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; margin-bottom: 6px; font-size: 14px; cursor: pointer; }
.hms-quiz-opt input { margin-top: 2px; }
.hms-quiz-opt.wrong { border-color: #fca5a5; background: #fef2f2; }
.hms-quiz-expl { font-size: 12px; color: #b91c1c; background: #fef2f2; border-radius: 8px; padding: 8px 10px; margin: 4px 0 8px; }
.notice-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.notice-card h4 { margin: 0 0 4px; font-size: 15px; }
.notice-card p { margin: 0 0 10px; font-size: 13px; color: #334155; }
.notice-proj { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.notice-proj strong { font-size: 14px; }
