:root{
  --page:#ffffff;
  --surface:#ffffff;
  --surface-soft:#f8fafc;
  --ink:#111827;
  --muted:#64748b;
  --line:#e2e8f0;
  --line-strong:#cbd5e1;
  --accent:#2563eb;
  --accent-soft:#eff6ff;
  --green:#15803d;
  --green-soft:#ecfdf3;
  --amber:#b45309;
  --amber-soft:#fff7ed;
  --red:#b91c1c;
  --red-soft:#fef2f2;
  --violet:#6d28d9;
  --violet-soft:#f5f3ff;
  --shadow:0 14px 30px rgba(15,23,42,.06);
}

*{box-sizing:border-box}

html,body{background:var(--page)}

body{
  margin:0;
  min-height:100vh;
  overflow-x:hidden;
  font-family:"Segoe UI",Arial,sans-serif;
  color:var(--ink);
}

button,input,select,textarea{font:inherit}
button{cursor:pointer}

.topbar{
  position:fixed;
  left:0;
  top:0;
  bottom:0;
  z-index:20;
  width:286px;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:22px;
  padding:24px 18px;
  background:#fff;
  border-right:1px solid var(--line);
}

.brand{
  display:flex;
  align-items:flex-start;
  gap:13px;
  min-width:0;
  padding-bottom:18px;
  border-bottom:1px solid var(--line);
}

.brand-mark{
  width:50px;
  height:50px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  color:#fff;
  background:var(--accent);
  border-radius:8px;
  font-weight:900;
  letter-spacing:.03em;
}

.brand-title{
  font-size:17px;
  line-height:1.16;
  font-weight:850;
}

.brand-subtitle{
  margin-top:5px;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.student-card{
  display:grid;
  gap:7px;
  margin-top:auto;
  padding:14px;
  border:1px solid var(--line);
  border-left:4px solid var(--accent);
  border-radius:8px;
  background:var(--surface-soft);
  font-size:13px;
  font-weight:800;
}

.student-card small{
  color:var(--muted);
  font-size:11px;
  line-height:1.45;
  font-weight:600;
}

.workspace-nav{
  position:fixed;
  z-index:30;
  left:18px;
  top:124px;
  width:250px;
  display:grid;
  gap:8px;
}

.nav-tab{
  width:100%;
  min-height:44px;
  padding:0 14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:#334155;
  text-align:left;
  font-size:13px;
  font-weight:800;
}

.nav-tab:hover{
  background:var(--surface-soft);
  border-color:var(--line-strong);
}

.nav-tab.active{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}

.shell{
  width:auto;
  margin-left:286px;
  padding:30px 32px 54px;
}

.hero-strip{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:20px;
  align-items:end;
  margin-bottom:20px;
  padding-bottom:22px;
  border-bottom:1px solid var(--line);
}

.eyebrow{
  margin:0 0 8px;
  color:var(--accent);
  font-size:11px;
  font-weight:850;
  letter-spacing:.1em;
  text-transform:uppercase;
}

h1,h2,h3,p{margin-top:0}

h1{
  max-width:980px;
  margin-bottom:0;
  color:#0f172a;
  font-size:34px;
  line-height:1.08;
  letter-spacing:0;
  overflow-wrap:break-word;
}

h1 span{display:block}
h1 span + span{color:#1e293b}
h2{margin-bottom:0;font-size:20px;line-height:1.25;color:#0f172a}
h3{font-size:15px;margin-bottom:8px}

.hero-status{
  display:inline-flex;
  align-items:center;
  gap:9px;
  min-height:40px;
  padding:0 13px;
  border:1px solid #bbf7d0;
  border-radius:8px;
  background:var(--green-soft);
  color:var(--green);
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}

.status-dot{
  width:9px;
  height:9px;
  border-radius:50%;
  background:var(--green);
}

.kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-bottom:18px;
}

.kpi-card,.panel{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:10px;
  box-shadow:var(--shadow);
}

.kpi-card{
  min-height:116px;
  padding:17px;
}

.kpi-label{
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.kpi-value{
  margin-top:12px;
  color:#0f172a;
  font-size:36px;
  line-height:1;
  font-weight:900;
}

.kpi-note{
  margin-top:8px;
  color:var(--muted);
  font-size:12px;
}

.view{display:none}
.view.active{display:block}

.layout{
  display:grid;
  gap:16px;
  margin-bottom:16px;
}

.layout.two{grid-template-columns:1.05fr .95fr}
.order-layout{grid-template-columns:minmax(0,1fr) 360px}

.panel{
  padding:19px;
}

.panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:16px;
  padding-bottom:14px;
  border-bottom:1px solid var(--line);
}

.toolbar{
  display:flex;
  justify-content:flex-end;
  gap:9px;
  flex-wrap:wrap;
}

.input{
  width:100%;
  min-height:40px;
  padding:9px 11px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:#fff;
  color:var(--ink);
  outline:none;
}

.input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(37,99,235,.12);
}

.input::placeholder{color:#94a3b8}
.input.compact{width:270px}
select.input.compact{width:166px}
textarea.input{resize:vertical}

.primary-btn,.ghost-btn,.danger-btn,.mini-btn,.icon-btn{
  border-radius:8px;
  font-weight:800;
}

.primary-btn,.ghost-btn,.danger-btn{
  min-height:40px;
  padding:0 14px;
}

.primary-btn{
  border:1px solid var(--accent);
  background:var(--accent);
  color:#fff;
}

.primary-btn:hover{background:#1d4ed8}

.ghost-btn{
  border:1px solid var(--line-strong);
  background:#fff;
  color:#334155;
}

.ghost-btn:hover{background:var(--surface-soft)}

.danger-btn{
  border:1px solid #fecaca;
  background:var(--red-soft);
  color:var(--red);
}

.danger-btn:hover{background:#fee2e2}

.deadline-list,.timeline,.stage-bars,.owner-list,.resource-grid,.report-grid{
  display:grid;
  gap:10px;
}

.deadline-item{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:13px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-soft);
}

.deadline-title{
  margin-bottom:5px;
  color:#0f172a;
  font-weight:850;
}

.deadline-meta,.muted-text{
  color:var(--muted);
  font-size:13px;
  line-height:1.55;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:24px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:850;
  white-space:nowrap;
}

.badge.blue{background:var(--accent-soft);color:var(--accent)}
.badge.green{background:var(--green-soft);color:var(--green)}
.badge.amber{background:var(--amber-soft);color:var(--amber)}
.badge.red{background:var(--red-soft);color:var(--red)}
.badge.violet{background:var(--violet-soft);color:var(--violet)}

.stage-row{
  display:grid;
  grid-template-columns:138px 1fr 34px;
  gap:12px;
  align-items:center;
}

.stage-name{
  color:#334155;
  font-size:13px;
  font-weight:800;
}

.bar-track{
  height:12px;
  border-radius:999px;
  background:#e5e7eb;
  overflow:hidden;
}

.bar-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,var(--accent),#22c55e);
}

.stage-count{
  text-align:right;
  font-weight:850;
  color:#0f172a;
}

.timeline-item{
  display:grid;
  grid-template-columns:112px 1fr;
  gap:12px;
  padding:13px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-soft);
}

.timeline-time{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

.timeline-title{
  margin-bottom:4px;
  color:#0f172a;
  font-weight:850;
}

.table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:8px;
}

table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  color:var(--ink);
  font-size:13px;
}

th,td{
  padding:11px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:middle;
}

th{
  background:var(--surface-soft);
  color:#64748b;
  font-size:11px;
  letter-spacing:.06em;
  text-transform:uppercase;
}

tr:last-child td{border-bottom:none}
tr:hover td{background:#f8fafc}

.progress{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:120px;
}

.progress-line{
  height:8px;
  flex:1;
  border-radius:999px;
  background:#e5e7eb;
  overflow:hidden;
}

.progress-fill{
  height:100%;
  border-radius:999px;
  background:#22c55e;
}

.progress span{
  color:#475569;
  font-size:12px;
  font-weight:800;
}

.row-actions{
  display:flex;
  justify-content:flex-end;
  gap:6px;
}

.icon-btn{
  width:34px;
  height:34px;
  border:1px solid var(--line-strong);
  background:#fff;
  color:var(--accent);
}

.icon-btn:hover{background:var(--accent-soft)}

.form{display:grid;gap:12px}
.form label{color:#475569;font-size:12px;font-weight:800}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}

.kanban{
  display:grid;
  grid-template-columns:repeat(5,minmax(190px,1fr));
  gap:12px;
  overflow:auto;
  padding-bottom:4px;
}

.kanban-column{
  min-height:342px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-soft);
}

.kanban-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
  color:#0f172a;
  font-size:13px;
  font-weight:850;
}

.order-card{
  margin-bottom:10px;
  padding:12px;
  border:1px solid var(--line);
  border-left:4px solid var(--accent);
  border-radius:8px;
  background:#fff;
}

.order-card strong{
  display:block;
  margin-bottom:6px;
  color:#0f172a;
}

.order-card p{
  margin:0 0 9px;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.card-actions{display:flex;gap:6px}
.card-actions button{flex:1}

.mini-btn{
  min-height:32px;
  border:1px solid var(--line-strong);
  background:#fff;
  color:#334155;
  font-size:12px;
}

.mini-btn:hover{background:var(--surface-soft)}

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

.resource-card,.owner-card,.report-card{
  padding:14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-soft);
}

.resource-top,.owner-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.load-meter{
  height:10px;
  border-radius:999px;
  background:#e5e7eb;
  overflow:hidden;
}

.load-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,#22c55e,var(--amber));
}

.owner-card{display:grid;gap:5px}
.owner-top strong{color:#0f172a;font-size:14px}
.owner-meta{color:var(--muted);font-size:12px}

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

.report-card strong{
  display:block;
  margin-bottom:5px;
  color:#0f172a;
  font-size:30px;
  line-height:1;
}

.report-card span{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

.button-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.footer{
  display:flex;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-left:286px;
  padding:18px 32px 30px;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:12px;
}

@media (max-width:1500px){
  .order-layout{grid-template-columns:1fr}
}

@media (max-width:1120px){
  .layout.two{grid-template-columns:1fr}
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kanban{grid-template-columns:repeat(3,minmax(220px,1fr))}
}

@media (max-width:820px){
  body{width:100vw;max-width:100vw}

  .topbar{
    position:static;
    width:100vw;
    max-width:100vw;
    gap:14px;
    padding:16px;
    border-right:none;
    border-bottom:1px solid var(--line);
  }

  .brand{
    width:100%;
    max-width:calc(100vw - 32px);
    min-width:0;
    align-items:flex-start;
  }

  .brand > div:not(.brand-mark){
    min-width:0;
    max-width:calc(100vw - 104px);
  }

  .brand-title{
    max-width:100%;
    font-size:16px;
    line-height:1.16;
    overflow-wrap:anywhere;
  }

  .student-card{
    width:100%;
    margin-top:0;
  }

  .workspace-nav{
    position:static;
    width:100vw;
    max-width:100vw;
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
    padding:12px 16px;
    background:#fff;
    border-bottom:1px solid var(--line);
    overflow:hidden;
  }

  .nav-tab{
    width:100%;
    min-width:0;
    padding:0 8px;
    text-align:center;
    white-space:normal;
    overflow-wrap:anywhere;
  }

  .shell,.footer{
    width:100%;
    max-width:100vw;
    margin-left:0;
    padding-left:16px;
    padding-right:16px;
    overflow:hidden;
  }

  .hero-strip{
    grid-template-columns:1fr;
    align-items:start;
  }

  .hero-status{
    width:100%;
    white-space:normal;
  }

  h1{
    width:100%;
    max-width:calc(100vw - 32px);
    font-size:21px;
    line-height:1.14;
    word-break:break-word;
    overflow-wrap:anywhere;
  }

  .kpi-grid,.resource-grid,.report-grid{
    grid-template-columns:1fr;
  }

  .toolbar,.input.compact,select.input.compact{
    width:100%;
  }

  .stage-row{
    grid-template-columns:104px 1fr 30px;
  }

  .timeline-item,.deadline-item{
    grid-template-columns:1fr;
  }

  .form-grid,.kanban{
    grid-template-columns:1fr;
  }
}
