:root {
    --blue: #007AFF;
    --blue-dark: #005FCC;
    --background: #F2F2F7;
    --card: #FFFFFF;
    --text: #1C1C1E;
    --secondary: #6E6E73;
    --border: #D1D1D6;
    --danger: #FF3B30;
    --green: #34C759;
}

* {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
}

html {
    background: var(--background);
}

body {
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "Helvetica Neue",
        Arial,
        sans-serif;

      color: var(--text);
      background: var(--background);

      min-height: 100vh;
      min-height: 100dvh;

      padding-bottom:
          env(safe-area-inset-bottom);
}

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

button {
    cursor: pointer;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 900px;
    margin: auto;
}

/* ========================================================= */
/* Header */
/* ========================================================= */

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding:
        calc(12px + env(safe-area-inset-top))
        18px
        12px;

    background: rgba(255,255,255,.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-bottom: 1px solid var(--border);
}

.app-header h1 {
    margin: 0;
    font-size: 20px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;

    background: #F2F2F7;

    font-size: 19px;
}

/* ========================================================= */
/* Main */
/* ========================================================= */

main {
    padding: 0 14px 110px;
}

.month-selector {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;

    margin: 14px 0;

    background: var(--card);
    border-radius: 16px;

    min-height: 52px;
}

.month-selector button {
    border: 0;
    background: transparent;

    color: var(--blue);

    font-size: 32px;
    line-height: 1;

    height: 52px;
}

.month-selector strong {
    text-align: center;
    font-size: 17px;
    text-transform: capitalize;
}
/* ========================================================= */
/* Cards */
/* ========================================================= */

.entry-card {
    background: var(--card);
    border-radius: 16px;

    margin-bottom: 12px;
    padding: 16px;

    box-shadow:
        0 2px 8px rgba(0,0,0,.05);
}

.entry-main {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.entry-info {
    min-width: 0;
}

.entry-date {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 7px;
}

.entry-detail {
    color: var(--secondary);
    font-size: 14px;
    margin-top: 5px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-detail span {
    margin-right: 5px;
}

.entry-result {
    text-align: right;
    flex-shrink: 0;
}

.entry-hours {
    color: var(--secondary);
    font-size: 14px;
}

.entry-amount {
    color: var(--blue);
    font-size: 17px;
    font-weight: 700;
    margin-top: 6px;
}

.entry-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;

    margin-top: 12px;
    padding-top: 10px;

    border-top: 1px solid #E5E5EA;
}

.small-button {
    border: 0;
    background: #F2F2F7;

    border-radius: 10px;

    padding: 8px 12px;

    color: var(--blue);
}

.small-button.delete {
    color: var(--danger);
}

/* ========================================================= */
/* Empty */
/* ========================================================= */

.empty {
    text-align: center;

    padding: 80px 20px;
    color: var(--secondary);
}

.empty-icon {
    font-size: 52px;
    margin-bottom: 15px;
}

.empty h2 {
    color: var(--text);
    font-size: 20px;
}

/* ========================================================= */
/* Summary */
/* ========================================================= */

.summary-card {
    background: var(--card);
    border-radius: 16px;

    padding: 18px;
    margin-top: 14px;
}

.summary-card > div:not(.summary-divider) {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.summary-card strong:last-child {
    color: var(--blue);
}

.summary-divider {
    height: 1px;
    background: var(--border);
    margin: 13px 0;
}

/* ========================================================= */
/* New button */
/* ========================================================= */

.new-entry-button {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom:
        calc(10px + env(safe-area-inset-bottom));

    max-width: 872px;
    margin: auto;

    z-index: 30;

    border: 0;
    border-radius: 15px;

    padding: 16px;

    background: var(--blue);
    color: white;

    font-weight: 700;
    font-size: 17px;

    box-shadow:
        0 5px 18px rgba(0,122,255,.3);
}

.new-entry-button:active {
    background: var(--blue-dark);
    transform: scale(.99);
}

/* ========================================================= */
/* Modal */
/* ========================================================= */

.modal {
    position: fixed;
    inset: 0;

    z-index: 100;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    background: rgba(0,0,0,.38);

    padding-top:
        env(safe-area-inset-top);
}

.modal-content {
    width: 100%;
    max-width: 650px;
    max-height: 94vh;
    max-height: 94dvh;

    overflow-y: auto;

    background: var(--background);

    border-radius:
        22px
        22px
        0
        0;

    padding:
        18px
        18px
        calc(22px + env(safe-area-inset-bottom));
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 18px;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.close-button {
    border: 0;
    background: #E5E5EA;

    border-radius: 50%;

    width: 34px;
    height: 34px;

    font-size: 24px;
    line-height: 1;

    color: var(--secondary);
}

/* ========================================================= */
/* Forms */
/* ========================================================= */

label {
    display: block;

    font-size: 14px;
    font-weight: 600;

    margin-bottom: 14px;
}

input,
select,
textarea {
    width: 100%;

    margin-top: 6px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: white;

    padding: 12px;

    color: var(--text);

    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow:
        0 0 0 3px rgba(0,122,255,.12);
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-section {
    margin-top: 24px;
}

.form-section h3,
form > h3 {
    font-size: 16px;
    margin: 22px 0 12px;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 0;
}

.switch-row input {
    width: 48px;
    height: 28px;

    margin: 0;

    appearance: none;
    -webkit-appearance: none;

    background: #D1D1D6;
    border: 0;
    border-radius: 20px;

    position: relative;

    transition: .2s;
}

.switch-row input::after {
    content: "";

    position: absolute;

    width: 24px;
    height: 24px;

    top: 2px;
    left: 2px;
    background: white;

    border-radius: 50%;

    box-shadow:
        0 1px 3px rgba(0,0,0,.25);

    transition: .2s;
}

.switch-row input:checked {
    background: var(--green);
}

.switch-row input:checked::after {
    transform: translateX(20px);
}

.calculation-box {
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: white;

    padding: 13px;

    border-radius: 11px;

    margin-bottom: 14px;
}

.calculation-box strong {
    color: var(--blue);
}

.help-text {
    color: var(--secondary);
    font-size: 13px;
    line-height: 1.45;
}

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

    margin-top: 24px;
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 12px;

    padding: 14px;

    font-weight: 700;
}

.primary-button {
    background: var(--blue);
    color: white;
}

.secondary-button {
    background: #E5E5EA;
    color: var(--text);
}

.full-width {
    width: 100%;
}

.data-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ========================================================= */
/* Toast */
/* ========================================================= */

.toast {
    position: fixed;

    left: 50%;
    bottom:
        calc(85px + env(safe-area-inset-bottom));

    transform: translateX(-50%);

    z-index: 200;

    background: rgba(30,30,30,.92);
    color: white;

    padding: 11px 16px;

    border-radius: 12px;

    font-size: 14px;

    max-width: calc(100% - 30px);

    text-align: center;
}

/* ========================================================= */
/* Utility */
/* ========================================================= */

.hidden {
    display: none !important;
}

/* ========================================================= */
/* iPad */
/* ========================================================= */

@media (min-width: 700px) {

    main {
        padding-left: 24px;
        padding-right: 24px;
    }

    .modal {
        align-items: center;
        padding: 20px;
    }

    .modal-content {
        border-radius: 22px;
        max-height: 90vh;
    }

    .new-entry-button {
        left: auto;
        right: 24px;
        width: 350px;
    }
    .entry-card {
        padding: 20px;
    }
}
