:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: var(--tg-theme-bg-color, #ffffff);
  --surface: var(--tg-theme-secondary-bg-color, #f4f5f7);
  --text: var(--tg-theme-text-color, #18181b);
  --muted: var(--tg-theme-hint-color, #71717a);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.container {
  width: min(100% - 28px, 600px);
  margin: 0 auto;
  padding: 18px 0 32px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.title {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.tz-pill {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.user-greeting {
  margin: 10px 0 16px;
  font-size: 14px;
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 16px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}

.tab.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.card {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
}

.badge.personal {
  background: rgba(113, 113, 122, 0.2);
  color: var(--text);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-due {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.empty {
  text-align: center;
  padding: 32px 16px;
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 18px;
}

.empty-icon { font-size: 32px; margin-bottom: 8px; }
.empty h2 { margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0; font-size: 14px; color: var(--muted); }

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 18px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 20;
}

.modal-card {
  width: min(100%, 540px);
  background: var(--bg);
  color: var(--text);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title { margin: 4px 0 0; font-size: 19px; }

.icon-btn {
  border: 0;
  background: var(--surface);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
}

.meta-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
}

.modal-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.link-btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea {
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(113, 113, 122, 0.25);
  background: var(--surface);
  color: var(--text);
}
