* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f1115;
  color: #e6e8eb;
}
header { padding: 16px 24px; border-bottom: 1px solid #222; }
h1 { margin: 0; font-size: 20px; }
h1 .sub { color: #8a8f98; font-weight: 400; font-size: 14px; }
h2 { font-size: 14px; margin: 0 0 8px; color: #b8bcc4; }

.add-box { padding: 16px 24px; border-bottom: 1px solid #222; background: #141821; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-row input {
  background: #0f1115; border: 1px solid #2a2f3a; color: #e6e8eb;
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
}
#f-server { width: 120px; }
#f-language { width: 140px; }
#f-url { flex: 1; min-width: 280px; }
button {
  background: #2d6cdf; color: #fff; border: 0; padding: 8px 16px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
button:hover { background: #3a78ea; }
.status { margin-top: 8px; font-size: 13px; min-height: 18px; }
.status.ok { color: #4ade80; }
.status.err { color: #f87171; }
.status.busy { color: #fbbf24; }

.tabs { display: flex; gap: 4px; padding: 12px 24px 0; flex-wrap: wrap; }
.tabs button {
  background: #1a1f2a; color: #b8bcc4; padding: 6px 14px;
  border-radius: 6px 6px 0 0; font-size: 13px;
}
.tabs button.active { background: #2d6cdf; color: #fff; }

.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 24px; border-bottom: 1px solid #222;
}
.subtabs, .sort { display: flex; gap: 6px; align-items: center; font-size: 13px; color: #8a8f98; }
.subtab, .sort-btn, .view-btn { background: #1a1f2a; color: #b8bcc4; padding: 6px 12px; }
.subtab.active, .sort-btn.active, .view-btn.active { background: #394150; color: #fff; }
#pending-count { color: #fbbf24; }

main { padding: 16px 24px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #1c2029; white-space: nowrap; }
th { color: #8a8f98; font-weight: 600; position: sticky; top: 0; background: #0f1115; }
.server-group { border-left: 2px solid #2a2f3a; }
.title-cell { font-weight: 600; white-space: normal; min-width: 220px; }
.title-cell .year { color: #8a8f98; font-weight: 400; margin-left: 4px; }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: #1f6f3f; color: #d7ffe6; cursor: pointer; font-size: 12px;
  border: 1px solid #2c8a52;
}
.chip:hover { background: #2c8a52; }
.chip.empty { background: transparent; color: #444a55; border: 0; cursor: default; }
.cell-actions { font-size: 11px; }
.cell-actions a { color: #6ea8ff; cursor: pointer; margin-right: 6px; text-decoration: none; }
.cell-actions a:hover { text-decoration: underline; }
.meta { color: #6b707a; font-size: 11px; }

.pending-group { background: #141821; border: 1px solid #2a2f3a; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.pending-group h3 { margin: 0 0 8px; font-size: 14px; }
.pending-group .badge { color: #fbbf24; font-size: 12px; margin-left: 8px; }
.pending-list { display: grid; gap: 4px; }
.pending-link { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.pending-link .srv { color: #6ea8ff; min-width: 60px; }
.pending-link .res { color: #b8bcc4; min-width: 50px; }
.pending-link .u { color: #8a8f98; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.del { background: #7f1d1d; padding: 2px 8px; font-size: 11px; }
.del:hover { background: #b91c1c; }
.empty-note { color: #6b707a; padding: 24px 0; }

/* ---- manage (servers & sources) ---- */
.manage { margin-top: 12px; border-top: 1px solid #1c2029; padding-top: 8px; }
.manage > summary { cursor: pointer; color: #8a8f98; font-size: 13px; user-select: none; }
.manage > summary:hover { color: #b8bcc4; }
.empty-note.small { padding: 10px 0; font-size: 12px; }
.manage-server { margin: 10px 0; border: 1px solid #1c2029; border-radius: 8px; padding: 8px 10px; }
.manage-server-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.manage-server-head strong { color: #6ea8ff; }
.manage-source { display: flex; gap: 10px; align-items: center; font-size: 12px; padding: 3px 0; }
.manage-source .ms-lang { color: #b8bcc4; min-width: 70px; }
.manage-source .ms-url { color: #8a8f98; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.manage-source .ms-meta { color: #6b707a; white-space: nowrap; }
.rescan-src { background: #1f4e6f; padding: 2px 8px; font-size: 11px; }
.rescan-src:hover { background: #2c6f9a; }
.del-src, .del-server { background: #7f1d1d; padding: 2px 8px; font-size: 11px; }
.del-src:hover, .del-server:hover { background: #b91c1c; }

/* full-name view: chip shows the whole file name, left-aligned + wrapping */
.chip.full {
  display: inline-block; max-width: 320px; white-space: normal;
  word-break: break-all; text-align: left; font-size: 11px; line-height: 1.3;
  background: #15212b; border-color: #21465c; color: #cfe8ff;
}
.chip.full:hover { background: #1d2d3a; }
td:has(.chip.full) { white-space: normal; vertical-align: top; }
