/* ============================================================
   Accreditation Log Tracker — Styles
   JNI Consulting, LLC
   ============================================================ */

/* ── Login Gate ─────────────────────────────────────────────── */
#loginGate {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f2942 0%, #1a4f7a 60%, #0f766e 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#loginGate.hidden { display: none; }
.login-card {
  background: white; border-radius: 18px; padding: 40px 36px;
  max-width: 420px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.4);
  text-align: center;
}
.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg,#1a4f7a,#0f766e);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; font-size: 1.8rem;
}
.login-title  { font-size: 1.3rem; font-weight: 800; color: #1e293b; margin-bottom: 4px; }
.login-sub    { font-size: .83rem; color: #64748b; margin-bottom: 28px; line-height: 1.5; }
.login-badges { display: flex; justify-content: center; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.login-badge  { padding: 4px 11px; border-radius: 99px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.login-field  { margin-bottom: 14px; text-align: left; }
.login-field label { display: block; font-size: .78rem; font-weight: 700; color: #475569; margin-bottom: 5px; }
.login-field input {
  width: 100%; padding: 11px 14px; border: 1.5px solid #d1dde8; border-radius: 9px;
  font-size: .95rem; outline: none; transition: border-color .15s; color: #1e293b;
}
.login-field input:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.1); }
.login-field input.error { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.login-error  { font-size: .78rem; color: #dc2626; font-weight: 600; margin-bottom: 12px; min-height: 20px; }
.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg,#1a4f7a,#0f766e);
  color: white; border: none; border-radius: 9px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s; margin-bottom: 14px;
}
.login-btn:hover { opacity: .92; }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }
.login-footer { font-size: .72rem; color: #94a3b8; }
.login-forgot { font-size: .75rem; color: #0ea5e9; cursor: pointer; text-decoration: underline; margin-top: 6px; display: inline-block; }

/* ── Root tokens ────────────────────────────────────────────── */
:root {
  --primary:       #1a4f7a;
  --primary-light: #2b6ca3;
  --accent:        #0ea5e9;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --bg:            #f0f4f8;
  --card:          #ffffff;
  --border:        #d1dde8;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --quad-color:    #7c3aed;
  --aaahc-color:   #b45309;
  --jc-color:      #0f766e;
  --shared-color:  #1a4f7a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Header ─────────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 100;
}
header .logo     { display: flex; align-items: center; gap: 12px; }
header .logo svg { width: 34px; height: 34px; flex-shrink: 0; }
header h1        { font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
header h1 span   { font-size: .8rem; font-weight: 400; opacity: .85; display: block; }
.header-right    { display: flex; align-items: center; gap: 12px; }
#currentDateTime { font-size: .8rem; opacity: .9; text-align: right; line-height: 1.5; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn         { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: .875rem; font-weight: 600; transition: all .15s; }
.btn-outline { background: transparent; border: 1.5px solid rgba(255,255,255,.6); color: white; }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-sm      { padding: 5px 10px; font-size: .78rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger  { background: var(--danger); color: white; }

/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard { padding: 18px 20px; max-width: 1600px; margin: 0 auto; }

/* ── Stats ──────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: 10px; padding: 16px 18px; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,.06); display: flex; align-items: center; gap: 12px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-sub   { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.progress-bar { width: 100%; height: 5px; background: #e2e8f0; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ── Toolbar ────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.period-tabs { display: flex; gap: 4px; background: var(--card); padding: 5px; border-radius: 10px; border: 1px solid var(--border); }
.period-tab { padding: 7px 20px; border-radius: 7px; border: none; background: transparent; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--text-muted); transition: all .15s; }
.period-tab.active { background: var(--primary); color: white; box-shadow: 0 2px 6px rgba(26,79,122,.3); }
.period-tab:hover:not(.active) { background: #f1f5f9; color: var(--text); }
.export-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-export { background: white; border: 1.5px solid var(--border); color: var(--text); padding: 7px 13px; border-radius: 7px; cursor: pointer; font-size: .78rem; font-weight: 600; display: flex; align-items: center; gap: 5px; transition: all .15s; }
.btn-export:hover { border-color: var(--accent); color: var(--accent); }

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.filter-bar label { font-size: .75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.filter-bar select, .filter-bar input[type="date"] { padding: 5px 9px; border: 1.5px solid var(--border); border-radius: 6px; font-size: .8rem; outline: none; }
.filter-bar select:focus, .filter-bar input[type="date"]:focus { border-color: var(--accent); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert-banner { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 8px; margin-bottom: 10px; font-size: .83rem; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }

/* ── Layout ─────────────────────────────────────────────────── */
.shared-row { margin-bottom: 16px; }
.org-grid   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .org-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width:  680px) { .org-grid { grid-template-columns: 1fr; } }

/* ── Section card ───────────────────────────────────────────── */
.acc-section { background: var(--card); border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow: hidden; }
.acc-section.shared-section { border-color: #bfdbfe; box-shadow: 0 1px 8px rgba(26,79,122,.12); }
.acc-header { padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.acc-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-title     { font-size: .95rem; font-weight: 700; }
.acc-title-sub { font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.acc-progress-text { font-size: .78rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }

/* ── Badges ─────────────────────────────────────────────────── */
.acc-badge    { padding: 3px 9px; border-radius: 99px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.badge-quad   { background: #ede9fe; color: var(--quad-color); }
.badge-aaahc  { background: #fef3c7; color: var(--aaahc-color); }
.badge-jc     { background: #ccfbf1; color: var(--jc-color); }
.badge-shared { background: #dbeafe; color: var(--shared-color); }

/* ── Checklist ──────────────────────────────────────────────── */
.checklist-scroll { max-height: 420px; overflow-y: auto; padding: 10px; }
.checklist-scroll::-webkit-scrollbar { width: 3px; }
.checklist-scroll::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 99px; }
.checklist-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.shared-section .checklist-scroll { max-height: none; }

.check-category { margin-bottom: 6px; }
.category-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--text-muted); padding: 5px 6px 3px; display: flex; align-items: center; gap: 6px; }
.category-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.check-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 6px; border-radius: 7px; cursor: pointer; transition: background .1s; border: 1px solid transparent; margin-bottom: 3px; }
.check-item:hover { background: #f8fafc; }
.check-item.completed { background: #f0fdf4; border-color: #bbf7d0; }
.check-item.oor       { background: #fef2f2 !important; border-color: #fecaca !important; }
.check-box { width: 19px; height: 19px; border-radius: 5px; border: 2px solid #cbd5e1; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; transition: all .15s; }
.check-item.completed .check-box, .check-item.oor .check-box { background: var(--success); border-color: var(--success); }
.check-item.oor .check-box { background: var(--warning); border-color: var(--warning); }
.check-box svg { display: none; }
.check-item.completed .check-box svg, .check-item.oor .check-box svg { display: block; }
.check-info   { flex: 1; min-width: 0; }
.check-name   { font-size: .83rem; font-weight: 600; line-height: 1.3; }
.check-detail { font-size: .72rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.check-meta   { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.check-tag    { font-size: .65rem; padding: 2px 5px; border-radius: 4px; font-weight: 600; }
.tag-critical { background: #fee2e2; color: var(--danger); }
.tag-required { background: #dbeafe; color: #1d4ed8; }
.tag-document { background: #fef9c3; color: #854d0e; }
.timestamp    { font-size: .68rem; color: var(--text-muted); }
.sign-btn { font-size: .68rem; padding: 3px 7px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; transition: all .15s; }
.sign-btn:hover { background: #e2e8f0; }

/* ── Shared items grid ──────────────────────────────────────── */
.shared-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 10px; padding: 10px; }

/* ── Overlap indicator ──────────────────────────────────────── */
.overlap-indicator { display: flex; align-items: center; gap: 4px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 6px; padding: 4px 8px; font-size: .68rem; color: #0369a1; font-weight: 600; margin-bottom: 10px; }
.overlap-indicator svg { width: 13px; height: 13px; }

/* ── History panel ──────────────────────────────────────────── */
.history-panel { background: var(--card); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-top: 18px; }
.history-header { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.history-header h3 { font-size: .95rem; font-weight: 700; }
.log-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.log-table th { text-align: left; padding: 9px 14px; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border); }
.log-table td { padding: 9px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: #f8fafc; }
.log-status       { padding: 2px 7px; border-radius: 99px; font-size: .68rem; font-weight: 700; }
.status-complete  { background: #dcfce7; color: var(--success); }
.status-pending   { background: #fef9c3; color: #854d0e; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal { background: white; border-radius: 14px; max-width: 520px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-orgs  { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.modal-body  { padding: 14px 20px; }
.modal-footer { padding: 10px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.form-group  { margin-bottom: 12px; }
.form-group label { display: block; font-size: .78rem; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: .85rem; outline: none; transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 65px; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  text-align: center; padding: 24px 20px; margin-top: 30px;
  font-size: .75rem; color: var(--text-muted); border-top: 1px solid var(--border);
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  header .btn-outline, .export-btns, .sign-btn, .period-tabs, .filter-bar, .site-footer { display: none !important; }
  .checklist-scroll, .shared-section .checklist-scroll { max-height: none; overflow: visible; }
  body { background: white; }
  .acc-section, .stat-card { break-inside: avoid; }
  .org-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin page ──────────────────────────────────────────────── */
.admin-header {
  background: linear-gradient(135deg, #0f2942 0%, var(--primary) 100%);
  color: white; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.admin-table th { text-align: left; padding: 10px 16px; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.admin-table tr:hover td { background: #f8fafc; }
