:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --muted: #68748a;
  --line: #e5e9f0;
  --blue: #3158c9;
  --blue-dark: #2446aa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 3%, rgba(206, 221, 255, 0.5), transparent 27rem),
    #f5f7fb;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(220, 226, 237, 0.8);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #18233a;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--blue);
  font-size: 16px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-email {
  color: var(--muted);
  font-size: 13px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 42px 0 23px;
}

.page-heading h1,
.login-panel h1 {
  margin: 5px 0 7px;
  font-size: clamp(27px, 4vw, 34px);
  letter-spacing: -0.04em;
}

h2 {
  margin: 5px 0 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted,
.field-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.page-heading p,
.login-panel > p {
  margin: 0;
}

.panel {
  border: 1px solid rgba(226, 231, 239, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 35px rgba(24, 40, 75, 0.045);
}

.records-panel,
.entry-panel,
.login-panel {
  padding: 25px;
}

.login-panel {
  width: min(430px, 100%);
  margin: 70px auto;
}

.login-panel h1 {
  font-size: 27px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 17px;
  margin-top: 22px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #38445a;
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #dce2ec;
  border-radius: 9px;
  outline: none;
  color: #172033;
  background: #fff;
  font-size: 14px;
  font-weight: 400;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #a1aabd;
}

input:focus,
textarea:focus {
  border-color: #7692e5;
  box-shadow: 0 0 0 3px rgba(49, 88, 201, 0.1);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.summary-card {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid rgba(226, 231, 239, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(24, 40, 75, 0.035);
}

.summary-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.summary-card > strong {
  display: block;
  margin-top: 10px;
  color: #1d2b47;
  font-size: clamp(20px, 2.4vw, 27px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.summary-card > small {
  display: block;
  margin-top: 7px;
  color: #8792a5;
  font-size: 11px;
  line-height: 1.45;
}

.summary-card-accent {
  border-color: #dbe4ff;
  background: linear-gradient(145deg, #fff, #f3f6ff);
}

.summary-card-accent > strong {
  color: var(--blue);
}

.target-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.target-form input {
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 13px;
}

.button-small {
  min-height: 36px;
  padding: 0 10px;
}

.order-form {
  display: grid;
  grid-template-columns: minmax(170px, 1.15fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) minmax(170px, 1.2fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
}

.order-form label {
  min-width: 0;
}

.field-hint {
  margin: 10px 0 0;
  font-size: 12px;
}

.button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.button-primary {
  min-height: 45px;
  color: #fff;
  background: var(--blue);
}

.button-primary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.button-quiet {
  color: #46536b;
  border-color: #dfe4ed;
  background: white;
}

.button-quiet:hover:not(:disabled) {
  border-color: #c4cde0;
  background: #f9faff;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.records-heading {
  margin-bottom: 12px;
}

.count-badge {
  padding: 6px 10px;
  border-radius: 20px;
  color: #4159a2;
  background: #eef2ff;
  font-size: 12px;
  font-weight: 700;
}

.records-status {
  padding: 28px 12px;
  text-align: center;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.records-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.records-table th {
  padding: 10px 12px;
  color: #637087;
  background: #f7f8fb;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.records-table td {
  padding: 10px 12px;
  border-top: 1px solid #edf0f5;
  color: #34415a;
  vertical-align: middle;
}

.records-table tr:hover td {
  background: #fbfcff;
}

.records-table th:nth-child(1) {
  width: 20%;
}

.records-table th:nth-child(2),
.records-table th:nth-child(3) {
  width: 11%;
}

.records-table th:nth-child(4) {
  width: 30%;
}

.records-table th:nth-child(5) {
  width: 18%;
}

.records-table th:nth-child(6) {
  width: 10%;
}

.investor-cell {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.number-cell {
  color: #233554 !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.note-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-note {
  color: #a2aaba;
}

.updated-cell {
  color: #778398 !important;
  font-size: 11px;
  white-space: nowrap;
}

.updated-cell small {
  display: block;
  margin-top: 3px;
  color: var(--blue);
  font-size: 10px;
}

.action-cell {
  text-align: right;
}

.row-action {
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--blue);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.row-action:hover:not(:disabled) {
  background: #eef2ff;
}

.row-action:disabled {
  cursor: wait;
  opacity: 0.6;
}

.cancel-action {
  color: #69758a;
}

.table-input {
  min-width: 70px;
  min-height: 34px;
  padding: 6px 7px;
  border-radius: 7px;
  font-size: 12px;
}

.numeric-input {
  font-variant-numeric: tabular-nums;
}

.editing-row td {
  background: #f8faff !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.notice {
  margin-top: 24px;
  padding: 13px 15px;
  border: 1px solid #f0cf87;
  border-radius: 10px;
  color: #755311;
  background: #fff8e8;
  font-size: 13px;
  line-height: 1.6;
}

.notice code {
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(117, 83, 17, 0.08);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2;
  max-width: min(440px, calc(100vw - 44px));
  padding: 13px 16px;
  border: 1px solid #cfe8d7;
  border-radius: 10px;
  color: #205c37;
  background: white;
  box-shadow: 0 8px 30px rgba(24, 40, 75, 0.12);
  font-size: 13px;
  line-height: 1.5;
}

.toast-error {
  border-color: #f0c9c9;
  color: #9e3030;
}

.footer {
  padding: 28px 0 22px;
  color: #9aa3b2;
  font-size: 11px;
  text-align: center;
}

@media (min-width: 761px) and (max-width: 1000px) {
  .order-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-form .note-field {
    grid-column: 1 / -1;
  }
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 28px, 560px);
  }

  .topbar {
    min-height: 67px;
  }

  .page-heading {
    align-items: flex-start;
    margin-top: 29px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .order-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-form .note-field {
    grid-column: 1 / -1;
  }

  .entry-panel,
  .records-panel,
  .login-panel {
    padding: 20px;
  }

  .login-panel {
    margin-top: 48px;
  }
}

@media (max-width: 430px) {
  .page-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .page-heading > .button {
    align-self: flex-start;
  }

  .user-email {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .order-form {
    grid-template-columns: 1fr;
  }

  .order-form .note-field {
    grid-column: auto;
  }
}
