:root {
  --navy: #1f3864;
  --accent: #2e74b5;
  --light: #eaf1f8;
  --grey: #595959;
  --warn-bg: #fff3cd;
  --warn-text: #7a5c00;
  --err-bg: #fde2e1;
  --err-text: #8a1f1f;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fa; color: #222; }

.hidden { display: none !important; }

/* ---- Logo ---- */
.logo-box {
  background: #000;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-box--large { padding: 18px 26px; margin-bottom: 0.5rem; }
.logo-box--large img { height: 56px; width: auto; display: block; }
.logo-box--small { padding: 7px 13px; border-radius: 10px; }
.logo-box--small img { height: 33px; width: auto; display: block; }

/* ---- Login screen ---- */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #191a2e 0%, #16305a 60%, #0f345f 100%);
  padding: 1rem;
}
.login-card {
  background: white; border-radius: 18px; padding: 2.5rem 2.75rem;
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100%; max-width: 360px;
}
#login-screen .tagline { color: var(--grey); margin: 0; }
.auth-buttons { display: flex; flex-direction: column; gap: 0.75rem; width: 280px; }
.auth-btn {
  padding: 0.65rem 1rem; border-radius: 6px; border: 1px solid #d0d7de;
  background: white; cursor: pointer; font-size: 0.95rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  color: #3c4043;
  transition: box-shadow .15s, background .15s;
}
.auth-btn svg { flex-shrink: 0; }
.auth-btn:hover { background: #f7f8f9; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#access-denied { color: var(--err-text); font-weight: 600; }
#login-error { color: var(--err-text); font-weight: 600; max-width: 320px; text-align: center; font-size: 0.9rem; }

/* ---- App shell ---- */
header.app-header {
  background: #000; color: white; padding: 0.6rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.5rem;
}
header.app-header .brand { display: flex; align-items: center; gap: 0.7rem; font-weight: 700; letter-spacing: 0.03em; }
header.app-header .user-info { display: flex; align-items: center; gap: 0.8rem; font-size: 0.9rem; }
header.app-header button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: white; padding: 0.35rem 0.8rem; border-radius: 5px; cursor: pointer; }

main { max-width: 1080px; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }

.card {
  background: white; border-radius: 10px; padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card h2 { margin-top: 0; color: var(--navy); font-size: 1.05rem; }

#last-report-body { color: var(--grey); }
#last-report-body strong { color: #222; }

form#report-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
form#report-form .field { display: flex; flex-direction: column; gap: 0.3rem; }
form#report-form label { font-size: 0.85rem; color: var(--grey); }
form#report-form input[type=date] { padding: 0.4rem 0.5rem; border: 1px solid #ccd3db; border-radius: 5px; }
.toggle-field { display: flex; align-items: center; gap: 0.5rem; flex-direction: row !important; }
button.primary {
  background: var(--accent); color: white; border: none; padding: 0.6rem 1.3rem;
  border-radius: 6px; cursor: pointer; font-weight: 600;
}
button.primary:disabled { opacity: 0.6; cursor: default; }

/* "Generate report" button — the actual AZ-in-the-logo yellow */
#generate-btn.primary {
  background: #FAD207;
  color: #1a1200;
}
#generate-btn.primary:hover { background: #e0bd00; }
#generate-btn.primary:disabled { background: #FAD207; opacity: 0.6; }

#status-area .msg { padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 0.4rem; font-size: 0.9rem; }
#status-area .msg.warning { background: var(--warn-bg); color: var(--warn-text); }
#status-area .msg.error { background: var(--err-bg); color: var(--err-text); }
#status-area .msg.info { background: var(--light); color: var(--navy); }

table.reports-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.reports-table th, table.reports-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid #eef0f3; }
table.reports-table th { color: var(--grey); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.status-pill { padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.status-pill.done { background: #e3f6e5; color: #1e7a2e; }
.status-pill.running { background: var(--warn-bg); color: var(--warn-text); }
.status-pill.error { background: var(--err-bg); color: var(--err-text); }
a.download-link { color: var(--accent); font-weight: 600; text-decoration: none; }
a.download-link:hover { text-decoration: underline; }
.muted { color: #9aa2ab; }

.delete-btn {
  background: transparent; border: 1px solid var(--err-text); color: var(--err-text);
  padding: 0.25rem 0.6rem; border-radius: 5px; cursor: pointer; font-size: 0.8rem;
}
.delete-btn:hover { background: var(--err-bg); }
.delete-btn:disabled { opacity: 0.5; cursor: default; }

/* ---- Issues button (per-report warnings/errors) ---- */
.issues-btn {
  border: 1px solid transparent; border-radius: 10px; padding: 0.2rem 0.6rem;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.issues-btn.has-warning { background: var(--warn-bg); color: var(--warn-text); }
.issues-btn.has-error { background: var(--err-bg); color: var(--err-text); }
.issues-btn:hover { filter: brightness(0.96); }

/* ---- Comment button ---- */
.comment-btn {
  border: 1px dashed #ccd3db; background: transparent; color: var(--grey);
  padding: 0.3rem 0.6rem; border-radius: 5px; cursor: pointer; font-size: 0.85rem;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: left;
}
.comment-btn:hover { background: var(--light); border-color: var(--accent); }
.comment-btn.has-comment { border-style: solid; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.comment-btn.has-comment:hover { background: var(--light); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 30, 45, .55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 1rem;
}
.modal-box {
  background: white; border-radius: 10px; padding: 1.5rem 1.75rem; max-width: 460px;
  width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.modal-box h2 { margin-top: 0; color: var(--navy); font-size: 1.1rem; }
.modal-box p { color: #333; line-height: 1.5; }
.modal-box button { margin-top: 0.5rem; }
.modal-checkbox {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem;
  font-size: 0.9rem; color: var(--grey); cursor: pointer;
}

.modal-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1rem; gap: 0.5rem;
}
.modal-actions-right { display: flex; gap: 0.5rem; }
.secondary-btn {
  background: transparent; border: 1px solid #ccd3db; color: #333;
  padding: 0.55rem 1rem; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.secondary-btn:hover { background: #f2f4f7; }
.secondary-btn.danger { border-color: var(--err-text); color: var(--err-text); }
.secondary-btn.danger:hover { background: var(--err-bg); }
.secondary-btn:disabled, button.primary:disabled { opacity: 0.6; cursor: default; }

#comment-modal-textarea {
  width: 100%; font-family: inherit; font-size: 0.95rem; padding: 0.6rem;
  border: 1px solid #ccd3db; border-radius: 6px; resize: vertical;
}

.issues-body { max-height: 50vh; overflow-y: auto; }
.issues-heading { margin: 0.8rem 0 0.3rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.issues-heading.err { color: var(--err-text); }
.issues-heading.warn { color: var(--warn-text); }
.issues-heading:first-child { margin-top: 0; }
.issues-list { margin: 0; padding-left: 1.2rem; font-size: 0.9rem; }
.issues-list li { margin-bottom: 0.3rem; }
.issues-list.err li { color: var(--err-text); }
.issues-list.warn li { color: var(--warn-text); }

/* ---- Table horizontal scroll on narrow screens ---- */
.table-scroll { width: 100%; overflow-x: auto; }
.load-more-row { display: flex; justify-content: center; margin-top: 1rem; }

/* ---- Mobile responsive ---- */
@media (max-width: 640px) {
  .logo-box--large { padding: 12px 18px; }
  .logo-box--large img { height: 40px; }
  #login-screen { padding: 1.5rem 1rem; min-height: 100vh; }
  .login-card { padding: 2rem 1.5rem; }
  .auth-buttons { width: 100%; max-width: 320px; }

  header.app-header { flex-direction: column; align-items: flex-start; }
  header.app-header .user-info { width: 100%; justify-content: space-between; }
  .logo-box--small { padding: 5px 10px; }
  .logo-box--small img { height: 26px; }

  main { padding: 1rem 0.75rem; gap: 1rem; }
  .card { padding: 1rem; }

  form#report-form { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  form#report-form button.primary { width: 100%; }

  table.reports-table { font-size: 0.82rem; }
  table.reports-table th, table.reports-table td { padding: 0.4rem 0.45rem; white-space: nowrap; }
  .comment-btn { max-width: 140px; }
}
