:root {
  --ink: #071943;
  --muted: #68728d;
  --paper: #f3f6fb;
  --surface: #ffffff;
  --line: #dbe2f0;
  --forest: #0b286e;
  --forest-2: #1645b8;
  --lime: #2456ff;
  --lime-soft: #eaf0ff;
  --amber: #e7a83b;
  --amber-soft: #fff2d7;
  --red: #a74437;
  --red-soft: #fbe4df;
  --blue: #2456ff;
  --blue-soft: #e7edff;
  --shadow: 0 16px 44px rgba(17, 46, 112, .09);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: "Inter", system-ui, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.boot, .auth-shell { min-height: 100vh; display: grid; place-items: center; }
.boot { align-content: center; gap: 14px; color: var(--muted); }
.boot img { width: 178px; height: auto; }

.auth-shell { grid-template-columns: minmax(320px, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.auth-story { height: 100%; padding: clamp(40px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; color: white; overflow: hidden; position: relative; background: linear-gradient(135deg, #071d59 0%, #0a2b82 58%, #164ed9 100%); }
.auth-story::before { content: ""; position: absolute; width: 66%; height: 58%; right: -18%; top: 8%; background: rgba(54, 104, 243, .3); transform: skewX(36deg); }
.auth-story::after { content: ""; position: absolute; width: 480px; height: 480px; right: -220px; bottom: -250px; border-radius: 50%; border: 2px solid rgba(255,255,255,.12); box-shadow: 0 0 0 92px rgba(255,255,255,.035); }
.auth-logo { position: relative; z-index: 2; display: flex; gap: 18px; align-items: center; }
.auth-logo img { width: 178px; height: auto; }
.auth-logo span { padding-left: 18px; border-left: 1px solid rgba(255,255,255,.35); font-size: 13px; font-weight: 700; }
.auth-message { position: relative; z-index: 2; }
.hero-kicker { margin-bottom: 19px; color: #8eb0ff; font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.auth-story h1 { position: relative; z-index: 1; max-width: 650px; margin: 0 0 22px; font: 700 clamp(42px, 5.1vw, 72px)/1.03 Montserrat, sans-serif; letter-spacing: -.055em; }
.auth-story h1 span { color: #8fb0ff; }
.auth-story p { max-width: 540px; margin: 0; color: #d3ddf6; font-size: 17px; line-height: 1.65; }
.flow-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 50px; color: #eaf0ed; font-size: 13px; font-weight: 600; }
.flow-line b { padding: 8px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; }
.flow-line i { color: #8fb0ff; font-style: normal; }
.auth-form-wrap { padding: clamp(36px, 7vw, 100px); display: grid; place-items: center; }
.auth-card { width: min(440px, 100%); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; color: var(--forest-2); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 24px; height: 2px; background: var(--lime); }
.auth-card h2 { margin: 0; font: 700 34px/1.15 Montserrat, sans-serif; letter-spacing: -.04em; }
.auth-card > p { margin: 12px 0 30px; color: var(--muted); line-height: 1.6; }

.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 13px; font-weight: 700; color: #1c2c56; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 112px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(36,86,255,.11); }
.hint { color: var(--muted); font-size: 12px; }

.btn { border: 0; border-radius: 10px; min-height: 42px; padding: 10px 17px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; font-weight: 700; transition: transform .15s, filter .15s, background .15s; }
.btn:hover { transform: translateY(-1px); filter: brightness(.98); }
.btn:disabled { cursor: wait; opacity: .6; transform: none; }
.btn-primary { color: white; background: var(--forest); }
.btn-accent { color: white; background: var(--lime); }
.btn-soft { color: var(--forest); background: #edf1fa; }
.btn-danger { color: var(--red); background: var(--red-soft); }
.btn-full { width: 100%; }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: 12px; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; color: #edf3ff; background: linear-gradient(180deg, #071d59 0%, #0b286e 72%, #123da3 100%); display: flex; flex-direction: column; overflow: hidden; }
.sidebar::after { content: ""; position: absolute; width: 250px; height: 250px; left: -160px; bottom: -110px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.025); pointer-events: none; }
.side-logo { position: relative; z-index: 1; display: grid; gap: 12px; align-items: center; padding: 0 10px 34px; }
.side-logo img { width: 156px; height: auto; }
.side-logo small { display: block; color: #91abed; font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.nav { display: grid; gap: 5px; }
.nav button { width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; display: flex; align-items: center; gap: 11px; color: #aec0ba; background: transparent; text-align: left; font-weight: 600; }
.nav button:hover, .nav button.active { color: white; background: rgba(255,255,255,.11); }
.nav button.active { box-shadow: inset 3px 0 0 #5b83ff; }
.nav .ico { width: 22px; color: #7fa1ff; text-align: center; }
.side-bottom { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.side-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #4b74ed; color: white; font-weight: 800; }
.side-user strong { display: block; max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.side-user span { color: #90a49d; font-size: 11px; }
.logout { margin-left: auto; border: 0; color: #b9cac4; background: transparent; font-size: 18px; }

.main { min-width: 0; padding: 34px clamp(24px, 4vw, 56px) 60px; }
.topbar { position: relative; overflow: hidden; min-height: 166px; padding: 30px 32px; display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-bottom: 20px; border-radius: 18px; color: white; background: linear-gradient(120deg, #082260 0%, #0d328f 63%, #2456ff 100%); }
.topbar::before { content: ""; position: absolute; width: 320px; height: 250px; right: 8%; top: -145px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 62px rgba(255,255,255,.035); }
.topbar::after { content: ""; position: absolute; width: 180px; height: 260px; right: -40px; top: -80px; background: rgba(63,111,244,.42); transform: skewX(34deg); }
.topbar > * { position: relative; z-index: 1; }
.topbar .eyebrow { color: #99b5ff; }
.topbar h1 { margin: 2px 0 7px; color: white; font: 700 clamp(27px, 3vw, 38px)/1.12 Montserrat, sans-serif; letter-spacing: -.045em; }
.topbar p { margin: 0; color: #d5dff7; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.topbar .btn-primary { color: #0b286e; background: white; }
.topbar .integration-flag { color: #e5ebfb; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.1); }
.integration-flag { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; color: var(--muted); background: rgba(255,255,255,.55); font-size: 11px; font-weight: 700; white-space: nowrap; }
.integration-flag i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.integration-flag.ok i { background: #2aa567; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { position: relative; min-height: 128px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(24,54,128,.04); overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -25px; top: -34px; width: 78px; height: 100px; background: var(--lime-soft); transform: rotate(35deg); }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat strong { display: block; margin-top: 12px; font: 700 31px/1 Montserrat, sans-serif; letter-spacing: -.04em; }
.stat em { display: inline-block; margin-top: 13px; color: var(--forest-2); font-size: 11px; font-style: normal; font-weight: 700; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 700 18px Montserrat, sans-serif; letter-spacing: -.02em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; }
.search { width: min(250px, 30vw); padding: 9px 11px; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: var(--muted); background: #f7f9fd; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: left; white-space: nowrap; }
td { padding: 16px; border-top: 1px solid #e7ebf3; font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f8faff; }
.protocol { color: var(--forest-2); font-weight: 800; }
.client-cell strong { display: block; }
.client-cell span { display: block; max-width: 290px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-wait { color: #8b671d; background: var(--amber-soft); }
.b-pending { color: #995743; background: #fae8dd; }
.b-rh { color: var(--blue); background: var(--blue-soft); }
.b-done { color: #31704c; background: #e4f3e9; }
.b-reject { color: var(--red); background: var(--red-soft); }
.row-action { border: 0; border-radius: 8px; padding: 7px 10px; color: var(--forest-2); background: #eaf0ff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.empty { padding: 55px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font: 700 18px Montserrat, sans-serif; }

.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.catalog-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.catalog-card .gift-icon { width: 40px; height: 40px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 12px; color: var(--forest); background: var(--lime-soft); font-size: 20px; }
.catalog-card h3 { margin: 0 0 6px; font: 700 16px Montserrat, sans-serif; }
.catalog-card p { min-height: 34px; margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.code { display: inline-block; padding: 5px 7px; border-radius: 6px; color: var(--forest-2); background: #eaf0ff; font: 700 10px ui-monospace, monospace; }
.history-list { padding: 0 22px 10px; }
.history-item { position: relative; margin-left: 8px; padding: 18px 8px 18px 27px; border-left: 1px solid var(--line); }
.history-item::before { content: ""; position: absolute; left: -5px; top: 24px; width: 9px; height: 9px; border-radius: 50%; background: var(--forest-2); box-shadow: 0 0 0 4px var(--surface); }
.history-item strong { font-size: 13px; }
.history-item p { margin: 6px 0; color: var(--muted); font-size: 12px; }
.history-item time { color: #8c9691; font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; padding: 24px; display: grid; place-items: center; background: rgba(5,22,64,.58); backdrop-filter: blur(4px); }
.modal { width: min(620px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 20px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.24); }
.modal-head { padding: 22px 24px 16px; display: flex; justify-content: space-between; align-items: flex-start; }
.modal-head h2 { margin: 0; font: 700 22px Montserrat, sans-serif; letter-spacing: -.03em; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.close { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: #edf1fa; font-size: 19px; }
.modal-body { padding: 8px 24px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.request-summary { margin-bottom: 20px; padding: 14px; border-radius: 12px; background: #f1f4fb; }
.request-summary b { display: block; margin-bottom: 4px; }
.request-summary p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 18px; }
.detail { padding: 12px; border-radius: 10px; background: #f1f4fb; }
.detail span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.detail strong { display: block; margin-top: 4px; font-size: 13px; }
.alert { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; color: #83503d; background: #f9e8de; font-size: 12px; line-height: 1.5; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 390px; padding: 13px 17px; border-radius: 11px; color: white; background: var(--forest); box-shadow: 0 14px 40px rgba(0,0,0,.2); transform: translateY(90px); opacity: 0; transition: .25s; font-size: 13px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { min-height: 42vh; padding: 40px; }
  .auth-story h1 { margin: 0 0 15px; font-size: 45px; }
  .auth-form-wrap { padding: 55px 30px; }
}

@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { position: sticky; z-index: 10; width: 100%; height: auto; padding: 12px 14px; flex-direction: row; align-items: center; overflow-x: auto; }
  .side-logo { padding: 0 14px 0 0; }
  .side-logo small, .side-bottom { display: none; }
  .side-logo img { width: 94px; }
  .nav { display: flex; }
  .nav button { width: auto; white-space: nowrap; padding: 9px 10px; }
  .nav .ico { display: none; }
  .main { padding: 24px 16px 45px; }
  .topbar { min-height: 0; padding: 24px; align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: space-between; }
  .stats { gap: 10px; }
  .stat { min-height: 110px; padding: 16px; }
  .stat strong { font-size: 27px; }
  .panel-head { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .cards-grid { grid-template-columns: 1fr; }
  .field-row, .detail-grid { grid-template-columns: 1fr; }
  .auth-story { min-height: 36vh; padding: 28px; }
  .auth-story h1 { margin: 0 0 12px; font-size: 38px; }
  .auth-story p, .flow-line { display: none; }
  .auth-form-wrap { padding: 40px 24px; }
  .integration-flag { display: none; }
}
