:root {
    --primary: #028d9c;
    --primary-dark: #006d79;
    --accent: #fab677;
    --accent-soft: #fff2e5;
    --green: #7fa572;
    --green-dark: #5f8555;
    --blue: #3498db;
    --danger: #d9534f;
    --ink: #24323a;
    --muted: #6b777d;
    --border: #e1e7e9;
    --surface: #ffffff;
    --page: #f8faf8;
    --shadow: 0 12px 35px rgba(31, 54, 60, .10);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: linear-gradient(
        180deg,
        #fffaf4 0,
        var(--page) 260px,
        #f6f8f7 100%
    );
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

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

.site-header {
    background: linear-gradient(
        135deg,
        #fab677 0%,
        #f5a866 100%
    );
    color: #fff;
    box-shadow: 0 3px 16px rgba(91, 63, 40, .14);
}

.header-inner {
    width: min(1400px, 96%);
    min-height: 96px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.header-logo {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,.7);
    box-shadow: 0 5px 14px rgba(0,0,0,.12);
    transition: transform .25s ease;
}

.header-logo:hover {
    transform: scale(1.04);
}

.header-text {
    min-width: 0;
}

.header-kannada {
    font-size: clamp(16px, 1.8vw, 24px);
    font-weight: 700;
    line-height: 1.25;
}

.header-english {
    margin-top: 4px;
    font-size: clamp(13px, 1.35vw, 18px);
    font-weight: 600;
    opacity: .96;
}

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

.top-nav a {
    text-decoration: none;
    color: #fff;
    padding: 9px 14px;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    font-weight: 600;
    transition: .2s ease;
}

.top-nav a:hover {
    background: rgba(255,255,255,.23);
    transform: translateY(-1px);
}

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

.page-content {
    width: min(1400px, 94%);
    margin: 0 auto;
    padding: 38px 0 110px;
}

.page-title-block {
    text-align: center;
    margin-bottom: 28px;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: .13em;
    font-size: 11px;
    font-weight: 800;
    color: var(--primary);
}

.page-title-block h1 {
    margin: 7px 0 6px;
    color: var(--primary);
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1.15;
}

.page-title-block p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

/* =========================================================
   NOTICES
   ========================================================= */

.notice {
    width: min(800px, 100%);
    margin: 0 auto 20px;
    padding: 13px 17px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
}

.notice.success {
    background: #eaf7ec;
    color: #26733a;
    border: 1px solid #c9e8d0;
}

.notice.error {
    background: #fff0ef;
    color: #a33a36;
    border: 1px solid #f1cbc9;
}

/* =========================================================
   CARDS
   ========================================================= */

.admin-card,
.search-panel,
.results-section,
.empty-state {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-card {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 30px;
}

.login-card {
    max-width: 500px;
    text-align: center;
}

.card-icon {
    font-size: 38px;
    margin-bottom: 6px;
}

.admin-card h2 {
    margin: 5px 0 8px;
    color: var(--primary);
    font-size: 25px;
}

.admin-card > p {
    color: var(--muted);
    margin: 0 0 22px;
    text-align: center;
}

.admin-form {
    max-width: 380px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
}

.admin-form label {
    display: block;
    text-align: left;
    margin: 12px 0 6px;
    font-size: 13px;
    font-weight: 700;
    color: #45545b;
}

.admin-form input {
    width: 100%;
    margin: 0;
}

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

.primary-btn,
.secondary-btn,
.danger-btn,
.edit-btn {
    border: 0;
    border-radius: 9px;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 700;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}

.primary-btn {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 5px 12px rgba(52,152,219,.18);
}

.primary-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.admin-form .primary-btn {
    width: 100%;
    margin-top: 18px;
}

.secondary-btn {
    background: #eef5f2;
    color: #35614b;
}

.secondary-btn:hover {
    background: #e1eee8;
}

.danger-btn {
    background: #fff0ef;
    color: var(--danger);
}

.danger-btn:hover {
    background: #ffe1df;
}

/* =========================================================
   EXCEL IMPORT
   ========================================================= */

.excel-layout {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 28px;
    align-items: stretch;
}

.excel-info {
    padding: 22px;
    background: #f8fbf8;
    border: 1px solid #e4eee7;
    border-radius: 13px;
}

.excel-info h3 {
    margin: 0 0 12px;
    color: var(--primary);
}

.excel-info ol {
    margin: 0;
    padding-left: 22px;
    color: #59666c;
    line-height: 1.75;
}

.upload-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    text-align: center;
}

.file-drop {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 25px;
    border: 2px dashed #cbded4;
    border-radius: 13px;
    background: #fbfdfc;
    cursor: pointer;
    color: #40525a;
}

.file-drop:hover {
    border-color: var(--green);
    background: #f6fbf8;
}

.file-drop input {
    display: none;
}

.upload-icon {
    font-size: 38px;
    color: var(--primary);
}

.file-drop small {
    color: var(--muted);
}

.selected-file {
    min-height: 20px;
    margin: 12px 0;
    color: var(--muted);
    font-size: 13px;
    word-break: break-word;
}

.upload-form .primary-btn {
    width: 100%;
}

.admin-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

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

.search-panel {
    padding: 20px;
    margin-bottom: 28px;
}

.search-form {
    max-width: none;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
}

.search-options {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    border-radius: 999px;
    color: #4e5b61;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.radio-option:hover {
    background: #f2f7f5;
}

.radio-option input {
    width: auto;
    margin: 0;
    accent-color: var(--primary);
}

.search-row {
    display: flex;
    width: min(650px, 100%);
    margin: 16px auto 0;
    gap: 9px;
}

.search-row input {
    flex: 1;
    width: auto;
    margin: 0;
}

.search-row .primary-btn {
    flex: 0 0 auto;
}

/* =========================================================
   INPUTS
   ========================================================= */

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5dddf;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition:
        border-color .18s ease,
        box-shadow .18s ease;
}

input:focus {
    border-color: #70b8c1;
    box-shadow: 0 0 0 3px rgba(2,141,156,.10);
}

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

/*
   FULL WIDTH RESULTS

   The normal page is limited to 1400px, but the search
   results are intentionally allowed to use almost the
   entire browser width.

   This is the important part of the dashboard layout.
*/

.results-section {
    position: relative;

    width: calc(100vw - 32px);
    max-width: none;

    margin-left: calc((100% - 100vw) / 2 + 16px);
    margin-right: 0;

    overflow: hidden;
}

/* =========================================================
   RESULTS HEADER
   ========================================================= */

.results-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.results-header h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 21px;
}

.result-tag {
    padding: 7px 10px;
    background: var(--accent-soft);
    color: #966033;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

/* =========================================================
   TABLE WRAPPER
   ========================================================= */

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* =========================================================
   MEMBERS TABLE
   ========================================================= */

/*
   IMPORTANT:
   Do NOT use min-width:1180px or min-width:1250px here
   on desktop.

   The table must actually shrink/expand with the available
   browser width.
*/

.members-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: collapse;
    background: #fff;
}

/* =========================================================
   TABLE CELLS
   ========================================================= */

.members-table th,
.members-table td {
    padding: 9px 6px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #edf0f1;
}

.members-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f3f7f5;
    color: #405057;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .025em;
    white-space: nowrap;
}

.members-table td {
    font-size: 12px;
}

/* =========================================================
   COMPACT COLUMNS
   ========================================================= */

/* Photo */
.members-table th:nth-child(1),
.members-table td:nth-child(1) {
    width: 72px;
}

/* Member ID */
.members-table th:nth-child(2),
.members-table td:nth-child(2) {
    width: 92px;
}

/* Name */
.members-table th:nth-child(3),
.members-table td:nth-child(3) {
    width: 125px;
}

/* Type */
.members-table th:nth-child(4),
.members-table td:nth-child(4) {
    width: 78px;
}

/* DOB */
.members-table th:nth-child(5),
.members-table td:nth-child(5) {
    width: 100px;
}

/* Gender */
.members-table th:nth-child(6),
.members-table td:nth-child(6) {
    width: 72px;
}

/* Mobile */
.members-table th:nth-child(7),
.members-table td:nth-child(7) {
    width: 100px;
}

/* =========================================================
   COMMUNICATION ADDRESS
   ========================================================= */

/*
   Address is deliberately allowed to consume the remaining
   available width.
*/

.members-table th:nth-child(8),
.members-table td:nth-child(8) {
    width: auto;
    min-width: 220px;
}

/* Place */
.members-table th:nth-child(9),
.members-table td:nth-child(9) {
    width: 95px;
}

/* Expired */
.members-table th:nth-child(10),
.members-table td:nth-child(10) {
    width: 62px;
}

/* Expiry Date */
.members-table th:nth-child(11),
.members-table td:nth-child(11) {
    width: 102px;
}

/* Action */
.members-table th:nth-child(12),
.members-table td:nth-child(12) {
    width: 78px;
}

/* =========================================================
   TABLE INPUTS
   ========================================================= */

.members-table .edit-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 6px 6px;
    font-size: 11px;
    margin: 0;
}

.members-table .name-cell .edit-input {
    min-width: 0;
}

.members-table td:nth-child(2) .edit-input {
    font-size: 10px;
}

.members-table td:nth-child(4) .edit-input,
.members-table td:nth-child(6) .edit-input {
    padding-left: 4px;
    padding-right: 4px;
    font-size: 10px;
}

.members-table td:nth-child(11) .edit-input {
    padding: 6px 3px;
    font-size: 10px;
}

/* =========================================================
   COMMUNICATION ADDRESS INPUT
   ========================================================= */

.members-table td:nth-child(8) .edit-input {
    width: 100%;
    min-width: 0;
    line-height: 1.3;
}

/* =========================================================
   PHOTO
   ========================================================= */

.members-table .photo-cell {
    width: 72px;
    min-width: 72px;
}

.table-photo {
    width: 50px;
    height: 63px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid #e0e5e6;
    box-shadow: 0 3px 9px rgba(0,0,0,.08);
}

.photo-na {
    color: #9aa3a7;
    font-size: 11px;
}

.photo-input {
    display: none;
    margin-top: 6px !important;
}

.photo-input.visible {
    display: block;
}

/* =========================================================
   EXPIRY CHECKBOX
   ========================================================= */

.edit-checkbox {
    width: 17px;
    height: 17px;
    accent-color: var(--danger);
    cursor: pointer;
}

/* =========================================================
   EXPIRY DATE
   ========================================================= */

.expiry-input {
    font-size: 10px !important;
    padding: 6px 3px !important;
}

/* =========================================================
   EDIT BUTTON
   ========================================================= */

.edit-btn {
    background: var(--blue);
    color: #fff;
    padding: 6px 8px;
    font-size: 10px;
    min-width: 62px;
    white-space: nowrap;
}

.edit-btn:hover {
    background: #2980b9;
}

.edit-btn.update-mode {
    background: var(--green-dark);
}

.edit-btn:disabled {
    opacity: .65;
    cursor: wait;
}

/* =========================================================
   TABLE HOVER
   ========================================================= */

.members-table tbody tr:hover {
    background: #fbfdfc;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    width: min(650px, 100%);
    margin: 25px auto 0;
    padding: 42px 25px;
    text-align: center;
}

.empty-icon {
    font-size: 42px;
}

.empty-state h2 {
    color: var(--primary);
    margin: 8px 0;
}

.empty-state p {
    color: var(--muted);
    margin: 0;
}

/* =========================================================
   TOAST
   ========================================================= */

.toast {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 9999;
    max-width: min(420px, calc(100% - 40px));
    padding: 13px 17px;
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,.2);
    opacity: 0;
    transform: translateY(12px);
    transition: .25s ease;
    font-weight: 600;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #3b8650;
}

.toast.error {
    background: #b94b47;
}

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
    background: #7fa572;
    color: #fff;
    padding: 12px 18px;
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
}

/* =========================================================
   ADMIN LOGIN LINK
   ========================================================= */

.login-to-edit {
    display: inline-flex;
    padding: 6px 8px;
    border-radius: 8px;
    background: #eef5f2;
    color: #35614b;
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.login-to-edit:hover {
    background: #e1eee8;
}

/* =========================================================
   LARGE DESKTOP
   ========================================================= */

@media (min-width: 1500px) {

    .results-section {
        width: calc(100vw - 40px);
        margin-left: calc((100% - 100vw) / 2 + 20px);
    }

    .results-header {
        padding-left: 28px;
        padding-right: 28px;
    }

    .members-table th,
    .members-table td {
        padding-left: 7px;
        padding-right: 7px;
    }

    .members-table th {
        font-size: 11px;
    }

    .members-table td {
        font-size: 12px;
    }

    .members-table .edit-input {
        font-size: 11px;
        padding: 7px;
    }

    /*
       Give address even more visual room on wide monitors.
    */

    .members-table th:nth-child(8),
    .members-table td:nth-child(8) {
        min-width: 300px;
    }
}
@media (max-width: 640px) {
    .members-table th:nth-child(8),
    .members-table td:nth-child(8) {
        min-width: 220px;
    }
}
/* =========================================================
   VERY LARGE DESKTOP
   ========================================================= */

@media (min-width: 1800px) {

    .results-section {
        width: calc(100vw - 50px);
        margin-left: calc((100% - 100vw) / 2 + 25px);
    }

    .members-table th,
    .members-table td {
        padding-left: 8px;
        padding-right: 8px;
    }

    .members-table .edit-input {
        padding: 7px 8px;
    }

    .members-table th:nth-child(8),
    .members-table td:nth-child(8) {
        min-width: 350px;
    }
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .header-inner {
        min-height: 82px;
    }

    .header-logo {
        width: 62px;
        height: 62px;
    }

    .top-nav a {
        padding: 7px 10px;
        font-size: 12px;
    }

    .excel-layout {
        grid-template-columns: 1fr;
    }

    /*
       At this width, there simply isn't enough physical
       screen space for every editable field.
    */

    .results-section {
        width: calc(100vw - 20px);
        margin-left: calc((100% - 100vw) / 2 + 10px);
    }

    .table-wrap {
        overflow-x: auto;
    }

    .members-table {
        min-width: 1120px;
        table-layout: auto;
    }

    .members-table th,
    .members-table td {
        padding: 9px 7px;
    }

    .members-table th:nth-child(8),
    .members-table td:nth-child(8) {
        min-width: 230px;
    }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 640px) {

    .header-inner {
        width: 94%;
        padding: 9px 0;
        gap: 9px;
        align-items: center;
    }

    .brand {
        gap: 9px;
    }

    .header-logo {
        width: 52px;
        height: 52px;
        border-radius: 11px;
    }

    .header-kannada {
        font-size: 12px;
    }

    .header-english {
        font-size: 10px;
    }

    .top-nav {
        gap: 4px;
    }

    .top-nav a {
        font-size: 10px;
        padding: 6px 8px;
    }

    .page-content {
        width: 94%;
        padding-top: 25px;
        padding-bottom: 85px;
    }

    .admin-card {
        padding: 20px 15px;
    }

    .search-panel {
        padding: 14px;
    }

    .search-options {
        justify-content: flex-start;
    }

    .radio-option {
        font-size: 12px;
        padding: 6px 8px;
    }

    .search-row {
        flex-direction: column;
    }

    .search-row .primary-btn {
        width: 100%;
    }

    /*
       Mobile gets the maximum possible width, but the table
       remains scrollable because 12 editable columns cannot
       physically fit on a phone.
    */

    .results-section {
        width: calc(100vw - 10px);
        margin-left: calc((100% - 100vw) / 2 + 5px);
        border-radius: 12px;
    }

    .results-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

    .result-tag {
        align-self: flex-start;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .members-table {
        min-width: 1120px;
        table-layout: auto;
    }

    .members-table th,
    .members-table td {
        padding: 8px 6px;
    }

    .members-table th {
        font-size: 10px;
    }

    .members-table td {
        font-size: 11px;
    }

    .members-table .edit-input {
        font-size: 10px;
    }

    .admin-actions {
        flex-direction: column;
        width: min(300px, 100%);
        margin-left: auto;
        margin-right: auto;
    }

    .admin-actions a {
        width: 100%;
    }

    .file-drop {
        min-height: 170px;
    }
}

/* =========================================================
   CLEAR SEARCH BUTTON
   ========================================================= */

.clear-search-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 9px;
    background: #fff0ef;
    color: #b94b47;
    border: 1px solid #f1cbc9;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: background .18s ease,
                color .18s ease,
                transform .18s ease;
}

.clear-search-btn:hover {
    background: #ffe1df;
    color: #963c38;
    transform: translateY(-1px);
}

.admin-top-nav {
    width: min(1400px, 96%);
    margin: 10px auto 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.admin-top-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    color: #405057;
    background: #ffffff;
    border: 1px solid #dfe6e8;
    box-shadow: 0 3px 10px rgba(0,0,0,.05);
    transition: .2s ease;
}

.admin-top-nav a:hover {
    background: #f2f7f5;
    transform: translateY(-1px);
}

.admin-top-nav .logout-link {
    color: #d9534f;
    background: #fff0ef;
    border-color: #f1cbc9;
}

.admin-top-nav .logout-link:hover {
    background: #ffe1df;
}

@media (max-width: 640px) {
    .admin-top-nav {
        width: 94%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .admin-top-nav a {
        flex: 1;
        min-width: 90px;
    }
}