:root {
  --ink: #16302a;
  --muted: #5d726a;
  --teal: #156f67;
  --teal-dark: #0f4f49;
  --mint: #d7ece2;
  --mint-strong: #c2e1d4;
  --sand: #efe5cf;
  --linen: rgba(248, 243, 232, 0.9);
  --card: rgba(244, 239, 227, 0.88);
  --card-strong: rgba(250, 246, 238, 0.94);
  --line: rgba(56, 93, 83, 0.16);
  --red: #b64033;
  --gold: #a56a19;
  --blue: #2b5ec7;
  --shadow: 0 20px 48px rgba(21, 48, 42, 0.12);
  --float-reserve: 72px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(157, 192, 174, 0.32), transparent 26rem),
    radial-gradient(circle at right 12% top 10%, rgba(232, 214, 177, 0.26), transparent 24rem),
    linear-gradient(135deg, #d9e4d7 0%, #e7decb 42%, #c9dace 100%);
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

.app {
  max-width: min(1880px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 26px calc(26px + var(--float-reserve)) 36px 26px;
}

.panel,
.login-card,
.dialog {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(460px, 100%);
  padding: 30px;
  display: grid;
  gap: 14px;
}

.login-card h1,
.banner h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
}

.login-card p,
.banner p,
.watch-head p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.eyebrow {
  color: var(--teal);
  font-weight: 800;
  letter-spacing: .16em;
  font-size: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--ink);
  background: rgba(255, 252, 246, 0.78);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(21, 111, 103, 0.18);
  border-color: rgba(21, 111, 103, 0.38);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: linear-gradient(135deg, #156f67, #0f5d56); }
.btn.light { color: var(--teal-dark); background: var(--mint); }
.btn.ghost { color: var(--teal-dark); background: rgba(255, 251, 245, 0.86); border: 1px solid var(--line); }
.btn.danger-btn { color: var(--red); background: rgba(255, 243, 240, 0.95); border: 1px solid rgba(182, 64, 51, 0.24); }
.btn:disabled { opacity: .58; cursor: wait; transform: none; }
.btn.small { padding: 8px 11px; font-size: 12px; }

.error { color: var(--red); min-height: 20px; }
.muted { color: var(--muted); line-height: 1.7; }
.full-label { margin-top: 14px; }
.import-result { margin-top: 12px; color: var(--teal-dark); font-weight: 800; min-height: 22px; }

.banner {
  min-height: 120px;
  padding: 26px 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(245, 238, 224, 0.96), rgba(228, 238, 226, 0.88)),
    radial-gradient(circle at top right, rgba(21, 111, 103, 0.08), transparent 16rem);
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(249, 244, 234, 0.9), rgba(240, 236, 224, 0.8));
}

.metric span { color: var(--muted); font-size: 14px; }
.metric strong { display: block; margin-top: 8px; font-size: 30px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.section { padding: 22px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.compact-title { margin-bottom: 10px; }
.section h2 { margin: 0; font-size: 22px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar select { min-width: 132px; }
.patent-toolbar {
  flex-wrap: nowrap;
  width: min(100%, 720px);
  justify-content: flex-end;
}
.patent-toolbar select {
  flex: 0 0 160px;
  min-width: 160px;
}
.patent-toolbar input {
  flex: 1 1 360px;
  min-width: 240px;
}
.count-chip { white-space: nowrap; }
.chip {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(215, 236, 226, 0.92);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

.table-scroll {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(251, 248, 241, 0.78);
}

.patent-scroll { max-height: 410px; }
.software-scroll { max-height: 280px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
.patent-table th,
.patent-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}

th {
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(240, 236, 224, 0.98);
}

.patent-table { table-layout: fixed; min-width: 1320px; }
.patent-col-title { width: 25%; }
.patent-col-number { width: 14%; }
.patent-col-type { width: 9%; }
.patent-col-folder { width: 7%; }
.patent-col-ipc { width: 8%; }
.patent-col-inventor { width: 12%; }
.patent-col-status { width: 7%; }
.patent-col-due { width: 9%; }
.patent-col-actions { width: 9%; }

.patent-table td:nth-child(1),
.patent-table th:nth-child(1) { min-width: 260px; }
.patent-table td:nth-child(4) {
  white-space: nowrap;
}
.patent-table td:nth-child(5) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.patent-table td:nth-child(9) { white-space: normal; }
.patent-table td:nth-child(9) .btn { margin: 2px 2px 2px 0; }

.copyright-table {
  table-layout: fixed;
  min-width: 1320px;
}

.copyright-col-name { width: 25%; }
.copyright-col-number { width: 14%; }
.copyright-col-version { width: 9%; }
.copyright-col-folder { width: 7%; }
.copyright-col-owner { width: 20%; }
.copyright-col-status { width: 7%; }
.copyright-col-date { width: 9%; }
.copyright-col-actions { width: 9%; }

.copyright-table td:nth-child(1),
.copyright-table th:nth-child(1) {
  min-width: 250px;
}

.copyright-table td:nth-child(2),
.copyright-table td:nth-child(5) {
  overflow-wrap: anywhere;
}

.copyright-table td:nth-child(4) {
  white-space: nowrap;
}

.copyright-table td:nth-child(8) {
  white-space: normal;
}

.copyright-table td:nth-child(8) .btn {
  margin: 2px 2px 2px 0;
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--teal-dark);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.link-button:hover { color: var(--teal); text-decoration: underline; }

.status,
.type-badge {
  padding: 6px 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  display: inline-block;
  white-space: nowrap;
}

.type-badge { border: 1px solid transparent; font-weight: 900; }
.type-invention { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.type-utility { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.type-design { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.type-other { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.ok { background: #dcfce7; color: #166534; }
.warn { background: #fef3c7; color: var(--gold); }
.danger { background: #fee2e2; color: var(--red); }
.sync { background: #dbeafe; color: var(--blue); }

.subsection { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.soft-tools,
.patent-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.tool-card,
.fee-card,
.monitor-card,
.monitor-table-card {
  padding: 15px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(252, 248, 241, 0.88), rgba(241, 236, 224, 0.78));
}

.tool-card-head,
.watch-head,
.floating-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tool-card p,
.fee-meta { color: var(--muted); font-size: 13px; line-height: 1.6; }
tr.selected td { background: rgba(21, 111, 103, 0.08); }

.fee-panel {
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - 108px));
  max-height: min(620px, calc(100vh - 110px));
}

.fee-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
  max-height: 440px;
}

.fee-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.fee-card { padding: 12px; }
.fee-card.urgent { border-color: rgba(182, 64, 51, 0.3); background: rgba(255, 242, 238, 0.92); }
.fee-card.warning { border-color: rgba(165, 106, 25, 0.28); background: rgba(255, 249, 234, 0.92); }
.fee-card.plan { border-color: rgba(43, 94, 199, 0.22); background: rgba(239, 244, 255, 0.88); }
.fee-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fee-name { font-weight: 800; line-height: 1.35; }
.fee-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.risk-menu { position: fixed; top: 18px; right: 20px; z-index: 20; }
.risk-trigger,
.fee-trigger {
  border: 1px solid rgba(21, 111, 103, 0.2);
  box-shadow: 0 14px 34px rgba(16, 36, 33, 0.14);
  color: var(--teal-dark);
  background: rgba(250, 246, 239, 0.96);
}

.risk-trigger {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}

.risk-panel {
  position: absolute;
  top: 56px;
  right: 0;
  width: 320px;
  padding: 18px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: .18s ease;
}

.risk-menu:hover .risk-panel,
.risk-menu:focus-within .risk-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.risk-line {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.fee-menu {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 19;
  display: flex;
  align-items: flex-start;
}

.fee-trigger {
  width: 58px;
  min-height: 186px;
  border-radius: 22px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 12px 8px;
  font-size: 16px;
}

.fee-trigger-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: .16em;
  font-size: 1em;
  font-weight: 900;
  line-height: 1.1;
}

.fee-trigger-bars {
  width: 1.75em;
  display: grid;
  gap: .32em;
  justify-items: start;
  position: relative;
}

.fee-trigger-bars i {
  display: block;
  width: 1.75em;
  height: .18em;
  border-radius: 999px;
  background: var(--teal-dark);
}

.fee-trigger-bars i.short { width: .88em; }
.fee-trigger-bars i.triangle-gap { margin-bottom: .04em; }
.fee-trigger-bars b {
  position: absolute;
  right: .08em;
  top: .68em;
  width: 0;
  height: 0;
  border-left: .58em solid var(--gold);
  border-top: .34em solid transparent;
  border-bottom: .34em solid transparent;
}

.fee-menu .fee-panel {
  position: absolute;
  top: 0;
  right: 68px;
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
  transition: .18s ease;
}

.fee-menu:hover .fee-panel,
.fee-menu:focus-within .fee-panel {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 248px;
  overflow: auto;
}

.file-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(231, 239, 229, 0.94);
}

.file-modal-upload,
.file-modal-batch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.file-category-field {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.file-category-field select {
  width: 120px;
  padding: 8px 10px;
  border-radius: 999px;
}

.file-modal-list {
  max-height: min(440px, calc(100vh - 330px));
  padding-right: 4px;
}

.file-batch-actions {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(231, 239, 229, 0.94);
}

.file-batch-meta,
.file-batch-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.file-batch-summary {
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 12px;
}

.file-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.86);
  color: var(--muted);
  font-size: 12px;
}

.file-line input { width: auto; }
.file-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-line a { color: var(--teal-dark); font-weight: 800; text-decoration: none; }
.file-actions { display: flex; align-items: center; gap: 8px; }
.file-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: rgba(215, 236, 226, 0.92);
  border: 1px solid rgba(21, 111, 103, 0.14);
  font-size: 12px;
  font-weight: 900;
}
.text-danger {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--red);
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}
.file-empty { color: var(--muted); font-size: 12px; margin-top: 10px; }

.competitor-monitor { margin-top: 18px; }
.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.monitor-table-card {
  padding: 0;
  overflow: hidden;
}

.monitor-table-card .table-scroll {
  max-height: 400px;
  border: 0;
  border-radius: 18px;
}

.monitor-table-card table {
  min-width: 1480px;
}

.competitor-dialog {
  width: min(1040px, calc(100vw - 30px));
}

.competitor-dialog .monitor-card {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.auto-watch-card { display: grid; gap: 14px; }
.watch-head-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.monitor-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.watch-box { display: grid; gap: 10px; }
.watch-list { display: grid; gap: 10px; max-height: 250px; overflow: auto; }
.watch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 251, 245, 0.84);
}
.watch-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.watch-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-content: start; }
.ledger-form {
  display: grid;
  gap: 12px;
}
.ledger-grid {
  margin-top: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.full-span {
  grid-column: 1 / -1;
}
.ledger-actions {
  margin-top: 4px;
}
.competitor-owner {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.audit { margin-top: 18px; }
.audit-list { display: grid; gap: 8px; color: var(--muted); font-size: 13px; max-height: 180px; overflow: auto; }

.dialog { width: min(760px, calc(100vw - 30px)); border: 0; padding: 24px; background: var(--card-strong); }
.dialog.wide { width: min(980px, calc(100vw - 30px)); }
.dialog::backdrop { background: rgba(16, 36, 33, 0.48); }
.dialog-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 251, 245, 0.9);
}

.detail-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.detail-row:nth-last-child(-n + 2) { border-bottom: 0; }
.detail-row span {
  padding: 11px 12px;
  background: rgba(224, 236, 228, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border-right: 1px solid var(--line);
}
.detail-row strong { padding: 11px 12px; line-height: 1.45; overflow-wrap: anywhere; }

.abstract-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  margin-top: 14px;
}

.abstract-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.9);
  color: var(--muted);
  line-height: 1.75;
}

.figure-box {
  min-height: 190px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(21, 111, 103, 0.35);
  border-radius: 18px;
  background: rgba(237, 244, 239, 0.85);
  color: var(--teal-dark);
  font-weight: 800;
  text-align: center;
  padding: 16px;
}

.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.check input { width: auto; }

@media (max-width: 1280px) {
  .banner,
  .metrics,
  .monitor-grid { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .patent-toolbar {
    width: 100%;
  }
  .app {
    padding-right: 32px;
  }
}

@media (max-width: 900px) {
  .soft-tools,
  .patent-tools,
  .detail-list,
  .abstract-layout,
  .form-grid { grid-template-columns: 1fr; }
  .ledger-grid { grid-template-columns: 1fr; }
  .patent-toolbar {
    flex-wrap: wrap;
  }

  .detail-row:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .detail-row:last-child { border-bottom: 0; }
}

@media (max-width: 720px) {
  .app { padding: 16px; padding-top: 74px; }
  table { white-space: nowrap; }
  .fee-menu .fee-panel {
    right: 0;
    top: 208px;
    width: min(92vw, 520px);
  }
}
