:root {
    --bg: #f5f7f5;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --text: #232323;
    --muted: #626b66;
    --line: #d8dfd9;
    --accent: #2e6f73;
    --accent-dark: #1f5054;
    --accent-soft: #dceceb;
    --gold: #b07935;
    --danger: #9d3d34;
    --shadow: 0 18px 50px rgba(32, 48, 40, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1160px;
    margin: 0 auto;
    padding: 24px;
}

.brand {
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 0.95rem;
}

.top-nav a {
    text-decoration: none;
}

.top-nav a:hover {
    color: var(--accent-dark);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 40px;
    align-items: end;
    max-width: 1160px;
    min-height: 440px;
    margin: 0 auto;
    padding: 72px 24px 80px;
}

.hero-copy {
    max-width: 760px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

h1 {
    max-width: 760px;
    margin-bottom: 20px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 4.9rem;
    line-height: 1;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    line-height: 1.15;
}

h3 {
    margin-bottom: 10px;
    font-size: 1.15rem;
    line-height: 1.25;
}

.lead {
    max-width: 620px;
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 1.18rem;
}

.hero-actions,
.form-actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 0 18px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    color: #fff;
    background: var(--accent);
}

.button.primary:hover {
    background: var(--accent-dark);
}

.button.secondary {
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-color: #c6dddb;
}

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

.button.compact {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.9rem;
}

.button.full-width {
    width: 100%;
}

.hero-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
}

.panel-label {
    display: block;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 0.9rem;
}

.hero-panel ul {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hero-panel li {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    font-weight: 700;
}

.section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 36px 24px;
}

.section-heading {
    margin-bottom: 22px;
}

.section-heading.with-meta {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.category-list {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.category-list span,
.tag,
.status-pill,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.category-list span,
.tag {
    color: var(--accent-dark);
    background: var(--accent-soft);
}

.status-pill,
.status.featured {
    color: #6d4616;
    background: #f2dfc5;
}

.featured-grid,
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

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

.tool-card {
    display: flex;
    min-height: 330px;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    background: var(--surface);
}

.featured-card {
    min-height: 360px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.tool-image,
.admin-image-preview,
.table-thumb {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(46, 111, 115, 0.08), rgba(176, 121, 53, 0.08)),
        #f7faf8;
}

.tool-image {
    aspect-ratio: 16 / 9;
    margin-bottom: 18px;
}

.tool-image img,
.admin-image-preview img,
.table-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--focus-x, 50%) var(--focus-y, 50%);
    transform: scale(var(--zoom, 1));
    transform-origin: var(--focus-x, 50%) var(--focus-y, 50%);
}

.tool-image span,
.admin-image-preview span,
.table-thumb span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 800;
}

.card-topline {
    display: flex;
    min-height: 28px;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

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

.text-link {
    margin-top: auto;
    color: var(--accent-dark);
    font-weight: 800;
    text-decoration: none;
}

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

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 32px;
    background: rgba(255, 255, 255, 0.45);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    max-width: 1160px;
    margin: 40px auto 0;
    border-top: 1px solid var(--line);
    padding: 24px;
    color: var(--muted);
    font-size: 0.9rem;
}

.admin-body {
    background: #f2f5f2;
}

.admin-header,
.admin-layout {
    max-width: 1120px;
}

.admin-layout {
    display: grid;
    gap: 20px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.admin-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.admin-title h1,
.login-card h1 {
    margin-bottom: 0;
    font-size: 2.6rem;
    line-height: 1.05;
}

.admin-title p {
    max-width: 420px;
    margin-bottom: 4px;
    color: var(--muted);
}

.admin-panel,
.login-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-heading h2 {
    font-size: 1.45rem;
}

.small-link {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.tool-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid #cbd4cd;
    border-radius: 7px;
    padding: 11px 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

textarea {
    resize: vertical;
}

input[type="file"] {
    padding: 9px 10px;
}

input[type="range"] {
    padding: 0;
    accent-color: var(--accent);
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(46, 111, 115, 0.16);
}

.wide {
    grid-column: 1 / -1;
}

.checkbox-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.checkbox-row input {
    width: auto;
}

.image-settings,
.range-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.image-settings > div:first-child {
    grid-column: span 2;
}

.admin-image-preview {
    aspect-ratio: 16 / 9;
}

.field-help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.remove-image-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.remove-image-row input {
    width: auto;
}

.notice {
    border-radius: 8px;
    padding: 13px 16px;
    color: #204c31;
    background: #deefe4;
    font-weight: 700;
}

.notice.error {
    color: #7a2620;
    background: #f4dedb;
}

.tool-table {
    display: grid;
    gap: 8px;
}

.table-row {
    display: grid;
    grid-template-columns: 92px minmax(220px, 1.5fr) 120px 150px 70px 170px;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.table-thumb {
    width: 92px;
    aspect-ratio: 16 / 10;
}

.table-head {
    border: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.table-row small,
.muted {
    display: block;
    color: var(--muted);
}

.status.on {
    color: #1d5534;
    background: #dcf0e4;
}

.status.off {
    color: #6b352f;
    background: #f0dfdc;
}

.row-actions form {
    margin: 0;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card {
    display: grid;
    width: min(100%, 430px);
    gap: 16px;
}

.login-brand {
    margin-bottom: 4px;
}

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

@media (max-width: 900px) {
    .hero,
    .featured-grid,
    .tool-grid,
    .tool-form {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-top: 44px;
    }

    h1 {
        font-size: 3.8rem;
    }

    .section-heading.with-meta,
    .admin-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .category-list {
        justify-content: flex-start;
    }

    .table-row,
    .table-head {
        grid-template-columns: 1fr;
    }

    .image-settings,
    .range-grid {
        grid-template-columns: 1fr;
    }

    .image-settings > div:first-child {
        grid-column: auto;
    }

    .table-head {
        display: none;
    }
}

@media (max-width: 560px) {
    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-nav {
        width: 100%;
        justify-content: space-between;
    }

    .hero,
    .section,
    .admin-layout {
        padding-left: 18px;
        padding-right: 18px;
    }

    h1 {
        font-size: 2.7rem;
    }

    .admin-title h1,
    .login-card h1 {
        font-size: 2.2rem;
    }
}
