:root {
  --bg: #f4f7f7;
  --panel: #ffffff;
  --line: #dce4e7;
  --text: #1c2a2f;
  --muted: #64747a;
  --teal: #ee4d2d;
  --teal-soft: #fff1ec;
  --orange: #e95f2a;
  --orange-soft: #fff0e8;
  --green: #2d7d46;
  --green-soft: #eaf5ed;
  --amber: #a46a12;
  --amber-soft: #fff6df;
  --blue: #2f6f9f;
  --blue-soft: #e8f1f8;
  --shadow: 0 14px 32px rgba(28, 42, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 20px 14px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.brand {
  font-size: 20px;
  font-weight: 900;
  margin: 0 8px 18px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

.nav a.active {
  color: var(--teal);
  background: var(--teal-soft);
}

.main {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.row,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.name {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.wait { color: var(--amber); background: var(--amber-soft); }
.badge.done { color: var(--green); background: var(--green-soft); }
.badge.edit { color: var(--orange); background: var(--orange-soft); }
.badge.scan { color: var(--blue); background: var(--blue-soft); }

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
}

input,
select,
textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

input[type="file"] {
  padding: 9px 12px;
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 13px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.button.approve { background: var(--green); }
.button.remake { background: var(--amber); }
.button.download { background: var(--orange); }

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.video-preview {
  height: 132px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #edf3f3;
}

.video-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.video-player {
  width: 100%;
  height: 100%;
  display: block;
  background: #111;
  object-fit: contain;
}

.title-line {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

.mobile-page {
  min-height: 100vh;
  background: #edf3f1;
}

.mobile-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 18px 14px 94px;
}

.mobile-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 74px;
  padding: 8px 2px 18px;
}

.mobile-kicker {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.mobile-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.mobile-screen {
  display: grid;
  gap: 12px;
}

.mobile-screen[hidden] {
  display: none;
}

.mobile-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}

.mobile-section-title.compact {
  margin-top: 6px;
}

.mobile-section-title h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.mobile-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mobile-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.mobile-form input,
.mobile-form select,
.mobile-form textarea {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
}

.mobile-form textarea {
  min-height: 112px;
}

.mobile-page .list,
.mobile-page .video-list {
  display: grid;
  gap: 10px;
  padding: 0;
}

.mobile-page .row,
.mobile-page .card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mobile-page .name {
  font-size: 16px;
}

.mobile-page .meta {
  font-size: 13px;
  line-height: 1.55;
}

.mobile-page .actions {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: stretch;
}

.mobile-page .button {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

.mobile-page .badge {
  min-height: 32px;
  width: fit-content;
}

.mobile-page .video-preview {
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: 68vh;
}

.mobile-page .video-player {
  object-fit: contain;
}

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 24px rgba(28, 42, 47, 0.12);
}

.mobile-nav button {
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.mobile-nav button.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .main {
    padding: 16px;
  }

  .stats,
  .grid.two,
  .grid.three,
  .video-grid {
    grid-template-columns: 1fr;
  }
}
