/*
 * 檔案：server/public/assets/admin.css
 * 修改日期：2026-10-06T08:23:47+08:00（UTC+8）
 * 版本：後台 0.2.0
 * 用途：管理介面、表格與響應式樣式。
 * 修改摘要：依 TPWDS 2.1.0 擴充原版；TVBOX 播放器版本維持 0.1.0。
 */

button,
.button {
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 42px;
}
.sidebar {
  padding-top: 20px;
  padding-bottom: 16px;
  transition: width 180ms ease;
}
.sidebar nav {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  padding-right: 2px;
}
.sidebar button[data-view],
.sidebar-bottom button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 12px;
}
.sidebar-bottom {
  flex-shrink: 0;
  margin-top: 16px;
}
.brand {
  margin-bottom: 22px;
  flex-shrink: 0;
}
.nav-icon {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-size: 18px;
}
.sidebar .sidebar-collapse {
  position: absolute;
  top: 100px;
  right: -14px;
  width: 28px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  background: #2d505b;
  border: 1px solid #6b858e;
  border-radius: 5px;
  text-align: center;
  color: white;
  font-size: 23px;
}
body.sidebar-collapsed .sidebar {
  width: 76px;
  padding-left: 10px;
  padding-right: 10px;
}
body.sidebar-collapsed .nav-label {
  display: none;
}
body.sidebar-collapsed .workspace {
  margin-left: 76px;
}
.workspace {
  transition: margin-left 180ms ease;
  min-width: 0;
}
.main-content {
  max-width: none;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}
#page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.password-field {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}
.password-field input {
  min-width: 0;
  margin: 0;
  flex: 1;
}
.password-field button {
  width: 44px;
  padding: 8px;
  margin: 0;
  min-width: 44px;
}
.captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-panel .captcha-row button {
  width: auto;
  margin: 0;
}
.login-panel .captcha-button {
  padding: 0;
  background: transparent;
}
.captcha-button img {
  display: block;
  width: 180px;
  height: 55px;
  max-width: 100%;
  object-fit: contain;
}
.preflight {
  padding: 18px;
  background: #f4f7f8;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 20px 0;
}
.check-ok {
  color: #236444;
}
.check-failed {
  color: #a53838;
}
.table-toolbar select {
  width: auto;
  max-width: 220px;
}
.table-toolbar input {
  min-width: 160px;
  flex: 1;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 16px 0;
}
tr.row-editable {
  cursor: pointer;
}
tr.row-editable:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
}
.tabs button.active {
  background: var(--teal);
  color: white;
}
.media-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.media-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}
.media-item img,
.media-item video {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #eef3f4;
}
.media-item h3 {
  font-size: 16px;
  overflow-wrap: anywhere;
  margin: 10px 0 4px;
}
.media-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.upload-workspace {
  background: white;
  border: 1px solid var(--line);
  padding: 22px;
  border-radius: 8px;
  margin-bottom: 22px;
}
progress {
  width: 100%;
  height: 20px;
  accent-color: var(--teal);
}
.media-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.media-picker label {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px;
}
.media-picker img {
  width: 100%;
  height: 68px;
  object-fit: contain;
}
.media-picker input {
  width: auto;
}
.media-picker span {
  display: block;
  overflow-wrap: anywhere;
}
dialog.layout-workspace {
  width: calc(100vw - 36px);
  max-width: 1500px;
  height: calc(100dvh - 36px);
  max-height: calc(100dvh - 36px);
}
dialog.layout-workspace #modal-body {
  max-height: calc(100dvh - 215px);
}
.update-drop {
  border: 2px dashed #96b7bb;
  background: #f3f8f7;
  padding: 26px;
  border-radius: 8px;
  margin: 20px 0;
}
.update-drop.drag-over {
  border-color: var(--teal);
}
.system-details {
  width: 100%;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  body.sidebar-collapsed .sidebar {
    width: 240px;
    padding: 20px 17px 16px;
  }
  body.sidebar-collapsed .nav-label {
    display: inline;
  }
  body.sidebar-collapsed .workspace {
    margin-left: 0;
  }
  .sidebar-collapse {
    display: none;
  }
  .topbar {
    padding: 10px 14px;
  }
  .tenant-label select {
    width: min(46vw, 210px);
  }
  .table-toolbar select {
    max-width: 100%;
  }
  .page-heading {
    flex-wrap: wrap;
  }
  dialog,
  dialog.layout-workspace {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
  #modal-body,
  dialog.layout-workspace #modal-body {
    max-height: calc(100dvh - 190px);
    padding: 10px 18px 20px;
  }
  .modal-heading,
  .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }
  .media-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .media-item {
    padding: 10px;
  }
  .media-item img,
  .media-item video {
    height: 100px;
  }
  .media-actions button {
    font-size: 13px;
    padding: 7px 9px;
  }
  .pagination {
    justify-content: space-between;
    gap: 5px;
  }
}
/* Keep the dialog header and actions visible while the workspace scrolls. */
dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-heading,
.modal-footer,
#modal-error {
  flex-shrink: 0;
}
#modal-error:empty {
  display: none;
}
#modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#modal-body {
  min-height: 0;
  flex: 1;
}
dialog.layout-workspace #modal-body {
  max-height: none;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #112c3b80;
}

@media (max-width: 700px) {
  .table-wrap table {
    min-width: 640px;
  }
}
@media (min-width: 761px) {
  .sidebar-backdrop {
    display: none;
  }
}

/* 嘉鑫看板品牌，2026-10-12 */
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  font-size: 24px;
  font-weight: 700;
}
.login-brand small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.login-brand img,
.brand img.brand-icon {
  object-fit: contain;
  background: transparent;
  padding: 0;
  flex-shrink: 0;
}
.brand img.brand-icon {
  border-radius: 0;
}
