:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: rgba(17, 22, 34, 0.88);
  --panel-strong: #131a28;
  --panel-soft: rgba(255, 255, 255, 0.045);
  --cell: #101722;
  --cell-muted: #0c111a;
  --ink: #edf3ff;
  --ink-dim: #bcc8dc;
  --muted: #94a3b8;
  --muted-dim: #6b7a93;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.3);
  --brand: #4dd4ac;
  --brand-dark: #1fa67e;
  --brand-glow: rgba(77, 212, 172, 0.15);
  --accent: #f59e57;
  --danger: #fb7185;
  --blue: #7dd3fc;
  --purple: #a78bfa;
  --yellow: #eab308;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-display: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --font-body: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef4f1;
  --panel: #fbfdfc;
  --panel-strong: #ffffff;
  --panel-soft: #f5f9f7;
  --cell: #ffffff;
  --cell-muted: #f2f7f5;
  --ink: #142e29;
  --ink-dim: #31524b;
  --muted: #49655e;
  --muted-dim: #617a73;
  --line: #c9ddd5;
  --line-strong: #84aa9c;
  --brand: #0b6b57;
  --brand-dark: #07513f;
  --brand-glow: rgba(11, 107, 87, 0.16);
  --accent: #9a6700;
  --danger: #b4233c;
  --blue: #1f5f9d;
  --purple: #6d4fb0;
  --yellow: #795b00;
  --shadow: 0 14px 36px rgba(21, 64, 54, 0.1);
}

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

body {
  margin: 0;
  min-height: 100vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(135deg, #070911 0%, #111827 48%, #061b1a 100%);
  background-size: 36px 36px, 36px 36px, auto;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
textarea,
input,
select {
  font: inherit;
  font-weight: inherit;
}

button {
  color: inherit;
  user-select: none;
}

::selection {
  background: var(--brand);
  color: #06231d;
}

/* Global focus-visible reset */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  width: min(1320px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.workspace,
.entry-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  padding: 24px;
}

.entry-panel {
  display: flex;
  flex-direction: column;
  align-self: start;
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow: hidden;
}

.app-header,
.panel-header,
.header-actions,
.brand,
.month-controls,
.entry-meta,
.entry-actions,
.important-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.important-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.important-check .toggle-track {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  transition: background 0.2s ease;
}

.important-check .toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--muted-dim);
  transition: transform 0.2s ease, background 0.2s ease;
}

.important-check input:checked + .toggle-track {
  background: rgba(77, 212, 172, 0.25);
}

.important-check input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--brand);
}

.important-check > span:last-child {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.15s ease;
}

.important-check input:checked ~ span:last-child {
  color: var(--brand);
}


.app-header {
  justify-content: space-between;
  gap: 20px;
  row-gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 30px;
  font-weight: 850;
}

h2 {
  font-size: 19px;
  font-weight: 800;
}

.header-actions {
  gap: 10px;
  margin-left: auto;
  justify-content: flex-end;
}

.cloud-status-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 118px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cloud-status-button:hover {
  border-color: rgba(77, 212, 172, 0.48);
  background: rgba(77, 212, 172, 0.1);
  color: var(--ink);
}

.cloud-status-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}

.cloud-status-label {
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.cloud-status-label::after {
  margin-left: 5px;
  color: var(--muted-dim);
  content: "/";
}

#cloudAccountStatus {
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.cloud-status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.cloud-status-button[data-tone="success"] {
  border-color: rgba(77, 212, 172, 0.34);
}

.cloud-status-button[data-tone="success"] .cloud-status-dot {
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand-glow);
}

.cloud-status-button[data-tone="success"] #cloudAccountStatus {
  color: var(--brand);
}

.cloud-status-button[data-tone="pending"] .cloud-status-dot {
  background: var(--yellow);
  animation: cloud-status-pulse 1.1s ease-in-out infinite;
}

.cloud-status-button[data-tone="pending"] #cloudAccountStatus {
  color: var(--yellow);
}

.cloud-status-button[data-tone="error"] {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.cloud-status-button[data-tone="error"] .cloud-status-dot {
  background: var(--danger);
}

.cloud-status-button[data-tone="error"] #cloudAccountStatus {
  color: var(--danger);
}

@keyframes cloud-status-pulse {
  50% { opacity: 0.35; transform: scale(0.76); }
}

.month-controls {
  height: 48px;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.month-title {
  width: 142px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.02em;
}

.icon-button,
.today-button,
.tool-button,
.submit-button,
.ghost-button,
.category-chip,
.entry-action {
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.09);
}

.icon-button span {
  display: block;
  height: 30px;
  font-size: 28px;
  line-height: 26px;
}

.theme-toggle {
  color: var(--yellow);
}

.theme-toggle .theme-icon {
  height: auto;
  font-size: 20px;
  line-height: 1;
}

.theme-toggle .theme-icon-moon {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.today-button,
.tool-button,
.submit-button {
  min-height: 38px;
  border-radius: var(--radius-md);
  font-weight: 800;
}

.today-button {
  padding: 0 14px;
  background: var(--brand);
  color: #05231d;
}

.tool-button {
  padding: 0 14px;
  border: 1px solid rgba(77, 212, 172, 0.32);
  background: rgba(77, 212, 172, 0.12);
  color: var(--brand);
}

.today-button:hover,
.submit-button:hover {
  background: #66e7bf;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--brand-glow);
}

.tool-button:hover {
  background: rgba(77, 212, 172, 0.22);
  border-color: rgba(77, 212, 172, 0.5);
  transform: translateY(-1px);
}

.today-button:active,
.submit-button:active,
.tool-button:active {
  transform: translateY(0);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.summary-grid article.is-clickable {
  cursor: pointer;
}

.summary-grid article.is-clickable:hover {
  border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)), var(--panel-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.summary-grid article {
  cursor: default;
  min-height: 86px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)), var(--panel-soft);
}

.summary-grid article {
  cursor: default;
}

.summary-grid span {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-grid span#topCategory {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
  min-height: 31px;
  display: flex;
  align-items: center;
}

.summary-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 18, 0.42);
}

.filter-panel .search-field {
  flex: 1 1 260px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  padding-bottom: 1px;
}

.filter-actions .tool-button {
  min-height: 40px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.field textarea {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 11, 18, 0.52);
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.field textarea::placeholder {
  color: var(--muted-dim);
}

.field select option {
  background: #131a28;
  color: var(--ink);
  padding: 8px;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 18, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 2l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center no-repeat;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field select:hover {
  border-color: var(--line-strong);
  background: rgba(8, 11, 18, 0.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 2l5 5 5-5' stroke='%23bcc8dc' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center no-repeat;
}

.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: rgba(8, 11, 18, 0.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 2l5 5 5-5' stroke='%234dd4ac' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center no-repeat;
}

.field input {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 18, 0.6);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.field input::placeholder {
  color: var(--muted-dim);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 28px;
}

.category-chip {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--chip-color) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--chip-color) 10%, transparent);
  color: var(--chip-color);
  font-size: 12px;
  font-weight: 800;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.category-chip:hover {
  background: color-mix(in srgb, var(--chip-color) 22%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--chip-color) 15%, transparent);
}

.category-chip:active {
  transform: translateY(0);
}

.reset-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.reset-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  border-color: var(--line-strong);
}

.calendar-card {
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 18, 0.52);
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.weekdays span {
  padding: 11px 0;
}

.calendar-grid {
  gap: 1px;
  background: var(--line);
}

.day-cell {
  position: relative;
  display: grid;
  grid-template-rows: 30px minmax(34px, auto) 22px;
  align-content: start;
  gap: 8px;
  min-height: 114px;
  padding: 10px;
  border: 0;
  background: var(--cell);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.day-cell:hover {
  background: #142032;
}

.day-cell:focus-visible {
  outline: none;
}

.day-cell.is-muted {
  background: var(--cell-muted);
  color: #59687a;
}

.day-cell.is-selected {
  background: #0b1e1e;
}

.day-cell.is-selected .day-number {
  background: var(--brand);
  color: #06231d;
}

.day-cell.is-today .day-number {
  background: var(--brand);
  color: #06231d;
  box-shadow: 0 0 12px var(--brand-glow);
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 800;
  font-size: 15px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.day-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 34px;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.day-cell.is-muted .day-summary {
  color: #59687a;
}

.day-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #8ca2bd;
}

.category-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.category-dot:hover {
  transform: scale(1.4);
}

.day-total {
  overflow: hidden;
  margin-left: 2px;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.day-preview {
  display: none;
  color: #a9b6c8;
  font-size: 12px;
  line-height: 1.45;
}

.important-marker {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.22);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.panel-header {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.entry-count {
  flex: 0 0 auto;
  min-width: 54px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(77, 212, 172, 0.14);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.day-insight {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  padding: 12px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.insight-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--pill-color) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill-color) 13%, transparent);
  color: var(--pill-color);
  font-weight: 750;
  font-size: 12px;
}

.entry-form {
  display: grid;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.entry-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inline-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
}

.ghost-button {
  min-height: 42px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: var(--radius-md);
  background: rgba(125, 211, 252, 0.1);
  color: var(--blue);
  font-weight: 800;
}

.ghost-button:hover {
  background: rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.45);
  transform: translateY(-1px);
}

.submit-button {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
  background: linear-gradient(135deg, var(--brand), #3ccba5);
  color: #06231d;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.submit-button:hover {
  background: linear-gradient(135deg, #66e7bf, #4dd4ac);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--brand-glow);
}

.submit-button:active {
  transform: translateY(0);
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.cancel-edit {
  min-width: 92px;
}

.entries {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-top: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.entries::-webkit-scrollbar {
  width: 5px;
}

.entries::-webkit-scrollbar-track {
  background: transparent;
}

.entries::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.entries::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
  text-align: center;
}

.entry-item {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 3px 0 0 var(--entry-color);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.entry-item:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.065);
}

.entry-item.is-important {
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.06);
}

.entry-meta {
  flex-wrap: wrap;
  gap: 6px;
}

.entry-category {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.entry-category {
  background: rgba(77, 212, 172, 0.14);
  color: var(--brand);
}

.entry-mood {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-dim);
}

.entry-important {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(234, 179, 8, 0.18);
  color: var(--yellow);
}

.entry-important[hidden] {
  display: none !important;
}

.entry-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-dim);
  letter-spacing: 0.02em;
}

#editTimeOverlay {
  display: none;
}

#editTimeOverlay .field input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 11, 18, 0.52);
  color: var(--ink);
  font-size: 13px;
  width: 140px;
}

.entry-text {
  margin: 0;
  color: #dbe6f7;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 13.5px;
}

.entry-actions {
  flex-wrap: wrap;
  gap: 6px;
}

.entry-action {
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.entry-action:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  transform: translateY(-1px);
}

.entry-action:active {
  transform: translateY(0);
}

.edit-entry {
  color: var(--blue);
}

.is-important .toggle-important {
  background: rgba(234, 179, 8, 0.2);
  color: var(--yellow);
}

.delete-entry {
  margin-left: auto;
  width: 30px;
  padding: 0;
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.delete-entry:hover {
  background: rgba(234, 179, 8, 0.3);
  color: var(--danger);
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 1fr;
  }

  .entry-panel {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .workspace,
  .entry-panel {
    padding: 14px;
  }

  .app-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .month-controls {
    width: 100%;
  }

  .month-title {
    flex: 1;
    width: auto;
  }

  .summary-grid,
  .filter-panel,
  .form-row,
  .form-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  .day-cell {
    min-height: 88px;
    padding: 7px;
  }

  .day-preview {
    display: none;
  }

  .day-summary,
  .day-meta {
    display: none;
  }

  .important-marker {
    top: 7px;
    right: 7px;
    width: 18px;
    height: 18px;
    font-size: 11px;
  }
}


/* Month entries modal */
.month-entry-group + .month-entry-group {
  margin-top: 12px;
}

.month-entry-group-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 4px 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.month-entry-group-header .group-date {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.month-entry-group-header .group-weekday {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-dim);
}

.month-entry-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.month-entry-card + .month-entry-card {
  margin-top: 6px;
}

.month-entry-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
}

.me-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.me-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.me-category {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.me-mood {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-dim);
}

.me-important {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.18) !important;
  color: var(--yellow) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.me-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-dim);
  flex: 0 0 auto;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.me-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.55;
  margin: 0;
  word-break: break-word;
}

/* Month entries modal */
.month-entry-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.1s ease;
}

.month-entry-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.month-entry-item + .month-entry-item {
  margin-top: 8px;
}

.month-entry-date {
  flex: 0 0 auto;
  width: 44px;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.3;
  text-align: center;
  padding-top: 2px;
}

.month-entry-date .day-num {
  display: block;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.month-entry-body {
  flex: 1;
  min-width: 0;
}

.month-entry-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.month-entry-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}

.month-entry-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-dim);
  flex: 0 0 auto;
  white-space: nowrap;
}


.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: grid;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted-dim);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.5s forwards;
  max-width: 380px;
}

.toast-success {
  border-left-color: var(--brand);
  border-color: rgba(77, 212, 172, 0.25) rgba(77, 212, 172, 0.25) rgba(77, 212, 172, 0.25) var(--brand);
  background: linear-gradient(135deg, rgba(77, 212, 172, 0.08), var(--panel-strong) 60%);
}

.toast-success .toast-icon {
  color: var(--brand);
}

.toast-error {
  border-left-color: var(--danger);
  border-color: rgba(234, 179, 8, 0.3) rgba(234, 179, 8, 0.3) rgba(234, 179, 8, 0.3) var(--danger);
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.08), var(--panel-strong) 60%);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-info {
  border-left-color: var(--blue);
  border-color: rgba(125, 211, 252, 0.2) rgba(125, 211, 252, 0.2) rgba(125, 211, 252, 0.2) var(--blue);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.06), var(--panel-strong) 60%);
}

.toast-info .toast-icon {
  color: var(--blue);
}

.toast-icon {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

@media (max-width: 480px) {
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
  .toast {
    max-width: none;
  }
}/* Category modal */
.modal-overlay[hidden] {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  animation: fadeIn 0.15s ease;
  padding: 20px;
}

.modal-dialog {
  width: min(480px, calc(100% - 20px));
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s ease;
}
.modal-dialog.modal-lg {
  width: min(680px, calc(100% - 20px));
}


@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 800;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
}

.modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.cloud-auth-dialog {
  width: min(440px, calc(100% - 20px));
}

.cloud-auth-body {
  display: grid;
  gap: 16px;
}

.cloud-auth-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.cloud-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.cloud-auth-tab {
  min-height: 36px;
  border: 0;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cloud-auth-tab:hover {
  color: var(--ink);
}

.cloud-auth-tab.is-active {
  background: var(--panel-strong);
  color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.cloud-auth-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.cloud-auth-tab:disabled {
  cursor: wait;
  opacity: 0.55;
}

.cloud-auth-form {
  display: grid;
  gap: 14px;
}

/* Author styles override the browser's default [hidden] rule, so restore it here. */
.cloud-auth-form[hidden],
.cloud-signed-in[hidden],
.cloud-sign-out[hidden] {
  display: none !important;
}

.cloud-auth-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
}

.cloud-sign-out {
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
}

.cloud-signed-in {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(77, 212, 172, 0.28);
  border-radius: var(--radius-md);
  background: rgba(77, 212, 172, 0.055);
}

.cloud-account-profile,
.cloud-sync-state {
  display: flex;
  align-items: center;
  gap: 11px;
}

.cloud-account-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #052b22;
  font-size: 13px;
  font-weight: 850;
}

.cloud-account-profile p,
.cloud-sync-state p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.cloud-account-profile strong,
.cloud-sync-state strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cloud-sync-state {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cloud-sync-state-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.cloud-sync-state[data-tone="success"] .cloud-sync-state-dot {
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand-glow);
}

.cloud-sync-state[data-tone="success"] strong {
  color: var(--brand);
}

.cloud-sync-state[data-tone="pending"] .cloud-sync-state-dot {
  background: var(--yellow);
  animation: cloud-status-pulse 1.1s ease-in-out infinite;
}

.cloud-sync-state[data-tone="pending"] strong {
  color: var(--yellow);
}

.cloud-sync-state[data-tone="error"] .cloud-sync-state-dot {
  background: var(--danger);
}

.cloud-sync-state[data-tone="error"] strong {
  color: var(--danger);
}

.cloud-signed-in-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  .cloud-status-button[data-tone="pending"] .cloud-status-dot,
  .cloud-sync-state[data-tone="pending"] .cloud-sync-state-dot {
    animation: none;
  }
}

.modal-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-add-row input {
  flex: 1;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 18, 0.6);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-add-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  outline: none;
}

.modal-add-row input::placeholder {
  color: var(--muted-dim);
}

.modal-add-row .tool-button {
  min-height: 40px;
  padding: 0 18px;
  flex: 0 0 auto;
}

.modal-category-list {
  display: grid;
  gap: 6px;
}

.modal-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.1s ease;
}

.modal-cat-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.modal-cat-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.modal-cat-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-cat-usage {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-dim);
  text-align: right;
  margin-right: 4px;
}

.modal-cat-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.modal-cat-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
}

.modal-cat-del {
  color: var(--danger);
}

.modal-cat-del:hover {
  background: rgba(234, 179, 8, 0.22) !important;
  color: var(--danger) !important;
}

.modal-cat-del:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-dim);
}

/* Day theme */
:root[data-theme="light"] body {
  scrollbar-color: rgba(41, 78, 72, 0.28) transparent;
  background: var(--bg);
}

:root[data-theme="light"] ::selection {
  background: #cde9de;
  color: var(--ink);
}

:root[data-theme="light"] .workspace,
:root[data-theme="light"] .entry-panel {
  border-color: rgba(41, 78, 72, 0.14);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

:root[data-theme="light"] .theme-toggle {
  color: var(--brand);
}

:root[data-theme="light"] .theme-toggle .theme-icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .theme-icon-moon {
  display: block;
}

:root[data-theme="light"] .month-controls {
  border-color: var(--line);
  background: #f3f7f5;
}

:root[data-theme="light"] .icon-button {
  border: 1px solid var(--line);
  background: #f7fbf9;
  color: var(--ink-dim);
  box-shadow: 0 1px 1px rgba(21, 64, 54, 0.04);
}

:root[data-theme="light"] .icon-button:hover,
:root[data-theme="light"] .icon-button:focus-visible {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.12);
}

:root[data-theme="light"] .icon-button:focus-visible {
  outline: none;
}

:root[data-theme="light"] .icon-button:active {
  background: #e8f2ee;
  box-shadow: none;
}

:root[data-theme="light"] .toast {
  border-color: var(--line);
  box-shadow: 0 12px 32px rgba(25, 55, 50, 0.12);
}

:root[data-theme="light"] .today-button,
:root[data-theme="light"] .submit-button {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(7, 81, 63, 0.18);
}

:root[data-theme="light"] .today-button:hover,
:root[data-theme="light"] .submit-button:hover {
  background: var(--brand-dark);
  box-shadow: 0 4px 12px rgba(7, 81, 63, 0.16);
}

:root[data-theme="light"] .today-button:focus-visible,
:root[data-theme="light"] .submit-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.22);
}

:root[data-theme="light"] .tool-button,
:root[data-theme="light"] .ghost-button {
  border-color: #b8d5ca;
  background: #f0f8f4;
  color: var(--brand-dark);
}

:root[data-theme="light"] .tool-button:hover,
:root[data-theme="light"] .ghost-button:hover {
  border-color: #79a997;
  background: #e1f1ea;
  color: var(--brand-dark);
}

:root[data-theme="light"] .tool-button:focus-visible,
:root[data-theme="light"] .ghost-button:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.14);
}

:root[data-theme="light"] .summary-grid article {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(25, 55, 50, 0.035);
}

:root[data-theme="light"] .summary-grid article.is-clickable:hover {
  border-color: rgba(13, 117, 95, 0.38);
  background: #f4faf7;
  box-shadow: 0 8px 20px rgba(25, 55, 50, 0.08);
}

:root[data-theme="light"] .filter-panel {
  padding: 14px 0 12px;
  border-width: 1px 0;
  border-radius: 0;
  background: transparent;
}

:root[data-theme="light"] .calendar-card {
  background: #ffffff;
}

:root[data-theme="light"] .weekdays {
  background: #f5f8f7;
}

:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .field input,
:root[data-theme="light"] .field select,
:root[data-theme="light"] #editTimeOverlay .field input,
:root[data-theme="light"] .modal-add-row input {
  border-color: rgba(41, 78, 72, 0.2);
  background-color: #ffffff;
  box-shadow: none;
}

:root[data-theme="light"] .field select {
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 2l5 5 5-5' stroke='%23516e66' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center no-repeat;
}

:root[data-theme="light"] .field textarea:hover,
:root[data-theme="light"] .field input:hover,
:root[data-theme="light"] .field select:hover,
:root[data-theme="light"] .modal-add-row input:hover {
  border-color: rgba(41, 78, 72, 0.34);
}

:root[data-theme="light"] .field select:hover {
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 2l5 5 5-5' stroke='%2331524b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center no-repeat;
}

:root[data-theme="light"] .field textarea:focus,
:root[data-theme="light"] .field input:focus,
:root[data-theme="light"] .field select:focus,
:root[data-theme="light"] .modal-add-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 117, 95, 0.12);
}

:root[data-theme="light"] .field select:focus {
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 2l5 5 5-5' stroke='%230b6b57' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center no-repeat;
}

:root[data-theme="light"] input:focus-visible,
:root[data-theme="light"] textarea:focus-visible,
:root[data-theme="light"] select:focus-visible {
  outline: none;
}

:root[data-theme="light"] .field select option {
  background: #ffffff;
  color: var(--ink);
}

:root[data-theme="light"] .day-cell:hover {
  background: #f4faf7;
}

:root[data-theme="light"] .day-cell.is-selected {
  background: #eaf6f1;
}

:root[data-theme="light"] .day-cell.is-selected .day-number,
:root[data-theme="light"] .day-cell.is-today .day-number {
  background: var(--brand);
  color: #ffffff;
}

:root[data-theme="light"] .day-cell:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

:root[data-theme="light"] .day-cell.is-muted,
:root[data-theme="light"] .day-cell.is-muted .day-summary {
  color: #667d76;
}

:root[data-theme="light"] .day-meta {
  color: #54716a;
}

:root[data-theme="light"] .day-preview,
:root[data-theme="light"] .entry-text {
  color: var(--ink);
}

:root[data-theme="light"] .entry-count {
  background: #e2f2eb;
  color: var(--brand-dark);
}

:root[data-theme="light"] .important-check .toggle-track {
  background: #d9e3df;
}

:root[data-theme="light"] .important-check input:checked + .toggle-track {
  background: #f6e8bc;
}

:root[data-theme="light"] .important-check input:checked + .toggle-track::after {
  background: var(--yellow);
}

:root[data-theme="light"] .important-check input:checked ~ span:last-child {
  color: var(--yellow);
}

:root[data-theme="light"] .empty-state {
  background: transparent;
}

:root[data-theme="light"] .entry-item,
:root[data-theme="light"] .month-entry-card,
:root[data-theme="light"] .month-entry-item,
:root[data-theme="light"] .modal-cat-row {
  border-color: rgba(41, 78, 72, 0.16);
  background: #ffffff;
}

:root[data-theme="light"] .entry-item:hover,
:root[data-theme="light"] .month-entry-card:hover,
:root[data-theme="light"] .month-entry-item:hover,
:root[data-theme="light"] .modal-cat-row:hover {
  background: #f6faf8;
}

:root[data-theme="light"] .entry-item.is-important {
  border-color: rgba(139, 104, 0, 0.32);
  background: rgba(139, 104, 0, 0.045);
}

:root[data-theme="light"] .entry-action,
:root[data-theme="light"] .modal-cat-btn,
:root[data-theme="light"] .modal-close,
:root[data-theme="light"] .reset-button {
  border: 1px solid var(--line);
  background: #f4f8f6;
  color: var(--ink-dim);
}

:root[data-theme="light"] .entry-action:hover,
:root[data-theme="light"] .modal-cat-btn:hover,
:root[data-theme="light"] .modal-close:hover,
:root[data-theme="light"] .reset-button:hover {
  border-color: var(--line-strong);
  background: #e7f1ed;
  color: var(--ink);
}

:root[data-theme="light"] .entry-action.edit-entry {
  color: var(--brand-dark);
}

:root[data-theme="light"] .entry-action:focus-visible,
:root[data-theme="light"] .modal-cat-btn:focus-visible,
:root[data-theme="light"] .modal-close:focus-visible,
:root[data-theme="light"] .reset-button:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.14);
}

:root[data-theme="light"] .delete-entry:hover,
:root[data-theme="light"] .modal-cat-del:hover {
  background: rgba(200, 66, 90, 0.12) !important;
  color: var(--danger) !important;
}

:root[data-theme="light"] .entry-important,
:root[data-theme="light"] .me-important,
:root[data-theme="light"] .important-marker {
  background: #fff4cc !important;
  color: var(--yellow) !important;
}

:root[data-theme="light"] .toast-error {
  border-color: rgba(200, 66, 90, 0.28);
  background: linear-gradient(135deg, rgba(200, 66, 90, 0.07), #ffffff 62%);
}

:root[data-theme="light"] .entries {
  scrollbar-color: rgba(41, 78, 72, 0.28) transparent;
}

:root[data-theme="light"] .entries::-webkit-scrollbar-thumb {
  background: rgba(41, 78, 72, 0.22);
}

:root[data-theme="light"] .entries::-webkit-scrollbar-thumb:hover {
  background: rgba(41, 78, 72, 0.38);
}

:root[data-theme="light"] .modal-dialog {
  box-shadow: 0 24px 64px rgba(25, 55, 50, 0.16);
}

@media (max-width: 760px) {
  .header-actions {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    width: 100%;
    margin-left: 0;
    align-items: center;
    gap: 8px;
  }

  .header-actions .month-controls {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .header-actions .theme-toggle {
    justify-self: start;
  }

  .header-actions .cloud-status-button {
    justify-self: stretch;
    justify-content: center;
  }

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

  .summary-grid article {
    min-height: 80px;
    padding: 14px;
  }

  .workspace,
  .entry-panel,
  .calendar-card,
  .weekdays,
  .calendar-grid,
  .day-cell {
    min-width: 0;
  }

  .calendar-card,
  .weekdays,
  .calendar-grid {
    width: 100%;
  }

  .filter-panel .search-field {
    flex-basis: 100%;
  }

  .filter-actions {
    width: 100%;
    padding-bottom: 0;
  }

  .filter-actions .tool-button {
    flex: 1;
  }
}

/* Light theme text and status contrast */
:root[data-theme="light"] .field > span,
:root[data-theme="light"] .summary-grid p,
:root[data-theme="light"] .day-total,
:root[data-theme="light"] .entry-mood,
:root[data-theme="light"] .entry-time,
:root[data-theme="light"] .me-mood,
:root[data-theme="light"] .me-time,
:root[data-theme="light"] .month-entry-time,
:root[data-theme="light"] .important-check > span:last-child,
:root[data-theme="light"] .empty-state {
  color: var(--ink-dim);
}

:root[data-theme="light"] .field textarea::placeholder,
:root[data-theme="light"] .field input::placeholder,
:root[data-theme="light"] .modal-add-row input::placeholder {
  color: #627873;
  opacity: 1;
}

:root[data-theme="light"] .modal-cat-del,
:root[data-theme="light"] .delete-entry {
  color: var(--danger);
}

:root[data-theme="light"] .toast-success {
  border-color: rgba(11, 107, 87, 0.28) rgba(11, 107, 87, 0.28) rgba(11, 107, 87, 0.28) var(--brand);
  background: linear-gradient(135deg, rgba(11, 107, 87, 0.08), #ffffff 62%);
}

:root[data-theme="light"] .toast-error {
  border-color: rgba(180, 35, 60, 0.28) rgba(180, 35, 60, 0.28) rgba(180, 35, 60, 0.28) var(--danger);
  background: linear-gradient(135deg, rgba(180, 35, 60, 0.08), #ffffff 62%);
}

:root[data-theme="light"] .toast-info {
  border-color: rgba(31, 95, 157, 0.24) rgba(31, 95, 157, 0.24) rgba(31, 95, 157, 0.24) var(--blue);
  background: linear-gradient(135deg, rgba(31, 95, 157, 0.07), #ffffff 62%);
}
