/* Keep a long note inside its column instead of widening the ledger. */
.month-spend {
  margin: 0 0 12px;
  line-height: 1.5;
}

.month-spend .spend-total {
  font-size: 18px;
}

.month-pie-note {
  color: #475467;
  margin-bottom: 12px;
}

.month-pies {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 28px;
}

.month-pie {
  text-align: center;
}

.month-pie-label {
  font-size: 14px;
  margin-bottom: 2px;
}

.month-pie.is-current .month-pie-label {
  color: #175cd3;
  font-weight: 700;
}

.month-pie-total {
  color: #475467;
  font-size: 13px;
  margin-bottom: 6px;
}

.month-pie-chart {
  margin: 0 auto;
}

.month-pie-empty {
  border: 1px dashed #d0d5dd;
  border-radius: 50%;
}

.month-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 18px 0 28px;
}

.month-legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.month-legend i {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.listheader::after {
  content: "";
  display: block;
  clear: both;
}

.receipt-lines-block {
  clear: both;
  display: block;
  margin: 0 0 12px;
  width: 100%;
}

.receipt-lines-toolbar {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 6px;
  width: 100%;
}

.receipt-lines-label {
  color: #475467;
  flex: 0 0 auto;
  font-size: 14px;
}

.receipt-lines-tip {
  color: #667085;
  flex: 1 1 12em;
  font-size: 13px;
  line-height: 1.4;
  min-width: 0;
}

.row-upload-btn.disabled {
  opacity: 0.65;
  pointer-events: none;
}

.row-upload-btn {
  background: #eee;
  border: 1px solid #bbb;
  border-radius: 2px;
  cursor: pointer;
  display: inline-block;
  font-size: 13px;
  font-weight: normal;
  line-height: 1.4;
  margin: 0;
  padding: 1px 6px;
  vertical-align: middle;
}

.row-upload-btn.armed {
  background: #dbeafe;
  border-color: #175cd3;
  color: #175cd3;
}

.receipt-lines {
  min-height: 7.5em;
  resize: vertical;
}

.receipt-lines-hint,
.note-count {
  color: #475467;
  font-size: 13px;
  margin-top: 4px;
}

.note-count.over {
  color: #b42318;
}

.month-detail {
  margin: 24px 0 40px;
}

.month-detail-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.month-detail-head h4 {
  margin: 0;
}

.month-detail-status {
  color: #475467;
  font-size: 14px;
  margin-bottom: 8px;
}

.month-detail-table {
  background: #fff;
}

.month-detail-table .note-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chart-group-toggle {
  margin-left: 12px;
  margin-right: 12px;
}

.chart-group-toggle .radio-inline {
  margin-right: 12px;
}

@media (min-width: 768px) {
  #Main > .entry-form,
  #Main > hr,
  #Main > .table-responsive {
    width: 58em;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  #Main > .entry-form {
    padding-left: 0;
    padding-right: 0;
  }

  #Main > .entry-form > .row {
    margin-left: 0;
    margin-right: 0;
  }

  #Main > .entry-form > .row > [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
  }

  #Main > .entry-form .receipt-lines-block {
    width: 100%;
  }

  #Main > .entry-form .input-group.col-md-8 {
    display: flex;
    float: none;
    width: 100%;
    margin-bottom: 8px;
    padding: 0;
  }

  #Main > .entry-form .input-group.col-md-8 > .input-group-addon,
  #Main > .entry-form .input-group.col-md-8 > .form-control {
    float: none;
    width: auto;
  }

  #Main > .entry-form .input-group.col-md-8 > .form-control,
  #Main > .entry-form .select-editable {
    flex: 1 1 auto;
  }

  #Main > .entry-form .select-editable {
    position: relative;
    height: 34px;
    border: 1px solid #ccc;
    border-left: 0;
  }

  #Main > .entry-form .select-editable select {
    position: relative;
    width: 100%;
    height: 32px;
    padding: 6px 8px;
  }

  .ledger-table {
    table-layout: fixed;
    width: 100%;
  }

  .ledger-table th:nth-child(1),
  .ledger-table td:nth-child(1) {
    width: 8em;
  }

  .ledger-table th:nth-child(2),
  .ledger-table td:nth-child(2),
  .ledger-table th:nth-child(3),
  .ledger-table td:nth-child(3) {
    width: 8em;
  }

  .ledger-table th:nth-child(4),
  .ledger-table td:nth-child(4) {
    width: 6em;
  }

  .ledger-table th:nth-child(5),
  .ledger-table td:nth-child(5) {
    width: 12em;
  }

  .ledger-table th:nth-child(6),
  .ledger-table td:nth-child(6) {
    width: 11.5em;
    white-space: nowrap;
  }

  .ledger-table .row-actions {
    white-space: nowrap;
  }

  .ledger-table .row-actions button,
  .ledger-table .row-actions .row-upload-btn {
    margin-right: 2px;
  }

  .ledger-table input {
    max-width: 100%;
    box-sizing: border-box;
  }

  .ledger-table .note-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
  }

  .entry-form .date-field {
    display: flex;
    width: fit-content;
    max-width: 100%;
  }

  .entry-form #datetimepicker1 {
    display: flex;
    width: auto;
  }

  .entry-form .date-field > .input-group-addon,
  .entry-form #datetimepicker1 > .input-group-addon {
    display: flex;
    align-items: center;
    float: none;
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .entry-form #datetimepicker1 > .form-control {
    flex: 0 0 12em;
    width: 12em;
  }
}

/* Phone layout. Desktop styles stay as they are above 768px. */
@media (max-width: 767px) {
  body {
    font-size: 16px;
  }

  input,
  select,
  textarea,
  .form-control {
    font-size: 16px;
  }

  .form-control,
  .btn,
  .navbar-nav > li > a,
  .input-group-addon {
    min-height: 44px;
  }

  .btn {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #wrap > img.img-responsive {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
  }

  .contentwrap {
    padding-top: 12px;
  }

  .login-captcha {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .login-captcha img {
    width: 180px;
    height: auto;
  }

  .login-captcha .form-control {
    width: 100%;
    margin: 8px 0 0 !important;
  }

  .navbar-form .form-control {
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }

  .navbar-form .btn {
    width: 100%;
  }

  .entry-form > .input-group,
  .entry-form .input-group.col-md-8 {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    clear: both;
  }

  .entry-form .receipt-lines-block {
    display: block;
    width: 100%;
    margin-bottom: 10px;
  }

  .entry-form .receipt-lines-toolbar {
    display: block;
  }

  .entry-form .receipt-lines-label,
  .entry-form .receipt-lines-tip {
    display: block;
    width: 100%;
  }

  .entry-form .receipt-lines-tip {
    margin-top: 2px;
  }

  .entry-form .receipt-lines {
    display: block;
    width: 100%;
  }

  .entry-form > .input-group > .input-group-addon,
  .entry-form .input-group.col-md-8 > .input-group-addon {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 4px 4px 0 0;
  }

  .entry-form .form-control,
  .entry-form .select-editable {
    display: block;
    width: 100%;
    border-radius: 0 0 4px 4px;
  }

  .select-editable {
    position: static;
    height: auto;
    min-height: 44px;
    border: 0;
  }

  .select-editable select,
  .select-editable input {
    position: static;
    display: block;
    width: 100%;
    height: 44px;
    font-size: 16px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 0 0 4px 4px;
  }

  #datetimepicker1 {
    display: table;
    width: 100%;
  }

  #datetimepicker1 > .form-control,
  #datetimepicker1 > .input-group-addon {
    display: table-cell;
    float: none;
    width: auto;
    min-height: 44px;
    vertical-align: middle;
    text-align: center;
  }

  #datetimepicker1 > .form-control {
    width: 100%;
    text-align: left;
  }

  .entry-form .row .btn {
    width: 100%;
    margin-top: 8px;
  }

  .month-spend {
    margin: 4px 12px 12px;
    padding: 12px;
    background: #f5f8fb;
    border-radius: 8px;
    font-size: 18px;
  }

  .listheader {
    padding: 0 12px 12px;
  }

  .listheader .pageblock,
  .listheader .searchblock {
    float: none !important;
    width: 100%;
    margin-bottom: 8px;
  }

  .listheader .searchblock input,
  .listheader select {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
    font-size: 16px;
  }

  .table-responsive {
    overflow: visible;
    border: 0;
  }

  .page-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }

  .page-nav a,
  .page-nav select {
    flex: 1 1 45%;
    min-height: 44px;
    line-height: 42px;
    text-align: center;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    background: #fff;
    text-decoration: none;
  }

  .ledger-table thead {
    display: none;
  }

  .ledger-table,
  .ledger-table tbody,
  .ledger-table tr,
  .ledger-table td {
    display: block;
    width: 100%;
  }

  .ledger-table tr {
    margin: 0 12px 12px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
  }

  .ledger-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 0;
    padding: 8px 0;
    text-align: right;
  }

  .ledger-table td::before {
    content: attr(data-label);
    flex: 0 0 4.5em;
    color: #667085;
    font-weight: 600;
    text-align: left;
  }

  .ledger-table td.note-cell {
    align-items: flex-start;
  }

  .ledger-table .note-text {
    min-width: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
    text-align: left;
  }

  .ledger-table td.row-actions {
    display: flex;
    gap: 8px;
  }

  .ledger-table td.row-actions::before {
    content: none;
  }

  .ledger-table td.row-actions button,
  .ledger-table td.row-actions .row-upload-btn {
    flex: 1;
    min-height: 44px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .spend-matrix {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 8px;
  }

  .spend-matrix > .row {
    display: table;
    width: max-content;
    min-width: 100%;
    margin: 0;
  }

  .spend-matrix .col-xs-1 {
    display: table-cell;
    float: none;
    width: auto;
    min-width: 76px;
    padding: 10px 8px;
    vertical-align: middle;
  }

  .chart-page .navbar-nav {
    float: none;
    margin: 0;
  }

  .chart-page .navbar-nav > li {
    float: none;
  }

  .chart-page .form-inline .form-group,
  .chart-page .form-inline .form-control,
  .chart-page .form-inline .btn {
    display: block;
    width: 100%;
    margin: 0 0 8px !important;
  }

  .chart-page #month_pie,
  .chart-page #bar_chart,
  .chart-page #chart1_div {
    height: 300px !important;
  }
}
