/* Author: 关羽 | Telegram: @cnitgy | Email: cnitol@hotmail.com */
.admin-header {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.admin-header > span:nth-last-child(2) {
  margin-left: auto;
}
.admin-header form {
  margin: 0;
}
.admin-frame {
  display: flex;
  min-height: calc(100dvh - 95px);
}
.admin-frame aside {
  width: 200px;
  flex: none;
  padding: 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.admin-frame nav a {
  display: block;
  padding: 10px;
  min-height: 44px;
  font-size: 13px;
}
.admin-frame main {
  min-width: 0;
  flex: 1;
  padding: 32px;
}
.admin h1 {
  font-size: 2rem;
}
.admin h2 {
  font-size: 1.4rem;
  margin-top: 1.5em;
}
.admin label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.admin label input,
.admin label select,
.admin label textarea {
  margin-top: 6px;
}
.admin input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  vertical-align: middle;
}
.admin-form {
  padding: 22px;
  margin-block: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.admin form > .btn {
  margin-top: 16px;
}
.auth-card {
  max-width: 460px;
  margin: 30px auto;
}
.auth-card form {
  margin-block: 24px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.metrics article {
  padding: 20px;
  border: 1px solid var(--line);
}
.metrics strong {
  display: block;
  font-size: 2rem;
  color: var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr) minmax(0, 0.9fr);
  gap: 20px;
}
.workspace section {
  min-width: 0;
}
.table-scroll {
  overflow: auto;
  max-width: 100%;
  margin-block: 24px;
  border: 1px solid var(--line);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
}
th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  min-width: 90px;
  max-width: 450px;
  overflow-wrap: anywhere;
}
th {
  background: var(--surface2);
  white-space: nowrap;
}
td {
  vertical-align: top;
}
.qr {
  width: 220px;
  background: #fff;
}
.admin pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 20px;
  border: 1px solid var(--line);
}
.admin p[role="alert"] {
  color: var(--warn);
}
.ops-console {
  max-width: 1500px;
  margin: 0 auto;
  min-width: 0;
}
.ops-console * {
  min-width: 0;
}
.ops-heading,
.ops-row-actions,
.ops-quick,
.ops-tabs,
.ops-sticky-actions,
.ops-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ops-heading {
  justify-content: space-between;
  margin: 12px 0 24px;
}
.ops-heading h2 {
  margin: 0;
}
.ops-form,
.ops-panel,
.ops-empty {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
  margin: 20px 0;
}
.ops-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.ops-form-grid > .full {
  grid-column: 1/-1;
}
.ops-form-grid label {
  margin: 0;
}
.ops-console input,
.ops-console select,
.ops-console textarea {
  max-width: 100%;
  width: 100%;
}
.ops-console textarea {
  resize: vertical;
  min-height: 100px;
}
.ops-console button,
.ops-console .btn {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  cursor: pointer;
}
.ops-console form[data-compact] {
  display: inline-flex;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}
.ops-console small {
  display: block;
}
.ops-console details {
  border: 1px solid var(--line);
  padding: 18px;
}
.ops-console summary {
  cursor: pointer;
  font-weight: 650;
  min-height: 36px;
}
.ops-notice {
  padding: 14px 18px;
  background: var(--soft);
  border-left: 3px solid var(--accent);
  overflow-wrap: anywhere;
}
.ops-error {
  border: 1px solid var(--warn);
  padding: 20px;
  color: var(--warn);
}
.ops-error h2 {
  margin: 0;
}
.ops-badge {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 5px 10px;
  color: var(--text);
  font-size: 13px;
}
.ops-break {
  overflow-wrap: anywhere;
}
.ops-filter {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: end;
  margin: 24px 0;
}
.ops-filter label {
  flex: 1 1 160px;
  margin: 0;
}
.ops-table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
}
.ops-table-scroll table {
  table-layout: fixed;
}
.ops-table-scroll td,
.ops-table-scroll th {
  min-width: 0;
}
.ops-table-scroll td a {
  color: var(--text);
}
.ops-table-scroll td > a:first-child {
  font-weight: 650;
}
.ops-thumb {
  width: 52px;
  height: 42px;
  object-fit: cover;
  display: block;
  margin-bottom: 8px;
}
.ops-row-actions {
  align-items: flex-start;
  gap: 10px;
}
.ops-metrics,
.ops-source-grid,
.ops-media-grid,
.ops-languages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.ops-metrics article {
  padding: 20px;
  border: 1px solid var(--line);
}
.ops-metrics strong {
  display: block;
  color: var(--accent);
  font-size: 2rem;
}
.ops-quick {
  margin-block: 24px;
}
.ops-source-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ops-source-grid .ops-panel {
  margin: 0;
}
.ops-source-grid dl {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}
.ops-source-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.ops-languages {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.ops-languages > div {
  padding: 12px;
  border: 1px solid var(--line);
}
.ops-languages span,
.ops-languages strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}
.ops-tabs {
  margin-block: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.admin-frame .ops-tabs a,
.admin-frame .ops-pagination a {
  display: inline-flex;
}
.ops-tabs a.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.ops-sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding: 16px 0;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  z-index: 5;
}
.ops-repeater {
  border: 1px solid var(--line);
  padding: 18px;
}
.ops-repeat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
  padding: 18px;
  background: var(--surface2);
}
.ops-repeat-tools {
  display: flex;
  gap: 8px;
  grid-column: 1/-1;
}
.ops-repeater[data-fixed] [data-row-add],
.ops-repeater[data-fixed] [data-row-delete] {
  display: none;
}
.ops-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--line);
}
.ops-toolbar button {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 13px;
}
.ops-rich {
  border: 1px solid var(--control);
}
.ops-rich-content {
  min-height: 320px;
  padding: 22px;
  outline-offset: 3px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
}
.ops-rich-content p {
  margin: 12px 0;
}
.ops-rich-content img {
  max-width: 100%;
  height: auto;
}
.ops-rich-content h2 {
  font-size: 1.4em;
}
.ops-media-grid article {
  border: 1px solid var(--line);
  padding: 18px;
}
.ops-media-grid img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: var(--surface2);
}
.ops-media-preview {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
}
.ops-console dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--control);
  padding: 24px;
}
.ops-console dialog::backdrop {
  background: #000a;
}
[data-media-results] {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
[data-media-results] button {
  padding: 12px;
}
[data-media-results] img {
  width: 100%;
  height: 130px;
  object-fit: contain;
}
@media (max-width: 1000px) {
  .ops-source-grid,
  .ops-languages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .ops-table-scroll {
    overflow: visible;
    border: 0;
  }
  .ops-table-scroll table,
  .ops-table-scroll tbody,
  .ops-table-scroll tr,
  .ops-table-scroll td {
    display: block;
    width: 100%;
    max-width: none;
  }
  .ops-table-scroll thead {
    display: none;
  }
  .ops-table-scroll tr {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
  }
  .ops-table-scroll td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
  }
}
@media (max-width: 600px) {
  .ops-form-grid,
  .ops-source-grid,
  .ops-metrics,
  .ops-repeat-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .ops-form,
  .ops-panel,
  .ops-empty {
    padding: 16px;
  }
  .ops-heading {
    align-items: flex-start;
  }
  .ops-languages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-sticky-actions {
    position: static;
  }
  [data-media-results] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-media-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-frame aside {
    width: 170px;
  }
}
@media (max-width: 700px) {
  .admin-frame {
    display: block;
  }
  .admin-frame aside {
    width: 100%;
    border-bottom: 1px solid var(--line);
  }
  .admin-frame nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .admin-frame nav a {
    padding: 8px;
  }
  .admin-header {
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
  }
  .admin-frame main {
    padding: 22px 16px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
