:root {
  --primary-color: #1677ff;
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --card-bg-muted: #fafafa;
  --header-height: 64px;
  --sider-width: 220px;
  --sider-collapsed-width: 80px;
  --text-color: rgba(0, 0, 0, 0.88);
  --border-color: #f0f0f0;
}

html, body, #root {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.app-layout {
  min-height: 100vh;
}

.app-sider {
  box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
  z-index: 10;
}

.app-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  background: #002140;
  color: #ffffff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  overflow: hidden;
  white-space: nowrap;
}

.app-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 6px;
  font-weight: bold;
  font-size: 18px;
}

.app-header {
  height: var(--header-height);
  line-height: var(--header-height);
  padding: 0 24px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 9;
}

.app-header-left,
.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-mobile-brand {
  display: none;
}

.app-trigger {
  font-size: 18px;
  cursor: pointer;
  transition: color 0.3s;
}

.app-trigger:hover {
  color: var(--primary-color);
}

.app-content {
  padding: 24px;
  min-height: 280px;
  background: var(--bg-color);
  overflow-y: auto;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
}

/* Microsoft To Do Task Style */
.todo-container {
  max-width: 680px;
  margin: 0 auto;
}

.todo-input-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.todo-input {
  font-size: 15px;
  flex: 1;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-empty-state {
  background: #ffffff;
  border-radius: 8px;
  padding: 32px 16px;
  text-align: center;
  border: 1px dashed var(--border-color);
}

.todo-item {
  background: #ffffff;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
  min-height: 52px;
  transition: all 0.2s ease;
  user-select: none;
}

.todo-item:hover {
  border-color: #d9d9d9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.todo-checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid #b0b0b0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.todo-checkbox:hover {
  border-color: var(--primary-color);
}

.todo-checkbox.checked {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
}

.todo-title {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-color);
  cursor: pointer;
  word-break: break-word;
}

.todo-item.completed {
  background: #fafafa;
}

.todo-item.completed .todo-title {
  text-decoration: line-through;
  color: rgba(0, 0, 0, 0.45);
}

.todo-delete-btn {
  background: transparent;
  border: none;
  color: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  padding: 6px;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.todo-delete-btn:hover {
  color: #ff4d4f;
  background: rgba(255, 77, 79, 0.08);
}

.todo-completed-section {
  margin-top: 24px;
}

.todo-completed-toggle {
  background: rgba(0, 0, 0, 0.04);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.65);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  user-select: none;
}

.todo-completed-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
}

.toggle-arrow {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
}

.todo-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.todo-filter-bar {
  margin-bottom: 12px;
  overflow-x: auto;
}

/* Monthly notes (Catatan) — Google Keep style */
.keep-page {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 24px;
}

.keep-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.keep-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.keep-month-nav,
.note-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  padding: 2px 4px;
  min-height: 42px;
  min-width: 220px;
}

.note-month-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: 50% !important;
}

.note-month-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  text-transform: capitalize;
  padding: 0 8px;
}

.keep-composer {
  max-width: 560px;
  margin: 0 auto 10px;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.2), 0 2px 6px rgba(60, 64, 67, 0.12);
}

.keep-composer-input {
  flex: 1;
  font-size: 15px;
}

.keep-composer-btn {
  border-radius: 8px !important;
}

.keep-copy-row {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.keep-empty {
  background: transparent;
  padding: 40px 16px;
}

.keep-grid {
  column-count: 1;
  column-gap: 14px;
}

@media (min-width: 640px) {
  .keep-grid {
    column-count: 2;
  }
}

@media (min-width: 960px) {
  .keep-grid {
    column-count: 3;
  }
}

.keep-card {
  break-inside: avoid;
  page-break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
  padding: 14px 14px 10px;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  text-align: left;
  vertical-align: top;
}

.keep-card:hover,
.keep-card:focus-within {
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.25), 0 4px 8px rgba(60, 64, 67, 0.12);
}

.keep-card:focus {
  outline: 2px solid rgba(26, 115, 232, 0.45);
  outline-offset: 2px;
}

.keep-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #202124;
  margin-bottom: 8px;
  word-break: break-word;
}

.keep-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keep-card-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 24px;
}

.keep-card-check.done .keep-check-label {
  text-decoration: line-through;
  color: rgba(0, 0, 0, 0.45);
}

.keep-check-btn {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.45);
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  line-height: 1;
}

.keep-check-btn.checked {
  background: #202124;
  border-color: #202124;
  color: #fff;
}

.keep-check-label {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  color: #3c4043;
  word-break: break-word;
}

.keep-card-empty {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.4);
  padding: 2px 0 6px;
}

.keep-card-more {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.5);
}

.keep-card-actions {
  display: flex;
  justify-content: flex-end;
  opacity: 0.55;
  transition: opacity 0.15s ease;
  margin-top: 6px;
  position: relative;
  z-index: 2;
}

.keep-card:hover .keep-card-actions,
.keep-card:focus-within .keep-card-actions {
  opacity: 1;
}

.keep-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.keep-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #d93025;
}

.note-detail-form {
  margin-top: 4px;
}

.note-detail-field {
  margin-bottom: 16px;
}

.note-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.note-check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-height: 48px;
}

.keep-detail-check {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0;
  padding: 8px 0;
  min-height: 40px;
}

.note-check-item.done .note-check-text {
  text-decoration: line-through;
  color: rgba(0, 0, 0, 0.45);
}

.note-check-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.note-check-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.keep-detail-title {
  font-size: 20px !important;
  font-weight: 600 !important;
  margin-bottom: 12px !important;
  padding: 0 !important;
}

.keep-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 575px) {
  .keep-card-actions {
    opacity: 1;
  }

  .keep-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .keep-month-nav {
    width: 100%;
  }
}

/* Settings page */
.settings-card.ant-card {
  background: var(--card-bg);
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
}

.settings-card .ant-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.settings-card-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.settings-card-header-between {
  justify-content: space-between;
  gap: 10px;
}

.settings-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 16px;
}

.settings-card-title {
  font-size: 15px;
}

.settings-card-subtitle {
  font-size: 12px;
}

.settings-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

.settings-card-hint {
  font-size: 13px;
}

.settings-trash-list {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.settings-trash-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card-bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  gap: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --card-bg-muted: rgba(255, 255, 255, 0.06);
  }
}

/* Planner & Calendar UI */
.planner-input-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planner-extra-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* Finance & Cashflow UI */
.finance-type-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

.finance-type-badge.income {
  background: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.finance-type-badge.expense {
  background: #fff2f0;
  color: #ff4d4f;
  border: 1px solid #ffccc7;
}

.finance-amount {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.finance-amount.income {
  color: #52c41a;
}

.finance-amount.expense {
  color: #ff4d4f;
}

.app-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .app-sider {
    display: none !important;
  }

  .app-trigger {
    display: none !important;
  }

  .app-mobile-brand {
    display: inline-flex;
    align-items: center;
  }

  .app-header {
    padding: 0 16px;
  }

  .app-content {
    padding: 16px 12px calc(72px + env(safe-area-inset-bottom, 0px)) 12px;
  }

  .app-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
    z-index: 1000;
  }

  .app-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: rgba(0, 0, 0, 0.45);
    text-decoration: none;
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .app-bottom-nav-item .nav-icon {
    font-size: 18px;
    line-height: 1;
  }

  .app-bottom-nav-item.active {
    color: var(--primary-color);
    font-weight: 600;
  }

  .app-bottom-nav-item:active {
    transform: scale(0.95);
  }
}

.app-update-banner {
  background: #e6f4ff;
  border-bottom: 1px solid #91caff;
  color: #0958d9;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1001;
  font-size: 13px;
  animation: slideDown 0.3s ease-out;
}

.app-update-banner-text {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-install-banner {
  background: #f6ffed;
  border-bottom: 1px solid #b7eb8f;
  color: #389e0d;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1001;
  font-size: 13px;
  animation: slideDown 0.3s ease-out;
}

.app-install-banner-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.app-install-banner-text {
  font-weight: 500;
}

.app-install-banner-tip {
  font-size: 12px;
  color: #52c41a;
  line-height: 1.35;
}

.app-install-banner-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.app-install-btn {
  font-weight: 500;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Accessibility (A11y) & Reduced Motion (WCAG 2.1 AA)
   ========================================================================== */

/* High-contrast focus visible indicator */
:focus-visible {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.25) !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="tab"]:focus-visible,
[tabindex]:focus-visible,
.ant-btn:focus-visible,
.ant-input:focus-visible,
.ant-select-selector:focus-visible {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  background: var(--primary-color);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  font-size: 14px;
  z-index: 10000;
  text-decoration: none;
  transition: top 0.2s ease-in-out;
}

.skip-link:focus {
  top: 0;
}

/* ===== Login screen (mobile-app first) ===== */
.login-shell {
  --login-ink: #0b1220;
  --login-teal: #2a9d8f;
  --login-teal-deep: #1f7a70;
  --login-bg: #f4f6f5;
  --login-text: rgba(11, 18, 32, 0.9);
  --login-muted: rgba(11, 18, 32, 0.55);
  --login-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --login-body: 'Source Sans 3', 'Segoe UI', sans-serif;

  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(42, 157, 143, 0.16), transparent 55%),
    var(--login-bg);
  color: var(--login-text);
  font-family: var(--login-body);
}

.login-screen {
  box-sizing: border-box;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.login-panel-header {
  margin: 8px 0 28px;
}

.login-brand {
  margin: 0;
  font-family: var(--login-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--login-ink);
}

.login-support {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--login-muted);
}

.login-tabs .ant-tabs-nav {
  margin-bottom: 16px;
}

.login-tabs .ant-tabs-nav::before {
  border-bottom-color: rgba(11, 18, 32, 0.08);
}

.login-tabs .ant-tabs-ink-bar {
  background: var(--login-teal);
}

.login-tabs .ant-tabs-tab {
  padding: 10px 0;
  font-size: 15px;
}

.login-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
  color: var(--login-teal-deep);
  font-weight: 600;
}

.login-tabs .ant-tabs-tab:hover .ant-tabs-tab-btn {
  color: var(--login-teal-deep);
}

.login-form .ant-form-item {
  margin-bottom: 14px;
}

.login-form .ant-form-item-label {
  padding-bottom: 4px;
}

.login-form .ant-form-item-label > label {
  font-size: 13px;
  color: var(--login-muted);
}

.login-form .ant-input-affix-wrapper,
.login-form .ant-input-password,
.login-form .ant-input {
  border-radius: 12px;
  min-height: 48px;
}

.login-form .ant-input-affix-wrapper-focused,
.login-form .ant-input-affix-wrapper:focus,
.login-form .ant-input-affix-wrapper:focus-within,
.login-form .ant-input:focus {
  border-color: var(--login-teal) !important;
  box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.16) !important;
}

.login-form .ant-checkbox-checked .ant-checkbox-inner {
  background-color: var(--login-teal);
  border-color: var(--login-teal);
}

.login-form .ant-checkbox-wrapper:hover .ant-checkbox-inner,
.login-form .ant-checkbox-checked::after {
  border-color: var(--login-teal);
}

.login-form-meta {
  display: flex;
  align-items: center;
  margin: 0 0 16px;
}

.login-form-meta .ant-checkbox-wrapper {
  font-size: 14px;
  color: var(--login-muted);
}

.login-submit.ant-btn-primary {
  height: 48px;
  border-radius: 12px;
  background: var(--login-teal);
  border-color: var(--login-teal);
  font-weight: 600;
  font-size: 16px;
}

.login-submit.ant-btn-primary:hover,
.login-submit.ant-btn-primary:focus {
  background: var(--login-teal-deep) !important;
  border-color: var(--login-teal-deep) !important;
}

.login-register-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  color: var(--login-muted);
}

/* Wide screens: keep phone-column app feel, no desktop landing */
@media (min-width: 480px) {
  .login-shell {
    align-items: center;
    padding: 24px 16px;
  }

  .login-screen {
    min-height: auto;
    max-height: min(760px, calc(100dvh - 48px));
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 36px rgba(11, 18, 32, 0.08);
    border: 1px solid rgba(11, 18, 32, 0.05);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

