:root{
  --bg-0: #f7efe5;
  --bg-1: #e7d8c5;
  --bg-2: #1e1711;
  --surface: rgba(255, 250, 244, 0.88);
  --surface-2: rgba(245, 236, 224, 0.96);
  --surface-soft: #fcf7f0;
  --surface-soft-2: #f2e8db;
  --surface-deep: #261d16;
  --surface-danger: #fff2ed;
  --text: #211913;
  --text-soft: #5b4d43;
  --text-inverse: #f7efe5;
  --line: #dccab7;
  --line-strong: #c6b198;
  --accent: #8d5f28;
  --accent-2: #b67a32;
  --accent-deep: #573615;
  --accent-soft: #f0e1cb;
  --danger: #a34231;
  --danger-soft: #f9e3dd;
  --warn: #93661f;
  --warn-soft: #f8eccb;
  --ok: #2f6b4d;
  --ok-soft: #e6f0ea;
  --radius: 18px;
  --radius-sm: 12px;
  --gap: 18px;
  --shadow: 0 28px 60px rgba(32, 22, 14, 0.12);
  --shadow-soft: 0 14px 30px rgba(43, 28, 17, 0.08);
  --font-ui: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-title: "Iowan Old Style", "Baskerville", "Palatino Linotype", serif;
}

*{ box-sizing: border-box; }

html{
  color-scheme: light;
}

body{
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at 0% 0%, rgba(255,255,255,0.8) 0%, transparent 32%),
    radial-gradient(circle at 100% 10%, rgba(182,122,50,0.15) 0%, transparent 30%),
    linear-gradient(180deg, #f4ebe0 0%, var(--bg-0) 34%, #f8f2ea 100%);
  min-height: 100vh;
  position: relative;
}

body::before,
body::after{
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  pointer-events: none;
  filter: blur(20px);
  opacity: 0.55;
}

body::before{
  width: 360px;
  height: 360px;
  top: 82px;
  right: -110px;
  background: radial-gradient(circle, rgba(182,122,50,0.18) 0%, rgba(182,122,50,0) 72%);
}

body::after{
  width: 420px;
  height: 420px;
  left: -160px;
  bottom: 14%;
  background: radial-gradient(circle, rgba(69,45,26,0.12) 0%, rgba(69,45,26,0) 74%);
}

.site-header{
  padding: 18px 22px;
  border-bottom: 1px solid rgba(198,177,152,0.26);
  background:
    linear-gradient(135deg, rgba(34,26,20,0.96), rgba(64,44,28,0.9)),
    radial-gradient(circle at top right, rgba(182,122,50,0.18), transparent 38%);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 12px 30px rgba(20, 14, 9, 0.18);
}

.brand-block{
  max-width: 720px;
}

.brand-kicker{
  margin: 0 0 6px;
  color: rgba(247,239,229,0.78);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

h1{
  margin: 0 0 4px;
  font-family: var(--font-title);
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--text-inverse);
}

.brand-subtitle{
  margin: 0;
  color: rgba(247,239,229,0.72);
  font-size: 13px;
  line-height: 1.5;
}

.header-meta{
  align-items: center;
}

h2, h3, h4, h5{
  margin: 0 0 10px;
  color: #241b14;
}

h2{
  font-family: var(--font-title);
  font-size: 1.8rem;
  letter-spacing: 0.01em;
}

h3{
  font-size: 1.1rem;
}

p{ margin: 0; }

.grid{
  display: block;
  padding: var(--gap);
  max-width: 1460px;
  margin: 0 auto;
}

.panel{
  background: var(--surface);
  border: 1px solid rgba(220,202,183,0.9);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  animation: panel-in 220ms ease-out;
}

.workspace-shell{
  background:
    linear-gradient(180deg, rgba(255,251,246,0.88), rgba(248,241,231,0.92)),
    radial-gradient(circle at top right, rgba(182,122,50,0.06), transparent 34%);
  box-shadow: var(--shadow);
}

.panel-login{
  background:
    linear-gradient(180deg, rgba(255,251,246,0.96), rgba(249,241,231,0.96)),
    radial-gradient(circle at top right, rgba(182,122,50,0.08), transparent 34%);
}

.panel.wide{
  max-width: 600px;
  margin: 34px auto;
}

.panel-intro,
.workspace-hero{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.workspace-hero-compact{
  margin-bottom: 12px;
}

.admin-shell{
  background:
    linear-gradient(180deg, rgba(255,251,246,0.92), rgba(244,235,222,0.92)),
    radial-gradient(circle at top right, rgba(141,95,40,0.07), transparent 32%);
}

.tone-soft{
  background:
    linear-gradient(180deg, rgba(252,247,240,0.95), rgba(241,232,219,0.95));
}

.nested-panel{
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), var(--shadow-soft);
}

.panel-danger{
  border-color: #e4bfb7;
  background:
    linear-gradient(180deg, rgba(255,250,248,0.95), rgba(255,241,236,0.98));
}

.eyebrow{
  display: inline-block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
}

.hint{
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.62;
}

.hint.subtle{
  color: #6a5a4f;
}

.credential-card{
  border: 1px dashed rgba(198,177,152,0.9);
  background: rgba(252,247,240,0.9);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
}

.status-card{
  min-width: 260px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: #2c221c;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.inline-status{
  margin-top: 14px;
}

.status-neutral{
  background: rgba(255,251,246,0.82);
  border-color: var(--line);
}

.status-ok{
  background: var(--ok-soft);
  border-color: #c5ddd0;
}

.status-warn{
  background: var(--warn-soft);
  border-color: #e7d39c;
}

.status-danger{
  background: var(--danger-soft);
  border-color: #e3bbb3;
}

.row{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.row-actions{
  margin-top: 14px;
}

.grid2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-zone{
  margin-bottom: 14px;
}

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

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

.form-grid.two-col{
  grid-template-columns: 1fr 1fr;
}

.form-grid.three-col{
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.workload-controls{
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin-bottom: 12px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span{
  font-size: 12px;
  font-weight: 700;
  color: #35291f;
}

.field-inline{
  max-width: 240px;
  margin-bottom: 10px;
}

.span-2{
  grid-column: span 2;
}

.action-field{
  justify-content: end;
}

input, select, textarea{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(214,194,172,0.95);
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder{
  color: #8a7868;
}

input:focus, select:focus, textarea:focus{
  outline: none;
  border-color: rgba(141,95,40,0.95);
  box-shadow: 0 0 0 4px rgba(182,122,50,0.14);
  transform: translateY(-1px);
}

input:disabled, textarea:disabled, select:disabled{
  background: rgba(242,233,220,0.76);
  color: #8f7c69;
  cursor: not-allowed;
}

textarea{
  min-height: 104px;
  resize: vertical;
}

button{
  padding: 10px 13px;
  border: 1px solid #70461a;
  border-radius: 12px;
  color: #fffaf5;
  background:
    linear-gradient(180deg, #ba7d34, #8b5c28);
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(111, 70, 23, 0.18);
}

button:hover{
  filter: brightness(1.03);
  transform: translateY(-1px);
}

button:active{
  transform: translateY(1px);
}

button:disabled{
  cursor: not-allowed;
  filter: grayscale(0.15);
  opacity: 0.66;
  transform: none;
  box-shadow: none;
}

.btn-secondary{
  color: #3d2f22;
  border-color: rgba(198,177,152,0.96);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,237,228,0.98));
  box-shadow: 0 8px 16px rgba(60, 44, 27, 0.08);
}

.btn-danger{
  border-color: #8f3125;
  background: linear-gradient(180deg, #c75444, #9c3a2e);
  box-shadow: 0 8px 16px rgba(115, 32, 24, 0.16);
}

.button-stack{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.button-stack.compact{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-list{
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.meta{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 0;
  color: var(--text-soft);
  font-size: 11px;
}

.meta-box{
  background: rgba(255,255,255,0.52);
  border: 1px dashed rgba(198,177,152,0.92);
  border-radius: 14px;
  padding: 11px 12px;
  margin-top: 12px;
}

.msg{
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

code{
  padding: 0.14rem 0.38rem;
  border-radius: 8px;
  background: rgba(51,35,21,0.08);
  color: #402d1d;
  font-size: 0.92em;
}

pre{
  white-space: pre-wrap;
  background: rgba(249,243,235,0.95);
  border: 1px solid rgba(214,194,172,0.9);
  padding: 12px;
  border-radius: 14px;
  min-height: 180px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}

.hidden{ display: none; }

.pill{
  padding: 7px 11px;
  border: 1px solid rgba(219,196,169,0.42);
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255,248,242,0.08);
  color: var(--text-inverse);
}

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

.stat-card{
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,238,226,0.96));
  border: 1px solid rgba(214,194,172,0.9);
  box-shadow: var(--shadow-soft);
}

.stat-label{
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6d5a49;
  font-weight: 700;
}

.stat-value{
  font-family: var(--font-title);
  font-size: 2rem;
  line-height: 1;
  color: #2d2017;
}

.message-guidance{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.mini-note{
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(246,236,223,0.9);
  border: 1px solid rgba(217,197,173,0.9);
}

.mini-note strong{
  font-size: 12px;
  color: #35271d;
}

.mini-note span{
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}

.message-builder-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.builder-card{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(252,247,240,0.92);
  border: 1px solid rgba(214,194,172,0.88);
}

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

.builder-row{
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(214,194,172,0.84);
}

.builder-row-head{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.builder-row-head strong{
  color: #302218;
  font-size: 13px;
}

.shared-item.note-item{
  border-left: 4px solid rgba(142,104,49,0.9);
}

.shared-item.url-item{
  border-left: 4px solid rgba(77,116,149,0.9);
}

.shared-item.file-item{
  border-left: 4px solid rgba(147,77,63,0.9);
}

.message-detail-panel{
  min-height: 100%;
}

.empty-state{
  min-height: 280px;
  border-radius: 16px;
  border: 1px dashed rgba(198,177,152,0.95);
  background: rgba(251,246,239,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: #6a5b4f;
  line-height: 1.7;
}

.detail-stack{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-section{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-heading{
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #715f4d;
}

.detail-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-row{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(251,246,239,0.9);
  border: 1px solid rgba(214,194,172,0.82);
}

.detail-row span{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #786553;
  font-weight: 700;
}

.detail-row strong{
  font-size: 13px;
  color: #2c1f16;
}

.detail-body{
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(214,194,172,0.84);
  color: #35291f;
  line-height: 1.65;
}

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

.attachment-item{
  padding: 12px;
  border-radius: 14px;
  background: rgba(250,244,236,0.9);
  border: 1px solid rgba(214,194,172,0.85);
}

.attachment-item strong{
  display: block;
  margin-bottom: 6px;
  color: #302218;
}

.attachment-meta{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.attachment-meta .detail-row{
  padding: 10px 11px;
}

.attachment-item .meta{
  margin-top: 8px;
}

.timeline{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item{
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
}

.timeline-dot{
  width: 12px;
  height: 12px;
  margin-top: 7px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.95);
  box-shadow: 0 0 0 1px rgba(198,177,152,0.85);
}

.timeline-dot.tone-ok{ background: var(--ok); }
.timeline-dot.tone-warn{ background: var(--warn); }
.timeline-dot.tone-danger{ background: var(--danger); }
.timeline-dot.tone-neutral{ background: var(--accent); }

.timeline-content{
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(251,246,239,0.88);
  border: 1px solid rgba(214,194,172,0.82);
}

.timeline-title{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 6px;
}

.timeline-title strong{
  color: #302218;
  font-size: 13px;
}

.timeline-meta{
  color: #7a6655;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-note{
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.table-actions{
  display: flex;
  gap: 6px;
  align-items: center;
}

.table-actions button{
  min-width: 72px;
}

.attachment-fields-disabled{
  opacity: 0.62;
}

table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

thead, tbody, tr{
  width: 100%;
}

th, td{
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.34;
}

thead th{
  color: #594535;
  font-weight: 800;
  background: transparent;
  border-bottom: 1px solid rgba(201,181,156,0.64);
}

tbody tr{
  background: rgba(255,255,255,0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

tbody td{
  border-top: 1px solid rgba(220,202,183,0.72);
  border-bottom: 1px solid rgba(220,202,183,0.72);
}

tbody td:first-child{
  border-left: 1px solid rgba(220,202,183,0.72);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

tbody td:last-child{
  border-right: 1px solid rgba(220,202,183,0.72);
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.badge{
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.badge.green{ background:#ebf9eb; color:#1e5c24; }
.badge.amber{ background:#fff6e2; color:#7a5410; }
.badge.red{ background:#fdeceb; color:#7d2418; }

.slider{ width: 110px; }
.plan-user{ margin: 8px 0; }

.plan-board{
  min-height: 70px;
}

.plan-block{
  display: inline-block;
  margin: 3px;
  padding: 5px 7px;
  border: 1px solid rgba(214,194,172,0.9);
  border-radius: 10px;
  font-size: 12px;
  background: rgba(252,247,240,0.94);
}

.danger-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.kanban{
  display: flex;
  gap: 10px;
  overflow: auto;
  padding: 4px;
}

.kanban-col{
  min-width: 300px;
  border: 1px solid rgba(214,194,172,0.85);
  border-radius: 16px;
  background: rgba(250,243,233,0.9);
  padding: 8px;
}

.kanban-col h5{
  margin: 6px 2px 12px;
  font-size: 13px;
}

.card{
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(220,202,183,0.84);
  border-radius: 14px;
  padding: 9px;
  margin-bottom: 8px;
  box-shadow: 0 6px 14px rgba(36, 24, 14, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.card:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(36, 24, 14, 0.09);
}

.card .title{
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 7px;
}

.card .meta2{
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card select{
  width: 100%;
  margin-top: 10px;
}

.pill2{
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid rgba(214,194,172,0.86);
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255,255,255,0.86);
}

.pill2.green{ background:#ebf9eb; }
.pill2.amber{ background:#fff6e2; }
.pill2.red{ background:#fdeceb; }

#superadminPanel{
  border-color: rgba(198,177,152,0.88);
  background:
    linear-gradient(180deg, rgba(255,251,246,0.95), rgba(245,236,223,0.96)),
    radial-gradient(circle at top right, rgba(163,66,49,0.05), transparent 26%);
}

#inbox th, #inbox td,
#routeTbl th, #routeTbl td,
#teamTasks th, #teamTasks td,
#ap th, #ap td,
#mine th, #mine td,
#msgInbox th, #msgInbox td,
#msgSent th, #msgSent td{
  font-size: 11px;
}

#inbox button, #routeTbl button, #teamTasks button, #ap button, #mine button, #msgInbox button, #msgSent button{
  padding: 7px 9px;
  font-size: 11px;
  border-radius: 10px;
}

#routeTbl select, #teamTasks select, #mine select, #msgInbox select, #msgSent select{
  padding: 6px 8px;
  font-size: 11px;
}

.kanban-col.dragover{ outline: 2px dashed #b68448; }
.card.dragging{ opacity: 0.62; }

.modal{
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal.hidden{
  display: none;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(23, 17, 13, 0.56);
  backdrop-filter: blur(4px);
}

.modal-dialog{
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 20px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,251,246,0.98), rgba(247,239,229,0.98));
  border: 1px solid rgba(198,177,152,0.9);
  box-shadow: 0 30px 80px rgba(24, 17, 11, 0.24);
}

.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

body.modal-open{
  overflow: hidden;
}

.toast-stack{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast{
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid rgba(214,194,172,0.9);
  background: rgba(255,251,246,0.97);
  box-shadow: 0 18px 34px rgba(31, 22, 15, 0.16);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-tone-ok{
  border-color: #bdd7c8;
  background: rgba(236,246,240,0.98);
}

.toast-tone-warn{
  border-color: #e4cf93;
  background: rgba(252,244,214,0.98);
}

.toast-tone-danger{
  border-color: #e2bab2;
  background: rgba(252,236,233,0.98);
}

.toast-head{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.toast-title{
  font-size: 13px;
  font-weight: 800;
  color: #2f2219;
}

.toast-close{
  width: auto;
  min-width: 0;
  padding: 6px 9px;
}

.toast-body{
  color: #584a3f;
  font-size: 12px;
  line-height: 1.58;
  word-break: break-word;
}

.toast-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

@media (max-width: 1180px){
  .stat-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.workload-controls{
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 980px){
  .grid2,
  .form-grid.two-col,
  .form-grid.three-col,
  .message-guidance,
  .message-builder-grid,
  .detail-grid,
  .attachment-meta{
    grid-template-columns: 1fr;
  }

  .span-2{
    grid-column: span 1;
  }

  .panel.wide{
    margin: 22px 8px;
  }

  .site-header{
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .panel-intro,
  .workspace-hero{
    flex-direction: column;
  }

  .status-card{
    min-width: 0;
    width: 100%;
  }

  .button-stack.compact{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px){
  :root{
    --gap: 12px;
    --radius: 16px;
  }

  .grid{ padding: var(--gap); }
  .panel{ padding: 12px; }
  h1{ font-size: 1.6rem; }
  h2{ font-size: 1.45rem; }
  .kanban-col{ min-width: 88vw; }
  button{ width: 100%; }
  .row > label,
  .field-inline{
    width: 100%;
    max-width: none;
  }
  .danger-grid,
  .form-grid.workload-controls,
  .stat-grid{
    grid-template-columns: 1fr;
  }
  .table-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .modal-actions{
    flex-direction: column;
  }
  .toast-stack{
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
  .timeline-title{
    flex-direction: column;
    align-items: flex-start;
  }
}
