/* Correction — Transit Rule */

.container { max-width: 1200px; padding: 24px 20px; }

.corr-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.corr-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    color: #1a3a5c;
    background: #f8fafc;
}

.corr-hint {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

/* Starting coordinates */
.start-coords {
    display: flex;
    gap: 20px;
    padding: 16px 20px 0;
}

.start-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    max-width: 240px;
}

.start-field label {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.start-field input {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: #111827;
    width: 100%;
    box-sizing: border-box;
}

.start-field input:focus { outline: none; border-color: #1a3a5c; box-shadow: 0 0 0 3px rgba(26,58,92,.08); }

/* Course input table */
.course-table-wrap {
    overflow-x: auto;
    padding: 16px 20px 8px;
}

.course-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.course-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 0 6px 8px;
    white-space: nowrap;
}

.th-no   { width: 36px; }
.th-dist { width: 130px; }
.th-del  { width: 36px; }

.course-table tbody tr { border-top: 1px solid #f3f4f6; }

.tc-num {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    padding: 8px 6px;
    text-align: center;
}

.tc-bearing {
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
}

.tc-dist { padding: 6px; }

.tc-bearing select,
.tc-bearing input[type="number"],
.tc-dist input[type="number"] {
    padding: 6px 5px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
}

.tc-bearing select:focus,
.tc-bearing input:focus,
.tc-dist input:focus { outline: none; border-color: #1a3a5c; }

.b-ns, .b-ew { width: 46px; }
.b-deg { width: 46px; }
.b-min, .b-sec { width: 40px; }
.b-sym { font-size: 12px; color: #6b7280; margin: 0 1px; }
.b-dist { width: 110px; }

.tc-del { padding: 6px; text-align: center; }

.btn-del-row {
    background: none;
    border: none;
    color: #d1d5db;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.btn-del-row:hover { color: #ef4444; background: #fef2f2; }

/* Action bar */
.corr-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 16px;
    gap: 10px;
}

.corr-actions-right { display: flex; gap: 8px; }

.btn-add-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: background .15s;
}
.btn-add-row:hover { background: #e5e7eb; }

.btn-clear {
    padding: 7px 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: background .15s;
}
.btn-clear:hover { background: #f9fafb; }

.btn-calculate {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 20px;
    background: #1a3a5c;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: background .15s;
}
.btn-calculate:hover { background: #122b46; }

/* Results */
.result-table-wrap { overflow-x: auto; padding: 16px 20px; }

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    white-space: nowrap;
}

.result-table th {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 8px 10px;
    border-bottom: 2px solid #e5e7eb;
    text-align: right;
}

.result-table th:first-child,
.result-table th:nth-child(2) { text-align: left; }

.result-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.result-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.result-table td.pos { color: #15803d; }
.result-table td.neg { color: #b91c1c; }
.result-table td.corr { color: #6b7280; font-size: 11.5px; }

.result-table tr.totals-row td {
    background: #f8fafc;
    border-top: 2px solid #e5e7eb;
    border-bottom: none;
}

.result-table tbody tr:hover td { background: #f9fafb; }

/* Hidden results */
.results-hidden { display: none; }

/* Station table */
.station-table-wrap { max-width: 680px; }
.station-table th { text-align: left !important; }
.station-table td.num { text-align: right; }
.station-table tbody tr:last-child td { border-bottom: none; }
/* E,N Combined column */
.th-combined { background: #1a3a5c !important; color: #fff !important; text-align: center !important; border-radius: 0; }
.coord-combined {
    font-family: monospace;
    font-size: 12.5px;
    color: #1a3a5c;
    letter-spacing: .02em;
    cursor: pointer;
    -webkit-user-select: all;
    user-select: all;
    text-align: center !important;
    transition: background .12s;
}
.coord-combined:hover { background: #eff6ff; }
.coord-combined.coord-copied { background: #dcfce7 !important; color: #15803d; }

/* Closing row highlight */
.coord-close-row td { background: #f0fdf4 !important; }

/* Copy All button */
.btn-copy-all {
    padding: 5px 13px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    letter-spacing: .03em;
    transition: background .15s, color .15s;
}
.btn-copy-all:hover { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

.coord-copy-bar { display: flex; justify-content: flex-end; padding: 8px 20px 0; }

/* visually-hidden */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* From Coordinates input */
.coord-input-wrap {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 20px;
}

.coord-textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: monospace;
    color: #111827;
    resize: vertical;
    min-height: 110px;
    box-sizing: border-box;
}

.coord-textarea:focus { outline: none; border-color: #1a3a5c; box-shadow: 0 0 0 3px rgba(26,58,92,.08); }

.coord-btn-group { display: flex; flex-direction: column; gap: 6px; align-self: flex-end; }
.coord-calc-btn { white-space: nowrap; }

.coord-summary-row { padding: 0 20px; margin-bottom: 12px; }

.coord-table-wrap { max-width: 100%; }

/* Summary cards */
.corr-summary-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.corr-summary-card {
    flex: 1;
    min-width: 140px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.corr-summary-card.highlight {
    border-color: #1a3a5c;
    background: #f0f4f8;
}

.cs-label {
    font-size: 10px;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cs-val {
    font-size: 15px;
    font-weight: 700;
    color: #1a3a5c;
}

/* Target Area Adjustment */
.adj-body        { padding: 14px 20px 18px; }
.adj-input-row   { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.adj-field       { display: flex; flex-direction: column; gap: 5px; min-width: 200px; }
.adj-field label { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.adj-field input { padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; font-family: 'Poppins', sans-serif; width: 100%; box-sizing: border-box; }
.adj-field input:focus { outline: none; border-color: #1a3a5c; }
.adj-area-wrap      { display: flex; align-items: center; gap: 8px; }
.adj-area-wrap input { flex: 1; }
.adj-nudge-group    { display: flex; gap: 3px; flex-shrink: 0; }
.adj-nudge          { padding: 5px 7px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 5px; font-size: 11px; font-weight: 600; color: #374151; cursor: pointer; font-family: 'Poppins', sans-serif; white-space: nowrap; transition: background .12s; }
.adj-nudge:hover    { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.adj-info-row    { display: flex; gap: 24px; flex-wrap: wrap; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 7px; padding: 10px 16px; margin-bottom: 14px; }
.adj-info-item   { font-size: 13px; color: #374151; }
.adj-info-item strong { color: #15803d; }
.adj-section-label  { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; }
.adj-verify-note    { font-size: 12px; color: #6b7280; margin: 0 0 10px; line-height: 1.5; }
.adj-auto-btn       { background: #1a3a5c !important; color: #fff !important; border-color: #1a3a5c !important; margin-left: 6px; }
.adj-auto-btn:hover { background: #0f2540 !important; border-color: #0f2540 !important; }

.btn-use-pob {
    font-size: 10px;
    font-weight: 600;
    color: #1a3a5c;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 3px 7px;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Poppins', sans-serif;
    transition: background .15s, color .15s;
}
.btn-use-pob:hover { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.adj-auto-range     { font-size: 12px; color: #1e3a5f; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.6; }
.adj-large-warn     { font-size: 12px; color: #92400e; background: #fefce8; border: 1px solid #fde68a; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.5; }
.adj-verify-wrap    { overflow-x: auto; margin-bottom: 16px; }
.adj-verify-table   { min-width: 640px; }
.adj-verify-table .th-left { text-align: left; }
.adj-copy-bar       { display: flex; justify-content: flex-end; padding: 8px 0 0; }
.adj-line-num       { color: #6b7280; font-size: 12px; }
.adj-match-ok       { text-align: center; font-weight: 700; font-size: 13px; color: #15803d; }
.adj-match-warn     { text-align: center; font-weight: 700; font-size: 13px; color: #b45309; }
.adj-match-fail     { text-align: center; font-weight: 700; font-size: 13px; color: #dc2626; }
.adj-coords-note    { font-size: 10px; font-weight: 400; color: #9ca3af; text-transform: none; letter-spacing: 0; }
.adj-coords-table   { min-width: 560px; }
.adj-shift-ok       { color: #15803d; font-weight: 600; }
.adj-shift-warn     { color: #b45309; font-weight: 600; }
.adj-shift-large    { color: #dc2626; font-weight: 600; }
.adj-sl-section     { border-top: 1px solid #e5e7eb; padding-top: 16px; margin-top: 8px; }
.adj-line-sel       { padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; font-family: 'Poppins', sans-serif; color: #111827; background: #fff; min-width: 160px; }
.adj-line-sel:focus { outline: none; border-color: #1a3a5c; }
.adj-sl-btn         { padding: 8px 18px; font-size: 13px; align-self: flex-end; }

/* Lot Drawing */
.lot-drawing-wrap { padding: 12px 20px 20px; }
.lot-svg   { width: 100%; height: auto; display: block; }
.lot-empty { padding: 24px; text-align: center; color: #9ca3af; font-size: 13px; margin: 0; }
.lot-poly  { fill: #dbeafe; stroke: #1a3a5c; stroke-width: 1.8px; stroke-linejoin: round; }
.lot-dot   { fill: #1a3a5c; }
.lot-dist-text  { font-size: 9px; fill: #1e3a5f; font-family: monospace; font-weight: 600; paint-order: stroke; stroke: white; stroke-width: 3px; }
.lot-pt-label   { font-size: 9.5px; fill: #1a3a5c; font-weight: 700; font-family: 'Poppins', sans-serif; paint-order: stroke; stroke: white; stroke-width: 3px; }
.lot-pt-num     { font-size: 9px; fill: #1a3a5c; font-weight: 800; font-family: 'Poppins', sans-serif; paint-order: stroke; stroke: white; stroke-width: 3px; }
.lot-coord-label{ font-size: 9.5px; fill: #b91c1c; font-family: monospace; font-weight: 700; paint-order: stroke; stroke: white; stroke-width: 3.5px; }
.lot-area-main  { font-size: 13px; fill: #1a3a5c; font-weight: 700; font-family: 'Poppins', sans-serif; }
.lot-area-sub   { font-size: 10px; fill: #6b7280; font-family: 'Poppins', sans-serif; }
.lot-north-line  { stroke: #6b7280; stroke-width: 1.5px; }
.lot-north-arrow { fill: #6b7280; }
.lot-north-text  { font-size: 9px; fill: #6b7280; font-weight: 700; font-family: 'Poppins', sans-serif; }

/* Tie Line */
.tie-header { cursor: pointer; }
.tie-header:hover { background: #f0f4f8; }
.tie-header-title { display: flex; align-items: center; gap: 6px; }
.tie-icon { vertical-align: -2px; flex-shrink: 0; }
.tie-chevron { transition: transform .2s; flex-shrink: 0; }
.tie-chevron-open { transform: rotate(180deg); }

.tie-coords { flex-wrap: wrap; padding-bottom: 12px; }

.tie-bearing-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 0 20px 16px;
    flex-wrap: wrap;
}

.tie-bearing-label {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    padding-bottom: 10px;
}

.tie-bearing-inputs { display: flex; align-items: center; gap: 3px; }

.tie-dist-field { min-width: 120px; }
.tie-dist-field label { font-size: 11px; font-weight: 500; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 5px; }
.tie-dist-field input { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 5px; font-size: 12px; font-family: 'Poppins', sans-serif; width: 100%; box-sizing: border-box; }
.tie-dist-field input:focus { outline: none; border-color: #1a3a5c; }

.tie-calc-btn { padding: 7px 16px; font-size: 12px; display: flex; align-items: center; gap: 6px; }

.tie-result {
    margin: 0 20px 16px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 13px;
    color: #15803d;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .start-coords { flex-direction: column; }
    .start-field { max-width: 100%; }
    .corr-summary-row { gap: 8px; }
    .corr-summary-card { min-width: 120px; }
}

/* Step badge that animates when Adjust runs */
@keyframes adjBadgePop {
    from { opacity: 0; transform: scale(0.75) translateY(-6px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}
@keyframes adjBadgeSpin {
    to { transform: rotate(360deg); }
}
.adj-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    animation: adjBadgePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.adj-step-badge.loading   { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }
.adj-step-badge.s1        { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.adj-step-badge.s2        { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.adj-step-badge.perfect   { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.adj-step-badge.partial   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Precision card — used while Correction 2 iterates */
.adj-step-badge.precision {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 16px;
    border-radius: 10px;
    background: #f0f9ff;
    color: #0c4a6e;
    border: 1px solid #7dd3fc;
    min-width: 320px;
    max-width: 520px;
    font-size: 12px;
    font-weight: 500;
}
.adj-step-badge.precision .adj-badge-spinner { margin-top: 3px; flex-shrink: 0; }
.adj-pc-body   { flex: 1; min-width: 0; }
.adj-pc-row    { display: flex; justify-content: space-between; align-items: center;
                 font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.adj-pc-iter   { font-size: 11px; font-weight: 600; opacity: .85; }
.adj-pc-bar    { height: 5px; background: #e0f2fe; border-radius: 3px; margin-bottom: 6px; overflow: hidden; }
.adj-pc-fill   { height: 100%; background: linear-gradient(90deg, #0ea5e9, #38bdf8);
                 border-radius: 3px; transition: width 0.12s linear; }
.adj-pc-stats  { font-size: 10.5px; color: #0369a1; font-weight: 500; line-height: 1.6; }
.adj-badge-spinner {
    width: 11px; height: 11px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    flex-shrink: 0;
    animation: adjBadgeSpin 0.65s linear infinite;
}
