/* Seafarer Resume Extractor — teal maritime theme */
:root {
  --teal-900: #134e4a;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-50:  #f0fdfa;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --red-600: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, #e6fffa 0%, #f0fdfa 40%, #f8fafc 100%);
  min-height: 100vh;
  color: var(--slate-700);
  font-size: 15px;
}

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px clamp(14px, 4vw, 36px);
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--teal-50);
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px;
  background: var(--teal-700); color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
}
.topbar h1 { margin: 0; font-size: clamp(17px, 3vw, 21px); color: var(--teal-900); }
.topbar .sub { margin: 2px 0 0; font-size: 13px; color: var(--slate-500); max-width: 640px; }
.logout {
  color: var(--teal-700); text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border: 1px solid var(--teal-600); border-radius: 10px; white-space: nowrap;
}
.logout:hover { background: var(--teal-50); }

.banner-error {
  margin: 14px clamp(14px, 4vw, 36px);
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  padding: 12px 16px; border-radius: 10px; font-size: 14px;
}

/* ---------- layout ---------- */
.wrap {
  display: grid; grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 18px; padding: 18px clamp(14px, 4vw, 36px);
  align-items: start;
}
.wrap > .card { min-width: 0; }   /* let grid children shrink so the table scrolls inside .table-wrap */
@media (max-width: 980px) { .wrap { grid-template-columns: 1fr; } }

.card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: clamp(14px, 2.5vw, 22px); box-shadow: 0 4px 14px rgba(15, 118, 110, .07);
}
.card h2 { margin: 0 0 12px; font-size: 16px; color: var(--teal-900); }

/* ---------- dropzone ---------- */
.dropzone {
  border: 2px dashed var(--teal-600); border-radius: 12px; background: var(--teal-50);
  padding: 26px 16px; text-align: center; cursor: pointer; outline: none;
  transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover { background: #ccfbf1; border-color: var(--teal-700); }
.dz-icon { font-size: 34px; }
.dz-main { margin: 8px 0 4px; font-weight: 600; color: var(--teal-900); }
.dz-link { color: var(--teal-700); text-decoration: underline; }
.dz-hint { margin: 0; font-size: 12.5px; color: var(--slate-500); }

.upload-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 240px; overflow-y: auto; }
.upload-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--slate-200); border-radius: 9px; margin-bottom: 7px; font-size: 13.5px;
  background: #fff;
}
.upload-list li .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-list li .detail { color: var(--slate-500); font-size: 12.5px; }
.upload-list li.ok { border-color: #a7f3d0; background: #ecfdf5; }
.upload-list li.fail { border-color: #fecaca; background: #fef2f2; }
.upload-list li .spin { width: 14px; height: 14px; border: 2px solid var(--teal-600); border-top-color: transparent;
  border-radius: 50%; animation: spin 1s linear infinite; flex: 0 0 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toolbar h2 { margin: 0; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#searchBox {
  padding: 9px 12px; border: 1px solid var(--slate-300); border-radius: 9px; font-size: 14px;
  width: clamp(160px, 24vw, 260px);
}
#rankFilter {
  padding: 9px 10px; border: 1px solid var(--slate-300); border-radius: 9px; font-size: 14px;
  max-width: 220px; background: #fff;
}
.btn {
  padding: 9px 14px; border-radius: 9px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--teal-700); color: #fff; }
.btn-primary:hover { background: var(--teal-600); }
.btn-danger { background: #fff; color: var(--red-600); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: #fff; color: var(--slate-700); border-color: var(--slate-300); }
.btn-ghost:hover { background: #f8fafc; }
.btn-mini {
  padding: 4px 9px; font-size: 12.5px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--slate-300); background: #fff; color: var(--slate-700); font-weight: 500;
}
.btn-mini:hover { border-color: var(--teal-600); color: var(--teal-700); }
.btn-mini.danger { color: var(--red-600); border-color: #fecaca; }
.btn-mini.danger:hover { background: #fef2f2; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 1050px; background: #fff; }
thead th {
  position: sticky; top: 0;
  background: var(--teal-700); color: #fff; text-align: left;
  padding: 10px 10px; font-size: 12.5px; letter-spacing: .2px; white-space: nowrap;
}
tbody td { padding: 9px 10px; border-top: 1px solid var(--slate-200); vertical-align: top; font-size: 13.5px; }
tbody tr:nth-child(even) { background: var(--teal-50); }
tbody tr:hover { background: #ccfbf1; }
td.name-cell strong { display: block; color: var(--teal-900); }
td.name-cell .file { font-size: 11.5px; color: var(--slate-500); display: block; max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-muted { color: var(--slate-500); }
.badge {
  display: inline-block; background: var(--teal-50); color: var(--teal-900);
  border: 1px solid #ccfbf1; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.actions-col { width: 120px; }
td.actions { white-space: nowrap; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--slate-500); }
.empty-icon { font-size: 34px; margin-bottom: 6px; }
.table-meta { margin-top: 10px; font-size: 13px; color: var(--slate-500); }

/* responsive column hiding */
@media (max-width: 1250px) { .hide-wide { display: none; } }
@media (max-width: 900px)  { .hide-mid { display: none; } }

/* ---------- modals ---------- */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; width: min(760px, 100%);
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(2, 44, 34, .3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--slate-200);
}
.modal-head h3 { margin: 0; font-size: 16px; color: var(--teal-900); }
.icon-btn {
  background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--slate-500);
  padding: 4px 8px; border-radius: 8px;
}
.icon-btn:hover { background: var(--teal-50); color: var(--teal-900); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--slate-200); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.detail-item { background: #f8fafc; border: 1px solid var(--slate-200); border-radius: 9px; padding: 8px 10px; }
.detail-item .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--slate-500); }
.detail-item .v { margin-top: 3px; font-size: 13.5px; word-break: break-word; white-space: pre-wrap; }
.raw-text {
  margin-top: 14px; background: #f8fafc; border: 1px solid var(--slate-200); border-radius: 9px;
  padding: 10px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; max-height: 220px; overflow-y: auto; color: var(--slate-700);
}
.extra-block { margin-top: 12px; }
.extra-block h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--teal-900); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; }
.form-grid label { display: block; font-size: 12px; color: var(--slate-500); margin-bottom: 4px; }
.form-grid input, .form-grid textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--slate-300); border-radius: 8px;
  font-size: 13.5px; font-family: inherit;
}
.form-grid .full { grid-column: 1 / -1; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 60; box-shadow: 0 10px 24px rgba(2, 6, 23, .35); max-width: 90vw;
}
.toast.error { background: #b91c1c; }

.foot { text-align: center; color: var(--slate-500); font-size: 12.5px; padding: 18px 10px 26px; }
