:root {
  color-scheme: light;
  --bg: #eef7f4;
  --surface: #ffffff;
  --surface-soft: #f7fbf9;
  --ink: #1f2a2d;
  --muted: #69777b;
  --line: #dce9e5;
  --accent: #25766e;
  --accent-deep: #155c55;
  --accent-soft: #dff1ed;
  --danger: #b84d3f;
  --danger-soft: #f8ded9;
  --shadow: 0 18px 42px rgba(31, 74, 68, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 118, 110, 0.13), transparent 28rem),
    linear-gradient(145deg, #eef7f4 0%, #f8fbf6 55%, #edf5fb 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(238, 247, 244, 0.86);
  backdrop-filter: blur(14px);
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid rgba(220, 233, 229, 0.95);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.admin-card {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
}

.login-card h2 {
  margin-bottom: 8px;
}

.login-tip {
  margin-bottom: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.login-error {
  min-height: 22px;
  margin: -4px 0 12px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 800;
}

.login-card .primary-button {
  width: 100%;
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 13px;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.user-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 24px 18px 34px;
  padding-top: max(42px, calc(24px + env(safe-area-inset-top, 0px)));
}

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

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

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

.icon-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 19px;
  color: #ffffff;
  background: var(--accent);
  box-shadow: var(--shadow);
  font-size: 30px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(330px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-card,
.edit-panel,
.list-panel {
  border: 1px solid rgba(220, 233, 229, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.summary-card {
  min-height: 92px;
  padding: 18px;
}

.summary-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-deep);
  font-size: 30px;
  font-weight: 850;
}

.summary-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.edit-panel,
.list-panel {
  padding: 20px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-title.compact {
  margin-bottom: 12px;
}

.save-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input {
  min-height: 50px;
  padding: 0 15px;
}

textarea {
  min-height: 112px;
  padding: 14px 15px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: rgba(37, 118, 110, 0.75);
  box-shadow: 0 0 0 4px rgba(37, 118, 110, 0.12);
}

.action-row,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 17px;
  font-weight: 850;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
}

.secondary-button {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.danger-button {
  color: #8d3826;
  background: var(--danger-soft);
}

.query-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.query-box label {
  margin-bottom: 0;
}

.toolbar {
  margin: 0 0 16px;
}

.file-button {
  display: inline-grid;
  place-items: center;
  margin: 0;
}

.file-button input {
  display: none;
}

.day-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--surface-soft);
}

.day-title span {
  color: var(--ink);
  font-weight: 850;
}

.day-title strong {
  color: var(--accent-deep);
}

.record-list {
  display: grid;
  gap: 10px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.record-card {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  text-align: left;
  color: inherit;
  background: var(--surface);
}

.record-card:hover,
.record-card.active {
  border-color: rgba(37, 118, 110, 0.65);
  box-shadow: 0 10px 28px rgba(37, 118, 110, 0.12);
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.record-index {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 30px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.record-time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.record-line {
  margin-bottom: 0;
  color: #243234;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.record-field {
  display: grid;
  gap: 5px;
}

.record-field b {
  color: var(--accent-deep);
  font-size: 13px;
}

.record-field p {
  margin-bottom: 0;
  color: #354043;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state {
  display: none;
  margin: 18px 0 0;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state.show {
  display: block;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 18px 13px 28px;
    padding-top: max(40px, calc(22px + env(safe-area-inset-top, 0px)));
  }

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

  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .summary-card {
    min-height: 66px;
    padding: 10px 8px;
    text-align: center;
    border-radius: 18px;
  }

  .summary-card span {
    margin-bottom: 4px;
    font-size: 22px;
  }

  .summary-card p {
    font-size: 12px;
    line-height: 1.25;
  }

  .edit-panel,
  .list-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .query-box {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    flex: 1 1 auto;
  }
}
