:root {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  letter-spacing: 0;
  color: var(--pa-text);
  background: var(--pa-bg);
  --et-action: #2563eb;
  --et-action-hover: #1d4ed8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button,
select,
input,
textarea {
  font: inherit;
  color: var(--pa-text);
}

button,
select,
input[type="text"],
input[type="search"] {
  border: 1px solid var(--pa-border);
  border-radius: 4px;
  background: var(--pa-raised);
  height: 30px;
}

input[type="text"],
input[type="search"],
textarea {
  background: var(--pa-inset);
  padding: 4px 8px;
  font-size: 12px;
}

textarea {
  border: 1px solid var(--pa-border);
  border-radius: 4px;
  resize: vertical;
  width: 100%;
  line-height: 1.55;
}

button {
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

button:hover:not(:disabled) {
  background: var(--pa-hover);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button.danger:hover:not(:disabled) {
  color: var(--pa-danger);
  border-color: var(--pa-danger);
}

select {
  padding: 0 8px;
  font-size: 12px;
  max-width: 100%;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--et-action);
  outline-offset: 2px;
}

svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.icon {
  width: 30px;
  min-width: 30px;
  padding: 0;
  justify-content: center;
}

.topbar {
  height: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid var(--pa-border);
  background: var(--pa-panel);
}

.topbar .brand {
  order: 1;
}

.topbar h1 {
  order: 2;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.offline-tip {
  order: 2;
  font-size: 11px;
  color: var(--pa-muted);
  white-space: nowrap;
  position: relative;
  top: 2px;
}

#interface-language {
  order: 3;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar > .pathadd-theme-control {
  order: 4;
  margin-left: 0;
  flex-shrink: 0;
}

.privacy-tech-link {
  order: 5;
  font-size: 12px;
  color: var(--pa-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.privacy-tech-link:hover {
  color: var(--pa-text);
}

.privacy-line {
  order: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--pa-teal);
  background: var(--pa-success-soft);
  border: 1px solid var(--pa-border);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.privacy-line strong {
  font-weight: 600;
}

main {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.case-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.case-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--pa-muted);
  flex: 1 1 240px;
  min-width: 180px;
}

.case-field span {
  white-space: nowrap;
}

.case-field input {
  flex: 1;
  min-width: 0;
}

.watermark-field {
  flex: 0 1 260px;
}

.case-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.primary,
.segments button[aria-pressed="true"] {
  background: var(--et-action);
  border-color: var(--et-action);
  color: #ffffff;
  font-weight: 600;
}

.primary:hover:not(:disabled),
.segments button[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--et-action-hover);
  border-color: var(--et-action-hover);
}

.segments {
  display: inline-flex;
  border: 1px solid var(--pa-border);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.segments button {
  border: 0;
  border-radius: 0;
  height: 26px;
  padding: 0 9px;
  font-size: 11px;
  background: var(--pa-panel);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.5fr);
  flex: 1;
  min-height: 260px;
  border: 1px solid var(--pa-border);
}

.timeline-pane,
.editor-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.timeline-pane {
  border-right: 1px solid var(--pa-border);
  background: var(--pa-inset);
}

.timeline-pane.drag-over {
  box-shadow: inset 0 0 0 2px var(--et-action);
}

.pane-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-bottom: 1px solid var(--pa-border);
  background: var(--pa-panel);
}

.pane-heading .icon {
  width: 26px;
  min-width: 26px;
  height: 26px;
}

h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.meta {
  font-size: 11px;
  color: var(--pa-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--pa-border);
  background: var(--pa-panel);
}

.timeline-controls input {
  flex: 1;
  min-width: 0;
  height: 26px;
  font-size: 11px;
}

.timeline-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.timeline-list::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: var(--pa-border);
}

.event-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 9px 10px;
  border: 1px solid var(--pa-border);
  border-radius: 6px;
  background: var(--pa-panel);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.event-card::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pa-muted);
  border: 2px solid var(--pa-inset);
}

.event-card[aria-selected="true"] {
  border-color: var(--et-action);
  background: var(--pa-raised);
  box-shadow: 0 0 0 1px var(--et-action);
}

.event-card[aria-selected="true"]::before {
  background: var(--et-action);
}

.event-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.event-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--et-action);
}

.event-time {
  font-size: 11px;
  color: var(--pa-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--pa-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--pa-muted);
}

.badge {
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--pa-border);
  background: var(--pa-inset);
  font-size: 10px;
}

.badge.redacted {
  color: var(--pa-teal);
  border-color: var(--pa-teal);
}

.event-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--pa-border);
  grid-row: 1 / span 2;
  grid-column: 2;
}

.empty-hint,
.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--pa-muted);
  gap: 8px;
}

.editor-empty h3 {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--pa-text);
}

.editor-empty p,
.empty-hint p {
  margin: 0;
  font-size: 12px;
  max-width: 380px;
  line-height: 1.6;
}

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 12px;
  gap: 10px;
  overflow-y: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--pa-muted);
}

.summary-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--pa-muted);
}

.mini-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
}

.canvas-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  border: 1px solid var(--pa-border);
  border-radius: 6px;
  overflow: hidden;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--pa-panel);
  border-bottom: 1px solid var(--pa-border);
  flex-wrap: wrap;
}

.canvas-title {
  font-size: 11px;
  color: var(--pa-muted);
}

.canvas-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.canvas-tools .icon {
  width: 26px;
  min-width: 26px;
  height: 26px;
}

.image-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--pa-panel);
  border-bottom: 1px solid var(--pa-border);
  overflow-x: auto;
  flex-shrink: 0;
}

.strip-item {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 2px solid var(--pa-border);
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--pa-inset);
}

.strip-item[aria-selected="true"] {
  border-color: var(--et-action);
  box-shadow: 0 0 0 1px var(--et-action);
}

.strip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.strip-idx {
  position: absolute;
  left: 3px;
  top: 3px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 10px;
  line-height: 15px;
}

.strip-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pa-teal);
  border: 1px solid #ffffff;
}

.file-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px;
  background: var(--pa-panel);
  border-bottom: 1px solid var(--pa-border);
  flex-shrink: 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--pa-border);
  border-radius: 4px;
  background: var(--pa-inset);
}

.file-name {
  font-weight: 600;
  color: var(--pa-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.file-meta {
  color: var(--pa-muted);
  font-family: monospace;
  font-size: 10px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-immutable {
  color: var(--pa-teal);
  border: 1px solid var(--pa-teal);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  white-space: nowrap;
}

.file-del {
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pa-muted);
  justify-content: center;
}

.file-del:hover {
  color: var(--pa-danger);
  background: var(--pa-hover);
}

.canvas-stage {
  flex: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--pa-inset);
  overflow: auto;
}

#redact-canvas {
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  border: 1px solid var(--pa-border);
  box-shadow: 0 4px 16px #00000026;
}

.no-image-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--pa-muted);
  font-size: 12px;
  text-align: center;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 6px 0 8px;
  font-size: 11px;
  color: var(--pa-muted);
  flex-wrap: wrap;
}

.footer-status,
.footer-notes {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

footer p {
  margin: 0;
}

#notice[data-error="true"] {
  color: var(--pa-danger);
}

.hash-info {
  font-family: monospace;
  font-size: 10px;
}

[hidden] {
  display: none !important;
}

dialog.tech-guide {
  max-width: 640px;
  width: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--pa-border);
  border-radius: 8px;
  background: var(--pa-panel);
  color: var(--pa-text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

dialog.tech-guide::backdrop {
  background: rgba(15, 23, 42, 0.65);
}

.tech-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pa-border);
}

.tech-guide-head h2 {
  font-size: 14px;
}

.tech-guide-body {
  padding: 14px 18px 18px;
  font-size: 12px;
  line-height: 1.7;
  max-height: 75dvh;
  overflow-y: auto;
}

.tech-guide-body h3 {
  font-size: 13px;
  margin: 10px 0 6px;
  color: var(--et-action);
}

.tech-guide-body section:first-child h3 {
  margin-top: 0;
}

.tech-guide-body ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

.tech-guide-body li {
  margin-bottom: 6px;
}

body.doc-page {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
}

.doc-main {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 36px;
  flex: 1;
}

.doc-nav {
  margin-bottom: 14px;
}

.doc-back {
  font-size: 12px;
  color: var(--et-action);
  text-decoration: none;
}

.doc-back:hover {
  text-decoration: underline;
}

.doc-card {
  background: var(--pa-panel);
  border: 1px solid var(--pa-border);
  border-radius: 8px;
  padding: 20px 24px;
}

.doc-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--pa-muted);
}

.doc-card h2 {
  font-size: 18px;
  margin: 0 0 16px;
}

.doc-card h3 {
  font-size: 14px;
  margin: 16px 0 8px;
  color: var(--et-action);
}

.doc-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.75;
}

.doc-card li {
  margin-bottom: 8px;
}

.doc-p {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.7;
}

.doc-action-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--et-action);
  color: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.doc-action-link:hover {
  background: var(--et-action-hover);
}

.doc-cmd {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--pa-border);
  background: var(--pa-inset);
  font: 12px/1.65 Consolas, "Cascadia Code", monospace;
  overflow-x: auto;
}

@media (max-width: 1150px) {
  .topbar {
    gap: 8px;
    padding: 0 12px;
  }
  .topbar h1 {
    font-size: 14px;
  }
  .offline-tip {
    display: none;
  }
  .workspace {
    grid-template-columns: minmax(240px, 0.65fr) minmax(0, 1.35fr);
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    height: auto;
    overflow: auto;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .timeline-pane {
    border-right: 0;
    border-bottom: 1px solid var(--pa-border);
    max-height: 360px;
  }
}
