:root{
  --bg:#f5f7fb;
  --surface:#ffffff;
  --text:#0f172a;
  --muted:#52617a;
  --primary:#0756ae;
  --accent:#ff9416;
  --border:#d7e0ee;
  --danger:#dc2626;
  --shadow:0 12px 32px rgba(15,23,42,.08);
}

*{
  box-sizing:border-box;
}

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

body.modal-open{
  overflow:hidden;
}

.site-header{
  background:var(--primary);
  color:white;
}

.header-inner{
  width:min(1500px,96%);
  min-height:100px;
  margin:0 auto;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:2rem;
}

.brand img{
  width:205px;
  max-height:76px;
  object-fit:contain;
  display:block;
}

.title-block h1{
  margin:0;
  font-size:1.85rem;
  line-height:1.1;
  font-weight:800;
}

.title-block p{
  margin:.35rem 0 0;
  color:#e6f0ff;
  font-weight:600;
}

.top-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:.7rem;
  flex-wrap:wrap;
}

.page-shell{
  width:min(1500px,96%);
  margin:0 auto;
  padding:1.75rem 0 3rem;
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:1rem;
  margin-bottom:1.5rem;
}

.stat-card,
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
}

.stat-card{
  padding:1.35rem 1.45rem;
}

.stat-card span{
  display:block;
  margin-bottom:.4rem;
  color:#657086;
  font-weight:800;
}

.stat-card strong{
  display:block;
  font-size:2rem;
  line-height:1;
}

.card{
  padding:1.35rem;
}

.directory-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  margin-bottom:1rem;
}

.directory-head h2{
  margin:0;
  font-size:1.5rem;
}

.directory-head p{
  margin:.3rem 0 0;
  color:var(--muted);
}

.filters{
  display:flex;
  justify-content:flex-end;
  gap:.7rem;
  flex-wrap:wrap;
}

.filters input{
  width:220px;
}

.filters select{
  width:185px;
}

input,
select,
textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:.8rem .9rem;
  min-height:46px;
  font:inherit;
  background:white;
  color:var(--text);
}

textarea{
  resize:vertical;
}

input:disabled,
select:disabled{
  background:#f1f5f9;
  color:#64748b;
  cursor:not-allowed;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus{
  outline:3px solid rgba(147,197,253,.85);
  outline-offset:2px;
}

.table-wrap{
  overflow-x:auto;
}

table{
  width:100%;
  min-width:1050px;
  border-collapse:collapse;
}

th,
td{
  padding:1rem .9rem;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:middle;
}

th{
  color:#647086;
  font-size:.82rem;
  font-weight:800;
}

tr:last-child td{
  border-bottom:0;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:.65rem 1rem;
  border:1px solid transparent;
  border-radius:12px;
  font:inherit;
  font-size:.92rem;
  line-height:1;
  font-weight:800;
  text-decoration:none;
  cursor:pointer;
  white-space:nowrap;
}

.btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.btn-secondary{
  color:white;
  background:rgba(255,255,255,.14);
  border-color:rgba(255,255,255,.35);
}

.btn-accent{
  color:#111827;
  background:var(--accent);
}

.btn-light{
  color:var(--text);
  background:#eef2f7;
  border-color:#d8e0ec;
}

.btn-danger{
  color:white;
  background:var(--danger);
}

.btn-small{
  min-height:35px;
  padding:.48rem .8rem;
  border-radius:10px;
  color:white;
  background:var(--primary);
}

.btn-small.btn-light{
  color:var(--text);
  background:#eef2f7;
}

.btn-small.btn-danger{
  color:white;
  background:var(--danger);
}

.row-actions{
  display:flex;
  align-items:center;
  gap:.5rem;
  flex-wrap:wrap;
}

.status-pill{
  display:inline-flex;
  align-items:center;
  padding:.35rem .7rem;
  border-radius:999px;
  font-size:.8rem;
  font-weight:800;
}

.status-uploaded{
  color:#166534;
  background:#dcfce7;
}

.status-missing{
  color:#9a4b00;
  background:#fff3df;
}

.date-cell{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:.3rem;
}

.badge-rescheduled{
  display:inline-flex;
  align-items:center;
  padding:.2rem .55rem;
  border-radius:999px;
  font-size:.72rem;
  font-weight:800;
  color:#9a3412;
  background:#ffedd5;
  border:1px solid #fed7aa;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  z-index:9999;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(15,23,42,.62);
  backdrop-filter:blur(6px);
}

.modal-backdrop.show{
  display:flex;
}

.modal-card,
.delete-modal-card{
  width:min(800px,96vw);
  max-height:90vh;
  overflow:auto;
  background:white;
  border:1px solid var(--border);
  border-radius:20px;
  box-shadow:0 28px 80px rgba(2,6,23,.38);
  animation:modalIn .16s ease-out;
}

.manage-modal-card{
  width:min(900px,96vw);
}

.delete-modal-card{
  width:min(520px,94vw);
}

.modal-head,
.delete-modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  padding:1.35rem 1.5rem;
  border-bottom:1px solid var(--border);
}

.modal-head h2,
.delete-modal-head h2{
  margin:0;
  font-size:1.4rem;
}

.modal-head p{
  margin:.3rem 0 0;
  color:var(--muted);
}

.modal-close{
  flex:0 0 auto;
  width:40px;
  height:40px;
  padding:0;
  border:1px solid var(--border);
  border-radius:12px;
  background:#f8fafc;
  color:var(--text);
  font-size:1.55rem;
  line-height:1;
  cursor:pointer;
}

.modal-body{
  padding:1.5rem;
}

.modal-actions,
.delete-modal-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:.75rem;
  padding:1rem 1.5rem 1.35rem;
  border-top:1px solid var(--border);
  background:#f8fafc;
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1rem;
}

.form-grid label{
  display:grid;
  gap:.4rem;
  font-weight:800;
}

.form-grid .full{
  grid-column:1/-1;
}

.hidden{
  display:none !important;
}

.status{
  min-height:24px;
  margin-top:1rem;
  color:var(--muted);
  font-weight:800;
}

.status.error{
  color:var(--danger);
}

.manage-documents-list{
  display:grid;
  gap:.75rem;
}

.manage-document-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:1rem;
  border:1px solid var(--border);
  border-radius:14px;
  background:#f8fafc;
}

.manage-document-item > div:first-child{
  display:grid;
  gap:.2rem;
}

.manage-document-item span,
.manage-document-item small{
  color:var(--muted);
}

.manage-document-item p{
  margin:.3rem 0;
  color:var(--text);
}

.empty-state{
  padding:1rem;
  color:var(--muted);
  border:1px dashed var(--border);
  border-radius:14px;
  text-align:center;
}

.delete-warning{
  margin:1.25rem 1.5rem 1rem;
  padding:1rem;
  border:1px solid #fecaca;
  border-radius:14px;
  background:#fee2e2;
  color:#991b1b;
}

.delete-warning strong{
  display:block;
  margin-bottom:.25rem;
}

.delete-warning p{
  margin:0;
  font-weight:600;
}

.delete-document-box{
  display:grid;
  gap:.25rem;
  margin:0 1.5rem 1.25rem;
  padding:1rem;
  border:1px solid var(--border);
  border-radius:14px;
  background:#f8fafc;
}

.delete-document-box span{
  color:var(--muted);
}

.signin-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:var(--primary);
}

.signin-panel{
  width:min(440px,94vw);
  padding:2rem;
  border-radius:18px;
  background:white;
  box-shadow:0 28px 80px rgba(2,6,23,.35);
  text-align:center;
}

.signin-panel img{
  width:235px;
  max-height:110px;
  object-fit:contain;
}

.signin-panel h1{
  margin:1rem 0 .5rem;
  font-size:1.6rem;
}

.signin-panel p{
  color:var(--muted);
}

.signin-panel button{
  padding:.75rem 1rem;
  border:0;
  border-radius:12px;
  background:var(--accent);
  font-weight:800;
  cursor:pointer;
}

@keyframes modalIn{
  from{
    opacity:0;
    transform:translateY(10px) scale(.98);
  }

  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}

@media(max-width:1050px){
  .header-inner{
    grid-template-columns:1fr;
    gap:1rem;
    padding:1rem 0;
  }

  .top-actions{
    justify-content:flex-start;
  }

  .stats-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .directory-head{
    flex-direction:column;
  }

  .filters{
    width:100%;
    justify-content:flex-start;
  }
}

@media(max-width:700px){
  .stats-grid,
  .form-grid{
    grid-template-columns:1fr;
  }

  .filters input,
  .filters select{
    width:100%;
  }

  .modal-backdrop{
    padding:12px;
  }

  .modal-actions,
  .delete-modal-actions{
    flex-direction:column-reverse;
    align-items:stretch;
  }

  .modal-actions .btn,
  .delete-modal-actions .btn{
    width:100%;
  }

  .manage-document-item{
    align-items:flex-start;
    flex-direction:column;
  }

  .brand img{
    width:190px;
  }
}

.empty-state strong{
  display:block;
  margin-bottom:.35rem;
  color:var(--text);
  font-size:1rem;
}

.empty-state p{
  margin:0;
  color:var(--muted);
}
