:root {
  --border: #d8dee6;
  --danger: #b4232c;
  --danger-bg: #fdecee;
  --facebook: #1877f2;
  --ink: #1b1f24;
  --linkedin: #0a66c2;
  --muted: #5c6773;
  --ok: #17683a;
  --ok-bg: #e8f6ed;
  --page: #f6f7f9;
  --scrim: rgb(0 0 0 / 55%);
  --surface: #ffffff;
  --youtube: #ff0000;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  padding: 32px 16px;
}

main {
  margin: 0 auto;
  max-width: 900px;
}

main.narrow {
  max-width: 360px;
}

main.wide {
  max-width: 1200px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.topbar {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0 0 20px;
  padding-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  border-radius: 5px;
  color: var(--muted);
  font-size: 14px;
  padding: 5px 12px;
  text-decoration: none;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  background: var(--ink);
  color: var(--surface);
}

.signout {
  display: flex;
  margin-left: auto;
}

h2 {
  border-top: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  margin: 32px 0 12px;
  padding-top: 24px;
}

.save-form {
  display: flex;
  gap: 8px;
}

input[type="password"],
input[type="text"],
input[type="url"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  flex: 1;
  font-size: 15px;
  padding: 10px 12px;
}

input[type="password"]:focus,
input[type="text"]:focus,
input[type="url"]:focus {
  border-color: var(--linkedin);
  outline: none;
}

button {
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--surface);
  cursor: pointer;
  font-size: 15px;
  padding: 10px 18px;
  white-space: nowrap;
}

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

.login-heading {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form label {
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  margin-bottom: 8px;
}

.login-form button {
  margin-top: 4px;
}

button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
  width: 100%;
}

.passkey-login .or {
  color: var(--muted);
  font-size: 13px;
  margin: 16px 0 8px;
  text-align: center;
}

.passkey-login .flash,
.passkey-form .flash {
  margin: 12px 0 0;
}

.passkey-form {
  max-width: 360px;
}

.passkey-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.passkey-list li {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.passkey-list li:last-child {
  border-bottom: none;
}

.passkey-list form {
  display: flex;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.flash {
  border-radius: 6px;
  font-size: 14px;
  margin: 0 0 16px;
  padding: 10px 12px;
}

.flash.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.flash.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.flash a {
  color: inherit;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
}

td,
th {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: top;
}

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

.col-thumb {
  width: 132px;
}

.thumb {
  background: var(--ink);
  border-radius: 4px;
  height: 68px;
  overflow: hidden;
  width: 120px;
}

.thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.col-name {
  overflow-wrap: anywhere;
}

.col-source {
  width: 96px;
}

.col-actions {
  width: 184px;
}

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

.actions form {
  display: flex;
}

.sub {
  color: var(--muted);
  display: block;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub a {
  color: var(--muted);
}

.missing {
  color: var(--danger);
}

.badge {
  border-radius: 4px;
  color: var(--surface);
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
}

.badge.facebook {
  background: var(--facebook);
}

.badge.linkedin {
  background: var(--linkedin);
}

.badge.youtube {
  background: var(--youtube);
}

a {
  color: var(--linkedin);
}

.button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--ink);
  display: inline-block;
  font-size: 13px;
  padding: 5px 10px;
  text-decoration: none;
}

.button.danger {
  border-color: var(--border);
  color: var(--danger);
}

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  margin: 0 0 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
}

.card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.card-value {
  font-size: 22px;
  font-weight: 600;
}

.card-row {
  display: flex;
  font-size: 14px;
  justify-content: space-between;
}

.stats-table {
  min-width: 1060px;
}

.stats-table .col-source {
  width: 100px;
}

.col-saved {
  white-space: nowrap;
  width: 120px;
}

.col-num {
  text-align: right;
  white-space: nowrap;
  width: 92px;
}

.col-res {
  width: 112px;
}

.col-codec {
  width: 150px;
}

.col-copy {
  width: 112px;
}

.col-video {
  overflow-wrap: anywhere;
}

.clamp {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  overflow: hidden;
}

th .sort {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  padding: 0;
  text-align: inherit;
  text-transform: inherit;
}

th .sort:hover {
  color: var(--ink);
}

th[aria-sort="ascending"] .sort::after {
  content: " \2191";
}

th[aria-sort="descending"] .sort::after {
  content: " \2193";
}

.video-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .video-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.media {
  aspect-ratio: 16 / 9;
  background: var(--ink);
  overflow: hidden;
  position: relative;
}

/* A blurred copy of the poster fills the frame, so vertical reels do not sit
   between black bars. */
.media::before {
  background: var(--poster) center / cover;
  content: "";
  filter: blur(24px) brightness(0.55);
  inset: -24px;
  position: absolute;
}

.media img,
.media video {
  display: block;
  height: 100%;
  object-fit: contain;
  position: relative;
  width: 100%;
}

.play {
  align-items: center;
  background: none;
  border: none;
  border-radius: 0;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 0;
  position: absolute;
}

.play-icon {
  align-items: center;
  background: var(--scrim);
  border: 2px solid var(--surface);
  border-radius: 50%;
  display: flex;
  height: 64px;
  justify-content: center;
  transition:
    background 0.15s,
    transform 0.15s;
  width: 64px;
}

.play-icon svg {
  fill: var(--surface);
  height: 28px;
  margin-left: 3px;
  width: 28px;
}

.play:focus-visible .play-icon,
.play:hover .play-icon {
  background: var(--ink);
  transform: scale(1.08);
}

.duration {
  background: var(--scrim);
  border-radius: 4px;
  bottom: 8px;
  color: var(--surface);
  font-size: 12px;
  padding: 1px 6px;
  pointer-events: none;
  position: absolute;
  right: 8px;
}

.media-missing {
  align-items: center;
  color: var(--surface);
  display: flex;
  font-size: 13px;
  height: 100%;
  justify-content: center;
  position: relative;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.card-title {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
}

.card-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 4px 10px;
  margin: 0;
}

.uploader {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.synopsis {
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

.synopsis.pending {
  color: var(--muted);
  font-style: italic;
}

.video-card .actions {
  margin-top: auto;
  padding-top: 4px;
}

.empty {
  color: var(--muted);
}
