:root {
    --navy-950: #06253a;
    --navy-900: #08344d;
    --navy-800: #0b4961;
    --teal-700: #087887;
    --teal-600: #0795a6;
    --cyan-500: #18afd0;
    --cyan-100: #dff7fb;
    --coral-600: #d94f45;
    --coral-100: #fff0ee;
    --ink-900: #102c3a;
    --ink-600: #526a75;
    --ink-500: #6d818a;
    --line: #d7e2e6;
    --surface: #ffffff;
    --surface-soft: #f2f7f8;
    --canvas: #eaf1f3;
    --shadow: 0 12px 30px rgba(6, 37, 58, 0.1);
    --header-height: 72px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-width: 320px;
    color-scheme: light;
}

body {
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink-900);
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

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

a {
    color: inherit;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Login */

.login-page {
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background:
        linear-gradient(145deg, rgba(8, 120, 135, 0.56), rgba(6, 37, 58, 0.96)),
        var(--navy-950);
}

.login-container {
    width: min(100%, 440px);
}

.login-card {
    width: 100%;
    padding: 38px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(2, 23, 35, 0.32);
}

.login-logo {
    width: min(100%, 300px);
    margin: 0 auto 24px;
}

.login-heading {
    margin-bottom: 28px;
    text-align: center;
}

.login-heading h1 {
    margin-bottom: 6px;
    color: var(--navy-900);
    font-size: 28px;
    line-height: 1.2;
}

.login-heading p {
    color: var(--ink-600);
    font-size: 14px;
}

.login-submit {
    width: 100%;
}

.error {
    margin-bottom: 18px;
    padding: 11px 13px;
    background: var(--coral-100);
    border-left: 3px solid var(--coral-600);
    color: #8f2f2a;
    font-size: 14px;
}

/* Header */

.site-header {
    position: sticky;
    z-index: 100;
    top: 0;
    height: var(--header-height);
    background: var(--navy-950);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: 0 5px 18px rgba(6, 37, 58, 0.18);
}

.header-inner {
    display: flex;
    align-items: center;
    width: min(100% - 40px, 1240px);
    height: 100%;
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    margin-right: 42px;
    text-decoration: none;
}

.brand-mark {
    width: 54px;
    height: 44px;
    object-fit: contain;
}

.brand-name {
    font-size: 20px;
    line-height: 1;
}

.brand-name strong {
    font-weight: 600;
}

.brand-name span {
    color: #45c8e2;
    font-weight: 500;
}

.primary-nav {
    display: flex;
    align-self: stretch;
    align-items: stretch;
    gap: 4px;
}

.primary-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    color: #d6e5e9;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.primary-nav a::after {
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 3px;
    background: var(--cyan-500);
    content: '';
    opacity: 0;
}

.primary-nav a:hover,
.primary-nav a:focus-visible,
.primary-nav a.is-active {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.primary-nav a.is-active::after {
    opacity: 1;
}

.header-account {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.account-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d6e5e9;
    font-size: 14px;
}

.account-name i {
    color: #45c8e2;
    font-size: 18px;
}

.header-logout,
.nav-toggle {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
}

.header-logout:hover,
.header-logout:focus-visible,
.nav-toggle:hover,
.nav-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.45);
}

.nav-toggle {
    display: none;
}

/* Shared layout */

.app-main {
    width: min(100% - 40px, 1180px);
    margin: 0 auto;
    padding: 42px 0 64px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.eyebrow {
    margin-bottom: 5px;
    color: var(--teal-700);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-heading h1 {
    color: var(--navy-900);
    font-size: 38px;
    line-height: 1.15;
}

.page-heading-copy {
    margin-top: 7px;
    color: var(--ink-600);
    font-size: 15px;
}

.page-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.section-title {
    margin-bottom: 16px;
    color: var(--navy-900);
    font-size: 18px;
}

.btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}

.btn-primary {
    background: var(--teal-700);
    color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--navy-800);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--navy-800);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--surface-soft);
    border-color: #b9cbd1;
}

.btn-danger {
    background: var(--coral-100);
    border-color: #f1c4bf;
    color: #a83630;
}

.btn-danger:hover,
.btn-danger:focus-visible {
    background: var(--coral-600);
    border-color: var(--coral-600);
    color: #ffffff;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--teal-700);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
    color: var(--navy-900);
}

/* Forms */

.field {
    margin-bottom: 20px;
}

.field label,
.field-label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-900);
    font-size: 14px;
    font-weight: 600;
}

.field input[type='text'],
.field input[type='password'],
.field input[type='file'],
.field textarea,
.search-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    background: #ffffff;
    border: 1px solid #c9d7dc;
    border-radius: 6px;
    color: var(--ink-900);
}

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

.field input:focus,
.field textarea:focus,
.search-field input:focus {
    border-color: var(--teal-600);
    outline: 3px solid rgba(7, 149, 166, 0.16);
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 14px;
    color: var(--teal-700);
    transform: translateY(-50%);
}

.input-wrapper input {
    padding-left: 43px !important;
}

.form-panel {
    width: min(100%, 780px);
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.current-image {
    width: min(100%, 420px);
    max-height: 250px;
    margin-bottom: 12px;
    border-radius: 6px;
    object-fit: cover;
}

/* Dashboard */

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

.dashboard-card {
    display: flex;
    min-height: 150px;
    align-items: center;
    gap: 18px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 7px 18px rgba(6, 37, 58, 0.06);
    color: var(--ink-900);
    text-decoration: none;
}

a.dashboard-card:hover,
a.dashboard-card:focus-visible {
    border-color: #9ec8d1;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.dashboard-card-icon {
    display: grid;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    place-items: center;
    background: var(--cyan-100);
    border-radius: 6px;
    color: var(--teal-700);
    font-size: 23px;
}

.dashboard-card h2 {
    margin-bottom: 4px;
    color: var(--navy-900);
    font-size: 18px;
}

.dashboard-card p {
    color: var(--ink-600);
    font-size: 13px;
}

.dashboard-card.is-unavailable {
    background: rgba(255, 255, 255, 0.58);
    color: var(--ink-500);
}

.dashboard-card.is-unavailable .dashboard-card-icon {
    background: #e5ecee;
    color: var(--ink-500);
}

.status-label {
    display: inline-block;
    margin-top: 8px;
    color: var(--teal-700);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Recipe list */

.recipe-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.search-form {
    width: min(100%, 520px);
}

.search-field {
    position: relative;
}

.search-field input {
    padding-right: 50px;
}

.search-submit {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    background: var(--teal-700);
    border: 0;
    border-radius: 5px;
    color: #ffffff;
    cursor: pointer;
}

.search-submit:hover,
.search-submit:focus-visible {
    background: var(--navy-800);
}

.clear-search {
    color: var(--teal-700);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

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

.recipe-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 7px 18px rgba(6, 37, 58, 0.06);
    color: var(--ink-900);
    text-decoration: none;
}

.recipe-card:hover,
.recipe-card:focus-visible {
    border-color: #9ec8d1;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.recipe-thumb,
.recipe-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 10;
}

.recipe-thumb {
    object-fit: cover;
}

.recipe-thumb-placeholder {
    display: grid;
    place-items: center;
    background: var(--cyan-100);
    color: var(--teal-700);
    font-size: 34px;
}

.recipe-card-content {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
}

.recipe-card-title {
    overflow-wrap: anywhere;
    color: var(--navy-900);
    font-size: 16px;
    font-weight: 600;
}

.recipe-card-content i {
    flex: 0 0 auto;
    color: var(--teal-600);
}

.empty-state {
    padding: 44px 24px;
    background: var(--surface);
    border: 1px dashed #adc2c9;
    border-radius: 8px;
    text-align: center;
}

.empty-state i {
    margin-bottom: 14px;
    color: var(--teal-600);
    font-size: 32px;
}

.empty-state h2 {
    margin-bottom: 6px;
    font-size: 19px;
}

.empty-state p {
    color: var(--ink-600);
}

/* Recipe detail */

.recipe-detail {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.recipe-detail-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
}

.recipe-media {
    min-height: 100%;
    background: var(--navy-900);
}

.recipe-image {
    width: 100%;
    height: 100%;
    min-height: 420px;
    object-fit: cover;
}

.recipe-image-placeholder {
    display: grid;
    min-height: 420px;
    place-items: center;
    color: #74d0e1;
    font-size: 68px;
}

.recipe-content {
    padding: 32px;
}

.recipe-section + .recipe-section {
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.recipe-section h2 {
    margin-bottom: 12px;
    color: var(--navy-900);
    font-size: 19px;
}

.recipe-section-copy {
    margin-bottom: 26px;
    color: #304a56;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/* Responsive */

@media (max-width: 960px) {
    .account-name {
        display: none;
    }

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

    .recipe-detail-grid {
        grid-template-columns: 1fr;
    }

    .recipe-image,
    .recipe-image-placeholder {
        min-height: 0;
        max-height: 440px;
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 760px) {
    :root {
        --header-height: 62px;
    }

    .header-inner,
    .app-main {
        width: min(100% - 28px, 1180px);
    }

    .brand {
        margin-right: 0;
    }

    .brand-mark {
        width: 46px;
        height: 38px;
    }

    .brand-name {
        font-size: 18px;
    }

    .nav-toggle {
        display: inline-grid;
        margin-left: auto;
    }

    .primary-nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: none;
        height: auto;
        padding: 8px 14px 14px;
        background: var(--navy-950);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 12px 24px rgba(6, 37, 58, 0.22);
    }

    .primary-nav.is-open {
        display: grid;
    }

    .primary-nav a {
        min-height: 48px;
        padding: 0 14px;
        border-radius: 6px;
    }

    .primary-nav a::after {
        top: 10px;
        right: auto;
        bottom: 10px;
        left: 0;
        width: 3px;
        height: auto;
    }

    .header-account {
        margin-left: 8px;
    }

    .header-logout,
    .nav-toggle {
        width: 38px;
        height: 38px;
    }

    .app-main {
        padding: 30px 0 48px;
    }

    .page-heading {
        align-items: flex-start;
    }

    .page-heading h1 {
        font-size: 28px;
    }
}

@media (max-width: 600px) {
    .login-page {
        padding: 18px 14px;
    }

    .login-card,
    .form-panel,
    .recipe-content {
        padding: 22px;
    }

    .login-logo {
        width: min(100%, 250px);
    }

    .page-heading {
        display: block;
    }

    .page-heading-actions {
        margin-top: 18px;
    }

    .page-heading-actions .btn {
        width: 100%;
    }

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

    .dashboard-card {
        min-height: 118px;
        padding: 20px;
    }

    .recipe-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .clear-search {
        align-self: flex-start;
    }

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

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

@media (max-width: 390px) {
    .brand-name {
        display: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .btn,
    .dashboard-card,
    .recipe-card {
        transition: background-color 160ms ease, border-color 160ms ease,
            box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
    }
}