:root{
  --bg:#f5f7fa;
  --panel:#ffffff;
  --line:#d9dee7;
  --line-soft:#edf0f4;
  --ink:#111827;
  --muted:#5f6b7a;
  --accent:#2563eb;
  --accent-dark:#174a7e;
  --soft:#f8fafc;
  --shadow:0 4px 16px rgba(15,23,42,.08);
  --radius:14px;
}
*{box-sizing:border-box}
body{margin:0;min-height:100vh;background:var(--bg);color:var(--ink);font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
button,select,input,textarea{font:inherit}
.tool-shell{width:min(1500px,calc(100% - 36px));margin:0 auto;padding:22px 0 64px}

.tool-hero{position:relative;min-height:225px;border-radius:22px;overflow:hidden;display:grid;grid-template-columns:150px minmax(0,1fr) 360px;align-items:center;background:#173a5e center/cover no-repeat;color:#fff;box-shadow:var(--shadow);isolation:isolate}
.tool-hero__veil{position:absolute;inset:0;background:linear-gradient(90deg,rgba(7,21,39,.92),rgba(7,21,39,.72) 58%,rgba(7,21,39,.86));z-index:-1}
.tool-hero__logo{width:118px;height:118px;object-fit:contain;justify-self:center;filter:drop-shadow(0 8px 16px rgba(0,0,0,.3))}
.tool-hero__copy{padding:28px 12px;min-width:0}
.tool-hero__copy p{margin:0 0 8px;text-transform:uppercase;letter-spacing:.12em;font-size:11px;font-weight:850;color:#d8e4f2}
.tool-hero__copy h1{margin:0 0 11px;font-size:clamp(34px,4vw,56px);line-height:1;letter-spacing:-.025em}
.tool-hero__copy span{display:block;max-width:720px;color:#d8e4f2;font-size:13px}
.tool-hero__controls{padding:22px;display:grid;gap:12px}
.tool-hero__controls label{color:#e8eef6}
.tool-hero__controls select{width:100%;background:rgba(255,255,255,.96);color:#172033}

label{display:grid;gap:5px;font-size:12px;font-weight:800}
select,input{min-height:38px;border:1px solid #cfd6df;border-radius:9px;padding:7px 10px;background:#fff;color:#172033}
select:focus,input:focus,textarea:focus{outline:2px solid rgba(37,99,235,.2);border-color:var(--accent)}

.tabs{display:flex;gap:8px;overflow-x:auto;margin:18px 0;padding-bottom:2px}
.tab{border:1px solid #cfd6df;background:#fff;color:#374151;border-radius:999px;padding:10px 16px;font-weight:800;cursor:pointer;white-space:nowrap}
.tab:hover{background:#f3f4f6;color:#111827}
.tab.active{background:var(--accent);border-color:var(--accent);color:#fff}

.panel{display:none;background:#fff;padding:21px;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}
.panel.active{display:block}
.section-head{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:4px}
.section-head h2{margin:0;font-size:1.35rem}
.section-kicker{margin:0 0 4px;color:var(--accent-dark);font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.1em}
.muted{color:var(--muted)}
.section-head .muted{margin:6px 0 0;font-size:13px}
.counters{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.counters span{padding:7px 10px;border:1px solid #d9dee7;border-radius:999px;background:#f8fafc;font-size:12px;font-weight:800;color:#374151}
.table-tools,.depth-tools{display:flex;justify-content:flex-end;align-items:end;gap:14px;margin:9px 0}
.depth-tools strong{padding:9px 12px;border:1px solid #d9dee7;border-radius:10px;background:#f8fafc;min-width:112px;text-align:center}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:14px;background:#fff}
.data-table{width:100%;border-collapse:collapse;min-width:980px;background:#fff;color:#111827;font-size:12px}
.data-table th,.data-table td{padding:9px 10px;border-bottom:1px solid var(--line-soft);text-align:center;white-space:nowrap}
.data-table th{background:#f8fafc;color:#374151;font-size:10px;text-transform:uppercase;letter-spacing:.055em;position:sticky;top:0;z-index:1}
.data-table tbody tr:hover td{background:#fafafa}
.data-table tr:last-child td{border-bottom:0}
.data-table th.player,.data-table td.player{text-align:left}
.player-name-wrap{display:flex;align-items:center;gap:9px;min-width:185px}
.player-name{font-weight:850}
.injury-dtd .player-name{color:#df7b25}
.injury-out .player-name{color:#c83f3f}

.rating-pair{display:inline-flex;gap:3px;flex:0 0 auto}
.rating-box{width:13px;height:25px;border-radius:4px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.6),0 1px 3px rgba(0,0,0,.14)}
.grade-green{background:#2e9f5b}.grade-blue{background:#2868b2}.grade-red{background:#c83f3f}.grade-orange{background:#df7b25}.grade-yellow{background:#d8b62b}.grade-purple{background:#7549a8}.grade-black{background:#151515}.grade-gray,.grade-grey{background:#677281}

.validation{min-height:25px;margin:8px 0;font-size:13px;font-weight:800}
.validation.error{color:#b42318}.validation.ok{color:#18733c}

.depth-slot{font-weight:900;color:#173a5e;min-width:52px}
.depth-empty td{background:#fbfcfd}
.empty-label{color:#98a2b3;font-style:italic}
.move-controls{display:inline-flex;gap:4px}
.icon-button{width:30px;height:30px;padding:0;border:1px solid #cfd6df;border-radius:7px;background:#fff;color:#374151;font-weight:900;cursor:pointer}
.icon-button:hover:not(:disabled){background:#edf4ff;border-color:#9ebcf2;color:#174a7e}
.icon-button:disabled{opacity:.35;cursor:not-allowed}
.clear-button{border:0;background:transparent;color:#9b2c2c;font-size:11px;font-weight:850;cursor:pointer}
.minutes-input{width:65px;min-height:32px;padding:4px 6px;text-align:center}

.unassigned-card{display:none;margin-top:16px;padding:16px;border:1px dashed #b9c4d3;border-radius:14px;background:#f8fafc}
.unassigned-card.visible{display:flex;justify-content:space-between;gap:20px;align-items:center}
.unassigned-card h3{margin:0 0 4px;font-size:14px}
.unassigned-card p{margin:0;font-size:12px}
.unassigned-list{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.unassigned-player{display:flex;align-items:center;gap:7px;padding:6px 7px 6px 10px;border:1px solid #d9dee7;border-radius:999px;background:#fff;font-size:12px;font-weight:800}
.unassigned-player button{border:0;border-radius:999px;background:#2563eb;color:#fff;padding:5px 8px;font-size:11px;font-weight:850;cursor:pointer}

.gameplan-grid{display:grid;grid-template-columns:repeat(3,minmax(250px,1fr));gap:18px}
fieldset{display:grid;gap:12px;border:1px solid var(--line);border-radius:14px;padding:17px;background:#fff}
legend{padding:0 8px;color:#173a5e;font-weight:900}
fieldset label{grid-template-columns:1fr 130px;align-items:center;font-size:12px}
.fieldset-note{margin:0;color:var(--muted);font-size:11px;line-height:1.4}

#order-preview{width:100%;border:1px solid #cfd6df;border-radius:12px;font-family:Consolas,"Courier New",monospace;padding:13px;resize:vertical;background:#fbfcfd;color:#111827}
.actions,.draft-bar{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
button,.file-button{border:1px solid var(--accent);background:var(--accent);color:#fff;padding:9px 14px;border-radius:8px;font-weight:800;cursor:pointer}
button:hover,.file-button:hover{filter:brightness(.96)}
.button-secondary{background:#fff;color:#374151;border-color:#cfd6df}
.file-button input{display:none}
.draft-bar{align-items:end;background:#fff;padding:14px 16px;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);margin-top:16px}
.draft-title{display:grid;margin-right:4px}.draft-title small{color:var(--muted);font-size:10px}
.draft-bar input{min-width:230px;flex:1}.draft-bar select{min-width:240px;flex:1}

@media(max-width:1050px){.tool-hero{grid-template-columns:120px 1fr}.tool-hero__controls{grid-column:1/-1;grid-template-columns:1fr 1fr;padding-top:0}.gameplan-grid{grid-template-columns:1fr 1fr}.gameplan-grid fieldset:last-child{grid-column:1/-1}}
@media(max-width:700px){.tool-shell{width:min(100% - 20px,1500px)}.tool-hero{grid-template-columns:1fr;text-align:center;padding-top:20px}.tool-hero__logo{width:90px;height:90px}.tool-hero__copy{padding:8px 18px}.tool-hero__controls{grid-template-columns:1fr;text-align:left}.section-head{align-items:stretch;flex-direction:column}.counters{justify-content:flex-start}.gameplan-grid{grid-template-columns:1fr}.gameplan-grid fieldset:last-child{grid-column:auto}.unassigned-card{align-items:flex-start!important;flex-direction:column}.unassigned-list{justify-content:flex-start}.draft-bar{align-items:stretch;flex-direction:column}}

.drag-handle{
  cursor:grab;
  color:#7a8797;
  font-size:18px;
  font-weight:900;
  letter-spacing:-3px;
  user-select:none;
  width:34px;
}
[data-depth-row]{transition:background-color .12s ease,opacity .12s ease}
[data-depth-row].dragging{opacity:.45}
[data-depth-row].drag-over td{background:#eaf2ff!important;border-top:2px solid #2563eb}

.drag-handle{
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
}
body.touch-dragging{
  overflow:hidden;
  overscroll-behavior:none;
}
body.touch-dragging .drag-handle{
  cursor:grabbing;
}
@media(max-width:700px){
  .drag-handle{
    min-width:42px;
    width:42px;
    font-size:22px;
  }
  .icon-button{
    width:34px;
    height:34px;
  }
}
