:root{
  --bg:#f4f7fb;
  --card:#ffffff;
  --line:#d9e3ee;
  --text:#142033;
  --muted:#66758a;
  --blue:#274f80;
  --shadow:0 10px 28px rgba(15,23,42,.06);
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family:"Segoe UI",Arial,sans-serif;}
body{padding:24px;}
.page{max-width:1440px;margin:0 auto;}
.topbar{
  display:flex;justify-content:space-between;gap:18px;align-items:flex-start;
  margin-bottom:18px;
}
.topbar h1{margin:0 0 6px;font-size:28px;}
.topbar p{margin:0;color:var(--muted);}
.cfg{
  display:grid;grid-template-columns:minmax(280px,420px) minmax(180px,240px) auto;
  gap:10px;align-items:center;
}
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:var(--shadow);
}
.toolbar{padding:18px;margin-bottom:18px;}
.toolbar-row{
  display:grid;
  grid-template-columns:130px 130px minmax(240px,1fr) 90px auto;
  gap:12px;align-items:center;
}
input,select,button,textarea{
  font:inherit;
  border:1px solid #c8d6e5;
  border-radius:14px;
  padding:12px 14px;
  background:#fff;
  color:var(--text);
}
button{
  cursor:pointer;
  background:var(--blue);
  color:#fff;
  border-color:var(--blue);
  font-weight:700;
}
.auto{display:flex;gap:8px;align-items:center;justify-self:end;color:var(--muted);}
.hint{margin-top:12px;color:var(--muted);font-size:14px;}

.table-card{
  padding:0;
  overflow:auto;
}

table{
  width:100%;
  min-width:1510px;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}
thead th{
  background:#eef4fb;
  color:#1f3654;
  font-weight:800;
  text-align:left;
  padding:14px 12px;
  border-bottom:1px solid var(--line);
}
tbody td{
  vertical-align:top;
  padding:12px;
  border-bottom:1px solid #edf2f7;
  line-height:1.6;
  font-size:14px;
}
tbody tr:hover{background:#fbfdff;}
.small{font-size:12px;color:var(--muted);}

.badge{
  display:inline-flex;align-items:center;justify-content:center;
  padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;
  border:1px solid transparent;
}
.s-new{background:#eef6ff;color:#1d4d8f;border-color:#cfe0ff;}
.s-contacted{background:#fff8e8;color:#9a5b00;border-color:#f4d7a1;}
.s-confirmed{background:#e8f8ef;color:#18794e;border-color:#b9e6cb;}
.s-done{background:#eef2f7;color:#475467;border-color:#d0d5dd;}
.s-archived{background:#f8fafc;color:#667085;border-color:#d0d5dd;}

textarea.note{
  width:100%;
  min-height:92px;
  resize:vertical;
  padding:10px 12px;
}
.actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.actions button{
  padding:8px 10px;
  font-size:12px;
  border-radius:10px;
}
.actions button[data-act="contacted"]{background:#d97706;border-color:#d97706;}
.actions button[data-act="confirmed"]{background:#2f855a;border-color:#2f855a;}
.actions button[data-act="done"]{background:#475467;border-color:#475467;}
.actions button[data-act="archived"]{background:#667085;border-color:#667085;}
.actions button[data-act="save"]{background:#274f80;border-color:#274f80;}

thead th:nth-child(1){width:130px;}
thead th:nth-child(2){width:150px;}
thead th:nth-child(3){width:90px;}
thead th:nth-child(4){width:280px;}
thead th:nth-child(5){width:200px;}
thead th:nth-child(6){width:260px;}
thead th:nth-child(7){width:110px;}
thead th:nth-child(8){width:220px;}
thead th:nth-child(9){width:190px;}

@media (max-width: 1100px){
  body{padding:14px;}
  .topbar{flex-direction:column;}
  .cfg{grid-template-columns:1fr;}
  .toolbar-row{grid-template-columns:1fr 1fr;align-items:stretch;}
  .auto{justify-self:start;}
  table{min-width:1320px;}
}
/* compact list + expandable details */
.compact-lines{
  white-space:pre-line;
  line-height:1.7;
}
.detail-box{
  margin-top:8px;
  border-top:1px dashed #d9e3ee;
  padding-top:8px;
}
.detail-box summary{
  cursor:pointer;
  color:#274f80;
  font-size:12px;
  font-weight:800;
  user-select:none;
}
.detail-box[open] summary{
  margin-bottom:8px;
}
.detail-meta{
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed #e5edf5;
}
tbody td{
  padding-top:10px;
  padding-bottom:10px;
}
textarea.note{
  min-height:72px;
}