/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  color: #1a202c;
}

/* ── Login layout ──────────────────────────────────────────────────────────── */
body:not(:has(.topbar)) {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a56db;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-email {
  font-size: .85rem;
  color: #6b7280;
}
.btn-logout {
  font-size: .85rem;
  color: #e02424;
  text-decoration: none;
  font-weight: 600;
}
.btn-logout:hover { text-decoration: underline; }

/* ── Main layout ───────────────────────────────────────────────────────────── */
.main {
  display: flex;
  justify-content: center;
  padding: 48px 16px;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 48px 40px;
  width: 100%;
  max-width: 500px;
}

/* ── Brand / header ────────────────────────────────────────────────────────── */
.brand {
  text-align: center;
  margin-bottom: 32px;
}
.brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a56db;
}
.brand p {
  font-size: .9rem;
  color: #6b7280;
  margin-top: 4px;
}

/* ── Form ──────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 22px;
}
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 7px;
}
.req { color: #e02424; margin-left: 3px; font-weight: 700; }
.hint { color: #9ca3af; font-weight: 400; font-size: .8rem; margin-left: 4px; }

.form-group input[type="date"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: #1a202c;
  background: #fff;
  outline: none;
  transition: border-color .2s;
}
.form-group input[type="date"]:focus {
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

/* ── Drop zone ─────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #f9fafb;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #1a56db;
  background: #eff6ff;
}
.drop-zone.has-file {
  border-color: #16a34a;
  background: #f0fdf4;
}
.drop-icon { font-size: 2rem; margin-bottom: 8px; }
.drop-text { font-size: .9rem; color: #6b7280; }
.drop-link { color: #1a56db; font-weight: 600; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: #1a56db;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.btn-primary:hover:not(:disabled) { background: #1648c0; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  border: 2px solid #dadce0;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #3c4043;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow .2s, border-color .2s;
}
.btn-microsoft:hover {
  border-color: #1a56db;
  box-shadow: 0 2px 8px rgba(26,86,219,.15);
}

.access-note {
  margin-top: 14px;
  text-align: center;
  color: #94a3b8;
  font-size: .8rem;
  line-height: 1.5;
}
.access-note b { color: #6b7280; }

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

/* ── Result / error boxes ──────────────────────────────────────────────────── */
.result-box {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 10px;
}
.result-icon { font-size: 1.2rem; }
.result-link {
  font-weight: 600;
  color: #15803d;
  text-decoration: none;
  word-break: break-all;
}
.result-link:hover { text-decoration: underline; }

.error-box {
  margin-top: 22px;
  padding: 14px 18px;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 10px;
  color: #b91c1c;
  font-size: .9rem;
}

/* ── AI badge ──────────────────────────────────────────────────────────────── */
.badge-ai {
  font-size: .75rem;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

/* ── Feedback button ──────────────────────────────────────────────────────── */
.btn-feedback {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #6b7280;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: border-color .15s, color .15s;
}
.btn-feedback:hover    { border-color: #d35400; color: #d35400; }
.btn-feedback:disabled { opacity: .5; cursor: wait; pointer-events: none; }

/* ── Feedback modal ───────────────────────────────────────────────────────── */
.fb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1100;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.fb-overlay.visible { display: flex; }
.fb-box {
  background: #fff;
  border-radius: 10px;
  width: clamp(320px, calc(100vw - 32px), 560px);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.fb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.fb-title { font-size: 1rem; font-weight: 600; }
.fb-body  { padding: 18px 20px 20px; overflow-y: auto; flex: 1; }
.fb-type-row { display: flex; gap: .5rem; }
.fb-type-btn {
  flex: 1; padding: .55rem .75rem;
  border: 2px solid #e2e8f0; border-radius: 8px;
  background: transparent; font-size: .88rem; font-weight: 500;
  cursor: pointer; font-family: inherit; color: #6b7280;
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  transition: border-color .15s, background .15s, color .15s;
}
.fb-type-btn.selected             { border-color: #1a56db; background: #eff6ff; color: #1a56db; }
.fb-type-btn:hover:not(.selected) { border-color: #9ca3af; color: #1a202c; }
.fb-ss-wrap {
  border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden;
  min-height: 56px; max-height: 180px;
  display: flex; align-items: center; justify-content: center;
  background: #f9fafb; cursor: zoom-in;
}
.fb-ss-wrap img { max-width: 100%; max-height: 180px; display: block; }
.fb-ss-ph { color: #6b7280; font-size: .85rem; padding: 1.2rem; text-align: center; }

/* ── Shared field / form styles used by feedback modal ───────────────────── */
.field { margin-bottom: 1.1rem; }
.field-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: #374151; }
.req { color: #e02424; font-weight: 700; margin-left: 2px; }
.input {
  display: block; width: 100%; padding: .55rem .75rem;
  border: 1px solid #d1d5db; border-radius: 6px;
  font-size: .95rem; font-family: inherit; color: #1a202c;
  background: #fff; transition: border-color .15s;
}
.input:focus { outline: none; border-color: #1a56db; }
textarea.input { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ── Feedback modal buttons ──────────────────────────────────────────────── */
.fb-overlay .btn { display: inline-block; padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid transparent; font-size: .9rem; font-weight: 500; cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s; }
.fb-overlay .btn.ghost { background: transparent; color: #1a202c; border-color: #d1d5db; }
.fb-overlay .btn.ghost:hover { background: #f3f4f6; }
.fb-overlay .btn.primary { background: #1a56db; color: #fff; }
.fb-overlay .btn.primary:hover { background: #1648c0; }
.fb-overlay .btn.primary:disabled { opacity: .6; cursor: not-allowed; }

/* ── Feedback modal error box ────────────────────────────────────────────── */
.fb-overlay .error-box {
  background: #fef2f2; border: 1.5px solid #fca5a5; border-radius: 6px;
  padding: .65rem .85rem; font-size: .9rem; color: #b91c1c; margin-bottom: 1rem;
  margin-top: 0;
}

/* ── Feedback close button (reuse guide-close-btn style) ─────────────────── */
.guide-close-btn {
  background: none; border: none;
  font-size: 22px; color: #6b7280;
  cursor: pointer; line-height: 1; padding: 0 2px;
}
.guide-close-btn:hover { color: #1a202c; }
