.shell {
  width: min(1200px, calc(100% - 40px));
}

.entry-card {
  padding: 16px 18px 15px;
}

.entry-card .section-title {
  margin-bottom: 12px;
}

.entry-card .title-with-badge {
  gap: 12px;
}

.entry-card #entryKindIndicator {
  display: none !important;
}

.entry-kind-switch-field {
  margin: 0;
}

.entry-kind-switch-field legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.entry-kind-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 156px;
  height: 32px;
  padding: 2px;
  border: 1px solid #c9d2da;
  border-radius: 999px;
  background: linear-gradient(90deg, #eaf7ed 0%, #f4f7f5 46%, #f7f7f7 50%, #f8f4f4 54%, #faecea 100%);
  box-shadow: inset 0 1px 2px rgba(35, 45, 55, .05);
}

.entry-kind-switch .kind-button {
  height: 26px;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.entry-kind-switch .kind-button[data-kind="income"] {
  color: #2e7443;
}

.entry-kind-switch .kind-button[data-kind="expense"] {
  color: #9a443c;
}

.entry-kind-switch .kind-button[data-kind="income"].active {
  background: rgba(255, 255, 255, .92);
  border-color: #9fcaab;
  box-shadow: 0 1px 4px rgba(36, 99, 55, .14);
  color: #235d35;
}

.entry-kind-switch .kind-button[data-kind="expense"].active {
  background: rgba(255, 255, 255, .92);
  border-color: #e2aaa4;
  box-shadow: 0 1px 4px rgba(139, 52, 45, .13);
  color: #84362f;
}

.entry-grid {
  grid-template-columns: 145px 160px minmax(175px, 1fr) minmax(250px, 1.45fr) 140px 92px;
  gap: 10px;
}

.entry-card.entry-income {
  background: #f7fcf8;
  border-color: #c8e3cf;
}

.entry-card.entry-expense {
  background: #fff9f8;
  border-color: #ead0cd;
}

/* Ledger header and desktop toolbar */
.ledger-title {
  padding: 11px 14px 7px;
  margin-bottom: 0 !important;
}

.ledger-title .section-title {
  margin-bottom: 0;
}

.ledger-title h2 {
  font-size: 17px;
}

#monthSummary {
  margin-top: 4px;
  line-height: 1.4;
}

.ledger-desktop-tools {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  border-top: 1px solid #e1e6eb;
  border-bottom: 1px solid #dce2e8;
  background: #f8fafb;
}

.ledger-period-tools,
.ledger-view-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ledger-period-tools {
  padding-right: 10px;
  border-right: 1px solid #dce2e8;
}

.ledger-view-tools {
  padding-left: 10px;
  border-left: 1px solid #dce2e8;
}

.ledger-month-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ledger-month-tools .month-picker {
  display: block;
}

.ledger-month-tools .month-picker > span {
  display: none;
}

.ledger-month-tools input[type="month"] {
  width: 150px;
  height: 30px;
}

.ledger-display-month {
  display: none;
}

.ledger-search {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 5px;
  min-width: 0;
}

.ledger-search input {
  min-width: 0;
}

.ledger-tool-button.emphasis {
  background: #fff;
  border-color: #9eabb7;
}

/* Right-edge input confirmation sidebar */
#confirmationToggle {
  display: none !important;
}

.confirmation-drawer {
  width: 330px;
  max-width: calc(100vw - 46px);
  background: #eef2f5;
  border-left: 1px solid #bcc6cf;
  overflow: visible;
  box-shadow: -10px 0 28px rgba(31, 42, 55, .14);
}

.confirmation-drawer-header {
  min-height: 58px;
  padding: 12px 14px;
}

.confirmation-drawer-header .confirmation-drawer-close {
  display: none;
}

.confirmation-drawer .confirmation-list {
  height: calc(100vh - 58px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 9px;
  background: #eef2f5;
}

.confirmation-edge-open {
  position: fixed;
  top: 82px;
  right: 0;
  z-index: 69;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #aeb9c5;
  border-right: 0;
  border-radius: 7px 0 0 7px;
  background: #fff;
  color: #42515f;
  font-weight: 700;
  cursor: pointer;
  box-shadow: -3px 2px 10px rgba(31, 42, 55, .10);
}

.confirmation-edge-open:hover {
  background: #f4f7f9;
}

.confirmation-edge-open .confirmation-count {
  position: absolute;
  top: -7px;
  left: -7px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  font-size: 10px;
}

.confirmation-drawer-collapse {
  position: absolute;
  left: -27px;
  top: 50%;
  transform: translateY(-50%);
  width: 27px;
  height: 86px;
  padding: 0;
  border: 1px solid #aeb9c5;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #f7f9fb;
  color: #485765;
  font-weight: 700;
  cursor: pointer;
  box-shadow: -3px 2px 9px rgba(31, 42, 55, .08);
}

.confirmation-drawer-collapse:hover {
  background: #eef3f6;
}

.confirmation-edge-open.hidden-edge,
.confirmation-drawer-collapse.hidden-edge {
  display: none;
}

/* Dedicated opening-balance dialog */
.opening-modal {
  width: min(650px, calc(100% - 28px));
  padding: 20px;
}

.opening-modal .opening-list {
  max-height: 52vh;
  overflow: auto;
  padding-right: 4px;
}

@media (max-width: 1250px) {
  .shell {
    width: calc(100% - 28px);
  }

  .entry-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-field {
    grid-column: span 2;
  }

  .ledger-desktop-tools {
    grid-template-columns: 1fr;
  }

  .ledger-period-tools,
  .ledger-view-tools {
    padding: 0;
    border: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    width: calc(100% - 20px);
  }

  .entry-kind-switch {
    width: 140px;
  }

  .entry-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ledger-desktop-tools {
    gap: 7px;
  }

  .ledger-search {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .confirmation-drawer {
    width: min(330px, calc(100vw - 34px));
  }
}

#monthSummary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.ledger-summary-item {
  color: #61707d;
  white-space: nowrap;
}

.ledger-summary-item strong {
  color: #2d3944;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ledger-summary-item.income strong {
  color: #2d7142;
}

.ledger-summary-item.expense strong {
  color: #98443c;
}

.ledger-summary-item.ending {
  padding-left: 10px;
  border-left: 1px solid #d7dee5;
}

.ledger-summary-search {
  color: #2f6489;
  white-space: nowrap;
}

.opening-dialog-heading {
  margin-top: 16px;
  align-items: end;
}

.opening-dialog-heading .hint {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .settings-nav {
    grid-template-columns: repeat(3, 1fr);
  }
}
