/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #9135eb;
  --purple-dark: #7020c8;
  --navy: #1F3864;
  --teal: #2E75B6;
  --green: #1db954;
  --red: #e53935;
  --orange: #f57c00;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #dde1ec;
  --text: #1a1a2e;
  --muted: #6b7280;
  --font: Arial, sans-serif;
}

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Mobile block ─────────────────────────────────────────────────────────── */
#mobileBlock {
  display: none;
  position: fixed; inset: 0;
  background: var(--purple);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  z-index: 9999;
}
#mobileBlock h2     { font-size: 1.4rem; margin-bottom: 1rem; }
#mobileBlock p      { color: rgba(255,255,255,.8); line-height: 1.6; margin-bottom: 1.5rem; }
#mobileBlock small  { color: rgba(255,255,255,.45); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }

@media (max-width: 768px) {
  #mobileBlock { display: flex; }
  #app { display: none; }
}

/* ── Auth / Login ─────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}

.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo h1 {
  font-size: 1.5rem;
  color: var(--purple);
  font-weight: 700;
}

.auth-logo p {
  color: var(--muted);
  font-size: .875rem;
  margin-top: .25rem;
}

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; }

.form-group input {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus { border-color: var(--purple); }

.auth-error {
  background: #fdecea;
  color: var(--red);
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1.4rem;
  border: none; border-radius: 8px;
  font-family: var(--font); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary  { background: var(--purple); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--purple-dark); }

.btn-secondary { background: #e9e4f7; color: var(--purple); }
.btn-secondary:hover:not(:disabled) { background: #d9d1f0; }

.btn-teal  { background: var(--purple); color: #fff; }
.btn-teal:hover:not(:disabled) { background: var(--purple-dark); }

.btn-ghost { background: transparent; color: var(--purple); border: 1.5px solid var(--purple); }
.btn-ghost:hover { background: #f0ebfa; }

.btn-lg { padding: .85rem 2rem; font-size: 1.05rem; }
.btn-full { width: 100%; }

.btn-eod {
  background: #9135eb;
  color: #fff;
}
.btn-eod:hover { opacity: .9; }

.btn-break-return { background: #f59e0b; color: #fff; }
.btn-break-return:hover:not(:disabled) { background: #d97706; }
.btn-break-overdue { background: #ef4444; color: #fff; }
.btn-break-overdue:hover:not(:disabled) { background: #dc2626; }

/* ── Employee view ────────────────────────────────────────────────────────── */
.emp-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.emp-header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 1rem 2rem;
  display: flex; align-items: center; gap: 1rem;
}
.emp-name { font-weight: 700; font-size: 1.1rem; color: var(--navy); }

.emp-body {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 2.5rem 1rem;
  gap: 2rem;
}

/* ── Clock ring ───────────────────────────────────────────────────────────── */
.clock-ring-wrap {
  position: relative; width: 220px; height: 220px;
}

.clock-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track {
  fill: none;
  stroke: #e8e2f8;
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke: var(--purple);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s ease;
}

.clock-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.clock-time {
  font-size: 2.2rem; font-weight: 700;
  color: var(--navy); letter-spacing: -.02em;
}
.clock-sub { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

/* ── Status badge ─────────────────────────────────────────────────────────── */
.status-badge {
  padding: .25rem .75rem;
  border-radius: 999px;
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-active        { background: #d4f5e2; color: #166534; }
.badge-break         { background: #fef3c7; color: #92400e; }
.badge-done          { background: #e0e7ff; color: #3730a3; }
.badge-overdue       { background: #fee2e2; color: var(--red); }
.badge-pre-sod       { background: #ede9fe; color: #5b21b6; }
.badge-admin-closed  { background: #e5e7eb; color: #374151; }
.badge-auto-closed   { background: #fef3c7; color: #92400e; }

/* ── Greeting shared ──────────────────────────────────────────────────────── */
.greeting-text {
  font-style: italic;
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ── Morning greeting ─────────────────────────────────────────────────────── */
.morning-greeting {
  display: none;
  background: #f5eeff;
  border-radius: 12px;
  padding: 16px 24px;
  max-width: 600px;
  margin: 16px auto;
  text-align: center;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  background: #9135eb;
  color: #fff;
  font-size: .9rem;
  font-style: italic;
  border-radius: 10px;
  padding: .75rem 1.25rem;
  max-width: 480px;
  text-align: center;
  line-height: 1.5;
}
@keyframes toastFade {
  0%   { opacity: 1; }
  93%  { opacity: 1; }
  100% { opacity: 0; }
}
.toast-fade {
  animation: toastFade 15s ease forwards;
}

/* ── EOD greeting ─────────────────────────────────────────────────────────── */
.eod-greeting {
  text-align: center;
  margin-bottom: 1.25rem;
}

/* ── Action buttons row ───────────────────────────────────────────────────── */
.emp-actions {
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;
}

/* ── Break log ────────────────────────────────────────────────────────────── */
.break-log { width: 100%; max-width: 540px; }
.break-log-title { font-size: .875rem; font-weight: 700; color: var(--muted); margin-bottom: .5rem; }
.break-log-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.break-log-list li {
  display: flex; gap: .75rem; align-items: center;
  font-size: .875rem; color: var(--text);
  background: var(--surface);
  padding: .4rem .75rem; border-radius: 6px;
  border: 1px solid var(--border);
}
.break-log-list li.overdue { border-color: var(--red); }
.overdue-badge { background: #fee2e2; color: var(--red); padding: .1rem .4rem; border-radius: 4px; font-size: .75rem; }

/* ── Break modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 2rem;
  width: 320px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
}
.modal h3 { font-size: 1.2rem; margin-bottom: 1.25rem; color: var(--navy); }
.time-picker {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1.25rem;
}
.tp-select {
  padding: .55rem .6rem; border-radius: 8px;
  border: 1.5px solid #9135eb; outline: none;
  font-family: var(--font); font-size: 1.05rem;
  color: #9135eb; background: #fff;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  text-align: center;
}
.tp-select:focus { box-shadow: 0 0 0 2px rgba(145,53,235,.2); }
.tp-select option:disabled { color: #ccc; }
.tp-colon { font-size: 1.3rem; font-weight: 700; color: #9135eb; }
.tp-ampm {
  display: flex; flex-direction: column; gap: .25rem; margin-left: .25rem;
}
.tp-ampm-btn {
  padding: .25rem .55rem; border-radius: 6px;
  border: 1.5px solid #9135eb; background: #fff;
  color: #9135eb; font-family: var(--font); font-size: .8rem;
  font-weight: 600; cursor: pointer; line-height: 1;
  transition: background .15s, color .15s;
}
.tp-ampm-btn.active {
  background: #9135eb; color: #fff;
}
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }
.modal-sub   { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.modal-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted);
               text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }
.modal-textarea {
  width: 100%; padding: .55rem .75rem; border-radius: 8px;
  border: 1.5px solid var(--border); font-family: var(--font); font-size: .95rem;
  resize: vertical; outline: none; margin-bottom: 1.25rem;
}
.modal-textarea:focus { border-color: var(--purple); }

/* Close Session button on admin cards */
.card-close-wrap { margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--bg); }
.btn-close-session {
  font-size: .78rem; font-weight: 600; cursor: pointer;
  background: transparent; border-radius: 6px; padding: .3rem .75rem;
  border: 1.5px solid #9ca3af; color: #6b7280; width: 100%;
  font-family: var(--font); transition: background .15s, color .15s, border-color .15s;
}
.btn-close-session:hover { background: #f3f4f6; border-color: #6b7280; color: #374151; }

/* Danger button for destructive confirms */
.btn-danger {
  background: var(--red); color: #fff; border: none; border-radius: 8px;
  padding: .6rem 1.2rem; font-family: var(--font); font-size: .95rem;
  font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: #c62828; }
.btn-danger:disabled { opacity: .5; cursor: default; }

/* Reopen session button (admin card header) */
.btn-reopen-session {
  font-size: .72rem; font-weight: 600; padding: .2rem .55rem;
  border: 1.5px solid #9135eb; border-radius: 6px;
  background: transparent; color: #9135eb; cursor: pointer;
  line-height: 1.3; transition: background .15s, color .15s;
}
.btn-reopen-session:hover { background: #9135eb; color: #fff; }
.btn-reopen-session:disabled { opacity: .5; cursor: default; }

/* Closed session note on admin card */
.closed-note {
  font-size: .8rem; color: var(--muted); margin-top: .6rem;
  padding: .4rem .6rem; background: var(--bg); border-radius: 6px;
}

/* ── EOD form ─────────────────────────────────────────────────────────────── */
.eod-container {
  width: 100%; max-width: 600px;
  background: var(--surface);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

.eod-field-label { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: .5rem; }
.eod-prompt { font-size: .95rem; color: var(--text); margin-bottom: 1rem; line-height: 1.5; }

.eod-input {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: .95rem;
  resize: vertical; outline: none;
  margin-bottom: .75rem;
}
.eod-input:focus { border-color: var(--purple); }

.eod-actions { display: flex; gap: .75rem; justify-content: flex-end; }

.eod-item-list {
  list-style: none;
  margin-bottom: .75rem;
}
.eod-item-list li {
  background: #f0ebfa;
  color: var(--purple-dark);
  padding: .35rem .75rem;
  border-radius: 6px;
  font-size: .875rem;
  margin-bottom: .35rem;
}

.eod-submitting { color: var(--muted); font-size: 1rem; text-align: center; padding: 2rem; }
.eod-error { color: var(--red); font-size: .9rem; margin-bottom: 1rem; }

/* ── Timesheet preview ────────────────────────────────────────────────────── */
.timesheet-preview {
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.preview-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); text-align: center; }

.session-closed-msg {
  text-align: center; font-size: .95rem; color: var(--muted);
  background: #f3f4f6; border-radius: 10px;
  padding: 1rem 1.25rem; line-height: 1.5;
}

/* ── Dashboard (Lead + Admin) ─────────────────────────────────────────────── */
.dashboard-wrap { min-height: 100vh; display: flex; flex-direction: column; }

.dash-header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 1rem 2rem;
  display: flex; align-items: center; gap: 1rem;
}
.dash-title { font-size: 1.2rem; font-weight: 700; flex: 1; color: var(--purple); }
.dash-role  { font-size: .875rem; color: var(--muted); }

.dash-summary {
  padding: 1rem 2rem;
  display: flex; gap: .75rem;
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
}
.summary-pill {
  padding: .35rem 1rem;
  border-radius: 999px;
  font-size: .85rem; font-weight: 700;
}
.pill-active        { background: #d4f5e2; color: #166534; }
.pill-break         { background: #fef3c7; color: #92400e; }
.pill-done          { background: #e0e7ff; color: #3730a3; }
.pill-admin-closed  { background: #e5e7eb; color: #374151; }
.pill-auto-closed   { background: #fef3c7; color: #92400e; }
.pill-total         { background: #f3f4f6; color: var(--muted); }

.dash-grid {
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* ── Team card ────────────────────────────────────────────────────────────── */
.team-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.team-card.status-active       { border-left: 4px solid var(--green); }
.team-card.status-on-break    { border-left: 4px solid var(--orange); }
.team-card.status-done        { border-left: 4px solid var(--purple); }
.team-card.has-overdue        { border-left: 4px solid var(--red); }
.team-card.status-admin_closed { border-left: 4px solid #9ca3af; }
.team-card.status-auto_closed  { border-left: 4px solid var(--orange); }

/* Card header: row 1 = name + badge left, clear button right */
.card-head {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .35rem;
}
.card-name { font-weight: 700; font-size: 1rem; color: var(--navy); }

/* Card header: row 2 = flags, hidden when empty */
.card-flags {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .65rem;
}
.flag-late-wrap, .flag-overbreak-wrap {
  display: inline-flex; align-items: center; gap: .3rem;
}
.flag-late      { font-size: .72rem; font-weight: 700; color: var(--orange); }
.flag-overbreak { font-size: .72rem; font-weight: 700; color: var(--red); }

.btn-clear-late, .btn-clear-overbreak {
  font-size: .65rem; font-weight: 600; cursor: pointer;
  background: transparent; border-radius: 4px; padding: .1rem .35rem;
  white-space: nowrap; line-height: 1.4;
}
.btn-clear-late {
  border: 1px solid var(--orange); color: var(--orange);
}
.btn-clear-late:hover { background: #fff7ed; }
.btn-clear-overbreak {
  border: 1px solid var(--red); color: var(--red);
}
.btn-clear-overbreak:hover { background: #fef2f2; }
.btn-clear-late:disabled, .btn-clear-overbreak:disabled { opacity: .4; cursor: default; }

.card-row {
  display: flex; justify-content: space-between;
  font-size: .85rem; padding: .25rem 0;
  border-bottom: 1px solid var(--bg);
  color: var(--text);
}
.card-row span:first-child { color: var(--muted); }
.net-row { font-weight: 700; border-bottom: none; }

.card-timestamps { margin-bottom: .75rem; }

.break-detail {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.break-detail h5 { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.break-row { font-size: .8rem; color: var(--text); margin-bottom: .25rem; }

.eod-detail {
  margin-top: .75rem;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.eod-detail summary {
  cursor: pointer; font-size: .85rem; font-weight: 700;
  color: var(--purple); margin-bottom: .5rem;
}
.eod-row { font-size: .82rem; margin-bottom: .4rem; line-height: 1.4; }
.eod-row strong { color: var(--navy); }

.standby-badge {
  background: #fef3c7; color: #92400e;
  padding: .1rem .4rem; border-radius: 4px; font-size: .75rem; margin-left: .25rem;
}

.empty-state { color: var(--muted); text-align: center; padding: 3rem; }

/* Stats card */
.stats-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.stats-row {
  display: flex; justify-content: space-between;
  font-size: .9rem; padding: .3rem 0;
  border-bottom: 1px solid var(--bg);
  color: var(--text);
}
.stats-row:last-child { border-bottom: none; }
.stats-row span:first-child { color: var(--muted); }
.stats-row-net { font-weight: 700; font-size: .95rem; }
.stats-row-overdue span { color: var(--red) !important; font-weight: 600; }

/* Reference line card */
.ref-card {
  background: #9135eb;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.ref-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.7);
  margin-bottom: .4rem;
}
.ref-line {
  font-family: 'Courier New', monospace;
  font-size: .95rem; color: #ffffff;
  letter-spacing: .02em;
  user-select: all;
}

/* SOD dropdown */
.sod-wrap {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  margin-bottom: .75rem;
}
.sod-label {
  font-size: .85rem; font-weight: 600; color: var(--muted);
}
.sod-select {
  padding: .5rem .85rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: .95rem;
  outline: none; cursor: pointer;
  min-width: 180px;
}
.sod-select:focus { border-color: var(--purple); }

/* Outline purple button (Timesheet Updated) */
.btn-outline-purple {
  background: transparent;
  border: 2px solid var(--purple);
  color: var(--purple);
  width: 100%;
}
.btn-outline-purple:hover { background: #f0ebfa; }

/* Late flag on admin card */
.late-flag {
  font-size: .75rem; color: var(--orange); font-weight: 700;
}

/* Timesheet buttons */
.ts-buttons {
  display: flex; flex-direction: column; gap: .65rem; margin-top: 1rem;
}
.ts-buttons .btn {
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;
}

/* Powered by OVD footer */
.ovd-footer {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 24px 0;
}
