/* Plain CSS for Kindle WebKit / older Silk — no color-mix, grid, or modern units */
html, body {
  margin: 0;
  padding: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.45;
  background: #fff;
  color: #111;
}
a { color: #111; text-decoration: underline; }
button, input, select {
  font-size: 18px;
  font-family: inherit;
  padding: 8px 10px;
  margin: 4px 0;
  border: 1px solid #333;
  background: #fff;
  color: #111;
  box-sizing: border-box;
}
button {
  cursor: pointer;
  background: #eee;
  min-height: 40px;
}
button.primary { font-weight: bold; background: #ddd; }
.wrap { max-width: 720px; margin: 0 auto; padding: 12px; }
.bar {
  border-bottom: 2px solid #111;
  padding: 8px 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.bar .title { font-weight: bold; font-size: 20px; }
.bar .right { float: right; font-size: 16px; }
.bar .right a { margin-left: 6px; }
.navtabs {
  border-bottom: 1px solid #999;
  margin: 0 0 12px 0;
  padding: 0 0 8px 0;
  overflow: hidden;
}
.navtabs a {
  display: inline-block;
  margin-right: 12px;
  padding: 6px 10px;
  text-decoration: none;
  border: 1px solid #666;
  background: #f5f5f5;
}
.navtabs a.on {
  font-weight: bold;
  background: #111;
  color: #fff;
  border-color: #111;
}
/* Library submenu under main Library tab */
.lib-subnav {
  border-bottom: 1px dotted #999;
  margin-top: -4px;
}
.lib-subnav a {
  font-size: 16px;
  background: #fff;
  border-style: dotted;
}
.lib-subnav a.on {
  background: #333;
  border-style: solid;
}
/*
 * E-ink / monochrome markers (Kindle): no colour reliance.
 * Use solid black fills, thick borders, bold ALL-CAPS text.
 */
.flag {
  display: inline-block;
  font-size: 13px;
  font-weight: bold;
  font-family: sans-serif;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  margin: 0 6px 4px 0;
  border: 2px solid #000;
  vertical-align: middle;
  line-height: 1.2;
  text-decoration: none;
}
/* Solid black block — highest contrast on e-ink */
.flag-new {
  background: #000;
  color: #fff;
  border-color: #000;
}
/* Outline only — “already read / up to date” */
.flag-read {
  background: #fff;
  color: #000;
  border-style: solid;
  border-width: 2px;
}
.flag-idle {
  background: #fff;
  color: #000;
  border-style: dashed;
  border-width: 2px;
  font-weight: normal;
}

.list li.has-new {
  border: 3px solid #000;
  border-left-width: 10px;
  margin: 8px 0;
  padding: 10px 8px;
  background: #fff;
}
.list li.has-new .item-title {
  font-weight: bold;
  font-size: 19px;
  text-decoration: underline;
}
.list li.up-to-date {
  border-bottom: 1px solid #000;
  border-left: 3px solid #000;
  margin: 4px 0;
  padding: 10px 8px;
}
.list li.up-to-date .item-title {
  font-weight: bold;
}

/* Books list: READ vs not-read (Angular rdone = ts_done set) */
.list li.is-read {
  border: 2px solid #000;
  border-left-width: 8px;
  margin: 6px 0;
  padding: 10px 8px;
  /* e-ink: dense top/bottom rules so "read" scans as a solid band */
  border-top-width: 2px;
  border-bottom-width: 2px;
}
.list li.is-read .item-title {
  font-weight: bold;
}
.list li.is-unread {
  border-bottom: 1px solid #000;
  border-left: 2px dotted #000;
  margin: 4px 0;
  padding: 10px 8px;
}
.list li.is-unread .item-title {
  font-weight: bold;
  font-size: 19px;
  text-decoration: underline;
}
.list li .item-status {
  font-size: 14px;
  font-weight: bold;
  font-family: sans-serif;
  margin: 4px 0 2px 0;
  text-transform: uppercase;
}
.list li .item-meta {
  font-size: 14px;
  margin-top: 2px;
  line-height: 1.35;
}
.list li .item-meta .lbl {
  font-weight: bold;
  font-family: sans-serif;
  font-size: 12px;
  text-transform: uppercase;
}

/* Legend for monochrome flags */
.eink-legend {
  border: 2px solid #000;
  padding: 8px 10px;
  margin: 0 0 14px 0;
  font-size: 14px;
  line-height: 1.5;
  background: #fff;
}
.eink-legend .flag { margin-bottom: 0; }
.eink-legend p { margin: 6px 0 0 0; }

/* legacy class names kept as aliases */
.list li.rdone { /* see .has-new */ }
.list li .badge-new { /* see .flag-new */ }
.msg { padding: 10px; border: 1px solid #666; margin: 10px 0; background: #f7f7f7; }
.err { border-color: #000; font-weight: bold; }
.err.debug {
  font-weight: normal;
  font-size: 13px;
  font-family: monospace, monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.35;
}
label { display: block; margin-top: 10px; font-weight: bold; }
input[type="text"], input[type="password"], input[type="date"] { width: 100%; max-width: 360px; }
.row { margin: 8px 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  border-bottom: 1px solid #999;
  padding: 10px 4px;
  overflow: hidden;
}
.list li a { text-decoration: none; display: block; }
.list li a:hover { background: #f0f0f0; }
.thumb {
  float: left;
  width: 64px;
  height: 64px;
  margin-right: 10px;
  border: 1px solid #666;
  background: #ddd;
}
.meta { font-size: 14px; color: #333; }
.crumbs { font-size: 15px; margin: 0 0 12px 0; padding: 6px 0; border-bottom: 1px dotted #999; }
.crumbs a { margin-right: 4px; }
.pager { margin: 16px 0; text-align: center; }
.pager button,
.pager a.btn {
  display: inline-block;
  margin: 0 6px;
  min-width: 90px;
  padding: 8px 10px;
  text-align: center;
  text-decoration: none;
  border: 1px solid #333;
  background: #eee;
  color: #111;
  box-sizing: border-box;
}
.pager button[disabled] {
  opacity: 0.5;
}
.pager span {
  display: inline-block;
  margin: 4px 6px;
  vertical-align: middle;
}
.viewer { text-align: center; }
.viewer img {
  max-width: 100%;
  height: auto;
  border: 1px solid #333;
}
.viewer .nav { margin: 12px 0; }
.viewer .nav button,
.viewer .nav a.btn {
  display: inline-block;
  min-width: 100px;
  margin: 4px;
  padding: 8px 10px;
  text-align: center;
  text-decoration: none;
  border: 1px solid #333;
  background: #eee;
  color: #111;
  box-sizing: border-box;
}
.viewer .nav button[disabled] {
  opacity: 0.5;
}
/* Inline progressive video / audio player (file view) */
.player-box {
  margin: 12px auto;
  max-width: 100%;
  text-align: center;
}
.media-player {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  margin: 0 auto;
  background: #000;
  border: 1px solid #333;
}
audio.media-player {
  background: #eee;
  min-height: 40px;
}
.player-poster {
  max-width: 100%;
  height: auto;
  border: 1px solid #333;
}
.player-hint {
  margin-top: 8px;
  text-align: left;
}
h1 { font-size: 22px; margin: 0 0 12px 0; }
h2 { font-size: 18px; margin: 8px 0; }
.note { font-size: 14px; margin-top: 16px; color: #333; }
.checkbox-row { margin-top: 10px; }
.checkbox-row label { display: inline; font-weight: normal; }
.searchbox {
  border: 1px solid #666;
  padding: 10px;
  margin-bottom: 14px;
  background: #fafafa;
}
.searchbox .inline label {
  display: inline;
  font-weight: normal;
  margin-right: 4px;
}
.searchbox .inline input { width: auto; max-width: 140px; margin-right: 8px; }
.dl-row { margin: 16px 0; }
.dl-row button, .dl-row a.btn {
  display: inline-block;
  margin: 4px 6px 4px 0;
  min-width: 72px;
  text-align: center;
  text-decoration: none;
  border: 1px solid #333;
  background: #eee;
  padding: 8px 10px;
  color: #111;
}
/* Video track choosers (audio / subtitles) */
.track-box {
  text-align: left;
  max-width: 420px;
  margin: 12px auto;
  padding: 10px;
  border: 1px solid #666;
  background: #fafafa;
}
.track-box label {
  display: block;
  margin-top: 8px;
  margin-bottom: 2px;
  font-weight: bold;
  font-size: 15px;
}
.track-box select {
  width: 100%;
  max-width: 100%;
  display: block;
}
.track-box .track-actions {
  margin-top: 12px;
  text-align: center;
}
.track-box .track-actions button,
.track-box .track-actions a.btn {
  display: inline-block;
  margin: 4px 6px 4px 0;
  min-width: 100px;
  text-align: center;
  text-decoration: none;
  border: 1px solid #333;
  background: #eee;
  padding: 8px 10px;
  color: #111;
}
.track-box .track-actions button.primary { font-weight: bold; background: #ddd; }
.book-meta div { margin: 6px 0; }
.book-meta .label { font-weight: bold; }
/* In-page HTML book reader */
.reader-toolbar {
  border-bottom: 2px solid #111;
  padding: 8px 0;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #fff;
}
.reader-body {
  font-size: 18px;
  line-height: 1.6;
  max-width: 40em;
  margin: 0 auto;
  padding: 0 4px 40px 4px;
  word-wrap: break-word;
}
.reader-body img { max-width: 100%; height: auto; }
.reader-body p { margin: 0 0 0.8em 0; }
.section-title {
  font-size: 16px;
  font-weight: bold;
  margin: 16px 0 6px 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 4px;
}
