*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAF8F5;
  --green: #2D5016;
  --gold: #8B6914;
  --text: #1A1A1A;
  --card-border: #E8E0D0;
  --surface: #FFFFFF;
  --muted: #6B6B6B;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

.header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.header-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.15em;
}

.header-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-left: 24px;
  transition: color 0.2s;
}

.header-nav a:hover, .header-nav a.active {
  color: var(--green);
  font-weight: 600;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.2s;
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: var(--green);
}

select {
  width: 100%;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

select:focus {
  outline: none;
  border-color: var(--green);
}

.form-row {
  margin-bottom: 24px;
}

.btn-primary {
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.05em;
}

.btn-primary:hover { background: #3a6b1e; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--green);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover { background: var(--green); color: white; }

.sse-box {
  margin-top: 32px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  min-height: 80px;
  font-size: 0.95rem;
  line-height: 1.8;
  display: none;
}

.sse-box p { margin-bottom: 4px; }
.sse-box br { display: block; margin: 4px 0; content: ''; }
.sse-box ul, .sse-box ol { padding-left: 20px; margin: 4px 0 8px; }
.sse-box li { margin-bottom: 4px; }
.sse-box .md-heading {
  font-weight: 700;
  color: var(--green);
  margin-top: 16px;
  margin-bottom: 4px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.sse-box .md-tag {
  display: inline-block;
  background: rgba(45, 80, 22, 0.08);
  color: var(--green);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-right: 4px;
}

.sse-box.visible { display: block; }

.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--green);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink { 50% { opacity: 0; } }

.card {
  background: var(--surface);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: 0 4px 20px rgba(45, 80, 22, 0.08); }

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.card-summary {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.tag {
  display: inline-block;
  background: rgba(45, 80, 22, 0.08);
  color: var(--green);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-right: 4px;
  margin-top: 4px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.card-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--card-border);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.card-actions button:hover { border-color: var(--green); color: var(--green); }

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--green);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.visible { transform: translateY(0); opacity: 1; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 64px 0;
  font-size: 0.95rem;
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
}

.inbox-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.count-badge {
  background: rgba(45, 80, 22, 0.1);
  color: var(--green);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}
