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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0 0 80px 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f4f6;
    color: #111827;
}


/* ================================
   APP HEADER
================================ */

.app-header {
    background: #111827;
    color: white;
    padding: 20px 18px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-header h1 {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
}

.app-header p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.7;
}


/* ================================
   MAIN
================================ */

main {
    width: 100%;
    max-width: 700px;
    margin: auto;
    padding: 16px;
}


/* ================================
   PAGE SYSTEM
================================ */

.page {
    display: none;
}

.page.active {
    display: block;
}


/* ================================
   WELCOME
================================ */

.welcome {
    margin-bottom: 18px;
}

.welcome h2 {
    margin: 0 0 5px;
    font-size: 24px;
}

.welcome p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}


/* ================================
   DASHBOARD
================================ */

.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat {
    background: white;
    border-radius: 16px;
    padding: 15px 8px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.stat-icon {
    display: block;
    font-size: 21px;
    margin-bottom: 6px;
}

.stat strong {
    display: block;
    font-size: 22px;
    line-height: 1.2;
}

.stat span:last-child {
    display: block;
    margin-top: 5px;
    color: #6b7280;
    font-size: 11px;
}


/* ================================
   SECTIONS
================================ */

.dashboard-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.dashboard-section h2 {
    margin: 0 0 12px;
    font-size: 17px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* ================================
   PAGE HEADER
================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.page-header h2 {
    margin: 0;
    font-size: 23px;
}

.page-header p {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 13px;
}


/* ================================
   BUTTONS
================================ */

button {
    font: inherit;
    cursor: pointer;
}

.primary-btn {
    border: none;
    background: #2563eb;
    color: white;
    padding: 11px 15px;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

.primary-btn:active,
.save-btn:active,
.settings-btn:active {
    transform: scale(0.97);
}


/* ================================
   SEARCH
================================ */

.search-box {
    width: 100%;
    border: 1px solid #d1d5db;
    background: white;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 15px;
    outline: none;
    font-size: 15px;
}

.search-box:focus {
    border-color: #2563eb;
}


/* ================================
   RECORD CARD
================================ */

.record {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.record h3 {
    margin: 0 0 9px;
    font-size: 18px;
}

.record p {
    margin: 7px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #374151;
}

.record-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.record-actions button {
    flex: 1;
    border: none;
    padding: 11px;
    border-radius: 10px;
    font-weight: 600;
}

.edit {
    background: #e5e7eb;
    color: #111827;
}

.delete {
    background: #fee2e2;
    color: #991b1b;
}


/* ================================
   FOLLOW-UP CARDS
================================ */

.followup-card {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 13px;
    margin-top: 8px;
    font-size: 14px;
}

.followup-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
}

.followup-card div {
    margin-top: 4px;
    color: #4b5563;
}

.empty {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    padding: 12px 0;
}


/* ================================
   SETTINGS
================================ */

.settings-card {
    background: white;
    border-radius: 16px;
    padding: 17px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.settings-card h3 {
    margin: 0 0 7px;
    font-size: 17px;
}

.settings-card p {
    margin: 5px 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.4;
}

.settings-card small {
    display: block;
    margin-top: 10px;
    color: #9ca3af;
}

.settings-btn {
    display: block;
    width: 100%;
    border: none;
    background: #e5e7eb;
    color: #111827;
    padding: 13px;
    margin-top: 9px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
}

.danger-card {
    border: 1px solid #fecaca;
}

.danger-button {
    width: 100%;
    border: none;
    background: #fee2e2;
    color: #991b1b;
    padding: 13px;
    border-radius: 10px;
    margin-top: 10px;
    font-weight: 700;
}


/* ================================
   MODAL
================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.hidden {
    display: none !important;
}


/* ================================
   FORM
================================ */

.form-box {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.form-header h2 {
    margin: 0;
    font-size: 21px;
}

.close-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    font-size: 25px;
    line-height: 1;
}

.form-box input,
.form-box select,
.form-box textarea {
    width: 100%;
    padding: 13px;
    margin: 6px 0 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    font: inherit;
    outline: none;
}

.form-box input:focus,
.form-box select:focus,
.form-box textarea:focus {
    border-color: #2563eb;
}

.form-box label {
    display: block;
    color: #4b5563;
    font-size: 13px;
    margin-top: 2px;
}

.form-box textarea {
    min-height: 105px;
    resize: vertical;
}

.save-btn {
    width: 100%;
    border: none;
    background: #16a34a;
    color: white;
    padding: 14px;
    border-radius: 11px;
    margin-top: 2px;
    font-weight: 700;
    font-size: 15px;
}


/* ================================
   BOTTOM NAVIGATION
================================ */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 68px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 80;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    border: none;
    background: transparent;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 20px;
}

.nav-btn small {
    font-size: 10px;
    font-weight: 600;
}

.nav-btn.active {
    color: #2563eb;
}


/* ================================
   SMALL PHONES
================================ */

@media (max-width: 380px) {

    main {
        padding: 13px;
    }

    .dashboard {
        gap: 7px;
    }

    .stat {
        padding: 13px 5px;
    }

    .stat strong {
        font-size: 19px;
    }

    .stat span:last-child {
        font-size: 10px;
    }

    .page-header h2 {
        font-size: 21px;
    }

}


/* ================================
   LARGER SCREENS
================================ */

@media (min-width: 700px) {

    .bottom-nav {
        max-width: 700px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 100%;
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
    }

}