body{font-family:Arial,sans-serif;margin:0;background:#f5f7fb;color:#222}header{background:#17385c;color:white;padding:16px 24px}h1{margin:0 0 10px}nav a{color:white;margin-right:15px;text-decoration:none;font-weight:bold}main{padding:24px;max-width:1200px;margin:auto}.card{background:white;border-radius:10px;padding:18px;margin-bottom:18px;box-shadow:0 1px 6px #ccd}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px}.stat{background:white;border-radius:10px;padding:18px;box-shadow:0 1px 6px #ccd}.stat b{font-size:28px;display:block}table{width:100%;border-collapse:collapse;background:white}th,td{padding:10px;border-bottom:1px solid #ddd;text-align:left}th{background:#eef3f8}input,select,textarea{width:100%;padding:9px;margin:5px 0 12px;border:1px solid #aaa;border-radius:6px;box-sizing:border-box}.row{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}.btn,button{display:inline-block;background:#17385c;color:white;padding:9px 13px;border-radius:6px;text-decoration:none;border:0;cursor:pointer}.btn.alt{background:#4d657d}.btn.danger,button.danger{background:#9c2f2f}.actions a{margin-right:8px}.search{display:flex;gap:10px}.search input{margin:0}footer{text-align:center;color:#777;padding:20px}.notice{background:#fff6bf;padding:10px;border-radius:8px}.small{font-size:12px;color:#666}

.legacy-page{background:#c8dff1;padding:18px;max-width:none;margin:-24px}.legacy-page h2{font-size:30px;font-weight:400;border-bottom:1px solid #6c9bc1;padding-bottom:12px;margin-top:0}.legacy-card{border:1px solid #9fb8cc;border-radius:4px;padding:24px 12px;background:#c8dff1}.report-toolbar{display:flex;justify-content:space-between;align-items:flex-start;margin:8px 18px 28px}.legacy-table th{background:#5f93c2;color:#fff;font-family:Georgia,serif;font-weight:bold}.legacy-table td{background:#c8dff1;font-family:Georgia,serif;font-weight:bold;border:1px solid #aaa;padding:14px 10px}.legacy-table .grand td{background:#a9c9e4;font-size:20px}.toggle-form{display:flex;gap:10px;align-items:flex-start;text-align:center}.switch input{display:none}.switch span{display:inline-block;width:48px;height:28px;background:#2196f3;border-radius:20px;position:relative}.switch span:after{content:'';position:absolute;right:4px;top:4px;width:20px;height:20px;background:white;border-radius:50%}.switch input:not(:checked)+span{background:#aaa}.switch input:not(:checked)+span:after{left:4px;right:auto}

.legacy-table .country-row td{background:#a9c9e4;font-size:22px}.legacy-table .total-row td{background:#ddd;font-weight:bold}.country-filter{min-width:300px}.country-filter label{font-weight:bold;display:block;margin-bottom:8px}.country-filter select{width:300px;margin:0}

.owner-report-toolbar{display:flex;justify-content:space-between;align-items:flex-start;margin:0 10px 18px}
.owner-card{background:white;border:1px solid #a9a9a9;border-radius:4px;padding:28px 12px}
.state-band{background:#a9c9e4;font-family:Georgia,serif;font-size:22px;margin:0 0 18px;padding:12px;font-weight:bold}
.owner-grid{display:grid;grid-template-columns:1fr 1fr;column-gap:70px;row-gap:34px;margin:0 20px 40px}
.owner-block{font-family:Georgia,serif;font-weight:bold;font-size:16px;line-height:1.45;min-height:180px}
.owner-block a{color:#0645ad}
.owner-remove{margin-top:18px;background:#5f93c2;font-family:Georgia,serif;font-weight:normal}
@media(max-width:800px){.owner-grid{grid-template-columns:1fr;column-gap:0}.legacy-page{padding:12px}.owner-card{padding:16px 8px}}

.unit-remove-form select,.unit-remove-form input{margin-bottom:6px}

/* Full-width admin layout for all report/table pages */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

main,
.container,
.page,
.page-wrap,
.content,
.content-wrap,
.legacy-page,
.card,
.legacy-card,
.edit-static-card {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
}

/* Give pages breathing room */
.legacy-page,
.card,
.edit-static-card {
    padding: 20px !important;
}

/* All wide report/edit tables */
.table-wrap,
.table-scroll,
.static-table-wrap,
.table1-wrap,
.table2-wrap,
.table3-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    box-sizing: border-box;
}

/* Report tables should use available space */
.legacy-table,
.edit-static-table,
.table1-report,
.table2-report,
.table3-report,
.table3-static-table {
    width: max-content;
    min-width: 100%;
}

/* Report font */
.legacy-table,
.legacy-table th,
.legacy-table td,
.edit-static-table,
.edit-static-table th,
.edit-static-table td {
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 10pt !important;
}
.table3-static-table {
    table-layout: fixed;
    width: 100%;
}

.table3-static-table th,
.table3-static-table td {
    padding: 3px 4px;
    font-size: 10pt;
}

.table3-static-table th:nth-child(3),
.table3-static-table td:nth-child(3) {
    width: 60px;
}

.table3-static-table th:nth-child(4),
.table3-static-table td:nth-child(4),
.table3-static-table th:nth-child(5),
.table3-static-table td:nth-child(5),
.table3-static-table th:nth-child(6),
.table3-static-table td:nth-child(6),
.table3-static-table th:nth-child(7),
.table3-static-table td:nth-child(7) {
    width: 70px;
}

.table3-static-table th:nth-child(8),
.table3-static-table td:nth-child(8),
.table3-static-table th:nth-child(9),
.table3-static-table td:nth-child(9) {
    width: 85px;
}

.table3-static-table input[type="number"] {
    width: 52px;
    text-align: center;
    padding: 2px;
}

.table3-static-table input[name="country[]"] {
    width: 95px;
}

.table3-static-table input[name="state[]"] {
    width: 125px;
}

.table3-static-table input[name="notes[]"] {
    width: 100%;
}

.status-display{padding:10px 0 12px}
.status-badge{display:inline-block;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:bold;background:#e6edf5;color:#17385c;border:1px solid #cad7e3}
.status-active{background:#e6f6ea;color:#166534;border-color:#b7e1c1}
.status-terminate{background:#fde8e8;color:#9c2f2f;border-color:#f5bcbc}
.status-non-renewal{background:#fff4d6;color:#8a5a00;border-color:#efd18a}
.status-reacquired-by-franchisor{background:#e8f0ff;color:#1d4f91;border-color:#b8cdf7}
.status-ceased-operations-other-reasons{background:#eee;color:#333;border-color:#ccc}
.unit-table td{vertical-align:middle}.unit-actions{white-space:nowrap}.unit-actions .btn{margin-right:6px}.unit-detail-row td{background:#f8fbff}.unit-edit-form{padding:10px 0}.history-list{margin:8px 0 0 18px;padding:0}.history-list li{margin-bottom:8px}
.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.45);align-items:center;justify-content:center;z-index:9999;padding:20px}.modal-box{background:white;border-radius:10px;box-shadow:0 8px 30px rgba(0,0,0,.25);padding:22px;width:min(520px,95vw)}.modal-box h3{margin-top:0}.modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:12px}.modal-box textarea{min-height:90px}

.owner-running-total{margin-top:28px;padding:14px 18px;border-top:3px solid #111;text-align:right;font-size:18px;background:#f8f9fa;}
.owner-total-count{font-size:14px;color:#555;margin-left:10px;}
.status-terminated{background:#fde8e8;color:#9c2f2f;border-color:#f5bcbc}
.modal-inline{background:#fff;border:1px solid #cad7e3;border-radius:10px;padding:18px;box-shadow:0 1px 6px #ccd;max-width:640px}.modal-inline h3{margin-top:0}.modal-row td{background:#f8fbff}
.table3-report th:nth-child(1){width:10%;}
.table3-report th:nth-child(10){width:15%;}
.notes-cell{position:relative;min-width:140px;vertical-align:top;}
.note-text{white-space:pre-line;min-height:38px;padding-right:28px;}
.note-pencil{background:transparent;color:#003399;border:0;border-radius:0;padding:2px 4px;font-size:22px;line-height:1;cursor:pointer;box-shadow:none;}
.note-pencil:hover{color:#17385c;text-decoration:underline;background:transparent;}

/* Static historical report editors */
.edit-static-card{padding-bottom:84px;}
.static-table-wrap{max-height:70vh;overflow:auto;border:1px solid #cad7e3;border-radius:8px;background:white;position:relative;}
.small-static-table{max-height:460px;}
.edit-static-table{min-width:980px;border-collapse:separate;border-spacing:0;}
.edit-static-table th{position:sticky;top:0;z-index:6;background:#eef3f8;border-bottom:2px solid #cad7e3;}
.edit-static-table td{background:#fff;}
.edit-static-table input{min-width:110px;margin:0;padding:7px;}
.table3-static-table input[name='notes[]']{min-width:260px;}
.sticky-col{position:sticky;z-index:5;background:#fff;box-shadow:2px 0 0 #dde6ef;}
th.sticky-col{z-index:8;background:#dbeaf7;}
.sticky-col-1{left:0;min-width:150px;width:150px;}
.sticky-col-2{left:150px;min-width:190px;width:190px;}
.floating-save-bar{position:sticky;bottom:0;z-index:20;background:rgba(255,255,255,.96);border-top:1px solid #cad7e3;box-shadow:0 -4px 14px rgba(0,0,0,.08);padding:12px 14px;margin:16px -18px -18px;display:flex;gap:10px;align-items:center;}
@media(max-width:900px){.sticky-col-1{min-width:120px;width:120px}.sticky-col-2{left:120px;min-width:150px;width:150px}.floating-save-bar{flex-wrap:wrap}}


/* Taller report and historical-data scroll areas */
.table3-wrap,
.table4-wrap,
.table5-wrap,
.report-table-wrap,
.static-table-wrap,
.hdm-table-wrap {
    height: calc(100vh - 170px) !important;
    min-height: 1100px !important;
    max-height: none !important;
    overflow: auto !important;
}

/* Keep smaller static Table 1 editor usable but still taller than before */
.small-static-table {
    height: calc(100vh - 220px) !important;
    min-height: 800px !important;
    max-height: none !important;
}


/* Sticky report toolbars at the top of report pages */
.report-toolbar{
    position: sticky;
    top: 0;
    z-index: 1000;
    background:#c8dff1;
    border:1px solid #8faac0;
    box-shadow:0 3px 10px rgba(0,0,0,.10);
    padding:12px 20px;
}

/* Sticky report table headers while scrolling report tables */
.report-table-wrap .legacy-table th,
.static-table-wrap .edit-static-table th{
    position: sticky;
    top: 0;
    z-index: 60;
}

@media print{
    .report-toolbar{display:none!important;}
}

/* White rounded application header */
header {
    background: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    border-radius: 12px;
    margin: 12px 18px 0;
    padding: 16px 24px;
    box-sizing: border-box;
}

header h1 {
    color: #000000;
}

header nav a {
    color: #000000;
}

header nav a:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    header {
        margin: 8px;
        border-radius: 10px;
    }
}
