:root {
    --admin-ink: #17201c;
    --admin-muted: #748078;
    --admin-bg: #f3f5f2;
    --admin-white: #fff;
    --admin-green-950: #061f19;
    --admin-green-900: #082d25;
    --admin-green-700: #0d5b49;
    --admin-green-600: #127158;
    --admin-green-100: #ddede6;
    --admin-gold: #d5a640;
    --admin-line: #dfe4df;
    --admin-red: #b64035;
    --admin-shadow: 0 18px 45px rgba(17, 36, 28, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0; color: var(--admin-ink); background: var(--admin-bg);
    font-family: "Avenir Next", "Segoe UI", Arial, sans-serif; font-size: 14px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--admin-gold); outline-offset: 2px; }

/* Login */
.login-page { min-height: 100vh; background: #fff; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .9fr) 1.1fr; }
.login-brand-panel {
    position: relative; overflow: hidden; padding: 55px; display: flex; flex-direction: column; justify-content: space-between;
    color: #fff; background: linear-gradient(145deg, var(--admin-green-950), var(--admin-green-700));
}
.login-brand-panel::before, .login-brand-panel::after {
    content: ""; position: absolute; width: 500px; height: 500px; right: -280px; top: 50%;
    border: 1px solid rgba(213,166,64,.24); border-radius: 50%; transform: translateY(-50%);
}
.login-brand-panel::after { width: 330px; height: 330px; right: -100px; }
.login-brand-panel > * { position: relative; z-index: 2; }
.admin-brand { display: inline-flex; align-items: center; gap: 12px; }
.admin-brand-mark {
    width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--admin-gold);
    border-radius: 10px; color: var(--admin-gold); font-size: 1.2rem; font-weight: 800;
}
.admin-brand > span:last-child { display: grid; gap: 4px; line-height: 1; }
.admin-brand strong { font-size: .95rem; letter-spacing: .18em; }
.admin-brand small { color: rgba(255,255,255,.5); font-size: .48rem; letter-spacing: .18em; }
.login-eyebrow, .login-kicker { color: var(--admin-gold); font-size: .68rem; font-weight: 850; letter-spacing: .16em; }
.login-brand-panel h1 { margin: 16px 0 22px; font-size: clamp(3rem, 5vw, 5.6rem); line-height: 1.02; letter-spacing: -.055em; font-weight: 520; }
.login-brand-panel p { max-width: 510px; color: rgba(255,255,255,.65); font-size: 1.05rem; }
.login-brand-panel > small { color: rgba(255,255,255,.36); }
.login-form-panel { display: grid; place-items: center; padding: 50px; background: #fff; }
.login-form-box { width: min(100%, 460px); }
.login-form-box h2 { margin: 13px 0 5px; font-size: 2.4rem; letter-spacing: -.04em; }
.login-form-box > p { margin: 0 0 35px; color: var(--admin-muted); }
.admin-login-form label { display: grid; gap: 8px; margin-bottom: 20px; }
.admin-login-form label > span { font-size: .77rem; font-weight: 750; }
.admin-login-form input {
    width: 100%; height: 52px; padding: 0 15px; border: 1px solid #ced5cf; border-radius: 8px;
    outline: 0; transition: border .2s, box-shadow .2s;
}
.admin-login-form input:focus { border-color: var(--admin-green-600); box-shadow: 0 0 0 3px rgba(18,113,88,.1); }
.password-field { position: relative; }
.password-field input { padding-right: 65px; }
.password-field button { position: absolute; right: 8px; top: 8px; height: 36px; border: 0; background: transparent; color: var(--admin-green-700); font-size: .7rem; font-weight: 800; }
.back-site { display: block; margin-top: 24px; text-align: center; color: var(--admin-muted); font-size: .76rem; }

/* Admin shell */
.admin-app { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.admin-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 100; width: 260px; padding: 26px 18px 20px;
    display: flex; flex-direction: column; color: #fff; background: var(--admin-green-950);
}
.admin-sidebar .admin-brand { padding: 0 10px 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-sidebar nav { padding-top: 20px; overflow-y: auto; scrollbar-width: thin; }
.nav-label { display: block; margin: 22px 13px 8px; color: rgba(255,255,255,.3); font-size: .57rem; font-weight: 850; letter-spacing: .15em; }
.admin-sidebar nav a, .sidebar-footer a {
    min-height: 42px; padding: 0 13px; display: flex; align-items: center; gap: 12px;
    border-radius: 7px; color: rgba(255,255,255,.62); font-size: .8rem; font-weight: 650;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { color: #fff; background: rgba(255,255,255,.085); }
.admin-sidebar nav a.active { box-shadow: inset 3px 0 var(--admin-gold); }
.admin-sidebar nav i, .sidebar-footer i { width: 18px; color: var(--admin-gold); text-align: center; font-style: normal; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer a:hover { color: #fff; }
.admin-main { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.admin-topbar {
    position: sticky; top: 0; z-index: 80; height: 76px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--admin-line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
}
.topbar-title { display: grid; gap: 3px; }
.topbar-title span { color: var(--admin-green-600); font-size: .55rem; font-weight: 850; letter-spacing: .14em; }
.topbar-title strong { font-size: .9rem; }
.admin-user { display: flex; align-items: center; gap: 11px; }
.admin-user > span {
    width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
    background: var(--admin-green-100); color: var(--admin-green-700); font-weight: 850;
}
.admin-user > div { display: grid; }
.admin-user strong { font-size: .75rem; }
.admin-user small { color: var(--admin-muted); font-size: .62rem; }
.sidebar-toggle { display: none; width: 40px; height: 40px; border: 0; background: transparent; font-size: 1.2rem; }
.admin-content { width: min(100%, 1500px); margin: 0 auto; padding: 36px; flex: 1; }
.admin-footer { padding: 16px 36px; display: flex; justify-content: space-between; border-top: 1px solid var(--admin-line); color: var(--admin-muted); font-size: .63rem; }

/* Common */
.admin-page-heading { margin-bottom: 28px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.admin-page-heading.compact { align-items: center; }
.admin-page-heading > div > span { color: var(--admin-green-600); font-size: .6rem; font-weight: 850; letter-spacing: .15em; }
.admin-page-heading h1 { margin: 5px 0 4px; font-size: 2rem; line-height: 1.2; letter-spacing: -.035em; }
.admin-page-heading p { margin: 0; color: var(--admin-muted); }
.admin-back { display: inline-block; margin-bottom: 12px; color: var(--admin-green-700); font-size: .72rem; font-weight: 750; }
.admin-button {
    min-height: 44px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 14px;
    border: 1px solid transparent; border-radius: 7px; font-weight: 750; font-size: .78rem; transition: .2s ease;
}
.admin-button:hover { transform: translateY(-1px); }
.admin-button.primary { background: var(--admin-green-700); color: #fff; }
.admin-button.primary:hover { background: var(--admin-green-600); }
.admin-button.secondary { border-color: var(--admin-green-700); background: transparent; color: var(--admin-green-700); }
.admin-button.ghost { border-color: var(--admin-line); background: #fff; color: var(--admin-muted); }
.admin-button.full { width: 100%; }
.admin-alert { margin-bottom: 22px; padding: 12px 15px; border-radius: 7px; font-size: .8rem; }
.admin-alert.success { color: #17633c; background: #e3f4e9; border: 1px solid #bfe1cb; }
.admin-alert.error { color: #9f3027; background: #fce9e7; border: 1px solid #efc4bf; }
.admin-panel { background: #fff; border: 1px solid var(--admin-line); border-radius: 10px; box-shadow: 0 4px 16px rgba(20,41,32,.025); }
.panel-heading { min-height: 72px; padding: 17px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--admin-line); }
.panel-heading span { color: var(--admin-green-600); font-size: .55rem; font-weight: 850; letter-spacing: .14em; }
.panel-heading h2 { margin: 2px 0 0; font-size: 1rem; }
.panel-heading a { color: var(--admin-green-700); font-size: .68rem; font-weight: 750; }
.status-badge {
    width: fit-content; padding: 4px 9px; display: inline-flex; align-items: center; border-radius: 999px;
    color: #4e5b53; background: #edf0ed; font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.status-badge::before { content: ""; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.status-published, .status-qualified, .status-closed { color: #1e7048; background: #e4f4ea; }
.status-draft, .status-spam { color: #a23f34; background: #f9e9e7; }
.status-new { color: #9a6d0e; background: #fbf1d9; }
.status-contacted { color: #3169a5; background: #e5eff9; }
.status-badge.large { padding: 8px 13px; }
.empty-state { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--admin-muted); }
.empty-state span { font-size: 1.8rem; color: var(--admin-green-600); }
.empty-state p { margin: 0; }

/* Dashboard */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.metric-grid > a { min-height: 145px; padding: 21px; display: grid; grid-template-columns: 42px 1fr 16px; gap: 14px; align-items: start; background: #fff; border: 1px solid var(--admin-line); border-radius: 10px; box-shadow: var(--admin-shadow); }
.metric-grid > a:hover { border-color: #b8c6be; transform: translateY(-2px); }
.metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; font-size: .9rem; }
.metric-icon.emerald { background: var(--admin-green-100); color: var(--admin-green-700); }
.metric-icon.gold { background: #f8edd6; color: #9c6c10; }
.metric-icon.blue { background: #e5eff8; color: #3269a1; }
.metric-icon.red { background: #f9e8e5; color: #aa4035; }
.metric-grid small { color: var(--admin-muted); font-size: .54rem; font-weight: 850; letter-spacing: .12em; }
.metric-grid strong { display: block; margin: 5px 0 1px; font-size: 1.8rem; line-height: 1; }
.metric-grid p { margin: 6px 0 0; color: var(--admin-muted); font-size: .66rem; }
.metric-grid > a > b { color: var(--admin-green-600); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, .7fr); gap: 24px; }
.activity-list > a { min-height: 72px; padding: 12px 20px; display: grid; grid-template-columns: 38px 1fr 100px 90px; gap: 13px; align-items: center; border-bottom: 1px solid var(--admin-line); }
.activity-list > a:last-child { border-bottom: 0; }
.activity-list > a:hover { background: #fafbf9; }
.activity-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--admin-green-100); color: var(--admin-green-700); font-weight: 850; }
.activity-list div { display: grid; }
.activity-list strong { font-size: .77rem; }
.activity-list small { color: var(--admin-muted); font-size: .66rem; }
.activity-list time { color: var(--admin-muted); font-size: .65rem; }
.quick-actions { padding-bottom: 8px; }
.quick-actions > a { padding: 16px 20px; display: grid; grid-template-columns: 34px 1fr 14px; gap: 12px; align-items: center; border-bottom: 1px solid var(--admin-line); }
.quick-actions > a:last-child { border-bottom: 0; }
.quick-actions > a:hover { background: #fafbf9; }
.quick-actions > a > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--admin-green-100); color: var(--admin-green-700); }
.quick-actions div { display: grid; }
.quick-actions strong { font-size: .76rem; }
.quick-actions small { color: var(--admin-muted); font-size: .64rem; }

/* Tables */
.table-panel { overflow: hidden; }
.table-toolbar { min-height: 68px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--admin-line); }
.table-toolbar > span { color: var(--admin-muted); font-size: .66rem; }
.table-search { width: min(100%, 340px); height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--admin-line); border-radius: 7px; background: #fafbf9; }
.table-search span { color: var(--admin-green-600); font-size: 1rem; }
.table-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: .75rem; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.admin-table th { padding: 13px 18px; background: #f8faf7; color: var(--admin-muted); text-align: left; font-size: .58rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.admin-table td { padding: 15px 18px; border-top: 1px solid var(--admin-line); color: #39443e; font-size: .73rem; vertical-align: middle; }
.admin-table tbody tr:hover { background: #fcfdfb; }
.actions-column { text-align: right !important; }
.table-actions { min-width: 200px; text-align: right; white-space: nowrap; }
.table-actions > a, .table-actions button { padding: 5px 7px; border: 0; background: transparent; color: var(--admin-green-700); font-size: .67rem; font-weight: 750; }
.table-actions .danger { color: var(--admin-red); }
.inline-form { display: inline; }
.mini-state { color: var(--admin-muted); font-size: .68rem; }
.mini-state.yes { color: var(--admin-green-700); font-weight: 800; }
.contact-cell { display: flex; align-items: center; gap: 10px; }
.contact-cell > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--admin-green-100); color: var(--admin-green-700); font-weight: 850; }
.contact-cell div { display: grid; }
.contact-cell strong { font-size: .74rem; }
.contact-cell small, .table-subtext { display: block; color: var(--admin-muted); font-size: .62rem; }

/* Forms */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.form-panel { overflow: hidden; }
.admin-form-grid { padding: 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.admin-form-grid label { display: grid; gap: 7px; align-content: start; }
.admin-form-grid label.full-width { grid-column: 1 / -1; }
.admin-form-grid label > span:first-child { color: #39433d; font-size: .72rem; font-weight: 750; }
.admin-form-grid input:not([type="checkbox"]), .admin-form-grid textarea, .admin-form-grid select,
.status-panel select {
    width: 100%; padding: 11px 12px; border: 1px solid #cdd5cf; border-radius: 7px; background: #fff; color: var(--admin-ink); outline: 0;
}
.admin-form-grid input:not([type="checkbox"]):focus, .admin-form-grid textarea:focus, .admin-form-grid select:focus, .status-panel select:focus {
    border-color: var(--admin-green-600); box-shadow: 0 0 0 3px rgba(18,113,88,.09);
}
.admin-form-grid textarea { line-height: 1.7; resize: vertical; }
.admin-form-grid small { color: var(--admin-muted); font-size: .6rem; }
.toggle-field { min-height: 58px; padding: 13px; grid-template-columns: 40px 1fr !important; align-items: center !important; border: 1px solid var(--admin-line); border-radius: 7px; }
.toggle-field input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #ccd2ce; transition: .2s; }
.toggle-ui::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-field input:checked + .toggle-ui { background: var(--admin-green-600); }
.toggle-field input:checked + .toggle-ui::after { transform: translateX(16px); }
.toggle-field > span:last-child { display: grid; }
.toggle-field strong { font-size: .7rem; }
.toggle-field small { font-weight: 400; }
.file-field input { padding: 11px; border: 1px dashed #bfc8c1 !important; background: #fafbf9 !important; }
.current-file { width: fit-content; margin-top: 5px; display: flex !important; align-items: center; gap: 10px; color: var(--admin-muted) !important; font-size: .64rem !important; font-weight: 500 !important; }
.current-file img { width: 55px; height: 42px; object-fit: cover; border-radius: 5px; }
.account-separator { margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--admin-line); }
.account-separator > span { color: var(--admin-green-700) !important; font-size: .8rem !important; }
.current-password { padding: 16px; border-radius: 7px; background: #f8faf7; }
.form-side { display: grid; gap: 18px; position: sticky; top: 100px; }
.publish-panel, .help-panel { padding: 22px; }
.publish-panel > span, .help-panel > span, .contact-panel > span, .status-panel > span { color: var(--admin-green-600); font-size: .57rem; font-weight: 850; letter-spacing: .13em; }
.publish-panel p, .help-panel p { margin: 12px 0 20px; color: var(--admin-muted); font-size: .72rem; }
.publish-panel .admin-button + .admin-button { margin-top: 9px; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 100px; padding: 12px; border: 1px solid var(--admin-line); border-radius: 9px; background: #fff; }
.settings-nav a { min-height: 40px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border-radius: 6px; color: var(--admin-muted); font-size: .72rem; }
.settings-nav a:hover { background: var(--admin-green-100); color: var(--admin-green-700); }
.settings-nav span { min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #edf0ed; font-size: .58rem; }
.settings-groups { display: grid; gap: 20px; }
.settings-panel { scroll-margin-top: 100px; overflow: hidden; }
.sticky-save { position: sticky; bottom: 14px; z-index: 10; min-height: 66px; padding: 10px 15px 10px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #cbd5ce; border-radius: 9px; background: rgba(255,255,255,.96); box-shadow: var(--admin-shadow); backdrop-filter: blur(10px); }
.sticky-save > span { color: var(--admin-muted); font-size: .7rem; }

/* Enquiry detail */
.enquiry-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.enquiry-message { overflow: hidden; }
.message-service { margin: 24px 24px 0; padding: 16px; display: grid; gap: 3px; background: var(--admin-green-100); color: var(--admin-green-700); border-radius: 7px; }
.message-service span { font-size: .55rem; font-weight: 850; letter-spacing: .13em; }
.message-service strong { font-size: .8rem; }
.enquiry-message > p { margin: 0; padding: 28px; color: #39443e; font-size: .9rem; line-height: 1.9; }
.enquiry-detail-grid > aside { display: grid; gap: 18px; }
.contact-panel, .status-panel, .enquiry-actions { padding: 22px; }
.contact-panel > div { display: grid; gap: 3px; padding: 14px 0; border-bottom: 1px solid var(--admin-line); }
.contact-panel > div:last-child { border-bottom: 0; }
.contact-panel small { color: var(--admin-muted); font-size: .54rem; font-weight: 850; letter-spacing: .09em; }
.contact-panel strong, .contact-panel a { font-size: .75rem; }
.contact-panel a { color: var(--admin-green-700); font-weight: 700; }
.status-panel form { display: grid; gap: 10px; margin-top: 15px; }
.enquiry-actions { display: grid; gap: 9px; }

@media (max-width: 1150px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-form-panel { min-height: 100vh; padding: 30px; }
    .admin-app { grid-template-columns: 1fr; }
    .admin-main { grid-column: 1; }
    .admin-sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 45px rgba(0,0,0,.18); }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .admin-topbar { padding: 0 20px; }
    .topbar-title { margin-right: auto; margin-left: 12px; }
    .form-layout, .settings-layout, .enquiry-detail-grid { grid-template-columns: 1fr; }
    .form-side, .settings-nav { position: static; }
    .settings-nav { display: flex; overflow-x: auto; }
    .settings-nav a { white-space: nowrap; gap: 9px; }
}

@media (max-width: 650px) {
    .admin-content { padding: 22px 16px; }
    .admin-topbar { height: 66px; }
    .admin-user > div { display: none; }
    .admin-page-heading { align-items: start; flex-direction: column; }
    .admin-page-heading > .admin-button { width: 100%; }
    .admin-page-heading h1 { font-size: 1.65rem; }
    .metric-grid { grid-template-columns: 1fr; }
    .activity-list > a { grid-template-columns: 38px 1fr 76px; }
    .activity-list time { display: none; }
    .admin-form-grid { grid-template-columns: 1fr; padding: 18px; }
    .admin-form-grid label { grid-column: 1 !important; }
    .sticky-save { align-items: stretch; flex-direction: column; padding: 14px; }
    .sticky-save .admin-button { width: 100%; }
    .admin-footer { padding: 14px 16px; }
}
