* {
  box-sizing: border-box;
}

:root {
  color: #202124;
  background: #f6f7f8;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

body {
  margin: 0;
  background: #f6f7f8;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}
h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

.container {
  width: min(100% - 32px, 860px);
  margin: 36px auto 64px;
}
.card {
  padding: 20px;
  border: 1px solid #d5d9dd;
  border-radius: 6px;
  background: #fff;
}
.eyebrow,
.section-label {
  margin-bottom: 6px;
  color: #5f6368;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.topbar > div > strong {
  display: block;
  font-size: 22px;
}
.topbar-user {
  margin: 5px 0 0;
  color: #5f6368;
  font-size: 14px;
}
.topbar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.topbar nav a,
.back-link,
.secondary-link,
.text-action {
  color: #1967a3;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
label {
  display: block;
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}
input,
select {
  display: block;
  width: 100%;
  height: 42px;
  padding: 9px 10px;
  border: 1px solid #aeb4ba;
  border-radius: 4px;
  background: #fff;
  color: #202124;
  font: inherit;
}
input:focus,
select:focus {
  border-color: #1967a3;
  box-shadow: 0 0 0 2px rgb(25 103 163 / 18%);
  outline: none;
}
button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #1967a3;
  border-radius: 4px;
  background: #1967a3;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
}
button:hover:not(:disabled),
.button-link:hover {
  border-color: #155a8f;
  background: #155a8f;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.delete-button {
  border-color: #b3261e;
  background: #b3261e;
}
.delete-button:hover:not(:disabled) {
  border-color: #8f1d17;
  background: #8f1d17;
}

.msg {
  min-height: 20px;
  margin: 14px 0 0;
  color: #b3261e;
  font-size: 14px;
}
.msg:not(:empty),
.error-panel {
  padding: 10px 12px;
  border: 1px solid #f1c3c0;
  border-radius: 4px;
  background: #fff7f6;
  color: #8c1d18;
  font-size: 14px;
}
.flash-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #b7d8c0;
  border-radius: 4px;
  background: #f2fbf4;
  color: #176a36;
  font-size: 14px;
  font-weight: 600;
}

.month-view,
.month-content {
  display: grid;
  gap: 16px;
}
.month-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}
.month-controls > div {
  min-width: 190px;
  text-align: left;
}
.icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
}
.month-picker-row {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d5d9dd;
  border-radius: 6px;
  background: #fff;
}
.month-picker-row label {
  margin: 0 0 10px;
  white-space: nowrap;
}
.month-picker-row select {
  width: min(260px, 100%);
}
.total-panel {
  display: flex;
  align-items: flex-end;
  gap: 36px;
  padding: 20px;
  border-radius: 6px;
  background: #1f4f72;
  color: #fff;
}
.total-main .section-label {
  color: #d6e7f2;
}
.total-amount {
  display: block;
  font-size: 36px;
  line-height: 1;
}
.total-breakdown {
  display: flex;
  gap: 28px;
}
.metric {
  display: grid;
  gap: 4px;
  color: #d6e7f2;
  font-size: 13px;
}
.metric strong {
  color: #fff;
  font-size: 16px;
}

.category-panel {
  display: grid;
  gap: 10px;
}
.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid #e2e5e8;
  font-size: 14px;
}
.category-copy {
  display: grid;
  gap: 3px;
}
.category-share {
  color: #5f6368;
  font-size: 12px;
}
.expense-list-panel {
  display: grid;
  gap: 10px;
}
.expense-list {
  border-top: 1px solid #d5d9dd;
}
.expense-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #e2e5e8;
}
.expense-date {
  color: #5f6368;
  font-size: 13px;
  font-weight: 600;
}
.expense-copy {
  min-width: 0;
}
.expense-description {
  display: block;
  overflow-wrap: anywhere;
}
.expense-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}
.category-chip,
.recurring-chip {
  padding: 3px 6px;
  border-radius: 3px;
  background: #edf3f7;
  color: #315d7c;
  font-size: 11px;
  font-weight: 650;
}
.recurring-chip {
  background: #fff2d6;
  color: #745300;
}
.expense-amount {
  white-space: nowrap;
}
.expense-actions {
  display: flex;
  gap: 12px;
}
.text-action {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.text-action:hover:not(:disabled) {
  background: transparent;
  color: #104b78;
}
.delete-text {
  color: #b3261e;
}
.empty-panel {
  text-align: left;
}
.empty-title {
  margin-bottom: 14px;
  color: #5f6368;
}

.expense-form-view {
  max-width: 560px;
}
.back-link {
  display: inline-block;
  margin-bottom: 16px;
}
.expense-form {
  margin-top: 16px;
}
.expense-form label:first-of-type {
  margin-top: 0;
}
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d5d9dd;
  border-radius: 4px;
}
.checkbox-label input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  padding: 0;
}
.checkbox-label span {
  display: grid;
  gap: 3px;
}
.checkbox-label small {
  color: #5f6368;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.secondary-link {
  margin-left: 2px;
}

.login-container {
  max-width: 420px;
  margin-top: 10vh;
}
.login-container h1 {
  margin-bottom: 20px;
}
.login-card {
  display: grid;
  gap: 0;
}
.login-card label:first-of-type {
  margin-top: 0;
}
.login-card button {
  width: 100%;
  margin-top: 20px;
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 24px, 860px);
    margin-top: 24px;
  }
  .card {
    padding: 16px;
  }
  .topbar {
    flex-direction: column;
    gap: 14px;
  }
  .topbar nav {
    justify-content: flex-start;
  }
  .month-picker-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .month-picker-row label {
    margin: 0;
  }
  .month-picker-row select {
    width: 100%;
  }
  .total-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
  .expense-row {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .expense-actions {
    grid-column: 2 / -1;
  }
}

/* Keep login geometry consistent across the workspace; theme colors stay app-specific. */
.login-container {
  width: min(100% - 32px, 460px);
  max-width: 460px;
  margin: 12vh auto 64px;
  padding: 0;
}

.login-container h1 {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1.15;
}

.login-card {
  display: block;
  min-height: 296px;
  margin-top: 20px;
  padding: 20px;
}

.login-card label {
  margin: 18px 0 7px;
  font-size: 14px;
  line-height: 19px;
}

.login-card label:first-of-type {
  margin-top: 0;
}

.login-card input {
  display: block;
  width: 100%;
  height: 42px;
  padding: 10px 11px;
}

.login-card button {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 20px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 20px;
}

.login-card .msg {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 20px;
}

@media (max-width: 640px) {
  .login-container {
    width: min(100% - 24px, 460px);
    margin: 24px auto 48px;
    padding: 0;
  }

  .login-card {
    padding: 20px;
  }
}

/* Match the shared Daily and One Line Diary content column. */
.container:not(.login-container) {
  max-width: 560px;
  margin: 48px auto;
  padding: 0 20px;
}

@media (max-width: 640px) {
  .container:not(.login-container) {
    margin: 20px auto;
    padding: 0 16px;
  }
}

@media (max-width: 380px) {
  .container:not(.login-container) {
    padding: 0 12px;
  }
}

/* Expenses theme tokens for common/design.css. */
:root {
  --ui-background: #fffbf4;
  --ui-surface: #ffffff;
  --ui-ink: #3e3422;
  --ui-muted: #776b59;
  --ui-border: #e6d8bd;
  --ui-field-border: #d5bd91;
  --ui-accent: #a56a13;
  --ui-accent-strong: #80510c;
  --ui-accent-soft: #fff3db;
  --ui-accent-soft-border: #eed4a1;
  --ui-focus: rgb(165 106 19 / 24%);
}
