:root {
  --bg: #f4f5f1;
  --surface: #fff;
  --ink: #172a24;
  --muted: #718077;
  --line: #dfe5dd;
  --accent: #155e4b;
  --soft: #eaf3ed;
  --danger: #b23b3b;
  --shadow: 0 8px 32px #172a2405;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.6 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
label.button-label {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
[data-finder]:disabled {
  cursor: not-allowed;
}
.cleanup-link {
  color: var(--danger);
}
.output-actions .cleanup-link {
  flex: 0 0 auto;
  min-width: 44px;
}
#cleanup-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  color: var(--ink);
  background: var(--surface);
}
#cleanup-dialog::backdrop {
  background: #172a2470;
}
#cleanup-form {
  display: grid;
  gap: 16px;
}
#cleanup-title {
  font-size: 20px;
}
#cleanup-options {
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
}
#cleanup-options legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}
.cleanup-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.cleanup-choice input {
  flex: 0 0 auto;
  margin: 5px 0 0;
  width: 16px;
  height: 16px;
}
.cleanup-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--soft);
}
.cleanup-choice small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
#cleanup-file-details {
  min-width: 0;
  font-size: 12px;
}
#cleanup-file-details summary {
  cursor: pointer;
  overflow-wrap: anywhere;
}
#cleanup-file-list {
  max-height: 180px;
  overflow: auto;
  padding-left: 18px;
}
#cleanup-file-list li {
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
#cleanup-file-list small {
  display: block;
  color: var(--muted);
}
.cleanup-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.cleanup-buttons button {
  min-height: 44px;
}
.primary.danger-button {
  background: var(--danger);
  border-color: var(--danger);
}
button,
a,
input,
select,
summary {
  outline-offset: 4px;
}
a {
  color: var(--accent);
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 30px;
  letter-spacing: -1px;
  line-height: 1.4;
}
h2 {
  font-size: 16px;
}
h3 {
  font-size: 15px;
}
p {
  color: var(--muted);
}
code {
  font:
    12px/1.6 ui-monospace,
    SFMono-Regular,
    monospace;
  overflow-wrap: anywhere;
}
header {
  height: 88px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 5px;
}
.brand-mark {
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 23px;
  letter-spacing: -3px;
  padding-right: 3px;
  font-weight: 700;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}
.pill,
.small-tag {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
}
.version {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
}
.layout {
  max-width: 1500px;
  margin: auto;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: calc(100vh - 140px);
}
nav {
  padding: 38px 16px;
  border-right: 1px solid var(--line);
}
.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 14px 13px;
  border-radius: 9px;
  text-align: left;
  margin-bottom: 8px;
}
.nav-button span {
  font:
    11px ui-monospace,
    monospace;
  opacity: 0.55;
}
.nav-button.active {
  background: var(--soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-button b {
  font-size: 10px;
}
.nav-note {
  font-size: 11px;
  line-height: 1.9;
  color: var(--muted);
  padding: 40px 14px;
}
main {
  min-width: 0;
  padding: 38px 38px 50px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 700;
}
.page-heading {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}
.page-heading p {
  margin-top: 10px;
  font-size: 13px;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr);
  gap: 24px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  gap: 8px;
}
.library-head {
  flex-wrap: wrap;
  gap: 12px;
}
.library-head h2 {
  white-space: nowrap;
}
.library-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.library-actions .secondary {
  padding: 6px 10px;
  color: var(--accent);
}
.count {
  font:
    11px ui-monospace,
    monospace;
  background: var(--bg);
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 7px;
  margin-left: 6px;
}
.secondary,
.primary,
.button-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.button-label {
  color: var(--accent);
  padding: 6px 10px;
  cursor: pointer;
}
.wide {
  width: 100%;
}
.text-button {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 6px 0;
  font-size: 12px;
}
.search {
  display: block;
  width: calc(100% - 44px);
  margin: 0 22px 15px;
  background: var(--bg);
}
input,
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
  font-size: 16px;
}
input[type="file"] {
  font-size: 12px;
}
input[type="checkbox"],
input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
label > input,
label > select {
  margin-top: 7px;
}
.file-list {
  min-height: 260px;
  max-height: 620px;
  overflow: auto;
}
.file-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 17px 22px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.file-card.selected {
  background: var(--soft);
}
.file-card input {
  margin-top: 15px;
}
.app-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-size: 19px;
  font-weight: 700;
}
.file-info {
  flex: 1;
  min-width: 0;
}
.file-info h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info p {
  font-size: 11px;
  overflow-wrap: anywhere;
  margin-top: 3px;
}
.file-info .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  margin-top: 6px;
  color: var(--muted);
}
.panel-foot {
  border-top: 1px solid var(--line);
  padding: 15px 22px;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
}
.composer {
  padding: 0 22px 22px;
}
.composer > .panel-head {
  padding-left: 0;
  padding-right: 0;
}
.selected-ipa {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}
.selected-ipa strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
}
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin: 10px 0;
}
.cert-choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 8px 0;
  padding: 12px;
  cursor: pointer;
}
.cert-choice input {
  margin-top: 3px;
}
.cert-choice strong {
  display: block;
  font-size: 13px;
}
.cert-choice small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.cert-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--soft);
}
.advanced {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
  margin: 20px 0;
  font-size: 12px;
}
.signing-mode {
  margin: 20px 0;
}
.signing-mode select {
  margin: 7px 0;
  font-size: 14px;
}
.advanced summary {
  cursor: pointer;
  font-weight: 600;
}
.advanced p {
  margin-top: 12px;
}
.advanced label {
  margin-top: 12px;
}
.naming {
  margin-bottom: 20px;
}
.naming span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}
.naming code {
  display: block;
  font-size: 10px;
}
.footnote {
  font-size: 11px;
  margin-top: 12px;
  line-height: 1.8;
}
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty strong {
  color: var(--ink);
  display: block;
  margin-bottom: 9px;
  font-size: 16px;
}
.form-panel {
  padding: 24px;
}
.form-panel h2 {
  margin-bottom: 18px;
}
.form-panel label {
  margin-bottom: 16px;
}
.form-panel p {
  margin-bottom: 16px;
}
.form-panel form + form {
  margin-top: 20px;
}
.hint {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.hint.warning,
.error {
  color: var(--danger);
}
.library-panel > .hint {
  margin: 0 22px 14px;
}
.certificate-list {
  display: grid;
  gap: 16px;
}
.cert-card {
  padding: 22px;
}
.cert-card .head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 15px;
}
.cert-card h2 {
  font-size: 17px;
}
.cert-card .detail {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.profile-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.profile-row strong {
  font-size: 12px;
}
.cert-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.path {
  font:
    12px ui-monospace,
    monospace;
  overflow-wrap: anywhere;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}
.job-card {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  margin-bottom: 14px;
}
.job-card .detail,
.output-card .detail {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.job-card .error {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  margin-top: 12px;
}
.job-card h3 {
  font-size: 16px;
  margin-bottom: 5px;
}
.job-state {
  font-size: 12px;
  color: var(--accent);
}
.job-state.failed,
.job-state.interrupted {
  color: var(--danger);
}
.page-actions,
.output-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.output-hint {
  margin: -12px 0 28px;
}
.output-certificate {
  margin-bottom: 32px;
}
.output-cert-head,
.output-date-head,
.output-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.output-cert-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.output-cert-head h2 {
  font-size: 20px;
  overflow-wrap: anywhere;
}
.output-date-head {
  margin: 18px 0 12px;
}
.output-date-head h3 {
  font-size: 13px;
  color: var(--muted);
}
.output-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 20px;
  padding: 20px 22px;
  margin-bottom: 12px;
}
.output-file {
  min-width: 0;
}
.output-file code {
  display: block;
  margin: 7px 0 4px;
}
.output-title h3 {
  overflow-wrap: anywhere;
}
.output-details {
  grid-column: 1/-1;
  font-size: 11px;
  color: var(--muted);
}
.output-details summary {
  cursor: pointer;
  width: fit-content;
}
.output-details > div {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.unfinished-jobs {
  margin-top: 32px;
}
.unfinished-jobs > h2 {
  margin-bottom: 14px;
}
.job-output {
  grid-column: 1/-1;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.job-output code {
  font-size: 11px;
}
.job-output > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.job-output small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.login {
  width: min(420px, 100%);
  margin: 12vh auto;
  padding: 24px;
}
.login h1 {
  margin-top: 24px;
}
.login form {
  margin: 25px 0;
  display: grid;
  gap: 18px;
}
.login > .muted {
  font-size: 12px;
}
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, 90vw);
  padding: 13px 20px;
  background: var(--ink);
  color: white;
  border-radius: 10px;
  z-index: 100;
  font-size: 13px;
  box-shadow: 0 8px 30px #0002;
}
.toast.bad {
  background: #893535;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1px;
}
.hidden {
  display: none !important;
}
#pairing strong {
  display: block;
  font:
    22px ui-monospace,
    monospace;
  letter-spacing: 2px;
  color: var(--ink);
  margin: 10px 0;
}
#pairing a {
  display: block;
  overflow-wrap: anywhere;
}
button:hover,
.button-label:hover {
  filter: brightness(0.96);
}
@media (max-width: 1100px) {
  header {
    padding: 0 24px;
  }
  .layout {
    grid-template-columns: 155px minmax(0, 1fr);
  }
  main {
    padding: 28px 22px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .nav-button {
    gap: 7px;
    font-size: 12px;
  }
  h1 {
    font-size: 26px;
  }
  .file-list {
    max-height: 420px;
  }
}
@media (max-width: 600px) {
  #tab-jobs .page-heading {
    flex-direction: column;
  }
  .output-hint {
    margin-top: 0;
  }
  .output-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px;
  }
  .output-actions {
    width: 100%;
  }
  .output-actions > * {
    flex: 1;
    min-height: 44px;
    padding: 9px;
    font-size: 12px;
  }
  header {
    height: 72px;
    padding: 0 18px;
  }
  .brand {
    font-size: 17px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 21px;
  }
  .version {
    display: none;
  }
  .header-right {
    gap: 4px;
  }
  .pill {
    font-size: 10px;
    padding: 3px 7px;
  }
  .layout {
    display: block;
  }
  nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 9px 8px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
    border-right: 0;
  }
  .nav-button {
    display: block;
    padding: 9px 2px;
    margin: 0;
    text-align: center;
    font-size: 11px;
    border-radius: 8px;
  }
  .nav-button span,
  .nav-note {
    display: none;
  }
  .nav-button b {
    margin-left: 3px;
  }
  main {
    padding: 26px 16px 95px;
  }
  .page-heading {
    gap: 12px;
    align-items: start;
    margin-bottom: 22px;
  }
  .page-heading > .secondary {
    padding: 7px 9px;
    font-size: 11px;
    margin-top: 22px;
  }
  .page-heading p {
    font-size: 12px;
  }
  h1 {
    font-size: 23px;
    letter-spacing: -0.8px;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 1.5px;
  }
  .workspace {
    gap: 18px;
  }
  .panel-head {
    padding: 17px;
  }
  .library-actions {
    width: 100%;
  }
  .library-actions > .secondary,
  .library-actions > .button-label {
    flex: 1;
    min-height: 44px;
  }
  .composer {
    padding: 0 17px 18px;
  }
  .search {
    width: calc(100% - 34px);
    margin-left: 17px;
    margin-right: 17px;
  }
  .file-card {
    padding: 15px 17px;
    gap: 9px;
  }
  .app-icon {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    font-size: 16px;
  }
  .file-card input {
    width: 15px;
    height: 15px;
  }
  .file-info h3 {
    font-size: 14px;
  }
  .panel-foot {
    padding: 13px 17px;
  }
  .form-panel,
  .cert-card {
    padding: 18px;
  }
  .job-card {
    padding: 18px;
  }
  .job-output {
    align-items: start;
    flex-direction: column;
  }
  .job-output .secondary {
    width: 100%;
  }
  footer {
    display: none;
  }
  .toast {
    bottom: 95px;
  }
  .settings-grid {
    gap: 18px;
  }
  .small-tag {
    font-size: 10px;
    padding: 3px 7px;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101b17;
    --surface: #172720;
    --ink: #e3ebe6;
    --muted: #9aaba1;
    --line: #2c3c33;
    --accent: #7dd0ac;
    --soft: #203e30;
  }
  .primary {
    background: #8bd7b5;
    color: #10251a;
  }
  .brand-mark {
    background: #8bd7b5;
    color: #10251a;
  }
  .toast {
    background: #dfebe2;
    color: #132319;
  }
  .toast.bad {
    color: white;
  }
}
