* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fff;
  min-height: 100vh;
  padding-top: 40px;
  padding-bottom: 40px;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.header {
  margin-bottom: 24px;
}

.header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: #5f6368;
}

.submit-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 10px;
}

.submit-header {
  margin-bottom: 12px;
}

.submit-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 4px;
}

.submit-subtitle {
  font-size: 13px;
  color: #5f6368;
  margin: 0;
}

.submit-controls {
  margin-bottom: 12px;
}

.submit-btn {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-btn:hover:not(:disabled) {
  background: #1557b0;
}

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

.submit-btn.ghost {
  margin-left: 12px;
  background: transparent;
  color: #1a73e8;
  border: 1px dashed #1a73e8;
}

.submit-btn.ghost:hover:not(:disabled) {
  background: #e8f0fe;
}

.submit-result {
  font-size: 13px;
  color: #202124;
  padding: 12px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e8eaed;
}

.submit-result.success {
  background: #e6f4ea;
  border-color: #34a853;
  color: #137333;
}

.submit-result.error {
  background: #fce8e6;
  border-color: #ea4335;
  color: #c5221f;
}

.table-container {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 8px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e8eaed;
  background: #f8f9fa;
}

.table-title {
  font-size: 14px;
  font-weight: 600;
  color: #3c4043;
  margin: 0;
}

.table-refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #5f6368;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.table-refresh-btn:hover:not(:disabled) {
  background: #f1f3f4;
  border-color: #1a73e8;
  color: #1a73e8;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead {
  background: #f8f9fa;
}

.results-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #5f6368;
  font-size: 12px;
  border-bottom: 1px solid #e8eaed;
}

.results-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f3f4;
  color: #202124;
  vertical-align: middle;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr.clickable {
  cursor: pointer;
}

.results-table tbody tr.clickable:hover {
  background: #e8f0fe;
}

.results-table tbody tr.clickable.selected {
  background: #d2e3fc;
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  background: #f1f3f4;
}

.sort-icon {
  font-size: 10px;
  color: #9aa0a6;
  margin-left: 4px;
}

.sortable.asc .sort-icon,
.sortable.desc .sort-icon {
  font-size: 0;
}

.sortable.asc .sort-icon::before {
  content: "↑";
  font-size: 10px;
  color: #1a73e8;
}

.sortable.desc .sort-icon::before {
  content: "↓";
  font-size: 10px;
  color: #1a73e8;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid #e8eaed;
  background: #f8f9fa;
  flex-wrap: wrap;
}

.page-btn {
  background: #fff;
  color: #5f6368;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

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

.page-numbers {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-number-btn {
  background: #fff;
  color: #5f6368;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  min-width: 32px;
}

.page-number-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #1a73e8;
}

.page-number-btn.active {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.page-ellipsis {
  color: #9aa0a6;
  padding: 0 4px;
  font-size: 12px;
}

.item-count {
  font-size: 12px;
  color: #9aa0a6;
  margin-left: 8px;
}

.actions-cell {
  white-space: nowrap;
}

.row-submit-btn {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.row-submit-btn:hover:not(:disabled) {
  background: #1557b0;
}

.row-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fce8e6;
  border: 1px solid #f28b82;
  border-radius: 8px;
  color: #c5221f;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* Detail panel (slide-over) */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.detail-overlay:not(.hidden) {
  pointer-events: auto;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.detail-overlay:not(.hidden) .detail-backdrop {
  opacity: 1;
}

.detail-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1;
}

.detail-overlay:not(.hidden) .detail-panel {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8eaed;
  background: #f8f9fa;
}

.detail-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #202124;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #5f6368;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.close-btn:hover {
  background: #e8eaed;
  color: #202124;
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.detail-loading {
  text-align: center;
  color: #5f6368;
  padding: 24px;
}

.detail-body {
  display: block;
}

.detail-section {
  margin-bottom: 28px;
}

.detail-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8eaed;
}

.detail-section.task-section .detail-dl {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 4px 0;
  border: 1px solid #e8eaed;
}

.detail-dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: baseline;
  gap: 0;
  font-size: 13px;
}

.detail-dl dt {
  font-weight: 500;
  color: #5f6368;
  font-size: 12px;
  padding: 10px 14px 10px 14px;
  grid-column: 1;
}

.detail-dl dd {
  margin: 0;
  padding: 10px 14px 10px 10px;
  color: #202124;
  word-break: break-word;
  border-bottom: 1px solid #e8eaed;
  grid-column: 2;
  font-weight: 500;
}

.detail-dl dd:last-child {
  border-bottom: none;
}

.detail-dl dd a.detail-link {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 500;
}

.detail-dl dd a.detail-link:hover {
  text-decoration: underline;
}

.detail-dl dd a.detail-link:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.detail-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.detail-badge.yes {
  background: #e6f4ea;
  color: #137333;
}

.detail-badge.no {
  background: #fce8e6;
  color: #c5221f;
}

.detail-section.purchases-section h3 {
  margin-bottom: 10px;
}

.purchases-table-wrap {
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fafafa;
}

.results-table.compact th,
.results-table.compact td {
  padding: 8px 10px;
  font-size: 12px;
}

.no-purchases {
  color: #5f6368;
  font-size: 13px;
  padding: 12px 0;
}

/* Token overlay */
.token-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.token-overlay.hidden {
  display: none;
}

.token-modal {
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.token-modal h2 {
  margin-bottom: 8px;
  font-size: 20px;
  color: #202124;
}

.token-modal p {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 20px;
}

.google-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 14px;
  color: #3c4043;
  background: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.google-signin-btn:hover {
  background: #f8f9fa;
}

.google-signin-btn .google-icon {
  flex-shrink: 0;
}

a.submit-btn.ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.token-overlay-error {
  margin-top: 8px;
  font-size: 12px;
  color: #ea4335;
}
