@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --navy: #0b3d5c;
  --navy-dark: #082c43;
  --teal: #1a9bb5;
  --teal-soft: #e7f6f9;
  --gold: #c9a84c;
  --gray-25: #fcfcfd;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --white: #ffffff;
  --danger: #d92d20;
  --success: #12b76a;
  --sidebar-w: 290px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Outfit, system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
}
.sidebar-brand img { width: 46px; height: 46px; object-fit: contain; }
.sidebar-brand strong { display: block; font-size: 14px; color: var(--navy); }
.sidebar-brand span { display: block; font-size: 11px; color: var(--gray-500); letter-spacing: .04em; text-transform: uppercase; }
.sidebar nav { padding: 8px 16px 24px; overflow: auto; }
.nav-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin: 18px 10px 8px;
}
.nav-item, .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
}
.nav-item:hover, .nav-link:hover { background: var(--gray-100); }
.nav-item.active, .nav-link.active {
  background: #e8f4f8;
  color: var(--navy);
}
.nav-sub { padding-left: 36px; display: none; }
.nav-group.open .nav-sub { display: block; }
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 30;
}
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--gray-200);
  background: var(--white); border-radius: 10px; cursor: pointer; color: var(--gray-600);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 999px;
  background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600;
}
.main { padding: 24px; }
.breadcrumb { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.breadcrumb h1 { margin: 0; font-size: 22px; color: var(--navy); }
.crumb { color: var(--gray-500); font-size: 13px; }
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card + .card { margin-top: 16px; }
.card-title { margin: 0 0 14px; font-size: 16px; color: var(--navy); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--gray-200);
  background: var(--white);
}
.stat .label { color: var(--gray-500); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; color: var(--navy); margin-top: 6px; }
.stat.teal { background: linear-gradient(180deg, #f3fbfd, #fff); border-color: #cceef4; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; background: var(--gray-100); color: var(--gray-700);
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-outline { background: #fff; border-color: var(--gray-200); }
.btn-danger { background: #fef3f2; color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: 13px; vertical-align: middle; }
table.data th { color: var(--gray-500); font-weight: 600; background: var(--gray-25); }
table.data tr:hover td { background: #f8fbfd; }
.badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--teal-soft); color: var(--navy); }
.badge-gold { background: #fbf6e8; color: #8a6d1b; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--gray-300); border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #fff; color: var(--gray-800);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(26,155,181,.15); border-color: var(--teal); }
.section { margin-bottom: 22px; }
.section h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--teal); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
.muted { color: var(--gray-500); }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: grid; grid-template-columns: 70px 1fr; gap: 12px; }
.time { font-weight: 700; color: var(--navy); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-visual {
  background: radial-gradient(circle at 20% 20%, #1a9bb5 0, transparent 40%), linear-gradient(160deg, #082c43, #0b3d5c 55%, #0e5874);
  color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 40px;
}
.login-visual img { width: 180px; margin-bottom: 24px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; background: #fff; }
.login-box { width: 100%; max-width: 420px; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fef3f2; color: #b42318; }
.alert-success { background: #ecfdf3; color: #067647; }
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #fff; border: 1px solid var(--gray-200); border-left: 4px solid var(--teal); border-radius: 10px; padding: 12px 14px; min-width: 260px; box-shadow: 0 10px 30px rgba(15,23,42,.12); }
.toast.error { border-left-color: var(--danger); }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; z-index: 70; padding: 16px; }
.modal.open { display: flex; }
.modal-card { background: #fff; border-radius: 16px; max-width: 640px; width: 100%; padding: 20px; max-height: 90vh; overflow: auto; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 8px 12px; font-size: 14px; }
.dl dt { color: var(--gray-500); }
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; }
.empty { text-align: center; color: var(--gray-500); padding: 28px; }
.program-title { text-align: center; color: var(--navy); letter-spacing: .06em; margin: 8px 0 18px; }
.menu-toggle { display: none; }

@media (max-width: 1100px) {
  .grid-4, .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; }
  .content { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { min-height: 240px; }
  .form-grid, .grid-2, .dl { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .header, .no-print, .overlay, .toast-wrap { display: none !important; }
  .content { margin: 0; }
  .main { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}

.dropzone {
  position: relative;
  display: block;
  border: 1.5px dashed var(--gray-300);
  background: linear-gradient(180deg, #f7fbfd, #fff);
  border-radius: 16px;
  padding: 22px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--teal);
  background: #f3fbfd;
  box-shadow: 0 0 0 4px rgba(26,155,181,.08);
}
.dropzone.has-file { cursor: default; border-style: solid; border-color: #cceef4; }
.dropzone input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone.has-file input[type=file] { pointer-events: none; }
.dropzone-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--gray-600);
}
.dropzone-idle strong { color: var(--navy); font-size: 15px; }
.dropzone-idle span:last-child { font-size: 13px; color: var(--gray-500); }
.dropzone-icon { font-size: 28px; line-height: 1; }
.dropzone-file {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}
.dropzone-preview-wrap {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dropzone-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.dropzone-pdf {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #c2410c;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.dropzone-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.dropzone-meta strong { color: var(--navy); word-break: break-word; }
.dropzone-meta span { font-size: 12px; color: var(--gray-500); }
.extract-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: var(--gray-100);
  color: var(--gray-700);
}
.extract-status.is-loading { background: #eef8fb; color: var(--navy); }
.extract-status.is-ok { background: #ecfdf3; color: #067647; }
.extract-status.is-warn { background: #fff8eb; color: #8a6d1b; }
.extract-status.is-error { background: #fef3f2; color: #b42318; }
.extract-org-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--gray-700);
  background: #fbf6e8;
  border-radius: 10px;
  padding: 10px 12px;
}
.extract-text { margin-top: 10px; font-size: 13px; color: var(--gray-600); }
.extract-text summary { cursor: pointer; }
.extract-text pre {
  white-space: pre-wrap;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  font-size: 12px;
}
.existing-files { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
input.prefilled, select.prefilled, textarea.prefilled {
  border-color: var(--teal);
  background: #f3fbfd;
  box-shadow: 0 0 0 3px rgba(26,155,181,.12);
  animation: prefillFlash .8s ease;
}
@keyframes prefillFlash {
  from { box-shadow: 0 0 0 0 rgba(26,155,181,.35); }
  to { box-shadow: 0 0 0 3px rgba(26,155,181,.12); }
}

.fc { font-family: Outfit, sans-serif; }
.fc .fc-toolbar-title { color: var(--navy); font-size: 18px; }
.fc .fc-button { background: var(--navy); border: 0; border-radius: 8px; }
.fc .fc-button-active { background: var(--teal) !important; }
.fc .fc-daygrid-event { background: var(--teal); border: 0; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--gray-700); }
