:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1d2733;
    --muted: #677585;
    --line: #dde3e9;
    --accent: #1f6feb;
    --accent-dark: #1857bd;
    --danger: #c62f2f;
    --success: #1e7a46;
    --radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }

.topbar { background: #16202b; color: #fff; }
.topbar__inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav__link { color: #c8d3de; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.nav__link:hover, .nav__link.is-active { background: rgba(255, 255, 255, .12); color: #fff; }
.userbox { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.userbox__name { color: #c8d3de; font-size: 14px; }
.topbar .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; }

.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page--narrow { max-width: 760px; }
.page__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page__head h1 { margin: 0; }
.eyebrow { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }

.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card { max-width: 420px; margin: 40px auto 0; }
.card--wide { max-width: 720px; }
.card__links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; flex-wrap: wrap; }
.panel { margin-bottom: 20px; }
.panel__title { margin-bottom: 16px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form--grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form__row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field--full { grid-column: 1 / -1; flex-direction: row; gap: 10px; flex-wrap: wrap; }
label.field--full { flex-direction: column; }
.field__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field__hint { font-size: 12px; color: var(--muted); }
.field__error { font-size: 13px; color: var(--danger); }
.has-error input, .has-error textarea { border-color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=datetime-local], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; font: inherit; color: inherit;
    border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid rgba(31, 111, 235, .25); border-color: var(--accent); }
textarea { resize: vertical; }
.radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.radio input { margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; font: inherit; font-weight: 600;
    border-radius: 6px; border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: #b7c2cd; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.alert { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.alert--success { background: #eaf6ef; border-color: #b9e0c8; color: var(--success); }
.alert--error { background: #fdeeee; border-color: #f2c3c3; color: var(--danger); }
.alert--info { background: #eaf2fe; border-color: #c3d8fa; color: #1a4fa3; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 13px; color: var(--muted); font-weight: 600; background: #f8fafb; }
.table .num { text-align: right; white-space: nowrap; }
.table__empty { text-align: center !important; color: var(--muted); padding: 28px 12px !important; }
.actions { white-space: nowrap; text-align: right !important; }

.badge { display: inline-block; white-space: nowrap; padding: 2px 9px; border-radius: 99px; font-size: 13px; background: #eef1f4; }
.badge--pending { background: #fff4d6; color: #8a5a00; }
.badge--active { background: #e3f4ea; color: var(--success); }
.badge--blocked { background: #fbe4e4; color: var(--danger); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs__item { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); font-size: 14px; }
.tabs__item.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.details { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 0 0 16px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details--compact { grid-template-columns: 130px 1fr; font-size: 13px; margin: 8px 0 0; }
.reqs summary { cursor: pointer; font-weight: 600; }

.status-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.status-row { display: flex; gap: 6px; align-items: center; }
.status-row input[type=text] { max-width: 360px; }

a.badge, .eyebrow a { color: inherit; }
h1 .badge { font-size: 14px; vertical-align: middle; font-weight: 600; }
.small { font-size: 13px; }
.table tr.is-link { cursor: pointer; }
.table tr.is-link:hover td { background: #f8fafc; }
.table__total td { font-weight: 700; border-bottom: 0; }
.table--items td { vertical-align: middle; }
.table--items input { padding: 6px 8px; }
.table--items .col-sku { width: 190px; }
.table--items .col-qty { width: 90px; }
.table--items .col-price { width: 130px; }
.table--items .col-sum { width: 130px; }
.table--items .col-actions { width: 90px; text-align: right; }
.table--items .num input { text-align: right; }
.new-item td { background: #f8fafc; }
input.is-invalid { border-color: var(--danger); background: #fff7f7; }
tr.is-dirty td { background: #fffbeb; }
.suggest { position: relative; }
.suggest__list { position: absolute; z-index: 20; left: 0; top: calc(100% + 2px); width: 520px; max-width: 80vw; max-height: 320px; overflow-y: auto;
    margin: 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
.suggest__item { padding: 7px 12px; cursor: pointer; display: flex; gap: 6px; align-items: baseline; font-size: 14px; }
.suggest__item:hover, .suggest__item.is-active { background: #eaf2fe; }
.suggest__price { margin-left: auto; white-space: nowrap; color: var(--muted); }
.suggest__note { padding: 7px 12px; color: var(--muted); font-size: 13px; }
.form--grid-3 { grid-template-columns: 1fr 1fr 2fr; }
.form__row--actions { margin-top: 16px; align-items: center; }
.import-report { margin: 0; padding-left: 20px; font-size: 14px; }

@media (max-width: 720px) {
    .form--grid, .form--grid-3 { grid-template-columns: 1fr; }
    .details { grid-template-columns: 1fr; }
    .table { display: block; overflow-x: auto; }
    .table--items .col-sku input { min-width: 130px; }
    .table--items td:nth-child(2) input { min-width: 200px; }
    .table--items .col-qty input { min-width: 60px; }
    .table--items .col-price input { min-width: 90px; }
}
