﻿:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f1;
  --ink: #15201d;
  --muted: #65716d;
  --line: #dce4e1;
  --accent: #0e7a62;
  --accent-strong: #075845;
  --accent-soft: #dff3ec;
  --red: #b42318;
  --red-soft: #fde8e5;
  --blue: #2563eb;
  --blue-soft: #e7efff;
  --amber: #9a6700;
  --amber-soft: #fff2cc;
  --shadow: 0 18px 45px rgba(23, 38, 34, 0.08);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(14, 122, 98, 0.1), transparent 260px),
    var(--bg);
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 96px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 4px;
  font-size: 17px;
  letter-spacing: 0;
}

.market-clock {
  min-width: 190px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  text-align: right;
}

.market-clock span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.market-clock strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.logout-button {
  display: inline-grid;
  place-items: center;
  margin-top: 10px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 720;
  text-decoration: none;
}

.logout-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-link {
  margin-right: 6px;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1 {
  margin-bottom: 22px;
  font-size: 32px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form .primary-button {
  margin-top: 4px;
}

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

.metric {
  min-height: 106px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.05;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.entry-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.entry-panel {
  position: sticky;
  top: 16px;
  padding: 18px;
}

.results-panel {
  min-height: 560px;
  padding: 18px;
}

.panel-title,
.toolbar,
.form-actions,
.card-head,
.quick-levels,
.score-row,
.price-line {
  display: flex;
  align-items: center;
}

.panel-title,
.toolbar,
.card-head,
.price-line {
  justify-content: space-between;
  gap: 12px;
}

.toolbar {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.icon-button,
.remove-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover,
.remove-button:hover,
.secondary-button:hover {
  border-color: var(--accent);
}

.holding-rows {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.holding-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.holding-main,
.alert-fields {
  display: grid;
  gap: 9px;
  align-items: end;
}

.holding-main {
  grid-template-columns: 1.25fr 0.9fr 0.8fr 36px;
}

.alert-fields {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

select {
  min-height: 38px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 122, 98, 0.14);
}

.form-actions {
  gap: 10px;
  margin-top: 16px;
}

.saved-holdings {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.saved-holdings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.saved-holdings-head h3 {
  margin: 0;
  font-size: 16px;
}

.saved-holdings-head span {
  color: var(--muted);
  font-size: 12px;
}

.holding-list {
  display: grid;
  gap: 8px;
}

.holding-list-empty,
.holding-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.holding-list-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.holding-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.holding-list-item strong,
.holding-list-item span,
.holding-list-item small {
  display: block;
}

.holding-list-item strong {
  margin-bottom: 3px;
}

.holding-list-item span,
.holding-list-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.holding-list-actions {
  display: inline-flex;
  gap: 6px;
}

.holding-list-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 720;
}

.holding-list-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 750;
}

.primary-button {
  flex: 1;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.note {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.note strong {
  color: var(--ink);
}

.note p {
  margin: 4px 0 0;
}

.prebuy-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.compact-title h2 {
  font-size: 18px;
}

.prebuy-form,
.confirm-buy-form {
  display: grid;
  gap: 10px;
}

.confirm-buy-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.confirm-buy-form button {
  grid-column: 1 / -1;
}

.prebuy-result {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.prebuy-result.empty {
  color: var(--muted);
  background: var(--surface-muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: 18px;
}

.admin-card label,
.admin-form {
  display: grid;
  gap: 12px;
}

.admin-card label + label {
  margin-top: 12px;
}

.admin-wide {
  grid-column: 1 / -1;
}

.admin-count {
  color: var(--muted);
  font-size: 13px;
}

.template-list {
  display: grid;
  gap: 10px;
}

.template-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.template-item strong {
  display: block;
  margin-bottom: 6px;
}

.template-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.weather-admin p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.prebuy-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.prebuy-head h3 {
  margin-bottom: 2px;
}

.prebuy-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.prebuy-level {
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 9px;
}

.prebuy-level span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.prebuy-level strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

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

.watch-button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 780;
}

.watch-button.is-running {
  border-color: var(--red);
  background: var(--red);
}

.watch-controls span {
  color: var(--muted);
  font-size: 13px;
}

.status {
  min-height: 22px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
}

.status.error {
  color: var(--red);
}

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

.report-panel {
  display: grid;
  gap: 14px;
}

.report-panel[hidden] {
  display: none;
}

.report-toolbar,
.report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.report-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-metric {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.report-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.report-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.report-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.report-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

.report-table th {
  background: #fbfcfc;
  color: var(--muted);
  font-weight: 760;
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.stock-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.card-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.stock-title {
  min-width: 0;
}

.stock-title h3 {
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-title span {
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.tag.hold {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag.buy {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.sell,
.tag.danger {
  background: var(--red-soft);
  color: var(--red);
}

.tag.wait,
.tag.neutral {
  background: var(--amber-soft);
  color: var(--amber);
}

.card-body {
  padding: 16px;
}

.price-line {
  margin-bottom: 14px;
}

.price {
  font-size: 34px;
  font-weight: 820;
  line-height: 1;
}

.change {
  font-size: 15px;
  font-weight: 760;
}

.up {
  color: var(--red);
}

.down {
  color: var(--accent);
}

.flat {
  color: var(--muted);
}

.quick-levels {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.alert-list,
.operation-panel,
.pending-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.alert-list {
  display: grid;
  gap: 8px;
}

.alert-item {
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.45;
}

.alert-item.danger,
.alert-item.clear {
  background: var(--red-soft);
  color: var(--red);
}

.alert-item.buy {
  background: var(--blue-soft);
  color: var(--blue);
}

.operation-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.operation-button,
.confirm-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 720;
}

.operation-button:hover,
.confirm-button:hover {
  border-color: var(--accent);
}

.pending-panel {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}

.level {
  flex: 1 1 120px;
  min-width: 120px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.level span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.level strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.score-row {
  gap: 10px;
  margin: 12px 0;
}

.score-label {
  width: 72px;
  color: var(--muted);
  font-size: 13px;
}

.score-track {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: var(--surface-muted);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  width: var(--score);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--amber), var(--red));
}

.score-number {
  width: 44px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.detail {
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reasons {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .workspace,
  .summary-grid,
  .result-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .entry-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

  .topbar,
  .toolbar,
  .report-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .watch-controls,
  .report-actions {
    justify-content: flex-start;
  }

  .market-clock {
    width: 100%;
    text-align: left;
  }

  .holding-row {
    grid-template-columns: 1fr;
  }

  .holding-main,
  .alert-fields {
    grid-template-columns: 1fr;
  }

  .remove-button {
    width: 100%;
  }

  .holding-list-item {
    grid-template-columns: 1fr;
  }

  .template-item {
    grid-template-columns: 1fr;
  }

  .holding-list-actions {
    width: 100%;
  }

  .holding-list-actions button {
    flex: 1;
  }

  .details {
    grid-template-columns: 1fr;
  }

  .report-summary {
    grid-template-columns: 1fr;
  }
}

