/* =========================================================================
   Craft Corner for Business – design system
   Brief: professional navy, ivory, grey and muted plum; the pink heart logo
   is a restrained accent.
   ========================================================================= */

:root {
    --navy-900: #141c2f;
    --navy-800: #1f2a44;
    --navy-700: #2c3a5c;
    --navy-100: #e6e9f0;
    --ivory: #faf7f2;
    --ivory-200: #f3eee6;
    --paper: #ffffff;
    --grey-700: #4a4f5c;
    --grey-500: #7a7f8c;
    --grey-300: #c9ccd3;
    --grey-200: #e3e5ea;
    --plum-700: #6b4a5a;
    --plum-500: #8e6878;
    --plum-100: #f1e8ec;
    --pink: #e4569b;
    --pink-100: #fde8f2;

    --success: #2f7d5b;
    --success-bg: #e5f3ec;
    --warning: #9a6a12;
    --warning-bg: #fbf0d9;
    --danger: #b3364a;
    --danger-bg: #fbe7ea;
    --info: #2e5b9a;
    --info-bg: #e5edf8;

    --bg: var(--ivory);
    --surface: var(--paper);
    --text: #1d2233;
    --text-muted: var(--grey-500);
    --border: var(--grey-200);

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(20, 28, 47, .06), 0 4px 16px rgba(20, 28, 47, .05);
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Fraunces", Georgia, serif;
}

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

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--plum-700); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; color: var(--navy-800); margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; font-family: var(--font-sans); }
h1:focus { outline: none; }
p { margin: 0 0 .75rem; }
code { background: var(--ivory-200); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 600; color: var(--plum-500); margin-bottom: .5rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none !important;
    transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-700); }
.btn-accent { background: var(--plum-700); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--plum-500); }
.btn-secondary { background: var(--surface); color: var(--navy-800); border-color: var(--grey-300); }
.btn-secondary:hover:not(:disabled) { border-color: var(--navy-700); }
.btn-ghost { background: transparent; color: var(--navy-800); }
.btn-ghost:hover:not(:disabled) { background: var(--navy-100); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #e7b9c1; }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: 0; font-size: 1.15rem; cursor: pointer; color: inherit; padding: .25rem .5rem; border-radius: var(--radius-sm); }
.btn-icon:hover { background: rgba(0,0,0,.06); }

/* ---------- Cards & panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card + .card { margin-top: 1rem; }
.card__header { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card__header h2, .card__header h3 { margin: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--accent { border-left: 4px solid var(--plum-500); }
.card--warning { border-left: 4px solid var(--warning); background: #fffdf7; }

/* ---------- Page header ---------- */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header__subtitle { color: var(--text-muted); margin: .25rem 0 0; }
.page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; }
.breadcrumb a { color: var(--text-muted); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label, .label { font-weight: 600; font-size: .85rem; color: var(--grey-700); }
.field__hint { font-size: .8rem; color: var(--text-muted); }
.field__error, .validation-message { color: var(--danger); font-size: .8rem; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, select.input, textarea.input {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--grey-300); border-radius: var(--radius-sm);
    font: inherit; background: var(--paper); color: var(--text);
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--plum-100); border-color: var(--plum-500); }
textarea.input, .field textarea { min-height: 90px; resize: vertical; }
.input--sm { padding: .3rem .5rem; font-size: .85rem; }
.input--qty { width: 5.5rem; }
.invalid { border-color: var(--danger) !important; }
.checkbox { display: inline-flex; gap: .5rem; align-items: center; font-size: .9rem; cursor: pointer; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.input-group { display: flex; align-items: stretch; }
.input-group__prefix { padding: .55rem .6rem; background: var(--ivory-200); border: 1px solid var(--grey-300); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--grey-700); }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .input { width: auto; min-width: 200px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--border); background: #fcfbf8; white-space: nowrap; }
.table td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfaf6; }
.table tfoot td { font-weight: 600; background: #fcfbf8; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.row-link { font-weight: 600; color: var(--navy-800); }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge--neutral { background: var(--navy-100); color: var(--navy-700); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--muted { background: #f0f0f2; color: var(--grey-500); }
.badge--accent { background: var(--plum-100); color: var(--plum-700); }
.badge--pink { background: var(--pink-100); color: #a3336b; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent; }
.alert--danger { background: var(--danger-bg); color: #7d2232; border-color: #f2c7cf; }
.alert--success { background: var(--success-bg); color: #1e5a40; border-color: #c4e3d3; }
.alert--warning { background: var(--warning-bg); color: #6d4a08; border-color: #f0dcae; }
.alert--info { background: var(--info-bg); color: #1f4272; border-color: #c9d9ef; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { display: grid; gap: .2rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none !important; border-top: 3px solid var(--grey-300); }
.stat-card:hover { border-color: var(--grey-300); }
.stat-card--warning { border-top-color: var(--warning); }
.stat-card--success { border-top-color: var(--success); }
.stat-card--accent { border-top-color: var(--plum-500); }
.stat-card__label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.stat-card__value { font-size: 1.7rem; font-family: var(--font-serif); color: var(--navy-800); }
.stat-card__hint { font-size: .78rem; color: var(--text-muted); }

/* ---------- Thumbnails & product cards ---------- */
.thumb { position: relative; margin: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--ivory-200); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb--sm { width: 48px; height: 48px; flex: none; }
.thumb--md { width: 100%; aspect-ratio: 1 / 1; }
.thumb--lg { width: 100%; max-width: 420px; aspect-ratio: 1 / 1; }
.thumb__placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: var(--pink); font-size: 1.6rem; }
.thumb__concept { position: absolute; left: .5rem; bottom: .5rem; background: rgba(20, 28, 47, .72); color: #fff; font-size: .68rem; padding: .1rem .45rem; border-radius: 999px; letter-spacing: .02em; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.product-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.product-card .thumb { border-radius: 0; }
.product-card__body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-card__code { font-size: .72rem; font-weight: 700; color: var(--plum-500); letter-spacing: .06em; }
.product-card__name { font-weight: 600; color: var(--navy-800); }
.product-card__price { font-family: var(--font-serif); font-size: 1.15rem; color: var(--navy-800); margin-top: auto; }
.product-card__price--request { font-family: var(--font-sans); font-size: .85rem; color: var(--plum-700); font-weight: 600; }
.product-card__actions { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.pill-list { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0; list-style: none; }
.pill-list li { background: var(--ivory-200); border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; color: var(--grey-700); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { padding: .6rem 1rem; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.is-active, .tab.active { color: var(--navy-800); border-bottom-color: var(--plum-500); }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--text-muted); font-weight: 600; }
.dl dd { margin: 0; }

.totals { margin-left: auto; width: min(100%, 360px); display: grid; gap: .35rem; font-size: .92rem; }
.totals > div { display: flex; justify-content: space-between; gap: 1rem; }
.totals .totals__grand { border-top: 1px solid var(--border); padding-top: .5rem; font-weight: 700; font-size: 1.05rem; color: var(--navy-800); }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.timeline li { display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; font-size: .85rem; }
.timeline time { color: var(--text-muted); }

.steps { display: flex; gap: .25rem; flex-wrap: wrap; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.steps li { flex: 1 1 120px; padding: .5rem .6rem; font-size: .78rem; font-weight: 600; background: var(--ivory-200); color: var(--grey-500); border-radius: var(--radius-sm); text-align: center; }
.steps li.is-done { background: var(--success-bg); color: var(--success); }
.steps li.is-current { background: var(--navy-800); color: #fff; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state__icon { font-size: 2rem; color: var(--pink); }
.empty-state h3 { color: var(--navy-800); margin-top: .5rem; }

.secret-box { background: var(--navy-900); color: #fff; padding: .9rem 1rem; border-radius: var(--radius-sm); font-family: ui-monospace, Consolas, monospace; word-break: break-all; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 47, .45); z-index: 50; }
.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal--wide { width: min(860px, calc(100vw - 2rem)); }
.modal__header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal__header h2 { margin: 0; font-size: 1.15rem; }
.modal__body { padding: 1.25rem; }
.modal__footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: #fcfbf8; }

/* ---------- Admin shell ---------- */
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-800); color: #d9deea; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar__brand { display: flex; gap: .7rem; align-items: center; padding: 1.1rem 1.2rem; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar__brand img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.sidebar__brand span { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.1; }
.sidebar__brand small { display: block; font-family: var(--font-sans); font-size: .72rem; color: #aab3c8; letter-spacing: .04em; }
.sidebar__nav { padding: .75rem .6rem 1.5rem; display: grid; gap: .1rem; }
.nav-section { margin: 1rem .6rem .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #8892aa; font-weight: 600; }
.nav-item { display: flex; gap: .6rem; align-items: center; padding: .5rem .65rem; border-radius: var(--radius-sm); color: #d9deea; font-weight: 500; font-size: .9rem; text-decoration: none !important; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--pink); }
.nav-ico { width: 1.1rem; text-align: center; opacity: .8; }
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .65rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar__menu { display: none; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .6rem; }
.topbar__user form { margin: 0; }
.topbar__name { display: grid; font-weight: 600; font-size: .85rem; line-height: 1.2; }
.topbar__name small { font-weight: 400; color: var(--text-muted); font-size: .75rem; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--plum-100); color: var(--plum-700); font-weight: 700; font-size: .8rem; }
.content { padding: 1.75rem 2rem 3rem; max-width: 1400px; width: 100%; }

@media (max-width: 960px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .admin-shell.nav-open .sidebar { transform: none; }
    .topbar__menu { display: inline-block; }
    .topbar__name { display: none; }
    .content { padding: 1.25rem 1rem 2.5rem; }
}

/* ---------- Portal shell ---------- */
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }
.portal-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.portal-header__inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 1.25rem; padding: .7rem 1.25rem; }
.portal-header__menu { display: none; }
.portal-nav { display: flex; gap: .15rem; flex: 1; flex-wrap: wrap; }
.portal-nav__item { padding: .45rem .75rem; border-radius: var(--radius-sm); color: var(--grey-700); font-weight: 500; font-size: .9rem; text-decoration: none !important; }
.portal-nav__item:hover { background: var(--ivory-200); color: var(--navy-800); }
.portal-nav__item.active { color: var(--navy-800); background: var(--plum-100); font-weight: 600; }
.portal-user { display: flex; gap: .5rem; align-items: center; }
.portal-user form { margin: 0; }
.portal-user__name { font-size: .85rem; font-weight: 600; color: var(--grey-700); }
.portal-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
@media (max-width: 960px) {
    .portal-header__inner { flex-wrap: wrap; }
    .portal-header__menu { display: inline-block; margin-left: auto; }
    .portal-nav { display: none; flex-basis: 100%; flex-direction: column; }
    .portal-nav.is-open { display: flex; }
    .portal-user__name { display: none; }
}

.hero-banner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: center; background: var(--navy-800); color: #e9ecf3; border-radius: var(--radius); padding: 2rem; margin-bottom: 1.5rem; overflow: hidden; }
.hero-banner h1 { color: #fff; font-size: 1.9rem; }
.hero-banner .eyebrow { color: #f2b8d4; }
.hero-banner img { width: 100%; border-radius: var(--radius-sm); }
@media (max-width: 900px) { .hero-banner { grid-template-columns: 1fr; } }

/* ---------- Public / auth ---------- */
.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.public-header { padding: 1rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.public-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 2.5rem 1.25rem; }
.public-footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.5rem; font-size: .8rem; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none !important; color: var(--navy-800); }
.brand__logo { height: 40px; width: auto; }
.brand__text { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; }
.brand__text em { font-style: normal; color: var(--plum-500); }
.auth-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; }
.auth-hero h1 { font-size: 2.2rem; }
.auth-hero__list { padding-left: 1.1rem; color: var(--grey-700); }
.auth-hero__list li::marker { color: var(--pink); content: "♥  "; }
.auth-card { max-width: 440px; width: 100%; justify-self: end; }
.auth-card--narrow { margin: 0 auto; }
.auth-message { max-width: 520px; margin: 4rem auto; text-align: center; }
.page-loading { padding: 3rem; text-align: center; color: var(--text-muted); }
@media (max-width: 860px) { .auth-grid { grid-template-columns: 1fr; } .auth-card { justify-self: stretch; max-width: none; } }

/* ---------- Blazor defaults ---------- */
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { outline: none; }
#blazor-error-ui { display: none; }
.blazor-error-boundary { background: var(--danger-bg); padding: 1rem; color: var(--danger); border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "An error has occurred."; }
