.manage-lanes-v2 {
    --ml-navy: #003b70;
    --ml-navy-dark: #00264d;
    --ml-navy-soft: #edf5fb;
    --ml-orange: #ff8400;
    --ml-ink: #11263c;
    --ml-muted: #697b8d;
    --ml-border: #dce5ed;
    --ml-surface: #ffffff;
    --ml-bg: #f4f7fa;
    --ml-success: #228a49;
    --ml-danger: #cf2437;
    max-width: 1480px;
    margin: 0 auto;
    padding: 26px 28px 48px;
    color: var(--ml-ink);
}

.manage-lanes-v2 *, .manage-lanes-v2 *::before, .manage-lanes-v2 *::after { box-sizing: border-box; }
.manage-lanes-v2 button, .manage-lanes-v2 input { font: inherit; }

.ml-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}
.ml-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 132, 0, .11);
    color: #b45c00;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ml-page-header h1 { margin: 8px 0 6px; color: var(--ml-navy-dark); font-size: clamp(28px, 3vw, 38px); line-height: 1.08; }
.ml-page-header p { margin: 0; max-width: 700px; color: var(--ml-muted); font-size: 15px; line-height: 1.55; }
.ml-header-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.ml-btn {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 9px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.ml-btn:not(:disabled):hover { transform: translateY(-1px); }
.ml-btn-primary {
    color: #fff;
    background: radial-gradient(circle at top right, rgba(255, 132, 0, 0.14), transparent 32%), linear-gradient(135deg, rgba(0, 38, 77, 0.96), rgba(0, 59, 112, 0.96));
    box-shadow: 0 8px 18px rgba(0, 59, 112, .16);
}
.ml-btn-secondary { color: var(--ml-navy); background: #fff; border-color: #cddae5; }
.ml-btn-secondary:hover { border-color: #9db4c8; box-shadow: 0 5px 14px rgba(0, 59, 112, .08); }
.ml-btn-small { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.ml-btn-danger-ghost { color: #a62030; background: #fff; border-color: #f0c7cd; }
.ml-btn-danger-ghost:hover { background: #fff5f6; border-color: #de8793; }
.ml-btn-danger { color: #fff; background: var(--ml-danger); border-color: var(--ml-danger); }
.ml-btn-disabled { color: #7a8997; background: #f1f4f7; border-color: #dde4ea; cursor: not-allowed; }

.ml-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 12px;
    border: 1px solid;
    font-size: 13px;
    font-weight: 700;
}
.ml-flash.is-success { color: #176b38; background: #effaf3; border-color: #bfe3cb; }
.ml-flash.is-error { color: #9d2030; background: #fff1f3; border-color: #f0bcc4; }

.ml-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.ml-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 96px;
    padding: 16px;
    background: var(--ml-surface);
    border: 1px solid var(--ml-border);
    border-radius: 15px;
    box-shadow: 0 5px 18px rgba(21, 54, 82, .05);
}
.ml-stat-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--ml-navy-soft);
    color: var(--ml-navy);
}
.ml-stat-icon.is-busy { background: #fff4e9; color: #d56c00; }
.ml-stat-icon.is-free { background: #eff9f3; color: var(--ml-success); }
.ml-stat small, .ml-stat span { display: block; color: var(--ml-muted); font-size: 11px; }
.ml-stat strong { display: block; color: var(--ml-navy-dark); font-size: 24px; line-height: 1.05; margin: 2px 0; }
.ml-stat small { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }

.ml-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--ml-border);
    border-radius: 14px;
}
.ml-search-wrap { position: relative; }
.ml-search-wrap i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #8294a6; font-size: 13px; }
.ml-search-wrap input {
    width: 100%; height: 42px; padding: 0 14px 0 37px;
    border: 1px solid #d6e0e8; border-radius: 10px; color: var(--ml-ink); background: #f9fbfc; outline: none;
}
.ml-search-wrap input:focus { border-color: #6fa2ca; box-shadow: 0 0 0 3px rgba(0, 59, 112, .09); background: #fff; }
.ml-filter-group { display: flex; gap: 6px; padding: 4px; border-radius: 10px; background: #f1f5f8; }
.ml-filter {
    border: 0; border-radius: 8px; padding: 8px 10px; color: #52677a; background: transparent; font-size: 12px; font-weight: 800; cursor: pointer;
}
.ml-filter span { margin-left: 4px; opacity: .68; }
.ml-filter.is-active { color: #fff; background: var(--ml-navy); box-shadow: 0 3px 9px rgba(0, 59, 112, .16); }
.ml-toolbar-meta { color: var(--ml-muted); font-size: 12px; font-weight: 700; white-space: nowrap; padding-right: 4px; }

.ml-lane-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 14px; }
.ml-lane-card {
    min-width: 0;
    background: #fff;
    border: 1px solid var(--ml-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(20, 54, 84, .055);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.ml-lane-card:hover { border-color: #bdcfdd; box-shadow: 0 10px 25px rgba(20, 54, 84, .08); transform: translateY(-1px); }
.ml-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ml-lane-identity { display: flex; gap: 11px; min-width: 0; align-items: flex-start; }
.ml-lane-number {
    flex: 0 0 auto; min-width: 42px; height: 38px; padding: 0 8px; display: grid; place-items: center;
    border-radius: 10px; background: var(--ml-navy-soft); color: var(--ml-navy); font-size: 12px; font-weight: 900;
}
.ml-lane-identity h2 { margin: 1px 0 6px; color: var(--ml-navy-dark); font-size: 18px; line-height: 1.15; overflow-wrap: anywhere; }
.ml-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; }
.ml-state i { font-size: 8px; }
.ml-state.is-busy { color: #c35e00; }
.ml-state.is-available { color: var(--ml-success); }
.ml-icon-btn {
    width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 9px;
    border: 1px solid #dae3ea; background: #fff; color: #577086; cursor: pointer;
}
.ml-icon-btn:hover { color: var(--ml-navy); border-color: #abc0d2; background: #f7fafc; }

.ml-current-booking {
    padding: 13px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid #f0d5b7;
    background: #fff9f2;
}
.ml-current-booking.is-free { border-color: #cce6d5; background: #f4fbf6; }
.ml-current-label { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; color: #b95c00; font-size: 10px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.ml-current-booking.is-free .ml-current-label { color: #1d7c42; }
.ml-current-booking strong { display: block; margin-bottom: 2px; color: #263d52; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-current-booking span { color: #708294; font-size: 11px; }

.ml-next-row { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: start; padding: 11px 2px 13px; border-bottom: 1px solid #edf1f4; }
.ml-next-row > span { color: #7b8c9d; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.ml-next-row > span i { margin-right: 4px; }
.ml-next-row strong { display: block; color: #263d52; font-size: 12px; }
.ml-next-row small { display: block; margin-top: 2px; color: #7a8b9a; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ml-card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 13px 0; }
.ml-card-metrics div { padding: 8px 9px; border-radius: 9px; background: #f6f9fb; text-align: center; }
.ml-card-metrics small { display: block; margin-bottom: 2px; color: #8594a2; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ml-card-metrics strong { color: var(--ml-navy-dark); font-size: 15px; }
.ml-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.ml-empty, .ml-no-results {
    min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    background: #fff; border: 1px dashed #cdd9e3; border-radius: 16px; color: var(--ml-muted); padding: 28px;
}
.ml-empty-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--ml-navy-soft); color: var(--ml-navy); font-size: 22px; }
.ml-empty h2 { margin: 14px 0 4px; color: var(--ml-navy-dark); font-size: 20px; }
.ml-empty p { margin: 0 0 16px; }
.ml-no-results { min-height: 180px; margin-top: 14px; gap: 4px; }
.ml-no-results i { margin-bottom: 8px; color: #8ea0b0; font-size: 22px; }
.ml-no-results strong { color: #31495f; }
.ml-no-results span { font-size: 12px; }

.ml-modal { position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 18px; }
.ml-modal.is-open { display: flex; }
.ml-modal-backdrop { position: absolute; inset: 0; background: rgba(9, 24, 40, .58); backdrop-filter: blur(3px); }
.ml-modal-card {
    position: relative; z-index: 1; width: min(460px, 100%); padding: 24px; border-radius: 18px; background: #fff;
    box-shadow: 0 28px 70px rgba(0, 30, 57, .28); border: 1px solid rgba(255,255,255,.4);
}
.ml-modal-close { position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f1f4f7; color: #596d80; cursor: pointer; }
.ml-modal-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--ml-navy-soft); color: var(--ml-navy); margin-bottom: 12px; }
.ml-modal-danger .ml-modal-icon { background: #fff0f2; color: var(--ml-danger); }
.ml-modal-card h2 { margin: 0 42px 5px 0; color: var(--ml-navy-dark); font-size: 22px; }
.ml-modal-card > p { margin: 0 0 18px; color: var(--ml-muted); font-size: 13px; line-height: 1.5; }
.ml-modal-form label { display: block; margin-bottom: 7px; color: #334d63; font-size: 12px; font-weight: 800; }
.ml-modal-form input[type="text"], .ml-modal-form input:not([type]) { width: 100%; }
.ml-modal-form input[name="name"] {
    width: 100%; height: 44px; border: 1px solid #cedae4; border-radius: 10px; padding: 0 12px; outline: none; color: var(--ml-ink); background: #fff;
}
.ml-modal-form input[name="name"]:focus { border-color: #6fa2ca; box-shadow: 0 0 0 3px rgba(0, 59, 112, .09); }
.ml-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }

body.ml-modal-lock { overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1020px) {
    .ml-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ml-toolbar { grid-template-columns: 1fr; }
    .ml-toolbar-meta { padding-left: 2px; }
}
@media (max-width: 760px) {
    .manage-lanes-v2 { padding: 18px 14px 34px; }
    .ml-page-header { flex-direction: column; }
    .ml-header-actions { width: 100%; }
    .ml-header-actions .ml-btn { flex: 1; }
    .ml-lane-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .ml-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .ml-stat { min-height: 82px; padding: 12px; gap: 9px; }
    .ml-stat-icon { width: 36px; height: 36px; flex-basis: 36px; }
    .ml-stat strong { font-size: 20px; }
    .ml-filter-group { overflow-x: auto; }
    .ml-filter { flex: 1 0 auto; }
    .ml-card-actions, .ml-modal-actions { grid-template-columns: 1fr; }
}


/* Party lane allocation */
.ml-party-control {
    margin-bottom: 16px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--ml-border);
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(20, 54, 84, .05);
}
.ml-party-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:14px; }
.ml-party-section-head h2 { margin:2px 0 5px; color:var(--ml-navy-dark); font-size:20px; }
.ml-party-section-head p { margin:0; max-width:760px; color:var(--ml-muted); font-size:12px; line-height:1.55; }
.ml-inline-form { margin:0; padding:0; background:transparent; box-shadow:none; flex:0 0 auto; }
.ml-party-grid { display:grid; grid-template-columns:minmax(0, .95fr) minmax(0, 1.05fr); gap:12px; }
.ml-party-settings-card, .ml-party-attention-card { border:1px solid #dfe7ed; border-radius:14px; padding:15px; background:#fbfcfd; min-width:0; }
.ml-party-attention-card.has-attention { border-color:#efc58f; background:#fffaf3; }
.ml-party-card-title { display:flex; align-items:center; gap:10px; margin-bottom:13px; }
.ml-party-card-title strong { display:block; color:#233e55; font-size:13px; }
.ml-party-card-title small { display:block; margin-top:2px; color:#7b8d9e; font-size:10px; }
.ml-party-icon { width:36px; height:36px; border-radius:10px; display:grid; place-items:center; flex:0 0 36px; background:var(--ml-navy-soft); color:var(--ml-navy); }
.ml-party-icon.is-warning { background:#fff1df; color:#c46100; }
.ml-party-icon.is-ok { background:#eaf7ef; color:#16743b; }
.ml-party-pair-form { margin:0; padding:0; background:transparent; box-shadow:none; }
.ml-pair-block { display:grid; grid-template-columns:30px 1fr; gap:10px; align-items:center; padding:10px; border-radius:11px; background:#fff; border:1px solid #e3e9ee; margin-bottom:8px; }
.ml-pair-rank { width:27px; height:27px; border-radius:50%; display:grid; place-items:center; font-size:11px; font-weight:900; color:#fff; background:var(--ml-navy); }
.ml-pair-rank.is-backup { background:#708294; }
.ml-pair-fields label { display:block; margin-bottom:5px; color:#566d81; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.05em; }
.ml-pair-selects { display:grid; grid-template-columns:minmax(0,1fr) 18px minmax(0,1fr); gap:6px; align-items:center; }
.ml-pair-selects > span { color:#8797a5; font-weight:900; text-align:center; }
.ml-pair-selects select, .ml-manual-pair-grid select { width:100%; height:39px; padding:0 9px; border:1px solid #cfdae3; border-radius:9px; background:#fff; color:#263e53; font:inherit; font-size:12px; outline:none; }
.ml-pair-selects select:focus, .ml-manual-pair-grid select:focus { border-color:#6fa2ca; box-shadow:0 0 0 3px rgba(0,59,112,.08); }
.ml-party-save { width:100%; margin-top:3px; }
.ml-pair-readonly { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:11px 12px; margin-bottom:7px; border:1px solid #e1e8ed; border-radius:10px; background:#fff; }
.ml-pair-readonly span { color:#718496; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.05em; }
.ml-pair-readonly strong { color:#29465d; font-size:12px; text-align:right; }
.ml-role-note { margin:10px 0 0; color:#7a8c9d; font-size:10px; line-height:1.45; }
.ml-role-note i { margin-right:4px; }
.ml-party-attention-list { display:grid; gap:8px; max-height:300px; overflow:auto; }
.ml-party-attention-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px; border:1px solid #efd7b8; border-radius:10px; background:#fff; }
.ml-party-attention-copy { min-width:0; }
.ml-party-attention-copy strong { display:block; color:#334c61; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ml-party-attention-copy span { display:block; margin-top:2px; color:#6f8294; font-size:10px; }
.ml-party-attention-copy small { display:block; margin-top:3px; color:#a35a10; font-size:9px; line-height:1.35; }
.ml-party-clear { min-height:94px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; border:1px dashed #cde1d4; border-radius:11px; color:#4f7961; background:#f7fcf9; font-size:11px; }
.ml-party-clear i { font-size:20px; color:#25834c; }
.ml-manual-pair-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ml-modal-note { display:flex; gap:8px; align-items:flex-start; margin-top:12px; padding:10px; border-radius:9px; background:#f5f8fa; color:#6e8192; font-size:10px; line-height:1.45; }
.ml-modal-note i { margin-top:2px; color:var(--ml-navy); }

@media (max-width: 900px) {
    .ml-party-grid { grid-template-columns:1fr; }
}
@media (max-width: 620px) {
    .ml-party-section-head { flex-direction:column; }
    .ml-inline-form, .ml-inline-form .ml-btn { width:100%; }
    .ml-party-attention-item { align-items:flex-start; flex-direction:column; }
    .ml-party-attention-item .ml-btn { width:100%; }
    .ml-manual-pair-grid { grid-template-columns:1fr; }
    .ml-pair-selects { grid-template-columns:1fr; }
    .ml-pair-selects > span { display:none; }
}
