* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f7f8;
    color: #243238;
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.8;
}

.site-header {
    background: #176b68;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    width: min(92%, 1000px);
    min-height: 64px;
    margin: 0 auto;
}

.brand,
.nav-link {
    color: #fff;
    text-decoration: none;
}

.brand {
    margin-left: auto;
    font-size: 1.15rem;
    font-weight: bold;
}

.nav-link:hover {
    text-decoration: underline;
}

.page-content {
    width: min(92%, 1000px);
    margin: 4rem auto;
}

.welcome-card {
    padding: 3rem 1.5rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(23, 107, 104, 0.1);
    text-align: center;
}

.welcome-card h1 {
    margin: 0 0 0.75rem;
    color: #176b68;
    font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.welcome-card p {
    margin: 0;
    color: #5b686d;
}

.auth-card {
    width: min(100%, 440px);
    margin: 0 auto;
    padding: 2rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(23, 107, 104, 0.1);
}

.auth-card h1,
.dashboard-heading h1 {
    margin-top: 0;
    color: #176b68;
}

.login-form,
.form-field {
    display: grid;
    gap: 0.5rem;
}

.login-form {
    gap: 1.25rem;
}

.form-field input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #b8c7c7;
    border-radius: 7px;
    font: inherit;
}

.form-field input:focus {
    border-color: #176b68;
    outline: 2px solid rgba(23, 107, 104, 0.18);
}

.primary-button {
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 7px;
    background: #176b68;
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.error-message,
.field-error {
    color: #a42828;
}

.error-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 7px;
    background: #fff0f0;
}

.dashboard-heading {
    margin-bottom: 2rem;
}

.dashboard-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 1.25rem;
    border: 1px solid #dce7e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(23, 107, 104, 0.07);
    color: #243238;
    text-align: right;
}

.menu-link {
    text-decoration: none;
}

.logout-button {
    border-color: #edd5d5;
    color: #9b2828;
    cursor: pointer;
    font: inherit;
}

.list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.list-heading h1 {
    margin: 0;
    color: #176b68;
}

.list-heading a,
.clear-search {
    color: #176b68;
}

.search-form {
    margin-bottom: 1.5rem;
}

.search-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.4rem;
}

.search-controls input {
    flex: 1 1 260px;
    padding: 0.7rem;
    border: 1px solid #b8c7c7;
    border-radius: 7px;
    font: inherit;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(23, 107, 104, 0.08);
}

.medicine-table {
    width: 100%;
    border-collapse: collapse;
}

.medicine-table th,
.medicine-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #e3ecec;
    text-align: right;
    white-space: nowrap;
}

.medicine-table th {
    background: #eaf4f3;
    color: #174f4d;
}

.medicine-table tbody tr:last-child td {
    border-bottom: 0;
}

.medicine-table .empty-message {
    padding: 2rem;
    color: #687579;
    text-align: center;
}

.import-help,
.upload-form,
.import-result {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(23, 107, 104, 0.08);
}

.import-help p:first-child {
    margin-top: 0;
}

.upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.file-button {
    padding: 0.7rem 1rem;
    border: 1px solid #176b68;
    border-radius: 7px;
    color: #176b68;
    cursor: pointer;
}

.file-button:focus-within,
.file-button:hover {
    background: #eaf4f3;
}

.selected-file-name {
    flex: 1 1 200px;
    color: #5b686d;
}

.import-result h2 {
    margin-top: 0;
    color: #176b68;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.result-summary div {
    padding: 1rem;
    border-radius: 8px;
    background: #eaf4f3;
}

.result-summary dt {
    color: #415255;
}

.result-summary dd {
    margin: 0.3rem 0 0;
    color: #176b68;
    font-size: 1.5rem;
    font-weight: bold;
}

.import-cancelled {
    padding: 0.8rem;
    border-radius: 7px;
    background: #fff0f0;
    color: #a42828;
}

.prescription-card {
    margin-bottom: 1rem;
    padding: 1.25rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(23, 107, 104, 0.08);
}

.patient-fields,
.prescription-item-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.prescription-item-row {
    position: relative;
    grid-template-columns: minmax(220px, 2fr) minmax(100px, 0.7fr) minmax(240px, 2fr) auto;
    align-items: end;
}

.prescription-card input[type="text"] {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #b8c7c7;
    border-radius: 7px;
    font: inherit;
}

.delete-field {
    display: none;
}

.autocomplete-field {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    z-index: 10;
    top: 100%;
    right: 0;
    left: 0;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #b8c7c7;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.autocomplete-option,
.autocomplete-empty {
    display: block;
    width: 100%;
    padding: 0.7rem;
    border: 0;
    border-bottom: 1px solid #e3ecec;
    background: #fff;
    color: #243238;
    font: inherit;
    text-align: right;
}

.autocomplete-option {
    cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option:focus {
    background: #eaf4f3;
}

.autocomplete-empty {
    color: #687579;
}

.prescription-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.secondary-button,
.danger-button {
    padding: 0.7rem 1rem;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    font: inherit;
}

.secondary-button {
    border: 1px solid #176b68;
    color: #176b68;
}

.danger-button {
    border: 1px solid #b33b3b;
    color: #9b2828;
}

.success-message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: #e4f5e9;
    color: #176134;
}

.prescription-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.prescription-meta p {
    margin: 0.4rem 0;
}

@media (max-width: 800px) {
    .patient-fields,
    .prescription-item-row {
        grid-template-columns: 1fr;
    }

    .prescription-actions {
        flex-direction: column;
    }
}

.report-filter {
    display: flex;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(23, 107, 104, 0.08);
}

.report-filter input[type="date"] {
    padding: 0.65rem;
    border: 1px solid #b8c7c7;
    border-radius: 7px;
    font: inherit;
}

.report-filter select {
    min-width: 240px;
    padding: 0.65rem;
    border: 1px solid #b8c7c7;
    border-radius: 7px;
    background: #fff;
    font: inherit;
}

.report-date {
    color: #415255;
}

.report-table {
    min-width: 1200px;
}

.report-prompt {
    padding: 2rem;
    border-radius: 10px;
    background: #fff;
    color: #687579;
    text-align: center;
}

.statistics-card {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(23, 107, 104, 0.08);
}

.medicine-statistics-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    border-bottom: 1px solid #e3ecec;
}

.medicine-statistics-heading h2 {
    margin: 0;
    color: #176b68;
    text-align: right;
}

.medicine-statistics-heading p {
    margin-top: 0.35rem;
    color: #5b686d;
}

.medicine-totals {
    display: flex;
    gap: 1rem;
    margin-top: 0;
}

.medicine-totals div {
    min-width: 130px;
    padding: 0.75rem;
    border-radius: 8px;
    background: #eaf4f3;
}

.medicine-totals dt {
    color: #415255;
}

.medicine-totals dd {
    margin: 0.25rem 0 0;
    color: #176b68;
    font-size: 1.4rem;
    font-weight: bold;
}

.no-statistics {
    color: #687579;
}

.selected-user-title {
    color: #176b68;
    font-size: 1.25rem;
}

.heading-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-link {
    display: inline-block;
    text-decoration: none;
}

@media (max-width: 700px) {
    .medicine-statistics-heading,
    .medicine-totals {
        flex-direction: column;
    }

    .medicine-totals {
        width: 100%;
    }
}
