/* ==========================================================================
   ONDC Local E-Cart — KYC form + admin panel
   Plain CSS, no build step required.
   ========================================================================== */

:root {
    --brand: #0f6f5c;
    --brand-dark: #0a5446;
    --brand-soft: #e6f2ef;
    --accent: #f59e0b;
    --bg: #f4f7f6;
    --surface: #ffffff;
    --text: #13201e;
    --muted: #5f706d;
    --border: #dfe7e5;
    --border-strong: #c6d3d0;
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --success: #1d7a4c;
    --success-soft: #e7f6ee;
    --warn: #b26a00;
    --warn-soft: #fff4e0;
    --info: #1f6f8b;
    --info-soft: #e6f2f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 40, 36, .06), 0 1px 3px rgba(16, 40, 36, .04);
    --shadow-md: 0 10px 30px rgba(16, 40, 36, .09);
    --font: "Segoe UI", Roboto, Helvetica, Arial, system-ui, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3 {
    margin: 0 0 .4em;
    line-height: 1.25;
    font-weight: 700;
}

p {
    margin: 0 0 1em;
}

img {
    max-width: 100%;
}

/* --------------------------------------------------------------- buttons -- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .68rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus-visible {
    outline: 3px solid rgba(15, 111, 92, .35);
    outline-offset: 2px;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
    color: #fff;
}

.btn-outline {
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--border);
    color: var(--text);
}

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

.btn-danger:hover {
    background: #a5342a;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: .4rem .7rem;
    font-size: 13px;
}

/* ----------------------------------------------------------------- brand -- */

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-size: 16px;
}

.brand-text small {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .02em;
}

.brand-light .brand-text strong {
    color: #fff;
}

.brand-light .brand-text small {
    color: rgba(255, 255, 255, .62);
}

/* ---------------------------------------------------------- public pages -- */

.public-body {
    background:
        radial-gradient(1200px 400px at 50% -180px, #dcefe9 0%, rgba(220, 239, 233, 0) 70%),
        var(--bg);
}

.public-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.public-header-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-chip {
    padding: .3rem .7rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.public-main {
    max-width: 880px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3.5rem;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.form-card-head {
    padding: 1.6rem 1.6rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fbfdfc 0%, #ffffff 100%);
}

.form-card-head h1 {
    font-size: 22px;
}

.form-card-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.form-body {
    padding: 1.6rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem 1.35rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.field-full {
    grid-column: 1 / -1;
}

.label {
    font-size: 13.5px;
    font-weight: 650;
    color: var(--text);
}

.label .req {
    color: var(--danger);
    margin-left: 2px;
}

.hint {
    font-size: 12.5px;
    color: var(--muted);
}

.input,
.select,
.textarea {
    width: 100%;
    padding: .62rem .75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 111, 92, .15);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
    border-color: var(--danger);
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
    color: #9aa8a6;
}

.input-mono {
    font-family: var(--mono);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.field-error {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--danger);
}

.file-input-wrap {
    position: relative;
}

input[type="file"].input {
    padding: .5rem;
    background: #fbfdfc;
}

input[type="file"]::file-selector-button {
    margin-right: .7rem;
    padding: .45rem .8rem;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.file-chosen {
    display: block;
    margin-top: .3rem;
    font-size: 12.5px;
    color: var(--muted);
}

.form-actions {
    margin-top: 1.6rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-actions .btn-primary {
    min-width: 190px;
    padding: .8rem 1.4rem;
    font-size: 15px;
}

.form-note {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

/* --------------------------------------------------------------- notices -- */

.alert {
    padding: .8rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 1.25rem;
}

.alert ul {
    margin: .4rem 0 0;
    padding-left: 1.1rem;
}

.alert-success {
    background: var(--success-soft);
    border-color: #bfe3ce;
    color: #145c39;
}

.alert-error {
    background: var(--danger-soft);
    border-color: #f3c4bf;
    color: #96271b;
}

.alert-info {
    background: var(--info-soft);
    border-color: #c2dee9;
    color: #17556b;
}

.alert ul {
    margin-bottom: 0;
}

/* ------------------------------------------------------------ success page */

.success-card {
    max-width: 620px;
    margin: 1.5rem auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.4rem 1.8rem;
    text-align: center;
}

.success-icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 30px;
    font-weight: 800;
}

.success-card h1 {
    font-size: 22px;
}

.success-card > p {
    color: var(--muted);
}

.reference-box {
    margin: 1.4rem 0;
    padding: 1rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
}

.reference-box span {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.reference-box strong {
    font-family: var(--mono);
    font-size: 20px;
    color: var(--brand-dark);
}

/* ----------------------------------------------------------------- admin -- */

.admin-body {
    background: var(--bg);
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex: none;
    background: #0d2b25;
    color: #fff;
    padding: 1.3rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex: 1;
}

.side-nav a {
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .74);
    font-size: 14px;
    font-weight: 600;
}

.side-nav a:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    text-decoration: none;
}

.side-nav a.active {
    background: var(--brand);
    color: #fff;
}

.side-foot {
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.side-user {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.side-user span {
    font-weight: 650;
    font-size: 14px;
}

.side-user small {
    color: rgba(255, 255, 255, .55);
    font-size: 12px;
    word-break: break-all;
}

.side-foot .btn-ghost {
    border-color: rgba(255, 255, 255, .2);
    color: rgba(255, 255, 255, .8);
}

.side-foot .btn-ghost:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0;
    font-size: 18px;
}

.topbar-sub {
    color: var(--muted);
    font-size: 13px;
    margin: .1rem 0 0;
}

.admin-chip {
    padding: .35rem .8rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 650;
}

.admin-content {
    padding: 1.6rem;
    flex: 1;
}

/* ----------------------------------------------------------------- cards -- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.4rem;
}

.card-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-head h2 {
    margin: 0;
    font-size: 15.5px;
}

.card-head p {
    margin: .1rem 0 0;
    font-size: 13px;
    color: var(--muted);
}

.card-body {
    padding: 1.25rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius-sm);
    padding: .95rem 1.1rem;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 650;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 750;
    line-height: 1.2;
    margin-top: .2rem;
}

.stat-pending {
    border-left-color: var(--accent);
}

.stat-approved {
    border-left-color: var(--success);
}

.stat-rejected {
    border-left-color: var(--danger);
}

/* ---------------------------------------------------------------- toolbar -- */

.toolbar {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.toolbar .field {
    min-width: 190px;
}

.toolbar-spacer {
    flex: 1;
}

/* ----------------------------------------------------------------- table -- */

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: .7rem .85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}

.table th {
    background: #f7faf9;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}

.table tbody tr:hover {
    background: #fafcfb;
}

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

.table .cell-strong {
    font-weight: 650;
}

.table .cell-mono {
    font-family: var(--mono);
    font-size: 13px;
}

.table .cell-wrap {
    white-space: normal;
    max-width: 220px;
}

.table .cell-sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
}

.empty-state strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    margin-bottom: .3rem;
}

/* ---------------------------------------------------------------- badges -- */

.badge {
    display: inline-block;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.badge-pending {
    background: var(--warn-soft);
    color: var(--warn);
}

.badge-approved {
    background: var(--success-soft);
    color: var(--success);
}

.badge-rejected {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ------------------------------------------------------------- detail view -- */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.detail-item {
    border-bottom: 1px dashed var(--border);
    padding-bottom: .7rem;
}

.detail-item dt {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 650;
    margin-bottom: .2rem;
}

.detail-item dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.detail-item dd.mono {
    font-family: var(--mono);
    letter-spacing: .04em;
}

.detail-item dd.muted {
    color: var(--muted);
    font-weight: 500;
}

.detail-item.full {
    grid-column: 1 / -1;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.doc-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fbfdfc;
}

.doc-box header {
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: 13px;
    font-weight: 700;
    background: var(--surface);
}

.doc-preview {
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: .8rem;
}

.doc-preview img {
    max-height: 260px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: contain;
}

.doc-empty {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    padding: 2rem 1rem;
}

.doc-meta {
    padding: .55rem .8rem;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
    background: var(--surface);
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1.4rem;
    align-items: start;
}

.danger-zone {
    border-color: #f0c9c4;
}

.danger-zone .card-head {
    border-bottom-color: #f5d9d5;
    background: #fef7f6;
}

.danger-zone .card-head h2 {
    color: var(--danger);
}

/* ----------------------------------------------------------------- login -- */

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background:
        radial-gradient(900px 380px at 50% -160px, #d8ece6 0%, rgba(216, 236, 230, 0) 70%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem 1.75rem;
}

.login-card .brand {
    justify-content: center;
    margin-bottom: 1.4rem;
}

.login-card h1 {
    text-align: center;
    font-size: 19px;
    margin-bottom: .2rem;
}

.login-card .login-sub {
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 1.4rem;
}

.login-card .field {
    margin-bottom: 1rem;
}

.login-card .btn {
    margin-top: .4rem;
}

.login-foot {
    text-align: center;
    margin-top: 1.2rem;
    font-size: 13px;
    color: var(--muted);
}

/* ------------------------------------------------------------ pagination -- */

.pagination {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
}

.pagination a:hover {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}

.pagination .active span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.pagination .disabled span {
    color: #a9b6b4;
    background: #f7faf9;
}

.pagination-meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
}

/* ------------------------------------------------------------- utilities -- */

.check-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .9rem;
    font-size: 13.5px;
    color: var(--muted);
    cursor: pointer;
}

.check-row input {
    width: 15px;
    height: 15px;
    accent-color: var(--brand);
}

.mt-1 {
    margin-top: .9rem;
}

.mt-2 {
    margin-top: 1.1rem;
}

.back-link {
    margin: 0 0 1rem;
    font-size: 14px;
    font-weight: 600;
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 960px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .admin-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;
        padding: .9rem 1rem;
    }

    .side-nav {
        flex-direction: row;
        flex-wrap: wrap;
        flex: 1 1 100%;
    }

    .side-foot {
        border-top: 0;
        padding-top: 0;
        flex-direction: row;
        align-items: center;
        gap: .7rem;
    }

    .admin-content,
    .topbar {
        padding: 1rem;
    }

    .form-grid,
    .detail-grid,
    .doc-grid {
        grid-template-columns: 1fr;
    }

    .public-main {
        padding: 1.25rem 1rem 2.5rem;
    }

    .form-body,
    .form-card-head {
        padding: 1.2rem;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

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