:root {
    --ink: #0b0d0b;
    --paper: #f3f1ec;
    --white: #fff;
    --lime: #caff47;
    --orange: #f04b25;
    --muted: #6e706d;
    --line: #e5e5df;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Kanit", sans-serif;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.5;
}

body:not(.login-page) {
    padding-left: 270px;
}

a {
    color: inherit;
    text-decoration: none;
}

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

img {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    font-family: "Montserrat", sans-serif;
    letter-spacing: -.03em;
}

.admin-sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: 270px;
    padding: 30px 22px 24px;
    color: white;
    background: #0a0c0a;
}

.admin-brand {
    display: block;
    padding: 4px 8px 36px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.admin-brand img {
    width: 165px;
    margin-bottom: 12px;
}

.admin-brand span {
    color: rgba(255, 255, 255, .5);
    font-size: 13px;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.admin-sidebar nav {
    display: grid;
    gap: 5px;
    margin-top: 28px;
}

.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 14px;
    color: rgba(255, 255, 255, .66);
    border-radius: 9px;
    transition: color .2s, background .2s;
}

.admin-sidebar nav a span {
    width: 22px;
    font-size: 19px;
    text-align: center;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    color: var(--ink);
    background: var(--lime);
}

.sidebar-footer {
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.sidebar-footer a,
.sidebar-footer button {
    width: 100%;
    padding: 10px 12px;
    color: rgba(255, 255, 255, .65);
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.sidebar-footer a:hover,
.sidebar-footer button:hover {
    color: white;
}

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

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 112px;
    padding: 22px 42px;
    background: rgba(255, 255, 255, .85);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(15px);
}

.admin-topbar p {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .17em;
    text-transform: uppercase;
}

.admin-topbar h1 {
    margin-bottom: 0;
    font-size: 29px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user > span,
.inquiry-row > span,
.inquiry-meta > span {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    color: var(--ink);
    background: var(--lime);
    border-radius: 50%;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
}

.admin-user strong,
.admin-user small {
    display: block;
}

.admin-user small {
    color: var(--muted);
}

.admin-main {
    width: min(1420px, 100%);
    padding: 38px 42px 90px;
}

.admin-alert {
    margin-bottom: 24px;
    padding: 15px 18px;
    border-radius: 9px;
}

.admin-alert.success {
    background: #e2f9ab;
    border: 1px solid #b4df51;
}

.admin-alert.error {
    color: #82230f;
    background: #fff0ec;
    border: 1px solid #fac1b4;
}

.admin-alert ul {
    margin-bottom: 0;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stats-cards a {
    display: flex;
    flex-direction: column;
    min-height: 190px;
    padding: 26px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 16px;
    transition: border .2s, transform .2s;
}

.stats-cards a:hover {
    border-color: var(--ink);
    transform: translateY(-3px);
}

.stats-cards span {
    color: var(--muted);
}

.stats-cards strong {
    margin: 10px 0 auto;
    font-family: "Montserrat", sans-serif;
    font-size: 53px;
    letter-spacing: -.05em;
}

.stats-cards small {
    font-size: 14px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 28px;
}

.admin-card {
    padding: 30px;
    margin-bottom: 28px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .02);
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 26px;
}

.card-heading span,
.section-editor-heading span {
    color: var(--orange);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .18em;
}

.card-heading h2,
.section-editor-heading h2 {
    margin: 5px 0 0;
    font-size: 27px;
}

.card-heading p {
    margin: 7px 0 0;
    color: var(--muted);
}

.card-heading > a:not(.admin-primary) {
    padding-bottom: 3px;
    border-bottom: 1px solid;
}

.inquiry-row {
    display: grid;
    grid-template-columns: 43px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 17px 0;
    border-top: 1px solid var(--line);
}

.inquiry-row strong,
.inquiry-row small {
    display: block;
}

.inquiry-row small,
.inquiry-row time {
    color: var(--muted);
}

.quick-actions {
    display: flex;
    flex-direction: column;
}

.quick-actions > a {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 19px 0;
    border-top: 1px solid var(--line);
}

.quick-actions > a:hover {
    color: #526d00;
}

.quick-actions b {
    color: #a3a69f;
    font-family: "Montserrat", sans-serif;
}

.quick-actions strong,
.quick-actions small {
    display: block;
}

.quick-actions small {
    color: var(--muted);
}

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

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

.admin-table th {
    padding: 12px 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: .12em;
    text-align: left;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
}

.admin-table td {
    padding: 21px 14px;
    border-bottom: 1px solid var(--line);
}

.admin-table td strong,
.admin-table td small {
    display: block;
}

.admin-table td small {
    color: var(--muted);
}

.tag,
.status {
    display: inline-block;
    padding: 5px 10px;
    background: #f1f1ec;
    border-radius: 20px;
    font-size: 12px;
}

.status.published {
    color: #314900;
    background: #e1f8aa;
}

.table-action {
    text-align: right;
    white-space: nowrap;
}

.table-action a,
.table-action button {
    margin-left: 14px;
    font-size: 14px;
}

.table-action form {
    display: inline;
}

.table-action button {
    color: #a03b24;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.admin-tabs {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    gap: 6px;
    padding: 8px;
    margin-bottom: 28px;
    overflow-x: auto;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
    border-radius: 12px;
    backdrop-filter: blur(12px);
}

.admin-tabs a {
    padding: 9px 14px;
    border-radius: 8px;
    white-space: nowrap;
}

.admin-tabs a:hover {
    background: var(--lime);
}

.admin-form label {
    display: block;
    margin-bottom: 17px;
    font-weight: 400;
}

.admin-form label small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-weight: 300;
}

.admin-form input:not([type="checkbox"], [type="file"]),
.admin-form textarea,
.admin-form select {
    display: block;
    width: 100%;
    padding: 11px 13px;
    margin-top: 6px;
    color: var(--ink);
    background: #fbfbf8;
    border: 1px solid #d9dad4;
    border-radius: 8px;
    outline: 0;
    transition: border .2s, box-shadow .2s;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: #91b932;
    box-shadow: 0 0 0 3px rgba(202, 255, 71, .28);
}

.admin-form textarea {
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 120px;
}

.seo-editor {
    margin: 30px 0;
    padding: 28px;
    background: #f7f8f2;
    border: 1px solid #e2e5d8;
    border-radius: 14px;
}

.seo-editor .section-editor-heading {
    margin: 0 0 22px;
}

.seo-preview {
    display: grid;
    gap: 6px;
    max-width: 700px;
    margin-top: 20px;
    padding: 22px;
    background: #fff;
    border: 1px solid #dde1d4;
    border-radius: 12px;
}

.seo-preview small {
    color: #397357;
}

.seo-preview strong {
    color: #2449a5;
    font-size: 20px;
    font-weight: 500;
}

.seo-preview p {
    margin: 0;
    color: #4b4e48;
    line-height: 1.55;
}

.tracking-toggle {
    margin-bottom: 26px;
    padding: 20px;
    background: #f7f8f2;
    border: 1px solid #e2e5d8;
    border-radius: 12px;
}

.tracking-toggle p {
    margin: 10px 0 0 28px;
    color: var(--muted);
    font-size: 13px;
}

.tracking-settings-grid,
.custom-code-grid {
    display: grid;
    gap: 18px;
}

.tracking-settings-grid {
    grid-template-columns: repeat(3, 1fr);
}

.custom-code-grid {
    grid-template-columns: repeat(2, 1fr);
    margin: 26px 0;
}

.tracking-help > div:last-child {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.tracking-help article {
    padding: 22px;
    background: #f7f8f2;
    border-radius: 12px;
}

.tracking-help article b {
    color: var(--orange);
}

.tracking-help article h3 {
    margin: 12px 0 8px;
}

.tracking-help article p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.check-row,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.check-row {
    justify-content: flex-start;
    margin: 10px 0 22px;
}

.check-row label,
.form-actions label,
.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.admin-primary {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    min-width: 155px;
    padding: 11px 17px;
    color: var(--ink);
    background: var(--lime);
    border: 1px solid #a8d331;
    border-radius: 8px;
    font-weight: 400;
    cursor: pointer;
}

.admin-primary:hover {
    background: #b8ec38;
}

.section-editor-heading {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin: 55px 0 24px;
}

.section-editor-heading > p {
    max-width: 550px;
    color: var(--muted);
}

.section-editor {
    position: relative;
}

.section-editor-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.section-editor-title h3 {
    display: inline-block;
    margin: 0 0 0 10px;
    font-size: 21px;
}

.code-field {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
}

.image-picker {
    display: grid;
    grid-template-columns: 1.2fr .8fr 110px;
    gap: 18px;
    align-items: end;
}

.image-picker img {
    width: 110px;
    height: 85px;
    margin-bottom: 17px;
    object-fit: cover;
    background: #eee;
    border-radius: 8px;
}

.delete-form {
    position: absolute;
    right: 30px;
    bottom: 34px;
}

.delete-form button {
    color: #9a341d;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.media-upload {
    max-width: 900px;
}

.drop-zone {
    display: grid !important;
    min-height: 180px;
    margin-bottom: 24px !important;
    place-items: center;
    align-content: center;
    background: #f7f9f0;
    border: 2px dashed #bec69c;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
}

.drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.drop-zone span {
    font-family: "Montserrat", sans-serif;
    font-size: 19px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.media-item {
    overflow: hidden;
    background: white;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.media-item > img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: #ecece7;
}

.media-item > div {
    padding: 16px;
}

.media-item strong,
.media-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-item small {
    margin-bottom: 12px;
    color: var(--muted);
}

.media-item button {
    padding: 0;
    margin-right: 12px;
    color: #3c5400;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.media-item form {
    display: inline;
}

.media-item form button {
    color: #9a341d;
}

.inquiry-list {
    display: grid;
    gap: 20px;
}

.inquiry-detail {
    margin: 0;
}

.inquiry-meta {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 15px;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.inquiry-meta h2 {
    margin: 0;
    font-size: 20px;
}

.inquiry-meta a,
.inquiry-meta time {
    color: var(--muted);
}

.inquiry-detail > h3 {
    font-size: 20px;
}

.inquiry-detail > p {
    max-width: 900px;
    color: #4e504c;
}

.inquiry-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
}

.inquiry-actions button {
    color: #9a341d;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.empty-state {
    padding: 35px;
    color: var(--muted);
    text-align: center;
}

.login-page {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    min-height: 100vh;
    color: white;
    background: #070807;
}

.login-art {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 50px;
    overflow: hidden;
    background: #030303 url("../images/image31.webp") center / cover;
}

.login-art > a {
    position: relative;
    z-index: 2;
    width: 180px;
}

.login-art > div {
    position: relative;
    z-index: 2;
    max-width: 660px;
    margin-bottom: 60px;
}

.login-art > div > p {
    color: var(--orange);
    letter-spacing: .17em;
}

.login-art h1 {
    margin-bottom: 25px;
    font-size: clamp(3rem, 5vw, 5.8rem);
    line-height: 1.02;
}

.login-art > div > span {
    color: rgba(255, 255, 255, .55);
}

.login-orbit {
    position: absolute;
    z-index: 1;
    right: -180px;
    bottom: -180px;
    width: 650px;
    opacity: .65;
}

.login-panel {
    display: grid;
    padding: 45px;
    place-items: center;
    color: var(--ink);
    background: white;
}

.login-panel form {
    width: min(430px, 100%);
}

.login-kicker {
    margin-bottom: 8px;
    color: var(--orange);
    font-size: 13px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.login-panel h2 {
    margin-bottom: 35px;
    font-size: 34px;
}

.login-panel label:not(.remember) {
    display: block;
    margin-bottom: 20px;
}

.login-panel input:not([type="checkbox"]) {
    display: block;
    width: 100%;
    padding: 13px 14px;
    margin-top: 7px;
    background: #f8f8f5;
    border: 1px solid #deded7;
    border-radius: 8px;
    outline: 0;
}

.login-panel input:focus {
    border-color: #90b830;
    box-shadow: 0 0 0 3px rgba(202, 255, 71, .25);
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 25px;
}

.login-panel .admin-primary {
    width: 100%;
    padding: 13px 18px;
}

.back-link {
    display: table;
    margin: 24px auto 0;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .media-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .login-page {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 850px) {
    body:not(.login-page) {
        padding-left: 0;
        padding-bottom: 76px;
    }

    .admin-sidebar {
        position: fixed;
        inset: auto 0 0;
        display: block;
        width: 100%;
        height: 70px;
        padding: 8px;
    }

    .admin-brand,
    .sidebar-footer {
        display: none;
    }

    .admin-sidebar nav {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
        margin: 0;
    }

    .admin-sidebar nav a {
        display: grid;
        gap: 1px;
        padding: 6px 3px;
        place-items: center;
        font-size: 10px;
        text-align: center;
    }

    .admin-sidebar nav a span {
        font-size: 18px;
    }

    .admin-topbar {
        padding: 18px 22px;
    }

    .admin-main {
        padding: 24px 20px 55px;
    }

    .admin-user div {
        display: none;
    }

    .media-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-picker {
        grid-template-columns: 1fr 1fr;
    }

    .image-picker img {
        grid-column: 1 / -1;
    }

    .tracking-settings-grid,
    .custom-code-grid,
    .tracking-help > div:last-child {
        grid-template-columns: 1fr;
    }

    .login-page {
        grid-template-columns: 1fr;
    }

    .login-art {
        min-height: 330px;
        padding: 30px;
    }

    .login-art > div {
        margin-bottom: 0;
    }

    .login-art h1 {
        font-size: 2.8rem;
    }

    .login-panel {
        min-height: 610px;
        padding: 30px 22px;
    }
}

@media (max-width: 580px) {
    .admin-topbar {
        min-height: 90px;
    }

    .admin-topbar h1 {
        font-size: 22px;
    }

    .stats-cards,
    .form-grid,
    .form-grid-3,
    .media-grid {
        grid-template-columns: 1fr;
    }

    .stats-cards a {
        min-height: 150px;
    }

    .admin-card {
        padding: 22px 18px;
    }

    .seo-editor {
        padding: 20px 16px;
    }

    .card-heading,
    .section-editor-heading {
        flex-direction: column;
    }

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

    .delete-form {
        position: static;
        margin-top: 20px;
    }

    .image-picker {
        grid-template-columns: 1fr;
    }

    .inquiry-meta {
        grid-template-columns: 45px 1fr;
    }

    .inquiry-meta time {
        grid-column: 2;
    }

    .inquiry-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .admin-sidebar nav a {
        font-size: 0;
    }

    .admin-sidebar nav a span {
        font-size: 21px;
    }
}
