:root {
  --orange: #f58220;
  --orange-dark: #d96f12;
  --navy: #1a2b4a;
  --navy-tab: #243656;
  --bg: #eef1f5;
  --card: #fff;
  --text: #2c3e50;
  --muted: #6b7c93;
  --border: #dde3ec;
  --success: #1a7f4b;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(26, 43, 74, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  background: #fff;
  color: var(--orange);
  font-weight: 700;
  font-size: 13px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #fff;
  color: var(--orange-dark);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.tabs {
  background: var(--navy);
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  overflow-x: auto;
}

.tab {
  background: var(--navy-tab);
  color: rgba(255, 255, 255, 0.75);
  border: none;
  padding: 12px 18px;
  border-radius: 8px 8px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  background: var(--bg);
  color: var(--navy);
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

.banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.banner.info {
  border-left: 4px solid var(--orange);
}

.banner.warn {
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.banner.success {
  border-left: 4px solid var(--success);
}

.banner.error {
  border-left: 4px solid var(--danger);
}

.summary {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary h2 {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.summary p {
  margin: 0;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.counts {
  display: flex;
  gap: 8px;
}

.count-pill {
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.count-pill strong {
  color: var(--navy);
  font-size: 0.95rem;
  margin-right: 2px;
}

.btn-add {
  background: var(--navy);
  color: #fff;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.card-title-input {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: inherit;
  background: transparent;
}

.card-title-input:hover,
.card-title-input:focus {
  border-color: var(--border);
  background: #fff;
  outline: 2px solid rgba(245, 130, 32, 0.35);
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--navy);
  padding: 0;
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.home-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.home-check input {
  accent-color: var(--orange);
}

.badge {
  background: var(--orange);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.04em;
}

.card-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.fund-box {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.fund-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #f3d2b0;
  box-shadow: 0 1px 2px rgba(245, 130, 32, 0.12);
  color: var(--navy);
  font-size: 0.78rem;
  line-height: 1.25;
}

.fund-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.fund-chip-x {
  border: none;
  background: #fdecea;
  color: var(--danger);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.fund-chip-x:hover {
  background: var(--danger);
  color: #fff;
}

.fund-add {
  flex: 1 1 140px;
  min-width: 120px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  padding: 6px 4px;
  color: var(--text);
}

.fund-add:focus {
  outline: none;
}

.fund-add::placeholder {
  color: #9aa8bb;
}

.simple-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.log-week {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.log-week-header {
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.95rem;
}

.log-entry {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.log-entry time {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.log-filter {
  margin-bottom: 10px;
}

.log-filter strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.chip.in {
  background: #e8f5ee;
  color: var(--success);
}

.chip.out {
  background: #fdecea;
  color: var(--danger);
}

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

.simple-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.simple-row {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.simple-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.simple-row input,
.simple-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.online {
  background: var(--success);
}

.status-dot.local {
  background: var(--orange);
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-end;
  }
}
