/* gio-cao-diem-moi brand (toi-gian kit + custom theme). Accent #059669 (green/energy). */
:root {
  color-scheme: light dark;
  --bg: #f0fdf4;
  --surface: #ffffff;
  --line: #d1fae5;
  --text: #111a33;
  --muted: #46506b;
  --brand: #059669;
  --brand-hover: #047857;
  --brand-ink: #059669;
  --brand-soft: #d1fae5;
  --on-brand: #ffffff;
  --bad-bg: #fdecea;
  --bad-ink: #9b1c1c;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4a00;
  --ok-bg: #e6f3e1;
  --ok-ink: #1f5a1a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b2818;
    --surface: #111c26;
    --line: #1f5a4a;
    --text: #e8eefc;
    --muted: #b6c3e0;
    --brand: #10b981;
    --brand-hover: #34d399;
    --brand-ink: #6ee7b7;
    --brand-soft: #064e3b;
    --on-brand: #0a1530;
    --bad-bg: #3a1a18;
    --bad-ink: #fca5a5;
    --warn-bg: #3a2e10;
    --warn-ink: #f3d58a;
    --ok-bg: #1c3318;
    --ok-ink: #a7e09c;
  }
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}

a {
  color: var(--brand-ink);
}

.topbar, main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.topbar {
  padding-top: 8px;
  padding-bottom: 8px;
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--brand-ink);
  text-decoration: none;
  white-space: nowrap;
}

.logo {
  width: 28px;
  height: 28px;
  flex: none;
}

main {
  padding-bottom: 48px;
}

h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin: 0.4em 0 0.3em;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 28px 0 8px;
}

p {
  margin: 12px 0;
}

small {
  color: var(--muted);
  font-size: 0.875rem;
}

code {
  background: var(--brand-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.875em;
}

textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  padding: 12px;
  font: 0.9375rem/1.5 ui-monospace, Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--brand-ink);
  outline-offset: 2px;
}

button {
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 0 24px;
  margin: 0 8px 8px 0;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

button:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

button.alt {
  background: transparent;
  color: var(--brand-ink);
}

button.alt:hover {
  background: var(--brand-soft);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

div#sum {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--brand-soft);
  border-radius: 10px;
  font-weight: 600;
}

div#sum:empty {
  display: none;
}

ul#err {
  margin: 12px 0;
  padding: 0 0 0 20px;
  color: var(--bad-ink);
}

ul#err:empty {
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

table:empty {
  display: none;
}

td, th {
  overflow-wrap: normal;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
}

th {
  background: var(--brand-soft);
  color: var(--muted);
  font-weight: 700;
}

.overdue {
  background: var(--bad-bg);
}

.overdue td {
  color: var(--bad-ink);
  font-weight: 600;
}

.today {
  background: var(--warn-bg);
}

.today td {
  color: var(--warn-ink);
  font-weight: 600;
}

.tomorrow {
  background: var(--brand-soft);
}

.later td {
  color: var(--text);
}

tr[onclick], tbody tr {
  cursor: pointer;
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.5rem;
  }
  button {
    width: 100%;
    margin-right: 0;
  }
  td, th {
    padding: 8px;
    font-size: 0.875rem;
  }
  table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
