:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Base layout */
body {
  margin: 0;
  background: #ffffff;
  color: #111;
}

.container {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 16px;
}

h1 {
  margin: 0 0 16px 0;
}

.card {
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

/* Forms */
label {
  display: block;
  margin-top: 10px;
  font-weight: 700;
}

.small-label {
  display: block;
  margin-top: 10px;
  font-weight: 700;
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border: 1px solid #ccd3dd;
  border-radius: 8px;
  box-sizing: border-box;
}

textarea {
  resize: vertical;
}

.row {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.col {
  flex: 1 1 260px;
}

/* Buttons base */
button {
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Button variants */
.primary-btn,
#runBtn {
  margin-top: 14px;
  padding: 10px 14px;
  background: #1a73e8;
  color: #fff;
}

.secondary-btn {
  margin-top: 10px;
  padding: 10px 14px;
  background: #111827;
  color: #fff;
  width: 100%;
}

.secondary-ghost-btn {
  padding: 10px 14px;
  background: #ffffff;
  color: #111827;
  border: 1px solid #ccd3dd;
  border-radius: 8px;
}

.secondary-ghost-btn:hover {
  background: #f2f4f7;
}

.danger-btn {
  padding: 10px 14px;
  background: #dc2626;
  color: #fff;
  width: 100%;
}

.danger-outline-btn {
  margin-top: 10px;
  padding: 10px 14px;
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
  width: 100%;
}

.danger-outline-btn:hover {
  background: #fff1f2;
}

.link-btn {
  background: transparent;
  color: #1a73e8;
  padding: 0;
  min-height: auto;
  font-weight: 900;
  text-decoration: underline;
}

.icon-btn {
  background: transparent;
  color: #111;
  font-size: 20px;
  padding: 0 6px;
  min-height: auto;
}

/* Errors and helpers */
.error-box {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.empty {
  padding: 12px;
  border: 1px dashed #ccd3dd;
  border-radius: 10px;
  color: #4b5563;
  background: #fafafa;
}

.small {
  padding: 10px;
  font-size: 13px;
}

.small-status {
  margin-top: 8px;
  font-size: 13px;
  color: #4b5563;
  font-weight: 900;
}

/* Status bar */
.status-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #e6e8ee;
  overflow: hidden;
  border: 1px solid #ccd3dd;
}

.status-fill {
  height: 100%;
  width: 0%;
  background: #16a34a;
  transition: width 300ms ease;
}

.status-text {
  margin-top: 10px;
  color: #374151;
  font-weight: 900;
}

/* Table */
.table-wrap {
  overflow: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

.results-table th,
.results-table td {
  border: 1px solid #e6e8ee;
  padding: 10px;
  vertical-align: top;
  font-size: 14px;
}

.results-table th {
  background: #f2f4f7;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-yes {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.badge-no {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
}

.sources {
  margin: 0;
  padding-left: 18px;
}

.sources li {
  margin: 0 0 6px 0;
}

.source-link {
  color: #1a73e8;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.source-hit {
  color: #065f46;
  font-weight: 900;
}

.source-hit .source-link {
  color: #065f46;
}

.ai-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.more-btn {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #ccd3dd;
  background: #fff;
  color: #111;
  font-weight: 900;
  min-height: 36px;
}

.more-btn:hover {
  background: #f2f4f7;
}

/* Export toolbar */
.results-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.export-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-label {
  margin: 0;
  font-weight: 900;
}

.export-select {
  width: 160px;
}

.export-btn {
  margin-top: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

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

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e6e8ee;
  position: sticky;
  top: 0;
  z-index: 200;
  pointer-events: auto;
}

.brand-title {
  font-weight: 900;
  font-size: 18px;
}

/* Profile */
.profile-area {
  position: relative;
}

.profile-btn {
  padding: 10px 12px;
  background: #111827;
  color: #fff;
}

.profile-panel {
  position: absolute;
  right: 0;
  top: 44px;
  width: 340px;
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
  padding: 10px;
  z-index: 220;
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
}

.profile-panel-title {
  font-weight: 950;
  font-size: 14px;
}

.profile-panel-header .icon-btn {
  font-size: 18px;
  line-height: 1;
}

.profile-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f2f6;
}

.section-title {
  font-weight: 950;
  margin: 0 0 6px 0;
  font-size: 13px;
}

.profile-panel input {
  padding: 9px 10px;
  border-radius: 8px;
}

.profile-panel .secondary-btn,
.profile-panel .danger-btn,
.profile-panel .danger-outline-btn {
  margin-top: 8px;
  padding: 9px 12px;
  min-height: 40px;
  border-radius: 8px;
}

.hint {
  color: #4b5563;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 8px;
  margin-bottom: 0;
}

#signedInAs {
  padding: 8px 10px;
  border: 1px solid #e6e8ee;
  border-radius: 10px;
  background: #fafafa;
  color: #111827;
  font-weight: 900;
  word-break: break-word;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e6e8ee;
  padding: 16px;
}

.modal-title {
  font-weight: 950;
  font-size: 18px;
}

.modal-subtitle {
  margin-top: 6px;
  color: #4b5563;
  font-size: 13px;
}

/* Auth modal layout updates */
.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.auth-actions .primary-btn {
  margin-top: 0;
  width: auto;
}

.auth-switch {
  justify-content: flex-end;
  margin-top: 10px;
}

.modal-switch {
  color: #4b5563;
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-switch span,
.auth-switch .link-btn {
  font-size: 14px;
  font-weight: 900;
}

.auth-switch .link-btn {
  text-decoration: underline;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  margin-top: 3px;
}

.checkbox-label {
  margin-top: 0;
  font-weight: 900;
}

.auth-hint {
  margin-top: 8px;
}

/* Delete modal actions */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.modal-actions button {
  flex: 1;
  min-height: 44px;
}

/* Locked state */
.locked #appRoot {
  filter: grayscale(0.2) blur(1px);
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

/* Footer */
.footer {
  padding: 18px 16px;
  text-align: center;
  color: #4b5563;
  border-top: 1px solid #e6e8ee;
  background: #fff;
  position: relative;
  z-index: 200;
  opacity: 1;
  pointer-events: auto;
}

.footer-links {
  margin-bottom: 12px;
}

.footer-coffee img {
  height: 40px;
}

.footer-link {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 900;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-sep {
  margin: 0 10px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-coffee-link img {
  height: 34px;
  vertical-align: middle;
}
