:root{
  --legacy-workspace:#fffff3;
  --legacy-panel:#fffff3;
  --legacy-panel-alt:#F4F2E4;
  --legacy-rail-top:#eeeef0;
  --legacy-rail-bottom:#dfdfe1;
  --legacy-tab-top:#f5f5f6;
  --legacy-tab-bottom:#e3e3e5;
  --legacy-tab-border:#d1d1d3;
  --legacy-rail-border:#c7c7c7;
  --legacy-text:#111;
  --legacy-muted:#6f6f6f;
  --legacy-blue:#0000ff;
  --legacy-navy:#00008b;
  --legacy-highlight:#ecec74;
  --legacy-bevel-dark:#8f8f8f;
  --legacy-bevel-mid:#d5d5d5;
  --legacy-bevel-light:#fff;
  --legacy-font:Tahoma,"Microsoft Sans Serif",Arial,sans-serif;
}
*{box-sizing:border-box}
html{font-size:16px}
body.legacy-page{margin:0;background:var(--legacy-workspace);color:var(--legacy-text);font-family:var(--legacy-font);font-size:16px;line-height:1.4}
button,input,select,textarea{font:inherit}
button{color:inherit}
.hidden{display:none!important}
.muted{color:var(--legacy-muted)}
.no-print{}

.legacy-shell{width:98vw;max-width:1600px;margin:.5rem auto;min-width:0}
.legacy-window-title{min-height:38px;display:flex;align-items:center;gap:10px;padding:5px 9px;background:linear-gradient(#e8e7e0,#d8d7d0);border:1px solid #a0a09a;border-bottom:0;box-shadow:inset 1px 1px 0 #fff;color:#222}
.legacy-window-title .legacy-title-text{font-weight:700;font-size:14px;white-space:nowrap}
.legacy-window-title .legacy-subtitle{font-size:12px;color:#555;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.legacy-window-title .legacy-spacer{flex:1}
.legacy-user-badge,.user-badge,.mode-badge{font-size:12px;border:1px solid #aaa;background:#f7f7f3;padding:3px 8px;border-radius:2px;white-space:nowrap}

.tab-strip,.legacy-tabs{height:34px;padding:4px 8px 0;background:linear-gradient(to bottom,var(--legacy-rail-top),var(--legacy-rail-bottom));border:1px solid var(--legacy-rail-border);border-bottom:1px solid var(--legacy-rail-border);display:flex;flex-wrap:nowrap;align-items:flex-end;gap:3px;overflow-x:auto;white-space:nowrap;scrollbar-width:none;position:relative;z-index:20}
.tab-strip::-webkit-scrollbar,.legacy-tabs::-webkit-scrollbar{display:none}
.tab,.legacy-tab{appearance:none;height:29px;padding:5px 16px 4px;font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1;border-radius:4px 4px 0 0;background:linear-gradient(to bottom,var(--legacy-tab-top),var(--legacy-tab-bottom));color:#666;cursor:pointer;outline:none;border:1px solid var(--legacy-tab-border);border-bottom-color:#c4c4c6;box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 1px 0 rgba(255,255,255,.55);position:relative;z-index:21;font-weight:400;white-space:nowrap;margin:0}
.tab.active,.legacy-tab.active{bottom:-1px;background:var(--legacy-workspace);color:#222;font-weight:700;border-bottom-color:var(--legacy-workspace);z-index:3;box-shadow:inset 0 1px 0 #fff}
.tab:hover:not(.active),.legacy-tab:hover:not(.active){color:#333;background:linear-gradient(to bottom,#fafafa,#e9e9eb)}
.tab:focus-visible,.legacy-tab:focus-visible{outline:2px solid #3e79c6;outline-offset:-3px}
.tab:disabled,.legacy-tab:disabled{opacity:.45;cursor:not-allowed}

.main-panel,.legacy-panel{background:var(--legacy-panel);position:relative;z-index:1;border:3px solid var(--legacy-highlight);box-shadow:inset 0 0 0 1px #b5b5aa;min-height:180px}
.legacy-panel-body{padding:16px 20px}
.legacy-section-title,.section-title,.sec-title{color:var(--legacy-blue);font-weight:700;font-size:1.35rem;margin:0 0 12px;line-height:1.3}
.legacy-section-subtitle{color:var(--legacy-navy);font-weight:700;font-size:1.05rem;margin:10px 0 6px}
.legacy-rule{border:0;height:1px;background:linear-gradient(to right,#aaa,#ddd,#aaa);margin:10px 0}

.legacy-field{display:flex;align-items:center;min-height:38px;margin-bottom:4px;flex-wrap:wrap;gap:6px}
.legacy-field>label,.legacy-label{min-width:180px;font-size:1rem;font-weight:600;padding:4px 8px 4px 0;flex-shrink:0}
.legacy-control-wrap{display:flex;align-items:center;flex-wrap:wrap;gap:4px 14px;flex:1}
body.legacy-page input[type=text],body.legacy-page input[type=email],body.legacy-page input[type=password],body.legacy-page input[type=number],body.legacy-page input[type=date],body.legacy-page textarea,body.legacy-page select,.legacy-control,.control{background:#fff;font-family:var(--legacy-font);font-size:1rem;color:#000;min-height:34px;padding:4px 8px;border-top:1px solid #a9a9a9;border-left:1px solid #a9a9a9;border-bottom:1px solid #fff;border-right:1px solid #fff;outline:none;border-radius:3px}
body.legacy-page textarea{min-height:84px;resize:vertical}
body.legacy-page input:focus,body.legacy-page textarea:focus,body.legacy-page select:focus,.legacy-control:focus{border-color:#0000ff;box-shadow:0 0 0 2px rgba(0,0,255,.12)}
body.legacy-page input[type=checkbox],body.legacy-page input[type=radio]{width:18px;height:18px;vertical-align:middle}

.pill,.legacy-btn,.btn,.btn-s{min-height:30px;padding:0 18px;border-radius:999px;font-family:var(--legacy-font);font-size:14px;font-weight:700;color:#111;text-shadow:0 1px 0 #fff;background:linear-gradient(to bottom,#fff 0%,#ededed 45%,#bfc3c9 100%);border:1px solid #8b8f96;box-shadow:inset 1px 1px 0 #fff,inset -1px -1px 0 #8a8e95,0 1px 0 rgba(0,0,0,.18);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;line-height:1;text-decoration:none}
.pill:hover,.legacy-btn:hover,.btn:hover,.btn-s:hover{background:linear-gradient(to bottom,#fff 0%,#f3f3f3 45%,#c9cdd3 100%)}
.pill:active,.legacy-btn:active,.btn:active,.btn-s:active{background:linear-gradient(to bottom,#b6bac1 0%,#d7d9dd 55%,#f2f2f2 100%);transform:translateY(1px)}
.pill:disabled,.legacy-btn:disabled,.btn:disabled,.btn-s:disabled{opacity:.42;cursor:not-allowed;pointer-events:none}
.legacy-btn.small,.btn.small{min-height:26px;padding:0 12px;font-size:12px}
.legacy-btn.danger,.btn.danger{color:#7a0000;background:linear-gradient(#fff,#f2dddd 55%,#ddbcbc)}
.legacy-btn.secondary,.btn.secondary,.btn.ghost{background:linear-gradient(#fff,#eee 55%,#d2d2d2)}
.btn-bar,.legacy-button-bar{display:flex;justify-content:center;flex-wrap:wrap;gap:20px;padding:16px;background:var(--legacy-workspace);border-top:1px solid #d0d0d0;box-shadow:inset 0 1px 0 #d0d0d0,inset 0 2px 0 #dbdad6}
.right-actions,.inline-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.inline-actions{justify-content:flex-start}

.data-table,.legacy-table,.report-table,.dt{width:100%;border-collapse:collapse;background:#fff}
.data-table th,.legacy-table th,.report-table th,.dt th{background:linear-gradient(to bottom,#fff,#d4d3d3);border:1px solid #a9a9a9;padding:6px 8px;font-size:.9rem;text-align:left;font-weight:700}
.data-table td,.legacy-table td,.report-table td,.dt td{border:1px solid #c0c0c0;padding:5px 7px;vertical-align:top;background:#fff}
.data-table tbody tr:nth-child(even),.legacy-table tbody tr:nth-child(even){background:#fafaf7}
.table-scroll{overflow:auto}

.status-note,.legacy-note{padding:8px 10px;background:#fffce2;border:1px solid #c9c48f;color:#504b20;font-size:.86rem;border-radius:2px}
.warning-note{background:#fff0d6;border-color:#d4a64d;color:#784900}
.tag{display:inline-block;font-size:.74rem;background:#dbeafe;color:#174b86;border:1px solid #9dbddd;border-radius:999px;padding:2px 7px}.tag.subtle{background:#eee;color:#555;border-color:#ccc}

.legacy-page-view{display:none;padding:16px 20px}.legacy-page-view.active{display:block}
.form-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:10px}.span-2{grid-column:span 2}.span-3{grid-column:span 3}.span-4{grid-column:span 4}.span-5{grid-column:span 5}.span-6{grid-column:span 6}.span-8{grid-column:span 8}.span-12{grid-column:span 12}
.field{display:flex;flex-direction:column;gap:4px}.field label{font-size:.85rem;font-weight:700;color:#333}.field input,.field select,.field textarea{width:100%}.inline-fields{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end}

.modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.42);z-index:9000;align-items:center;justify-content:center;padding:20px}.modal.show{display:flex}
.modal-card{background:#f0efe8;border:2px solid #6a7faf;border-radius:3px;box-shadow:4px 4px 16px rgba(0,0,0,.28);width:min(760px,96vw);max-height:92vh;overflow:auto}
.modal-head{display:flex;align-items:center;padding:7px 10px;background:linear-gradient(#dfe8f6,#b9c7df);border-bottom:1px solid #8799b5}.modal-head h2{margin:0;flex:1;font-size:1rem;color:#1b2940}.modal-body{padding:14px}.modal-foot{display:flex;justify-content:flex-end;gap:8px;padding:10px 14px;border-top:1px solid #bdbdb5;background:#e7e6df}

.toast-host{position:fixed;right:18px;bottom:18px;z-index:10000;display:grid;gap:8px}.toast{background:#444;color:#fff;padding:9px 12px;border:1px solid #222;box-shadow:2px 2px 7px rgba(0,0,0,.25);max-width:380px}.toast.success{background:#2d6b35}.toast.error{background:#8a1f1f}.toast.warning{background:#85610f}

@media(max-width:900px){
  .legacy-shell{width:100vw;margin:0}
  .legacy-window-title{flex-wrap:wrap}
  .legacy-window-title .legacy-spacer{display:none}
  .form-grid{grid-template-columns:1fr}.form-grid>[class^="span-"]{grid-column:auto}
  .legacy-field{display:block}.legacy-field>label,.legacy-label{display:block;min-width:0}
}
@media print{
  .legacy-window-title,.tab-strip,.legacy-tabs,.btn-bar,.legacy-button-bar,.no-print{display:none!important}
  .legacy-shell{width:100%;max-width:none;margin:0}
  .main-panel,.legacy-panel{border:0!important;box-shadow:none!important;min-height:0!important}
}
