* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  font: 13px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  width: min(640px, 100vw);
  min-height: 520px;
  margin: 0;
  padding: 12px;
  background: #000;
  color: #fff;
  overflow-x: hidden;
}

.top-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.gmail-panel,
.download-panel,
.download-jobs-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid rgba(104, 247, 255, 0.18);
  background: #000;
}

.gmail-panel > div:first-child,
.download-panel > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.download-jobs-panel {
  display: block;
}

.download-jobs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.download-head-actions {
  display: flex;
  gap: 6px;
}

.download-jobs {
  display: grid;
  gap: 5px;
  color: #d4d4d4;
}

.download-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding-top: 5px;
  border-top: 1px solid rgba(104, 247, 255, 0.12);
}

.download-job:first-child {
  padding-top: 0;
  border-top: 0;
}

.download-job-main {
  min-width: 0;
}

.download-job-name,
.download-job-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-job-name {
  color: #fff;
}

.download-job-meta {
  color: #9ca3af;
  font-size: 12px;
}

.download-job-progress {
  height: 7px;
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid rgba(104, 247, 255, 0.22);
  background: rgba(148, 163, 184, 0.14);
}

.download-job-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22c55e, #38bdf8);
}

.download-job-controls {
  display: flex;
  gap: 4px;
}

.download-job-controls button {
  padding: 3px 6px;
  font-size: 12px;
}

#gmailStatus,
#downloadStatus {
  margin-left: 8px;
  color: #d4d4d4;
}

.gmail-actions,
.download-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.download-actions {
  min-width: 330px;
}

#downloadUrl {
  min-width: 0;
  padding: 5px 8px;
}

input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(104, 247, 255, 0.28);
  border-radius: 0;
  background: #000;
  color: #68f7ff;
  caret-color: #68f7ff;
  font: inherit;
}

input::placeholder {
  color: #7fc7e8;
  opacity: 1;
}

button {
  padding: 5px 8px;
  border: 1px solid rgba(104, 247, 255, 0.42);
  border-radius: 0;
  background: #000;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

.state-button.is-on {
  border-color: #22c55e;
}

#summary {
  min-height: 20px;
  margin: 9px 0;
  color: #d4d4d4;
}

.sheet {
  max-height: 420px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(104, 247, 255, 0.18);
  background: #000;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 5px 7px;
  border-right: 1px solid rgba(104, 247, 255, 0.18);
  border-bottom: 1px solid rgba(104, 247, 255, 0.18);
  color: #fff;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #000;
  font-weight: 650;
}

th:nth-child(2),
td:nth-child(2) {
  width: 56px;
}

.top-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.title {
  font-size: 14px;
  font-weight: 400;
}

.url {
  margin-top: 3px;
  color: #7dd3fc;
  font-size: 14px;
}

.time {
  min-width: max-content;
  color: #e5e5e5;
  text-align: right;
}

.actions {
  padding: 3px 5px;
}

.record {
  cursor: pointer;
}

.record:hover .title,
.record:hover .url {
  text-decoration: underline;
}

.more {
  color: #d4d4d4;
  text-align: center;
}

@media (max-width: 520px) {
  .top-actions,
  .gmail-panel,
  .download-panel,
  .download-jobs-head,
  .gmail-actions,
  .download-actions,
  .download-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .download-actions {
    min-width: 0;
  }

  .download-job {
    grid-template-columns: 1fr;
  }

  .download-job-controls {
    flex-wrap: wrap;
  }

  .time {
    min-width: 0;
    text-align: left;
  }
}
