:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --muted: #72807a;
  --text: #18211e;
  --line: #dfe4e1;
  --accent: #2f6f5f;
  --accent-soft: #e7f1ee;
  --warn: #d29d3f;
  --danger: #bf5f4c;
  --focus: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #eef5ef 0%, #f6f7f5 46%, #f2f4f2 100%);
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 32px 60px rgba(16, 24, 20, 0.12);
  animation: rise 420ms ease-out;
}

.auth-card {
  padding: 42px;
}

.auth-brand {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: #41514b;
}

.auth-card h1 {
  margin: 12px 0 8px;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 34px;
}

.auth-card p {
  margin: 0 0 22px;
  color: #5e6c67;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  font-size: 13px;
  color: #3f4e48;
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  border: 1px solid #ccd5d1;
  background: #fefefe;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus {
  border-color: #4a7a6d;
  box-shadow: 0 0 0 3px rgba(74, 122, 109, 0.18);
}

.auth-form button {
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #f7f8f7;
  background: linear-gradient(135deg, #335f54 0%, #1f4540 100%);
  cursor: pointer;
}

.auth-error {
  border: 1px solid #f2ccc4;
  background: #fff1ee;
  color: #8f3c2f;
  font-size: 13px;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.auth-panel {
  background: linear-gradient(160deg, #1b2f2a 0%, #243c35 40%, #2b4a42 100%);
  color: #ebf2ef;
  padding: 42px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.auth-panel .panel-chip {
  display: inline-flex;
  border: 1px solid rgba(245, 252, 248, 0.36);
  background: rgba(245, 252, 248, 0.08);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-panel h2 {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  line-height: 1.2;
}

.auth-panel ul {
  margin: 0;
  padding-left: 18px;
  color: #d4e4de;
  display: grid;
  gap: 10px;
}

.dashboard-body {
  min-height: 100vh;
  padding: 12px;
}

.topbar {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 8px 18px rgba(18, 34, 28, 0.06);
}

.brand {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 14px;
  letter-spacing: 0.09em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  border: 1px solid #d4ddda;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  color: #576760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 10px;
}

.metrics div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}

.metrics strong {
  display: block;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 20px;
}

.metrics span {
  font-size: 11px;
  color: var(--muted);
}

button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: #394a44;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.grid-layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 12px;
}

.agents-panel,
.queue-panel,
.feed-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.93);
  border-radius: 18px;
  padding: 12px;
  min-height: 72vh;
}

.panel-title {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #4a5a54;
  margin-bottom: 10px;
}

.agent-item {
  border: 1px solid #e3e8e5;
  border-radius: 11px;
  padding: 10px;
  margin-bottom: 8px;
  display: grid;
  gap: 6px;
}

.agent-item h4 {
  margin: 0;
  font-size: 14px;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  text-transform: capitalize;
}

.agent-item p {
  margin: 0;
  font-size: 12px;
  color: #5f6d67;
}

.badge {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid transparent;
}

.badge-online {
  border-color: #9ed6c4;
  color: #1f6f57;
  background: #ecfaf5;
}

.badge-focus {
  border-color: #9ac6ea;
  color: #0f5a90;
  background: #edf6ff;
}

.badge-blocked {
  border-color: #f0c5bd;
  color: #8d3a2c;
  background: #fff0ec;
}

.badge-idle {
  border-color: #d6ddd8;
  color: #5f6d67;
  background: #f7f9f8;
}

.queue-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

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

.panel-header h2 {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
}

.panel-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.user-pill {
  border: 1px solid #d5ddd9;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: #4f6059;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.queue-col {
  border: 1px solid #e3e8e5;
  border-radius: 12px;
  background: #fdfefe;
  padding: 10px;
  min-height: 320px;
}

.queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.queue-head h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4b5c56;
}

.queue-head span {
  border-radius: 999px;
  border: 1px solid #d6ddd8;
  font-size: 11px;
  padding: 2px 8px;
  color: #5f6d67;
}

.task-card {
  border: 1px solid #e1e7e4;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 9px;
  margin-bottom: 8px;
  background: #fff;
  animation: rise 320ms ease-out;
}

.task-card header,
.task-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.task-card h4 {
  margin: 8px 0 6px;
  font-size: 13px;
  line-height: 1.3;
}

.task-card p,
.task-card footer {
  margin: 0;
  font-size: 11px;
  color: #607069;
}

.task-tag {
  font-size: 10px;
  color: #1f5648;
  border: 1px solid #b9d2c9;
  background: #edf7f3;
  border-radius: 999px;
  padding: 2px 7px;
}

.task-owner {
  font-size: 11px;
  color: #65756e;
}

.task-empty {
  border: 1px dashed #cad4cf;
  border-radius: 10px;
  padding: 10px;
  color: #687a73;
  font-size: 12px;
  text-align: center;
}

.reports h3 {
  margin: 0 0 8px;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 8px;
}

.report-item {
  border: 1px solid #e1e7e4;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.report-item h5 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #34453f;
}

.report-item p {
  margin: 0 0 5px;
  font-size: 11px;
  color: #62736d;
}

.feed-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-form {
  display: grid;
  gap: 8px;
}

.feed-form input,
.feed-form textarea {
  border: 1px solid #d2dbd7;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  outline: none;
}

.feed-form input:focus,
.feed-form textarea:focus {
  border-color: #5d887b;
  box-shadow: 0 0 0 2px rgba(73, 118, 104, 0.15);
}

.feed-form button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  color: #f7faf8;
  font-weight: 600;
  background: linear-gradient(145deg, #416f61 0%, #284840 100%);
  cursor: pointer;
}

.feed-list {
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.feed-item {
  border: 1px solid #e1e7e4;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.feed-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.feed-author {
  font-size: 12px;
  font-weight: 600;
  color: #2f4941;
}

.feed-kind {
  font-size: 11px;
  color: #5f6f69;
  border: 1px solid #d6ddd9;
  border-radius: 999px;
  padding: 2px 7px;
}

.feed-item p {
  margin: 7px 0;
  font-size: 12px;
  color: #42544d;
  line-height: 1.4;
}

.feed-item footer {
  font-size: 11px;
  color: #72817b;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .agents-panel,
  .queue-panel,
  .feed-panel {
    min-height: auto;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(70px, 1fr));
  }

  .topbar {
    grid-template-columns: 1fr;
  }
}

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

  .auth-panel {
    min-height: 220px;
  }
}

.banner {
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px solid transparent;
  font-size: 13px;
}

.banner.notice {
  border-color: #b8d5ca;
  background: #eef8f3;
  color: #225744;
}

.banner.error {
  border-color: #f0c9bf;
  background: #fff2ef;
  color: #8d3a2c;
}

.feed-status {
  font-size: 10px;
  border: 1px solid #d5ddd9;
  border-radius: 999px;
  padding: 2px 7px;
  margin-left: 6px;
  color: #5a6a63;
}

.admin-users {
  margin-top: 6px;
  border: 1px solid #e3e8e5;
  border-radius: 12px;
  padding: 10px;
  background: #fbfcfc;
}

.admin-users h3 {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 15px;
}

.admin-users > p {
  margin: 4px 0 10px;
  color: #65736d;
  font-size: 12px;
}

.create-user-form {
  display: grid;
  grid-template-columns: repeat(8, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.create-user-form input,
.create-user-form select,
.create-user-form button {
  border-radius: 9px;
  border: 1px solid #ced8d4;
  padding: 8px 9px;
  font-size: 12px;
}

.create-user-form button {
  cursor: pointer;
  color: #f6fbf8;
  border: 0;
  background: linear-gradient(145deg, #38695b 0%, #24453d 100%);
  font-weight: 600;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-row {
  border: 1px solid #dfe5e2;
  border-radius: 10px;
  padding: 9px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.user-row-main h5 {
  margin: 0;
  font-size: 13px;
}

.user-row-main p {
  margin: 3px 0;
  font-size: 12px;
  color: #5d6c66;
}

.user-row-main small {
  color: #7a8782;
  font-size: 11px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 8px;
}

.inline-form input,
.inline-form select,
.inline-form button {
  border: 1px solid #ced8d4;
  border-radius: 9px;
  padding: 7px 8px;
  font-size: 12px;
}

.inline-form button {
  cursor: pointer;
  background: #f3f7f5;
  color: #2f4540;
}

.active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5f6e68;
}

.self-tag {
  font-size: 10px;
  color: #2b6352;
  border: 1px solid #b8d5ca;
  border-radius: 999px;
  padding: 1px 6px;
}

@media (max-width: 1180px) {
  .create-user-form,
  .inline-form {
    grid-template-columns: 1fr;
  }
}

.create-task-wrap {
  margin-top: 10px;
}

.scope-bar {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.93);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.scope-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scope-chip {
  text-decoration: none;
  border: 1px solid #cfd9d5;
  background: #fff;
  color: #3f534c;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.scope-chip.active {
  border-color: #8fb7ac;
  background: #eaf5f1;
  color: #1f5a49;
}

.squad-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
}

.summary-item {
  border: 1px solid #dfe6e2;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 3px;
}

.summary-item strong {
  font-size: 12px;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
}

.summary-item small {
  font-size: 11px;
  color: #5f6f69;
}

.create-task-form {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.93);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1.2fr 80px 120px 170px 220px 1fr auto;
  gap: 8px;
}

.create-task-form input,
.create-task-form select,
.create-task-form button,
.task-inline-form select,
.task-inline-form button,
.stack-form input,
.stack-form select,
.stack-form textarea,
.stack-form button,
.ntf-item button {
  border: 1px solid #ced8d4;
  border-radius: 9px;
  padding: 8px 9px;
  font-size: 12px;
}

.create-task-form button,
.task-inline-form button,
.stack-form button,
.ntf-item button {
  cursor: pointer;
  color: #f6fbf8;
  border: 0;
  background: linear-gradient(145deg, #38695b 0%, #24453d 100%);
  font-weight: 600;
}

.task-inline-form {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.task-link {
  font-size: 11px;
  color: #3f6760;
  text-decoration: none;
}

.squad-tag {
  display: inline-flex;
  border: 1px solid #d0dcd7;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  color: #4a5c56;
  background: #f6faf8;
}

.meta-line {
  display: block;
  margin-top: 4px;
}

.st-inbox {
  border-left-color: #80908a;
}

.st-assigned {
  border-left-color: #4d7c70;
}

.st-progress {
  border-left-color: #2f6f5f;
}

.st-review {
  border-left-color: #8b6b3f;
}

.st-done {
  border-left-color: #2f8f4e;
}

.st-blocked {
  border-left-color: #b65440;
}

.task-detail {
  margin-top: 10px;
  border: 1px solid #dfe6e2;
  border-radius: 12px;
  background: #fcfdfc;
  padding: 10px;
}

.task-detail h3 {
  margin: 0 0 6px;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
}

.task-detail > p {
  margin: 2px 0;
  font-size: 12px;
  color: #566862;
}

.stack-form {
  margin-top: 8px;
  display: grid;
  gap: 7px;
}

.thread-list,
.docs-list,
.notifications-list,
.handoff-list,
.delivery-list,
.attachments-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.thread-item,
.doc-item,
.ntf-item,
.handoff-item,
.delivery-item,
.attachment-item {
  border: 1px solid #e0e6e3;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.thread-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #5e706a;
}

.thread-item p,
.doc-item p,
.ntf-item p,
.handoff-item p,
.delivery-item p,
.attachment-item p {
  margin: 6px 0;
  font-size: 12px;
  color: #42544d;
}

.doc-item h5 {
  margin: 0;
  font-size: 12px;
  color: #2f4440;
}

.doc-item small,
.ntf-item small,
.handoff-item small,
.delivery-item small,
.attachment-item small {
  font-size: 11px;
  color: #6d7d77;
}

.handoff-item header,
.delivery-item header,
.attachment-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #5e706a;
}

.attachment-link {
  margin-top: 6px;
  display: inline-block;
  font-size: 12px;
  color: #2f6f5f;
  text-decoration: none;
}

.attachment-link:hover {
  text-decoration: underline;
}

.delivery-pending,
.delivery-retry {
  border-color: #c7d8d2;
  background: #f3f8f6;
}

.delivery-delivered {
  border-color: #b9d9cb;
  background: #eef9f4;
}

.delivery-failed {
  border-color: #e7c2ba;
  background: #fff3f1;
}

.doc-item pre {
  white-space: pre-wrap;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-size: 11px;
  color: #5c6b65;
  margin: 6px 0 0;
}

.ntf-item.ntf-unread {
  border-color: #bdd8cf;
  background: #f2faf7;
}

.ntf-item.ntf-read {
  opacity: 0.85;
}

.subscribers {
  margin-top: 10px;
  font-size: 12px;
  color: #5f6e68;
}

.agent-config-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.agent-config-row {
  border: 1px solid #dfe5e2;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.agent-config-row strong {
  display: block;
  font-size: 12px;
}

.agent-config-row small {
  font-size: 11px;
  color: #6d7d77;
}

.agent-config-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.agent-config-form input,
.agent-config-form select,
.agent-config-form button {
  border: 1px solid #ced8d4;
  border-radius: 9px;
  padding: 7px 8px;
  font-size: 12px;
}

.agent-config-form button {
  cursor: pointer;
  color: #f6fbf8;
  border: 0;
  background: linear-gradient(145deg, #38695b 0%, #24453d 100%);
  font-weight: 600;
}

.system-config-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
}

.system-config-form label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: #586861;
}

.system-config-form input,
.system-config-form button {
  border: 1px solid #ced8d4;
  border-radius: 9px;
  padding: 8px 9px;
  font-size: 12px;
}

.system-config-form button {
  cursor: pointer;
  color: #f6fbf8;
  border: 0;
  background: linear-gradient(145deg, #38695b 0%, #24453d 100%);
  font-weight: 600;
}

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

  .create-task-form {
    grid-template-columns: 1fr;
  }

  .task-inline-form {
    grid-template-columns: 1fr;
  }

  .system-config-form {
    grid-template-columns: 1fr;
  }
}

.system-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.system-actions form button {
  border: 1px solid #ced8d4;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #f6fbf8;
  border: 0;
  background: linear-gradient(145deg, #536f66 0%, #2f4b43 100%);
}

@media (max-width: 1180px) {
  .system-actions {
    flex-direction: column;
  }
}
