:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #17202a;
  --muted: #697683;
  --line: #e2e8ec;
  --line-strong: #d4dde3;
  --brand: #164e45;
  --brand-2: #1f6b5e;
  --brand-soft: #e8f3f0;
  --blue-soft: #eaf2fb;
  --blue: #285f9c;
  --amber-soft: #fff4d9;
  --amber: #8a5a00;
  --red-soft: #fdeceb;
  --red: #9f302a;
  --gray-soft: #eef1f3;
  --shadow: 0 5px 18px rgba(20,35,45,.055);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
.topbar { min-height: 64px; position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 26px; padding: 0 28px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.brand-wrap { min-width: 230px; display: flex; gap: 9px; align-items: baseline; }
.brand { color: #133b35; font-size: 18px; font-weight: 850; letter-spacing: -.025em; text-decoration: none; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--brand-2); }
.version { color: #96a0a8; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.nav a { color: #5f6b74; font-size: 13px; font-weight: 700; padding: 10px 12px; border-radius: 9px; white-space: nowrap; }
.nav a:hover { text-decoration: none; background: #f4f6f6; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.user-name { color: #46535d; font-size: 12px; font-weight: 700; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.link-button { border: 0; background: none; padding: 0; color: #7c878f; cursor: pointer; font-size: 12px; }
.link-button:hover { color: var(--brand); text-decoration: underline; }
.shell { max-width: 1500px; margin: 0 auto; padding: 28px 28px 56px; }
h1, h2 { margin: 0; line-height: 1.15; letter-spacing: -.025em; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.page-head, .entity-head, .section-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.page-head { margin-bottom: 17px; }
.page-head p, .section-head p { margin: 5px 0 0; }
.section-head { margin: 26px 0 10px; align-items: end; }
.entity-head { margin-bottom: 18px; }
.entity-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; align-items: center; color: var(--muted); margin-top: 8px; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 10px; font-weight: 800; margin-bottom: 5px; }
.count-pill { display: inline-flex; align-items: center; min-height: 34px; background: var(--surface); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 750; box-shadow: var(--shadow); white-space: nowrap; }
.small-pill { min-height: 27px; padding: 4px 9px; box-shadow: none; font-size: 11px; }
.card, .table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters { display: grid; grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(130px, .7fr)) auto; gap: 12px; padding: 15px; margin-bottom: 13px; align-items: end; }
.organizer-filter-form { grid-template-columns: minmax(320px, 1.6fr) minmax(170px,.6fr) minmax(170px,.6fr) auto; }
.event-filter-form { grid-template-columns: minmax(300px,1.5fr) minmax(150px,.6fr) minmax(150px,.6fr) minmax(170px,.7fr) auto; }
.finance-filter-form { grid-template-columns: minmax(300px,1.5fr) minmax(170px,.65fr) minmax(150px,.6fr) minmax(150px,.6fr) auto; }
.filters label, .edit-form label { display: block; color: var(--muted); font-size: 12px; font-weight: 750; }
.filters input, .filters select, .edit-form input[type="text"], .edit-form input[type="url"], .edit-form input[type="email"], .edit-form input[type="password"], .edit-form select, .edit-form textarea, .login-card input { width: 100%; margin-top: 6px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--text); padding: 9px 10px; outline: none; min-height: 38px; transition: .12s border-color, .12s box-shadow; }
.filters input:focus, .filters select:focus, .edit-form input:focus, .edit-form select:focus, .edit-form textarea:focus, .login-card input:focus { border-color: #79ae9f; box-shadow: 0 0 0 3px rgba(31,107,94,.10); }
.search-input { position: relative; }
.search-input input { padding-right: 38px; }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-41%); display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: #849098; font-size: 20px; line-height: 1; }
.search-clear:hover { background: var(--gray-soft); text-decoration: none; color: var(--text); }
.filter-actions, .form-actions, .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-actions { justify-content: flex-end; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 38px; padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); font-weight: 750; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; max-width: 100%; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.btn.danger { color: var(--red); border-color: #edc8c5; background: #fff; }
.btn.wide { width: 100%; }
.advanced-filters { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 1px; }
.advanced-filters summary { cursor: pointer; color: var(--brand); font-weight: 750; width: fit-content; user-select: none; }
.advanced-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 12px; padding-top: 12px; }
.active-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 10px; }
.active-filter-label { color: var(--muted); font-size: 11px; font-weight: 750; }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #d5e2de; background: #f2f8f6; color: #31584f; border-radius: 999px; padding: 4px 8px 4px 9px; font-size: 11px; font-weight: 700; }
.filter-chip:hover { text-decoration: none; background: #eaf5f1; }
.filter-chip b { font-size: 14px; line-height: 1; font-weight: 500; }
.clear-all { margin-left: 3px; font-size: 11px; color: var(--muted); }
.results-line { min-height: 28px; display: flex; align-items: center; justify-content: space-between; color: #56636c; font-size: 12px; padding: 0 3px 7px; }
.list-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.saved-menu { position: relative; }
.saved-menu > summary { list-style: none; }
.saved-menu > summary::-webkit-details-marker { display:none; }
.saved-popover { position: absolute; z-index: 30; top: calc(100% + 7px); right: 0; width: min(360px, 90vw); padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 45px rgba(29,47,55,.15); }
.popover-title { font-weight: 800; margin-bottom: 8px; }
.popover-empty { color: var(--muted); font-size: 12px; padding: 7px 0 11px; }
.saved-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid #edf1f3; }
.saved-row a { overflow-wrap: anywhere; font-weight: 700; }
.icon-button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: #88939a; cursor: pointer; font-size: 18px; }
.icon-button:hover { background: var(--red-soft); color: var(--red); }
.save-selection-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 12px; }
.save-selection-form label { color: var(--muted); font-size: 11px; font-weight: 750; }
.save-selection-form input { width: 100%; margin-top: 5px; border: 1px solid var(--line-strong); padding: 8px 9px; border-radius: 8px; }
.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 13px; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid #edf1f3; vertical-align: top; overflow-wrap: break-word; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfc; }
.entity-table .main-col { width: 29%; min-width: 260px; }
.venue-table .main-col { width: 42%; }
.event-table .main-col { width: 30%; min-width: 270px; }
.finance-table .main-col { width: 32%; min-width: 260px; }
.compact-table .main-col, .finance-report-table .main-col { min-width: 260px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap, .datetime-cell, .contact-nowrap { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.entity-link { color: #173f38; font-weight: 780; overflow-wrap: anywhere; }
.subtle-link { color: #31584f; font-weight: 650; overflow-wrap: anywhere; }
.subline { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.text-wrap { white-space: normal; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.group-tag, .status, .tiny-tag { display: inline-flex; align-items: center; border-radius: 999px; white-space: nowrap; font-weight: 750; }
.group-tag { margin-top: 3px; padding: 3px 8px; font-size: 11px; }
.group-tag.history { color: var(--blue); background: var(--blue-soft); }
.group-tag.prospect { color: #66717b; background: var(--gray-soft); }
.status { padding: 4px 8px; font-size: 11px; border: 1px solid transparent; }
.status.active { color: #21644f; background: #e7f5ef; }
.status.inactive { color: #6c737a; background: #eff1f2; }
.status.closed { color: var(--red); background: var(--red-soft); }
.status.unknown, .status.neutral { color: #5f6a73; background: #f0f2f4; }
.tiny-tag { padding: 3px 8px; font-size: 10px; background: var(--brand-soft); color: var(--brand); }
.warning-text { color: var(--amber); }
.row-inactive { opacity: .62; }
.row-control { background: #fcfbf8; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.breadcrumbs a { color: var(--muted); }
.stat-row { display: flex; gap: 10px; margin: 0 0 18px; flex-wrap: wrap; }
.mini-stat { min-width: 118px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; box-shadow: var(--shadow); }
.mini-stat strong { display: block; font-size: 19px; letter-spacing: -.02em; }
.mini-stat span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.finance-stats .mini-stat { flex: 1; min-width: 135px; }
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 750; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a span { color: #9ba4ab; margin-left: 4px; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; }
.detail-grid > div { padding: 15px 17px; min-height: 72px; border-bottom: 1px solid #edf1f3; overflow-wrap: anywhere; }
.detail-grid > div:nth-child(odd):not(.full) { border-right: 1px solid #edf1f3; }
.detail-grid > div.full { grid-column: 1 / -1; }
.detail-grid label, .field-heading { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.notes { white-space: normal; }
.edit-form { padding: 20px; max-width: 980px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.field-error { display: block; color: var(--red); margin-top: 4px; font-size: 12px; }
.form-error-box { border: 1px solid #f0c9c6; background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 9px; margin-bottom: 16px; }
.check-label { display: flex !important; gap: 8px; align-items: center; min-height: 38px; color: var(--text) !important; }
.check-label input { width: auto !important; margin: 0 !important; }
.source-list { display: grid; gap: 9px; }
.source-card { padding: 15px 17px; display: grid; grid-template-columns: 160px minmax(220px, 1fr); gap: 6px 18px; align-items: start; }
.source-field { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.source-value { font-weight: 700; overflow-wrap: anywhere; }
.source-current { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.source-card details { grid-column: 2; margin-top: 3px; color: var(--muted); font-size: 12px; }
.source-card summary { cursor: pointer; }
.origin-list { padding: 7px 0 0 12px; display: grid; gap: 3px; }
.info-banner { padding: 12px 15px; border: 1px solid #dfe8dc; background: #f3f8f1; border-radius: 10px; color: #4c6348; margin-bottom: 15px; }
.info-banner code { color: #315a49; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; color: var(--muted); padding: 13px 3px 0; font-size: 12px; }
.pager-center { display: flex; gap: 7px; align-items: center; justify-content: center; flex-wrap: wrap; }
.page-size { display: flex; gap: 7px; align-items: center; justify-content: flex-end; }
.page-size a { color: var(--muted); padding: 3px 4px; border-radius: 5px; }
.page-size a.active { color: var(--brand); font-weight: 800; background: var(--brand-soft); }
.messages { margin-bottom: 16px; display: grid; gap: 8px; }
.message { padding: 10px 13px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); border: 1px solid #cfe0f1; }
.message.success { background: #e9f6f0; color: #23664f; border-color: #cae7da; }
.message.error { background: var(--red-soft); color: var(--red); border-color: #f0c9c6; }
.permission-note { padding: 16px; color: var(--muted); }
.last-change { color: var(--muted); font-size: 11px; margin-top: 7px; }
/* Staff and permissions */
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 12px; }
.role-card { display: block; padding: 17px; color: var(--text); }
.role-card:hover { text-decoration: none; border-color: #cbdad5; }
.role-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.role-card-head strong { font-size: 16px; }
.role-card p { margin: 9px 0 12px; color: var(--muted); }
.role-link { color: var(--brand); font-weight: 750; font-size: 12px; }
.permission-section, .effective-permissions { padding-top: 5px; }
.compact-copy { font-size: 12px; margin: 0 0 10px; }
.permission-checks ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 7px 12px; }
.permission-checks li label { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfb; color: var(--text); font-size: 12px; font-weight: 650; text-transform: none; letter-spacing: 0; cursor: pointer; }
.permission-checks input { width: auto !important; margin: 0 !important; min-height: auto !important; }
.permission-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.effective-permissions { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.actions-cell { text-align: right; white-space: nowrap; }
.state-page { max-width: 620px; margin: 80px auto; padding: 25px; text-align: center; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top, #1d554c 0, #123c36 30%, #eef3f2 30.2%, #f6f8f8 100%); padding: 25px; }
.login-card { width: min(410px, 100%); background: #fff; border-radius: 17px; padding: 30px; border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(17,60,54,.18); }
.login-brand { font-weight: 850; font-size: 26px; letter-spacing: -.03em; }
.login-card > .muted { margin: 2px 0 22px; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { color: var(--muted); font-size: 12px; font-weight: 750; }
.login-note { margin: 19px 0 0; color: #8a949b; font-size: 11px; line-height: 1.5; }
@media (max-width: 1180px) {
  .topbar { padding: 0 18px; gap: 15px; }
  .brand-wrap { min-width: auto; }
  .version { display: none; }
  .filters, .organizer-filter-form, .event-filter-form, .finance-filter-form { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .filter-search { grid-column: span 2; }
  .filter-actions { justify-content: flex-start; }
  .advanced-grid { grid-template-columns: repeat(3, minmax(160px,1fr)); }
  .permission-checks ul { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
  .topbar { min-height: auto; padding: 11px 14px; flex-wrap: wrap; position: static; }
  .brand-wrap { width: calc(100% - 150px); }
  .nav { width: 100%; order: 3; overflow-x: auto; }
  .nav a { padding: 8px 10px; }
  .userbox { margin-left: auto; }
  .shell { padding: 20px 13px 45px; }
  h1 { font-size: 25px; }
  .page-head, .entity-head { flex-direction: column; align-items: stretch; }
  .list-tools, .page-head .actions { justify-content: flex-start; }
  .filters, .organizer-filter-form, .event-filter-form, .finance-filter-form { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: 1 / -1; }
  .advanced-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid, .form-grid { grid-template-columns: 1fr; }
  .detail-grid > div.full, .form-grid .full { grid-column: auto; }
  .detail-grid > div:nth-child(odd):not(.full) { border-right: 0; }
  .source-card { grid-template-columns: 1fr; }
  .source-current, .source-card details { grid-column: 1; }
  .optional-col { display: none; }
  .entity-table .main-col, .venue-table .main-col, .event-table .main-col, .finance-table .main-col { min-width: 230px; width: auto; }
  .pager { grid-template-columns: 1fr; }
  .pager-center { justify-content: flex-start; }
  .page-size { justify-content: flex-start; }
  .role-grid { grid-template-columns: 1fr; }
  .permission-checks ul { grid-template-columns: 1fr; }
  .table-card { overflow-x: auto; }
  table { min-width: 680px; }
  .venue-table { min-width: 590px; }
}
@media (max-width: 560px) {
  .brand-wrap { width: 100%; }
  .userbox { width: 100%; justify-content: space-between; }
  .filters, .organizer-filter-form, .event-filter-form, .finance-filter-form, .advanced-grid { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1 1 140px; }
  .list-tools { width: 100%; }
  .list-tools .btn, .saved-menu { flex: 1 1 150px; }
  .saved-menu > summary { width: 100%; }
  .saved-popover { left: 0; right: auto; width: min(350px, calc(100vw - 26px)); }
  .save-selection-form { grid-template-columns: 1fr; }
  .stat-row { display: grid; grid-template-columns: repeat(2, 1fr); }
  .mini-stat { min-width: 0; }
  .form-actions { align-items: stretch; }
  .form-actions .btn { flex: 1 1 130px; }
  .actions { align-items: stretch; }
  .actions .btn { flex: 1 1 160px; }
  .finance-stats { grid-template-columns: repeat(2, 1fr); }
}
/* Orders V0.2 */
.order-filter-form { grid-template-columns: minmax(300px,1.5fr) minmax(150px,.6fr) minmax(150px,.6fr) minmax(180px,.7fr) auto; }
.order-table .main-col { width: 34%; min-width: 300px; }
.ticket-table .main-col { width: 34%; min-width: 280px; }
.status.warning { color: var(--amber); background: var(--amber-soft); }
.pii-card { padding: 15px 17px; }
.pii-grid { display: grid; grid-template-columns: repeat(3,minmax(180px,1fr)); gap: 16px; }
.pii-grid label { display:block; color:var(--muted); font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; margin-bottom:6px; }
.pii-locked { display:flex; justify-content:space-between; gap:18px; align-items:center; }
.pii-note { margin-top:12px; color:var(--muted); font-size:11px; }
.technical-card { margin-top:18px; overflow:hidden; }
.technical-card > summary { cursor:pointer; padding:13px 16px; color:var(--brand); font-weight:750; }
.technical-card[open] > summary { border-bottom:1px solid var(--line); }
.technical-grid { border:0; border-radius:0; box-shadow:none; }
@media (max-width:1180px){ .order-filter-form { grid-template-columns:repeat(3,minmax(160px,1fr)); } }
@media (max-width:860px){ .order-filter-form { grid-template-columns:1fr 1fr; } .pii-grid{grid-template-columns:1fr;} .pii-locked{align-items:flex-start;flex-direction:column;} .order-table .main-col,.ticket-table .main-col{min-width:230px;width:auto;} }
@media (max-width:560px){ .order-filter-form { grid-template-columns:1fr; } }
