:root {
  color: #172640;
  background: #f3f6fa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1120px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  height: 74px;
  padding: 13px max(40px, calc((100vw - 1440px) / 2));
  background: #fff;
  border-bottom: 1px solid #dce3ee;
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-grid; place-items: center; min-width: 49px; height: 30px; padding: 0 9px; border-radius: 7px; background: #172640; color: #fff; font-weight: 800; }
.env-badge { padding: 5px 10px; border: 1px solid #f2ca76; border-radius: 999px; background: #fff7e6; color: #8b5b00; font-size: 12px; font-weight: 700; }
.topbar p { margin: 5px 0 0; color: #667892; font-size: 13px; }

.tabs { display: flex; height: 49px; padding: 0 max(60px, calc((100vw - 1360px) / 2)); gap: 34px; background: #fff; border-bottom: 1px solid #d7e0ec; }
.tab { position: relative; padding: 0 0 2px; border: 0; background: transparent; color: #5e7088; font-weight: 750; }
.tab.active { color: #0e5bd4; }
.tab.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: #0e5bd4; }

main { max-width: 1500px; margin: 0 auto; padding: 22px 34px 110px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.page-heading h1 { margin: 0; font-size: 24px; }
.page-heading p { margin: 6px 0 0; color: #687993; font-size: 13px; }
.compact-heading { align-items: center; }
.heading-actions { display: flex; align-items: center; gap: 14px; }
.muted { color: #73839a; font-size: 12px; }

.primary, .secondary, .issue-button { min-height: 40px; padding: 0 17px; border-radius: 10px; font-weight: 750; }
.primary { border: 1px solid #0e5bd4; background: #0e5bd4; color: #fff; }
.primary:hover { background: #084aaf; }
.secondary { border: 1px solid #d7e0ec; background: #fff; color: #3d506b; }
.secondary:hover { background: #f1f5fa; }
.danger { min-height: 40px; padding: 0 15px; border: 1px solid #e3aaaa; border-radius: 10px; background: #fff4f4; color: #a02b2b; font-weight: 750; }
.wide { width: 100%; }

.filters { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid #d8e0eb; border-radius: 11px; background: #eaf0f7; }
.segmented button { min-width: 94px; padding: 7px 13px; border: 0; border-radius: 8px; color: #61738b; background: transparent; font-weight: 700; }
.segmented button.active { background: #fff; color: #154f9e; box-shadow: 0 1px 4px rgba(25, 52, 90, .14); }
.search-field { display: flex; align-items: center; gap: 8px; color: #667892; font-size: 12px; }
.search-field input { width: 230px; padding: 8px 11px; border: 1px solid #cfd9e6; border-radius: 9px; background: #fff; }
.legend { margin-left: auto; color: #697a92; font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; background: #b55bdf; }

.table-shell { overflow: auto; max-height: calc(100vh - 245px); border: 1px solid #d8e1ec; border-radius: 14px; background: #fff; box-shadow: 0 6px 20px rgba(32, 54, 84, .06); }
.levels-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.levels-table th { position: sticky; top: 0; z-index: 2; padding: 11px 10px; border-bottom: 1px solid #ccd7e5; background: #edf2f8; color: #5b6e87; text-align: right; white-space: nowrap; }
.levels-table th:first-child, .levels-table th:nth-child(8) { text-align: left; }
.levels-table td { padding: 8px 10px; border-bottom: 1px solid #e6ebf2; text-align: right; vertical-align: middle; }
.levels-table tr:last-child td { border-bottom: 0; }
.levels-table td:first-child { color: #154f9e; text-align: left; font-weight: 800; }
.levels-table td.people-cell { min-width: 320px; text-align: left; }
.levels-table td:last-child { width: 46px; }
.level-add { width: 30px; height: 30px; padding: 0; border: 1px solid #b8c9df; border-radius: 50%; background: #f5f8fc; color: #0e5bd4; font-size: 20px; line-height: 1; }
.person-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 280px; margin: 2px 4px 2px 0; padding: 5px 8px; border-radius: 999px; background: #e7f4ef; color: #09644a; font-size: 12px; }
.person-chip.next { background: #f2e5f9; color: #7b2da0; }
.person-chip small { overflow: hidden; max-width: 120px; text-overflow: ellipsis; white-space: nowrap; opacity: .72; }
.person-chip button { width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; background: rgba(23, 38, 64, .1); color: inherit; line-height: 15px; }
.empty { padding: 80px; color: #6d7e95; text-align: center; }

.flow-steps { display: grid; grid-template-columns: repeat(5, 1fr); margin: -22px -34px 28px; padding: 15px max(42px, calc((100vw - 1380px) / 2)); border-bottom: 1px solid #d2ddea; background: #fff; }
.flow-steps > div { position: relative; display: flex; align-items: center; gap: 9px; color: #90a0b4; }
.flow-steps > div:not(:last-child)::after { content: ""; position: absolute; right: 10px; left: 50px; top: 15px; height: 2px; background: #dce4ee; transform: translateX(60px); }
.flow-steps b { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid #d1dce9; border-radius: 50%; background: #eff4f8; }
.flow-steps span { display: flex; flex-direction: column; font-size: 13px; font-weight: 800; }
.flow-steps small { font-size: 10px; font-weight: 600; }
.flow-steps > div.current { color: #0e5bd4; }
.flow-steps > div.current b { border-color: #0e5bd4; background: #0e5bd4; color: #fff; box-shadow: 0 0 0 4px #dceafe; }
.flow-steps > div.done { color: #087459; }
.flow-steps > div.done b { border-color: #0b8a69; background: #0b8a69; color: #fff; }

.offer-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 18px; }
.offer-sidebar { position: sticky; top: 16px; align-self: start; }
.offer-list { margin-top: 12px; overflow: auto; max-height: calc(100vh - 250px); }
.offer-item { width: 100%; margin-bottom: 8px; padding: 12px; border: 1px solid #d5deea; border-radius: 11px; background: #fff; text-align: left; }
.offer-item.active { border-color: #3a7ee0; box-shadow: 0 0 0 2px #dceafe; }
.offer-item strong, .offer-item span { display: block; }
.offer-item span { margin-top: 4px; color: #718199; font-size: 11px; }
.offer-workspace { display: grid; grid-template-columns: minmax(410px, .8fr) minmax(570px, 1.2fr); gap: 18px; align-items: start; }
.editor-panel, .preview-panel { border: 1px solid #d6e0eb; border-radius: 15px; background: #fff; box-shadow: 0 7px 24px rgba(30, 52, 80, .07); }
.editor-panel { padding: 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.eyebrow { color: #74849a; font-size: 11px; font-weight: 700; }
.panel-heading h2 { margin: 3px 0 0; font-size: 21px; }
.status-badge { padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-badge.draft { background: #edf1f6; color: #56677e; }
.status-badge.approved { background: #e0f5ee; color: #087459; }
.status-badge.issued { background: #e1ecff; color: #1455b2; }
.status-badge.accepted { background: #eee6fb; color: #7037a2; }
.status-badge.revoked { background: #fae6e6; color: #a32d2d; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; color: #52657f; font-size: 11px; font-weight: 750; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #cdd8e5; border-radius: 8px; background: #fff; color: #172640; font-weight: 500; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 3px solid #d9e8ff; border-color: #2b70d6; }
.checkbox-label { flex-direction: row; align-items: center; align-self: end; min-height: 39px; }
.checkbox-label input { width: auto; }
fieldset { margin: 18px 0 0; padding: 14px; border: 1px solid #d7e0eb; border-radius: 11px; }
legend { padding: 0 6px; color: #334b69; font-size: 12px; font-weight: 800; }
.salary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.calculated-total { margin: 12px 0 0; padding: 10px; border-radius: 8px; background: #edf4ff; color: #174e9b; text-align: right; font-size: 12px; font-weight: 800; }
.compliance-grid { margin-top: 12px; }
.minimum-result { margin: 12px 0 0; padding: 9px 11px; border-radius: 8px; background: #f0f3f7; color: #5b6d84; font-size: 12px; }
.minimum-result.passed { background: #e5f6ef; color: #087459; }
.minimum-result.failed { background: #fde8e8; color: #a32929; }
.approval-checks { margin-top: 18px; padding: 14px; border: 1px solid #add8ca; border-radius: 11px; background: #f1faf7; }
.approval-checks strong { display: block; margin-bottom: 8px; }
.approval-checks label { flex-direction: row; align-items: center; margin: 7px 0; }
.approval-checks input { width: auto; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.editor-actions .danger { margin-right: auto; }

.preview-panel { overflow: hidden; padding: 18px; background: #0b0b17; }
.quest-cover { padding: 39px 30px 30px; border: 8px double #ffe600; background: #0c0872; color: #fff; text-align: center; }
.quest-cover small { color: #bcb9ef; letter-spacing: .12em; }
.quest-cover h2 { margin: 12px 0 22px; color: #ffe600; font-size: 28px; }
.quest-cover p { margin: 14px 0 24px; font-weight: 700; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-stats span { padding: 11px 7px; border: 2px solid #9895df; color: #bdbbea; font-size: 9px; }
.hero-stats b { display: block; margin-top: 4px; color: #fff; font-size: 16px; }
.legal-preview { margin-top: 16px; padding: 25px; background: #fff; color: #172640; }
.legal-heading { display: flex; justify-content: space-between; padding-bottom: 13px; border-bottom: 2px solid #172640; }
.legal-heading h3 { margin: 3px 0 0; font-size: 21px; }
.legal-heading p { margin: 0; color: #5d7088; font-size: 11px; }
.legal-preview dl { margin: 14px 0 0; }
.preview-condition { display: grid; grid-template-columns: 128px 1fr; border-bottom: 1px solid #d7dfeb; font-size: 11px; }
.preview-condition dt { padding: 10px; background: #f0f4f8; font-weight: 800; }
.preview-condition dd { margin: 0; padding: 10px; white-space: pre-line; line-height: 1.55; }

.issue-bar { position: fixed; z-index: 10; right: 24px; bottom: 22px; display: flex; align-items: center; gap: 18px; padding: 12px 14px 12px 20px; border: 1px solid #bfcae0; border-radius: 16px; background: rgba(255, 255, 255, .96); box-shadow: 0 14px 45px rgba(21, 42, 74, .22); }
.issue-bar span { color: #53657c; font-size: 12px; }
.issue-button { border: 1px solid #f1d600; background: #ffe600; color: #16132f; box-shadow: 0 5px 16px rgba(166, 142, 0, .25); }

dialog { width: min(500px, calc(100vw - 48px)); padding: 22px; border: 0; border-radius: 15px; color: #172640; box-shadow: 0 25px 80px rgba(11, 24, 43, .3); }
#assignment-dialog { width: min(640px, calc(100vw - 48px)); }
dialog::backdrop { background: rgba(20, 32, 50, .45); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.dialog-heading button { border: 0; background: transparent; color: #73839a; font-size: 24px; }
dialog label { margin-top: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 26px; padding: 11px 17px; border-radius: 999px; background: #172640; color: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); transform: translateX(-50%); font-size: 13px; }

@media (max-width: 1250px) {
  .offer-workspace { grid-template-columns: 470px 570px; }
}
