:root {
  font-family: system-ui, sans-serif;
  color: #182c31;
  background: #f4f7f6;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  background: #143e3b;
  color: white;
  padding: 30px max(24px, calc((100vw - 1160px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
h1 {
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -1px;
  margin: 4px 0;
}
h2 {
  font-size: 24px;
}
h3 {
  margin-top: 0;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: 700;
}
aside {
  padding: 12px 24px;
  background: #e3eee8;
  text-align: center;
  color: #31564a;
  font-size: 14px;
}
main {
  max-width: 1160px;
  margin: 28px auto;
  padding: 0 24px;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 24px;
}
button {
  background: #176951;
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 11px 17px;
  font: inherit;
  cursor: pointer;
}
button:hover {
  background: #114e3c;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
nav button {
  background: white;
  color: #164c40;
  border: 1px solid #b9d1c8;
}
nav button:hover { color: white; }
input,
select,
textarea {
  font: inherit;
  padding: 10px;
  border: 1px solid #a9bfb8;
  border-radius: 6px;
  max-width: 100%;
  width: 100%;
  background: white;
}
label {
  display: block;
  margin: 12px 0;
  color: #36504c;
}
form {
  max-width: 640px;
  padding: 22px;
  background: white;
  border: 1px solid #d7e3de;
  border-radius: 12px;
  margin: 18px 0;
}
form button {
  margin-top: 10px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.assignment-grid form { max-width: none; min-width: 0; }
.card {
  padding: 20px;
  background: white;
  border: 1px solid #d7e3de;
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.card button {
  margin-top: 12px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 14px/1.6 system-ui;
}
table {
  border-collapse: collapse;
  width: 100%;
  background: white;
}
td,
th {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #dae4df;
}
.table-wrap {
  overflow: auto;
}
#status {
  color: #8b3025;
  min-height: 24px;
}
.login {
  max-width: 620px;
  margin: 12vh auto;
  background: white;
  padding: 40px;
  border-radius: 18px;
  border: 1px solid #d7e3de;
}
p {
  line-height: 1.6;
}
.muted {
  color: #5b746c;
}
a {
  color: #176951;
}
.button-link {
  display: inline-block;
  background: #176951;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  text-decoration: none;
}
[hidden] { display: none !important; }

/* Sticky Quick Assignment Bar */
.sticky-assign-bar {
  position: sticky;
  top: 10px;
  z-index: 50;
  background: #e4efe9;
  border: 2px solid #8cb7a7;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 0 0 24px 0;
  box-shadow: 0 4px 14px rgba(20, 62, 59, 0.08);
}
.sticky-title {
  font-size: 13px;
  font-weight: 700;
  color: #143e3b;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.sticky-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.sticky-field {
  flex: 1 1 200px;
}
.sticky-field label {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: #1a4d42;
}

/* Filter Controls */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  max-width: none;
  background: #fdfdfd;
  padding: 16px;
  margin: 16px 0 24px 0;
}
.filter-bar input {
  flex: 2 1 200px;
}
.filter-bar select {
  flex: 1 1 150px;
}
.filter-bar button {
  margin-top: 0;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e2ece8;
  color: #164c40;
}
.badge-archived {
  background: #e2e8f0;
  color: #64748b;
}
.badge-active {
  background: #dcfce7;
  color: #15803d;
}
.badge-inactive {
  background: #fee2e2;
  color: #991b1b;
}

/* Cards & Actions */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.card-header h3, .card-header h4 {
  margin: 0;
  font-size: 18px;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Detail Views */
.detail-top-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.lifecycle-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px 0;
  border-bottom: 1px solid #dae4df;
}
.responsibilities-box {
  background: white;
  border: 1px solid #d7e3de;
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
}
.resp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 12px;
  border-bottom: 1px solid #f0f4f2;
}
.resp-row:last-child {
  border-bottom: none;
}

/* Handover Drilldown Box */
.handover-box {
  background: #ebf5f1;
  border: 1px solid #b7dbce;
  border-radius: 10px;
  padding: 18px;
  margin: 16px 0 24px 0;
}
.handover-box h3 {
  margin-top: 0;
  color: #143e3b;
}
.handover-box ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}
.handover-box li {
  padding: 4px 0;
  font-weight: 500;
}

/* Operational Summary Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.metric-card {
  background: white;
  border: 1px solid #d7e3de;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.metric-num {
  font-size: 32px;
  font-weight: 800;
  color: #143e3b;
  line-height: 1.2;
}
.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: #5b746c;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tabs & Pagination */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.pagination-row {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

/* Button Variants */
.button-sm {
  padding: 6px 12px;
  font-size: 13px;
}
.button-secondary {
  background: #506f66;
}
.button-secondary:hover {
  background: #39524b;
}
.button-danger {
  background: #b91c1c;
}
.button-danger:hover {
  background: #991b1b;
}
.button-active {
  background: #143e3b;
  color: white;
  border: 1px solid #143e3b;
}

@media (max-width: 480px) {
  .login { margin: 24px 12px; padding: 24px; }
  header { padding: 20px 16px; }
  main { padding: 0 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .sticky-assign-bar { position: static; }
  .filter-bar { padding: 12px; }
  .resp-row { flex-direction: column; align-items: flex-start; }
}
