:root {
    --ink: #15221c;
    --muted: #68756e;
    --line: #dce4df;
    --paper: #f5f7f4;
    --white: #fff;
    --green: #176b4b;
    --green-dark: #0e5138;
    --green-soft: #e5f2eb;
    --gold: #d7a83e;
    --danger: #a33b35;
    --shadow: 0 18px 55px rgba(24, 48, 36, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { height: 78px; padding: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; width: max-content; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--green); color: white; font-weight: 800; font-family: Georgia, serif; font-size: 21px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.tabs { align-self: stretch; display: flex; gap: 24px; }
.tab { display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); font-weight: 650; padding: 0 4px; position: relative; text-decoration: none; }
.tab::after { content: ""; position: absolute; height: 3px; border-radius: 3px 3px 0 0; left: 0; right: 0; bottom: 0; background: var(--green); transform: scaleX(0); transition: .2s; }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { transform: scaleX(1); }
.base-pill { justify-self: end; display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.base-pill span { width: 8px; height: 8px; border-radius: 50%; background: #aab4af; }
.base-pill.is-ready span { background: #2d9c68; box-shadow: 0 0 0 4px #e1f3e9; }
.base-pill.is-error span { background: var(--danger); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 18px; min-width: 0; }
.account-menu { position: relative; }
.account-menu summary { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; list-style: none; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu > div { position: absolute; top: 33px; right: 0; z-index: 40; min-width: 180px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.account-menu a, .account-menu button { display: block; width: 100%; padding: 10px; border: 0; border-radius: 7px; color: var(--ink); background: transparent; text-align: left; text-decoration: none; font-size: 12px; }
.account-menu a:hover, .account-menu button:hover { background: var(--paper); }
.account-menu form { margin: 0; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 60px 0 80px; }
.view { display: none; }
.view.is-active { display: block; animation: reveal .25s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.hero { margin-bottom: 34px; }
.hero.compact { margin-bottom: 28px; }
.hero h1 { margin: 7px 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 5.3vw, 66px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.hero.compact h1 { font-size: clamp(36px, 4vw, 52px); }
.hero > p:last-child { margin: 0; max-width: 660px; color: var(--muted); line-height: 1.65; font-size: 16px; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; letter-spacing: .16em; font-weight: 800; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: clamp(22px, 3vw, 34px); box-shadow: var(--shadow); }
.form-grid { display: grid; gap: 20px; }
.location-grid { grid-template-columns: minmax(220px, .72fr) minmax(300px, 1.28fr); }
.field { display: block; position: relative; }
.field.spaced { margin-top: 16px; }
.field > span { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: 13px; font-weight: 750; }
.field em { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-style: normal; }
.field input, .field select, .picker { width: 100%; height: 49px; padding: 0 14px; color: var(--ink); background: #fbfcfb; border: 1px solid #cfd9d3; border-radius: 10px; outline: none; text-align: left; transition: .18s; }
.field input:focus, .field select:focus, .picker:focus, .picker[aria-expanded="true"] { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,75,.12); }
.field input:disabled, .field select:disabled, .picker:disabled { color: #98a39d; cursor: not-allowed; background: #f1f3f1; }
.picker { display: flex; justify-content: space-between; align-items: center; }
.picker b { color: var(--green); font-size: 12px; }
.picker-menu { position: absolute; z-index: 10; left: 0; right: 0; top: 78px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: 0 22px 50px rgba(20,40,30,.16); }
.picker-menu input { height: 42px; }
.option-list { max-height: 260px; overflow: auto; padding-top: 8px; }
.city-option { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; font-size: 14px; }
.city-option:hover { background: var(--paper); }
.city-option input { width: 16px; height: 16px; accent-color: var(--green); }
.city-option.is-disabled { opacity: .45; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { border: 0; border-radius: 999px; padding: 7px 10px 7px 12px; color: var(--green-dark); background: var(--green-soft); font-size: 12px; font-weight: 700; }
.chip span { margin-left: 7px; font-size: 15px; line-height: 0; }
.advanced { margin-top: 25px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 17px 0; }
.advanced summary { cursor: pointer; font-size: 13px; font-weight: 800; }
.advanced summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; margin-left: 6px; }
.advanced-grid { grid-template-columns: 1.4fr .8fr .8fr .8fr; margin-top: 20px; }
.check-field { grid-column: 1 / -1; display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--muted); }
.check-field input { width: 17px; height: 17px; accent-color: var(--green); }
.search-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; }
.search-actions p { margin: 0; color: var(--muted); font-size: 12px; }
.button { min-height: 44px; padding: 0 18px; border-radius: 9px; font-weight: 750; border: 1px solid transparent; transition: .18s; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
.button.secondary { color: var(--green-dark); background: white; border-color: #bfd0c7; }
.button.secondary:hover:not(:disabled) { border-color: var(--green); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.full { width: 100%; margin-top: 18px; }

.results { margin-top: 42px; }
.results-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; }
.results-head h2 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th { padding: 14px 16px; text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; background: #fafbfa; }
td { padding: 16px; border-top: 1px solid #e8edea; font-size: 13px; vertical-align: top; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 4px; }
.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #edf0ee; }
.status.active { color: var(--green-dark); background: var(--green-soft); }
.detail-button { border: 0; background: transparent; color: var(--green); font-weight: 800; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 18px; }
.pagination span { color: var(--muted); font-size: 12px; }
.empty-state, .error-state { padding: 26px; margin-bottom: 14px; border-radius: 12px; background: white; border: 1px solid var(--line); color: var(--muted); }
.error-state { color: var(--danger); border-color: #e5c2bf; background: #fff8f7; }

.admin-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; }
.panel-title { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.panel-title h2, .requirements h2, .job-head h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; font-size: 25px; }
.panel-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.step { flex: 0 0 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 800; }
.feedback { margin-top: 16px; padding: 13px; border-radius: 9px; font-size: 12px; line-height: 1.5; }
.feedback.muted { background: var(--paper); color: var(--muted); }
.feedback.success { color: var(--green-dark); background: var(--green-soft); }
.feedback.error { color: var(--danger); background: #fff0ef; }
.fine-print { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.job-panel, .requirements { margin-top: 22px; }
.job-head { display: flex; justify-content: space-between; align-items: center; }
.job-head h2 { margin-top: 5px; }
#job-percent { font-family: Georgia, serif; color: var(--green); font-size: 28px; }
.progress { height: 9px; border-radius: 9px; overflow: hidden; margin: 22px 0 11px; background: #e7ece9; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #45a575); transition: width .35s; }
.job-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
#job-error { white-space: pre-wrap; color: var(--danger); background: #fff4f3; padding: 15px; border-radius: 9px; }
.requirement-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 24px; }
.requirement-list > div { display: flex; gap: 10px; }
.requirement-list b { color: var(--gold); font-family: Georgia, serif; }
.requirement-list strong, .requirement-list span { display: block; }
.requirement-list strong { margin-bottom: 5px; color: var(--ink); font-size: 13px; }
.requirement-list span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: 390px; padding: 14px 17px; color: white; background: var(--ink); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.company-dialog { width: min(920px, calc(100% - 28px)); max-height: min(860px, calc(100vh - 36px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 100px rgba(10,30,20,.3); }
.company-dialog::backdrop { background: rgba(15,28,22,.55); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 20px; padding: 25px 28px; background: white; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 5px 0 4px; font: 500 28px/1.1 Georgia, serif; }
.dialog-head > div > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.dialog-close { flex: 0 0 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: var(--paper); font-size: 25px; line-height: 1; }
.detail-content { padding: 26px 28px 34px; }
.detail-section + .detail-section { margin-top: 28px; }
.detail-section h3 { margin: 0 0 13px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font: 500 20px Georgia, serif; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px 22px; }
.detail-item small, .detail-item strong { display: block; overflow-wrap: anywhere; }
.detail-item small { margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.detail-item strong { font-size: 13px; font-weight: 650; }
.partner { padding: 13px 0; border-bottom: 1px solid #edf0ee; }
.partner:last-child { border: 0; }
.partner strong, .partner small { display: block; }
.partner small { margin-top: 4px; color: var(--muted); }

.auth-page { min-height: 100vh; background: radial-gradient(circle at 15% 10%, #e2f1e9, transparent 34%), var(--paper); }
.auth-shell { width: min(100% - 32px, 470px); min-height: 100vh; margin: 0 auto; padding: 45px 0; display: grid; place-items: center; }
.auth-card { width: 100%; padding: clamp(28px, 6vw, 46px); border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 28px 90px rgba(18, 49, 35, .14); }
.auth-brand { margin-bottom: 45px; }
.auth-card h1 { margin: 8px 0 10px; font: 500 clamp(35px, 8vw, 48px)/1 Georgia, serif; letter-spacing: -.04em; }
.auth-intro { margin: 0 0 26px; color: var(--muted); line-height: 1.55; }
.auth-form { display: grid; gap: 17px; }
.auth-form .button.full { margin-top: 4px; }
.auth-form .field small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.inline-user-form { display: grid; grid-template-columns: 1fr 190px auto; gap: 16px; align-items: end; }
.inline-user-form .button { height: 49px; }
.user-table-wrap { margin-top: 22px; }
.temporary-password { margin-top: 18px; padding: 16px; border: 1px solid #bad8c8; border-radius: 10px; background: var(--green-soft); }
.temporary-password strong, .temporary-password code, .temporary-password small { display: block; }
.temporary-password code { margin: 10px 0; padding: 10px; border-radius: 6px; background: white; font-size: 15px; overflow-wrap: anywhere; user-select: all; }
.temporary-password small { color: var(--muted); line-height: 1.45; }
.admin-data-grid { margin-top: 22px; }
.database-summary { margin-top: 22px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-grid > div { padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.metric-grid small, .metric-grid strong { display: block; }
.metric-grid small { margin-bottom: 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.metric-grid strong { font: 500 22px Georgia, serif; }

@media (max-width: 850px) {
    .topbar { grid-template-columns: 1fr auto; }
    .tabs { position: fixed; bottom: 0; left: 0; right: 0; height: 60px; justify-content: center; background: white; border-top: 1px solid var(--line); z-index: 30; }
    .tab { min-width: 130px; }
    .tab::after { top: 0; bottom: auto; }
    .base-pill { display: none; }
    .account-menu summary { max-width: 130px; }
    main { padding-top: 40px; }
    .location-grid, .advanced-grid, .admin-grid, .inline-user-form { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .requirement-list { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .search-actions { align-items: stretch; flex-direction: column; }
    .search-actions .button { width: 100%; }
}

@media (max-width: 520px) {
    main { width: min(100% - 24px, 1180px); }
    .topbar { padding: 0 14px; }
    .brand small { display: none; }
    .hero h1 { font-size: 39px; }
    .panel { border-radius: 14px; padding: 19px; }
    .requirement-list { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: 1fr; }
}
