
:root{
  --bg:#091221;
  --panel:#0f1d34;
  --card:#12203a;
  --text:#e8eefc;
  --muted:#a9b7d7;
  --border:rgba(255,255,255,.10);
  --accent:#77a6ff;
  --accent-strong:#1e5b92;
  --danger:#ff5c7a;
  --warn:#ffd27a;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(900px 540px at 0% 0%, rgba(44, 106, 178, .38) 0%, rgba(44, 106, 178, 0) 58%),
    linear-gradient(180deg, #0a1424 0%, var(--bg) 100%);
  color:var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:18px;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background: rgba(7, 12, 24, .72);
  backdrop-filter: blur(10px);
  position: sticky;
  top:0;
  z-index:10;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  color:var(--text);
  text-decoration:none;
  min-width:0;
}
.brand:hover{opacity:.98}
.logo{
  width:56px;
  height:56px;
  flex:0 0 56px;
  border-radius:16px;
  background:linear-gradient(180deg, rgba(30,91,146,.28) 0%, rgba(11,26,52,.65) 100%);
  display:grid;
  place-items:center;
  border:1px solid rgba(122,162,255,.18);
  box-shadow:0 12px 30px rgba(0,0,0,.18);
}
.logo-image{
  width:100%;
  height:100%;
  object-fit:contain;
  border-radius:14px;
}
.brand-copy{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.brand-title{
  font-weight:800;
  letter-spacing:.02em;
}
.brand-subtitle{
  font-size:12px;
  color:var(--muted);
  line-height:1.45;
}

.nav{display:flex;flex-wrap:wrap;gap:10px}
.nav a{
  color:var(--muted);
  text-decoration:none;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid transparent;
}
.nav a:hover{color:var(--text);border-color:var(--border);background:rgba(255,255,255,.04)}
.nav a.active{color:var(--text);border-color:rgba(122,162,255,.35);background:rgba(122,162,255,.10)}

.session-area{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.session-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.05);
  color:var(--muted);
  font-size:12px;
  font-weight:600;
}

.container{max-width:1100px;margin:18px auto;padding:0 16px 30px}
.grid{display:grid;gap:14px}
.grid-2{grid-template-columns: 1fr 1fr}
@media (max-width: 920px){.grid-2{grid-template-columns:1fr}}
.users-layout{grid-template-columns:1fr;align-items:start}
.users-layout > .card:first-child{max-width:760px}

.card{
  background: rgba(18, 31, 54, .75);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.card h2, .card h3{margin:0 0 10px 0}
.muted{color:var(--muted)}

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--border);
}
.table-scroll{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.table-scroll .table{
  min-width:680px;
}
.table th,.table td{
  padding:10px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}
.table th{color:var(--muted);font-weight:600;text-align:left;background:rgba(255,255,255,.03)}
.table tr:hover td{background:rgba(255,255,255,.03)}
.table tr:last-child td{border-bottom:none}

.row{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}
.field{display:flex;flex-direction:column;gap:6px;min-width:180px;flex:1}
.field label{font-size:12px;color:var(--muted)}
.field input,.field select, .field textarea{
  background: rgba(255,255,255,.04);
  color: var(--text);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 10px;
  outline:none;
}
.field textarea{min-height:80px;resize:vertical}

.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{
  appearance:none;
  border:1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:600;
}
.btn:hover{background: rgba(255,255,255,.08)}
.btn-primary{border-color:rgba(122,162,255,.45);background:rgba(122,162,255,.18)}
.btn-danger{border-color:rgba(255,92,122,.55);background:rgba(255,92,122,.15)}
.btn-ghost{background:transparent}

.alert{border-radius:14px;padding:10px 12px;border:1px solid var(--border);margin-bottom:12px}
.alert-error{border-color:rgba(255,92,122,.55);background:rgba(255,92,122,.12)}
.alert-warning{border-color:rgba(255,204,102,.55);background:rgba(255,204,102,.10)}
.alert-info{border-color:rgba(122,162,255,.55);background:rgba(122,162,255,.10)}

.install-sheet[hidden]{
  display:none;
}

.install-sheet{
  position:fixed;
  inset:0;
  z-index:40;
}

.install-sheet-backdrop{
  position:absolute;
  inset:0;
  background:rgba(3, 8, 18, .72);
  backdrop-filter:blur(8px);
}

.install-sheet-panel{
  position:relative;
  width:min(560px, calc(100% - 28px));
  margin:clamp(28px, 10vh, 88px) auto 0;
  padding:22px;
  border-radius:24px;
  border:1px solid rgba(122,162,255,.18);
  background:
    radial-gradient(440px 180px at 0% 0%, rgba(119,166,255,.16) 0%, rgba(119,166,255,0) 70%),
    linear-gradient(180deg, rgba(15,29,52,.98) 0%, rgba(8,16,30,.98) 100%);
  box-shadow:0 28px 80px rgba(0,0,0,.42);
}

.install-sheet-close{
  appearance:none;
  border:none;
  background:transparent;
  color:var(--muted);
  font:inherit;
  padding:0;
  position:absolute;
  top:16px;
  right:18px;
  cursor:pointer;
}

.install-sheet-close:hover{
  color:var(--text);
}

.install-sheet-kicker{
  margin:0 0 10px;
  color:var(--warn);
  font-size:12px;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
}

.install-sheet-title{
  margin:0 0 10px;
  font-size:1.7rem;
  line-height:1.15;
}

.install-sheet-text{
  margin:0 0 18px;
  color:var(--muted);
  line-height:1.6;
}

.install-steps{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:12px;
}

.install-step{
  display:grid;
  grid-template-columns:40px 1fr;
  gap:12px;
  align-items:flex-start;
  padding:14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
}

.install-step-number{
  width:40px;
  height:40px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-weight:800;
  color:var(--text);
  background:linear-gradient(180deg, rgba(119,166,255,.28) 0%, rgba(30,91,146,.45) 100%);
  border:1px solid rgba(122,162,255,.28);
}

.install-step strong{
  display:block;
  margin-bottom:4px;
}

.install-step p{
  margin:0;
  color:var(--muted);
  line-height:1.5;
}

.install-sheet-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.footer{
  max-width:1100px;
  margin:0 auto;
  padding:18px 16px 30px;
  color:var(--muted);
  font-size:12px;
}
.footer-separator{
  display:inline-block;
  margin:0 6px;
}

.portal-hero{
  padding:28px;
  background:
    radial-gradient(900px 240px at 0% 0%, rgba(122,162,255,.18) 0%, rgba(122,162,255,0) 60%),
    rgba(18, 31, 54, .78);
}

.portal-kicker,
.portal-card-kicker{
  color:var(--warn);
  font-size:12px;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
}

.portal-title{
  margin:10px 0 8px;
  font-size:2.25rem;
}

.portal-copy{
  max-width:720px;
  color:var(--muted);
  font-size:1.02rem;
  line-height:1.6;
}

.portal-grid{
  margin-top:14px;
}

.portal-card{
  min-height:220px;
  display:flex;
  flex-direction:column;
  gap:12px;
  justify-content:space-between;
}

.flight-form{display:flex;flex-direction:column;gap:18px}
.flight-block{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background:rgba(255,255,255,.03);
}
.flight-block-title{
  margin:0 0 14px 0;
  text-align:center;
  font-size:1.25rem;
  letter-spacing:.4px;
}
.flight-form .row{gap:14px}
.flight-form .field{min-width:220px}

.flight-group{
  border:1px solid var(--border);
  border-radius:14px;
  background:rgba(255,255,255,.03);
  overflow:hidden;
}

.flight-group-summary{
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:14px 16px;
  cursor:pointer;
  user-select:none;
  background:rgba(255,255,255,.04);
}

.flight-group-summary::-webkit-details-marker{
  display:none;
}

.flight-group-summary:hover{
  background:rgba(255,255,255,.07);
}

.flight-group-title{
  font-size:1.05rem;
  font-weight:700;
}

.flight-group-toggle{
  border:1px solid rgba(122,162,255,.35);
  border-radius:999px;
  background:rgba(122,162,255,.10);
  color:var(--text);
  padding:8px 12px;
  font-size:12px;
  font-weight:700;
  min-width:72px;
  text-align:center;
}

.flight-group[open] .flight-group-toggle{
  background:rgba(122,162,255,.18);
  color:var(--text);
  font-size:0;
}

.flight-group[open] .flight-group-summary{
  border-bottom:1px solid var(--border);
}

.flight-group[open] .flight-group-toggle::before{
  content:"Close";
  font-size:12px;
}

.flight-group-body{
  padding:14px;
}

@media (max-width: 720px){
  .topbar{
    padding:14px;
  }
  .topbar-right{
    width:100%;
    justify-content:flex-start;
  }
  .nav{
    width:100%;
    flex-wrap:nowrap;
    overflow-x:auto;
    padding-bottom:4px;
    scrollbar-width:thin;
  }
  .nav a{
    white-space:nowrap;
  }
  .session-area{
    width:100%;
    justify-content:space-between;
  }
  .install-sheet-panel{
    width:min(100% - 18px, 520px);
    margin-top:18px;
    padding:18px;
    border-radius:20px;
  }
  .install-sheet-title{
    font-size:1.35rem;
  }
  .install-step{
    grid-template-columns:34px 1fr;
    padding:12px;
  }
  .install-step-number{
    width:34px;
    height:34px;
  }
  .logo{
    width:48px;
    height:48px;
    flex-basis:48px;
  }
  .brand-title{
    font-size:15px;
  }
  .brand-subtitle{
    font-size:11px;
  }
  .portal-hero{
    padding:22px;
  }
  .portal-title{
    font-size:1.8rem;
  }
  .portal-card{
    min-height:unset;
  }
  .table-scroll .table{
    min-width:620px;
  }
  .flight-group-summary{
    align-items:flex-start;
    flex-direction:column;
  }
}

.builder-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.builder-item{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  text-decoration:none;
  color:var(--text);
  background:rgba(255,255,255,.03);
}

.builder-item:hover{
  background:rgba(255,255,255,.06);
}

.builder-item-active{
  border-color:rgba(122,162,255,.45);
  background:rgba(122,162,255,.12);
}

.spec-list{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:12px;
}

.spec-list div,
.stack div{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.stack{
  display:grid;
  gap:10px;
}

.plain-list{
  margin:0;
  padding-left:18px;
  display:grid;
  gap:8px;
}

code{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:12px;
  color:#d7e5ff;
  background:rgba(255,255,255,.06);
  border:1px solid var(--border);
  border-radius:10px;
  padding:4px 8px;
  width:fit-content;
  max-width:100%;
  overflow-wrap:anywhere;
}

.hero-card{
  background:
    radial-gradient(800px 300px at 0% 0%, rgba(122,162,255,.18) 0%, rgba(122,162,255,0) 60%),
    rgba(18, 31, 54, .82);
}

.hero-kicker{
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--accent);
  margin-bottom:8px;
}

.hero-copy{
  max-width:840px;
}

.cnc-workspace{
  display:grid;
  gap:16px;
}

.cnc-topbar{
  display:grid;
  gap:16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.01) 100%),
    radial-gradient(900px 320px at 0% 0%, rgba(122,162,255,.16) 0%, rgba(122,162,255,0) 60%),
    rgba(18, 31, 54, .82);
}

.workspace-title{
  margin:0;
}

.workspace-copy{
  max-width:920px;
  margin:8px 0 0 0;
}

.workspace-tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.workspace-tab{
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--muted);
  background:rgba(255,255,255,.03);
  font-size:12px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.workspace-tab-active{
  color:var(--text);
  border-color:rgba(122,162,255,.45);
  background:rgba(122,162,255,.16);
}

.profile-rack{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));
  gap:10px;
}

.profile-pill{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
}

.cnc-layout{
  display:grid;
  grid-template-columns:minmax(280px, 340px) minmax(0, 1fr) minmax(260px, 320px);
  gap:16px;
  align-items:start;
}

@media (max-width: 1180px){
  .cnc-layout{
    grid-template-columns:1fr;
  }
}

.cnc-sidebar,
.cnc-main,
.cnc-inspector{
  display:grid;
  gap:16px;
}

.cnc-form{
  display:grid;
  gap:16px;
}

.panel-card{
  padding:16px;
}

.panel-card-large{
  min-height:520px;
}

.panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.panel-header h3{
  margin:0;
}

.panel-badge{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(122,162,255,.3);
  background:rgba(122,162,255,.1);
  color:var(--accent);
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  white-space:nowrap;
}

.field-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(120px, 1fr));
  gap:12px;
}

.users-list{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.user-card{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background:rgba(255,255,255,.03);
}

.user-card-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}

.user-card-header h3{
  margin:0 0 4px 0;
}

.user-role-badge{
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(122,162,255,.35);
  background:rgba(122,162,255,.10);
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}

.user-meta-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:12px;
  margin-top:12px;
}

.user-aircraft-block{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--border);
}

.assigned-aircraft-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}

.aircraft-pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  font-size:13px;
  font-weight:600;
}

.aircraft-assignment-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  padding:12px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  background:rgba(255,255,255,.02);
}

.aircraft-assignment-grid-wide{
  grid-template-columns:1fr;
  max-width:none;
  width:100%;
}

.aircraft-option{
  display:flex;
  align-items:flex-start;
  gap:10px;
  min-width:0;
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
}

.aircraft-option-copy{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}

.aircraft-option-title{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:15px;
  font-weight:600;
  letter-spacing:.02em;
}

.aircraft-option-subtitle{
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}

.user-actions-grid{
  display:grid;
  grid-template-columns:minmax(180px, 220px) minmax(0, 1fr);
  gap:12px;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--border);
  align-items:start;
}

@media (max-width: 800px){
  .user-actions-grid{
    grid-template-columns:1fr;
  }
}

.term-panel{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background:rgba(255,255,255,.03);
}

.term-panel h4{
  margin:0 0 12px 0;
}

.term-note-list{
  display:grid;
  gap:10px;
  margin-top:14px;
}

.term-note-list div{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
  gap:12px;
}

.stat-box{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-height:86px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}

.stat-box strong{
  font-size:1.1rem;
}

.bounds-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:12px;
  margin-top:14px;
}

.bounds-grid div{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.code-textarea{
  min-height:280px !important;
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:12px;
  line-height:1.45;
}

.code-input{
  min-height:220px !important;
}

.code-output{
  min-height:420px !important;
}

.empty-state{
  min-height:320px;
  display:grid;
  place-content:center;
  gap:10px;
  text-align:center;
  border:1px dashed var(--border);
  border-radius:16px;
  background:rgba(255,255,255,.02);
  padding:20px;
}

.empty-state-short{
  min-height:160px;
}

.preview-shell{
  border:1px solid var(--border);
  border-radius:20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.02) 0%, rgba(255,255,255,.01) 100%),
    rgba(5, 10, 18, .55);
  padding:12px;
  margin-bottom:14px;
}

.toolpath-preview{
  display:block;
  width:100%;
  height:auto;
  border-radius:16px;
}

.preview-surface{
  fill:rgba(8,14,24,.96);
  stroke:rgba(255,255,255,.06);
  stroke-width:2;
}

.preview-rapid{
  fill:none;
  stroke:rgba(122,162,255,.55);
  stroke-width:2.5;
  stroke-dasharray:7 8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.preview-cut{
  fill:none;
  stroke:#8ef0a8;
  stroke-width:3.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.runtime-controls{
  display:grid;
  gap:10px;
  margin-top:14px;
}

.queue-panel{
  margin-top:14px;
  display:grid;
  gap:8px;
}

.jog-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
}

.queue-preview{
  margin:0;
  padding:12px;
  min-height:110px;
  max-height:220px;
  overflow:auto;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  color:#d7e5ff;
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:12px;
  line-height:1.45;
}

.schedule-shell{
  display:grid;
  grid-template-columns:minmax(0, 1.35fr) minmax(320px, .75fr);
  gap:16px;
  align-items:start;
}

.schedule-main,
.schedule-sidebar{
  display:grid;
  gap:16px;
}

.schedule-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.schedule-nav{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.schedule-month-label{
  min-width:160px;
  text-align:center;
  font-size:1.05rem;
  font-weight:700;
}

.schedule-filters{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.schedule-filter{
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--muted);
  text-decoration:none;
  font-weight:600;
}

.schedule-filter.active{
  color:var(--text);
  border-color:rgba(122,162,255,.35);
  background:rgba(122,162,255,.14);
}

.schedule-calendar{
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
}

.schedule-mobile-hint{
  display:none;
  margin:12px 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

.schedule-edit-panel{
  margin-top:16px;
}

.schedule-edit-panel-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.schedule-weekdays{
  display:grid;
  grid-template-columns:repeat(7, 1fr);
  background:rgba(255,255,255,.04);
  border-bottom:1px solid var(--border);
}

.schedule-weekdays div{
  padding:12px 10px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.schedule-grid{
  display:grid;
  grid-template-columns:repeat(7, minmax(0, 1fr));
}

.schedule-day{
  min-height:148px;
  padding:10px;
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  background:transparent;
  color:var(--text);
  text-align:left;
  cursor:default;
}

.schedule-day:nth-child(7n){
  border-right:none;
}

.schedule-day.outside-month{
  background:rgba(255,255,255,.015);
}

.schedule-day.today{
  background:rgba(122,162,255,.08);
}

.schedule-day-number{
  font-size:13px;
  font-weight:700;
  color:var(--muted);
}

.schedule-day-events{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:10px;
}

.schedule-event-chip{
  display:flex;
  flex-direction:column;
  gap:4px;
  width:100%;
  padding:8px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:color-mix(in srgb, var(--event-color) 18%, rgba(255,255,255,.03));
  color:var(--text);
  text-align:left;
  cursor:pointer;
}

.schedule-event-chip.active{
  outline:2px solid rgba(255,255,255,.28);
}

.event-chip-time{
  font-size:11px;
  font-weight:700;
  opacity:.85;
}

.event-chip-text{
  font-size:12px;
  font-weight:600;
  line-height:1.35;
}

.schedule-empty-slot{
  min-height:12px;
}

.schedule-form{
  display:grid;
  gap:12px;
}

.schedule-legs{
  display:grid;
  gap:12px;
}

.schedule-leg-card{
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}

.schedule-leg-grid{
  grid-template-columns:repeat(2, minmax(0, 1fr));
}

.schedule-detail{
  display:grid;
  gap:12px;
}

.schedule-detail-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.schedule-detail-block{
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.03);
}

.schedule-detail-label{
  color:var(--muted);
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  margin-bottom:6px;
}

.schedule-detail-value{
  line-height:1.55;
}

.schedule-detail-note{
  margin-top:8px;
  color:var(--muted);
  line-height:1.5;
}

.schedule-detail-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.schedule-detail-sheet{
  position:fixed;
  inset:0;
  z-index:80;
}

.schedule-detail-sheet-backdrop{
  position:absolute;
  inset:0;
  background:rgba(5,10,20,.72);
  backdrop-filter:blur(12px);
}

.schedule-detail-sheet-panel{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  max-height:min(82vh, 720px);
  padding:18px 18px 24px;
  border-top:1px solid rgba(255,255,255,.1);
  border-radius:24px 24px 0 0;
  background:linear-gradient(180deg, rgba(11,18,32,.98), rgba(9,15,28,.98));
  overflow:auto;
  box-shadow:0 -20px 40px rgba(0,0,0,.35);
}

.schedule-detail-sheet-close{
  appearance:none;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--muted);
  border-radius:999px;
  padding:8px 14px;
  font-weight:700;
  cursor:pointer;
  margin-bottom:12px;
}

.schedule-detail-sheet-kicker{
  margin:0 0 6px;
  color:var(--muted);
  font-size:11px;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.schedule-detail-sheet-panel h3{
  margin:0 0 14px;
}

.schedule-discrepancy-list,
.maintenance-discrepancy-list{
  display:grid;
  gap:12px;
}

.maintenance-aircraft-discrepancy-groups{
  display:grid;
  gap:18px;
}

.maintenance-aircraft-discrepancy-group{
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  background:rgba(255,255,255,.02);
}

.maintenance-aircraft-discrepancy-header{
  margin-bottom:12px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.maintenance-aircraft-discrepancy-header h3{
  margin:0;
}

.maintenance-aircraft-discrepancy-header p{
  margin:4px 0 0;
}

.schedule-discrepancy-card,
.maintenance-discrepancy-card{
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  background:rgba(255,255,255,.03);
}

.schedule-discrepancy-card.grounded,
.maintenance-discrepancy-card.grounded{
  border-color:rgba(209,79,79,.45);
  background:rgba(209,79,79,.08);
}

.schedule-discrepancy-top,
.maintenance-discrepancy-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.schedule-discrepancy-tail,
.maintenance-discrepancy-tail{
  font-weight:800;
  letter-spacing:.04em;
}

.schedule-discrepancy-status,
.maintenance-status-chip{
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  background:rgba(122,162,255,.14);
  color:var(--text);
}

.maintenance-status-chip.grounded,
.schedule-discrepancy-card.grounded .schedule-discrepancy-status{
  background:rgba(209,79,79,.18);
}

.maintenance-status-chip.deferred{
  background:rgba(213,164,91,.18);
}

.schedule-discrepancy-meta,
.maintenance-detail-label{
  color:var(--muted);
  font-size:12px;
}

.schedule-discrepancy-description,
.maintenance-discrepancy-body{
  line-height:1.6;
  margin:8px 0;
}

.maintenance-shell{
  display:grid;
  gap:16px;
}

.maintenance-section-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.maintenance-discrepancy-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px;
  margin:10px 0;
}

.maintenance-discrepancy-details{
  padding:0;
  overflow:hidden;
}

.maintenance-discrepancy-summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:14px;
}

.maintenance-discrepancy-summary::-webkit-details-marker{
  display:none;
}

.maintenance-discrepancy-summary-main{
  min-width:0;
  flex:1 1 auto;
}

.maintenance-discrepancy-summary-text{
  margin-top:4px;
  color:var(--text);
  line-height:1.5;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.maintenance-discrepancy-summary-side{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

.maintenance-discrepancy-summary-date{
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
}

.maintenance-discrepancy-expanded{
  padding:0 14px 14px;
  border-top:1px solid rgba(255,255,255,.06);
}

.maintenance-close-form{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--border);
  display:grid;
  gap:12px;
}

.maintenance-edit-form{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--border);
  display:grid;
  gap:12px;
}

@media (max-width: 1100px){
  .schedule-shell{
    grid-template-columns:1fr;
  }
}

@media (max-width: 800px){
  .schedule-shell{
    gap:12px;
  }

  .schedule-header{
    margin-bottom:10px;
  }

  .schedule-nav{
    width:100%;
    justify-content:space-between;
  }

  .schedule-month-label{
    min-width:0;
    flex:1 1 auto;
    font-size:.98rem;
  }

  .schedule-filters{
    flex-wrap:nowrap;
    overflow-x:auto;
    padding-bottom:4px;
    margin-bottom:10px;
    scrollbar-width:none;
  }

  .schedule-filters::-webkit-scrollbar{
    display:none;
  }

  .schedule-filter{
    flex:0 0 auto;
    white-space:nowrap;
  }

  .schedule-mobile-hint{
    display:block;
  }

  .schedule-edit-panel-header{
    flex-direction:column;
  }

  .schedule-weekdays div{
    padding:8px 4px;
    font-size:10px;
    text-align:center;
    letter-spacing:.04em;
  }

  .schedule-day{
    min-height:96px;
    padding:6px 4px;
    border-right:1px solid var(--border);
  }

  .schedule-day:nth-child(7n){
    border-right:none;
  }

  .schedule-day-number{
    font-size:11px;
  }

  .schedule-day-events{
    gap:4px;
    margin-top:6px;
  }

  .schedule-event-chip{
    padding:4px;
    border-radius:9px;
    gap:2px;
  }

  .event-chip-time{
    font-size:9px;
  }

  .event-chip-text{
    font-size:9px;
    line-height:1.15;
    word-break:break-word;
  }

  .schedule-detail-sidebar-card{
    display:none;
  }

  .schedule-detail-grid{
    grid-template-columns:1fr;
  }

  .schedule-leg-grid{
    grid-template-columns:1fr;
  }

  .maintenance-discrepancy-grid{
    grid-template-columns:1fr;
  }
}
