: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;
  }
}

/* Cliviti control system: engineering-led visual language */
:root{
  --bg-0: #f4f7f9;
  --bg-1: #e8eef2;
  --bg-2: #101820;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-soft: #f7f9fb;
  --surface-soft-2: #edf2f6;
  --surface-deep: #101820;
  --surface-danger: #fff1f1;
  --text: #161616;
  --text-soft: #596775;
  --text-inverse: #f3f8fb;
  --line: #d7e0e7;
  --line-strong: #a8b6c2;
  --accent: #0f62fe;
  --accent-2: #2d70f7;
  --accent-deep: #0530ad;
  --accent-soft: #edf5ff;
  --danger: #da1e28;
  --danger-soft: #fff1f1;
  --warn: #8a5b00;
  --warn-soft: #fff8e1;
  --ok: #198754;
  --ok-soft: #e8f5ee;
  --radius: 0;
  --radius-sm: 0;
  --gap: 24px;
  --shadow: 0 24px 64px rgba(16, 24, 32, 0.12);
  --shadow-soft: 0 10px 28px rgba(16, 24, 32, 0.06);
  --font-ui: "IBM Plex Sans", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-title: "IBM Plex Sans", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

html{
  background: var(--bg-0);
}

body{
  color: var(--text);
  background-color: var(--bg-0);
  background-image:
    linear-gradient(rgba(16, 24, 32, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 32, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0, #f4f7f9 520px, #eef3f6 100%);
  background-size: 64px 64px, 64px 64px, 100% 100%;
  font-family: var(--font-ui);
}

body::before{
  width: 420px;
  height: 420px;
  top: 74px;
  right: -210px;
  background: linear-gradient(135deg, rgba(15, 98, 254, 0.12), rgba(15, 98, 254, 0));
  filter: none;
  opacity: 1;
}

body::after{
  display: none;
}

.site-header{
  min-height: 76px;
  padding: 0 32px;
  border-bottom: 1px solid #2b3b48;
  background: #101820;
  box-shadow: none;
  backdrop-filter: none;
  align-items: stretch;
}

.brand-block{
  max-width: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 28px;
  border-right: 1px solid #2b3b48;
}

.brand-mark{
  width: 48px;
  height: 48px;
  border: 1px solid #526675;
  display: grid;
  grid-template-columns: 1fr;
  place-content: center;
  text-align: center;
  color: #ffffff;
  line-height: 1;
  background: linear-gradient(145deg, rgba(15, 98, 254, 0.24), rgba(15, 98, 254, 0));
}

.brand-mark span{
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-mark small{
  margin-top: 4px;
  color: #6ea0ff;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.brand-copy{
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-kicker{
  margin: 0 0 2px;
  color: #91a5b5;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.17em;
  font-weight: 600;
}

.brand-title-row{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

h1{
  margin: 0;
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.brand-edition{
  color: #6ea0ff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.brand-subtitle{
  margin-top: 2px;
  color: #c2ced7;
  font-size: 10px;
  line-height: 1.2;
}

.header-rail{
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 28px;
  color: #c7d1d9;
  font-size: 12px;
}

.header-rail span{
  position: relative;
}

.header-rail span + span::before{
  content: "/";
  position: absolute;
  left: -18px;
  color: #526675;
}

.header-meta{
  margin-left: auto;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}

.site-header .pill{
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid #3a4d5c;
  border-right: 0;
  border-radius: 0;
  color: #e8eef2;
  background: transparent;
}

.site-header #logout{
  min-height: 42px;
  padding-inline: 20px;
  border-color: var(--accent);
  background: var(--accent);
}

.site-header .hidden{
  display: none;
}

.grid{
  max-width: 1560px;
  padding: 32px;
}

h2, h3, h4, h5{
  color: var(--text);
}

h2{
  font-family: var(--font-title);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

h3{
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.panel{
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
  animation: control-reveal 360ms cubic-bezier(.2,.7,.2,1) both;
}

.panel.wide{
  max-width: 1240px;
  margin: 40px auto;
}

.workspace-shell,
.admin-shell,
#superadminPanel{
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-shell > .panel,
.workspace-shell > .grid2,
.workspace-shell > .stat-grid,
.workspace-shell > .message-guidance,
.workspace-shell > .message-builder-grid{
  margin-left: 0;
  margin-right: 0;
}

.workspace-hero{
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.7fr);
  gap: 0;
  align-items: stretch;
  margin-bottom: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  background: #ffffff;
}

.workspace-hero > div:first-child{
  padding: 30px 32px;
}

.workspace-hero h2{
  max-width: 760px;
  margin-bottom: 14px;
}

.workspace-hero .hint{
  max-width: 720px;
  font-size: 14px;
}

.workspace-hero .status-card{
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 26px;
  border: 0;
  border-left: 1px solid #7fa8fa;
  background: linear-gradient(145deg, #0636a8, #0f62fe);
  color: #ffffff;
  display: flex;
  align-items: center;
  font-size: 13px;
  line-height: 1.6;
}

.workspace-hero .status-danger{
  background: linear-gradient(145deg, #8e111a, #da1e28);
  border-left-color: #ef7f86;
}

.workspace-hero .status-warn{
  background: linear-gradient(145deg, #6b4500, #a56f00);
  border-left-color: #e9c66c;
}

.workspace-hero .status-ok{
  background: linear-gradient(145deg, #0d613b, #198754);
  border-left-color: #65b78f;
}

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

.panel-intro{
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow{
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

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

.tone-soft,
.nested-panel{
  border-color: var(--line);
  background: #f7f9fb;
  box-shadow: none;
}

.panel-danger{
  border-color: #f0a3a8;
  border-top: 4px solid var(--danger);
  background: #fff7f7;
}

.grid2{
  gap: 20px;
}

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

.panel-login{
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: var(--shadow);
}

.login-layout{
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(380px, 0.7fr);
  background: #ffffff;
}

.login-manifesto{
  position: relative;
  overflow: hidden;
  padding: 52px;
  border: 1px solid var(--line);
  background-color: #ffffff;
  background-image:
    linear-gradient(rgba(16, 24, 32, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 32, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  display: flex;
  flex-direction: column;
}

.login-manifesto::after{
  content: "01";
  position: absolute;
  top: 24px;
  right: 28px;
  color: #9aa8b3;
  font-size: 13px;
}

.login-manifesto h2{
  max-width: 720px;
  margin: 18px 0 26px;
  font-size: clamp(3.25rem, 5.2vw, 5.2rem);
  line-height: 0.94;
  font-weight: 300;
  letter-spacing: -0.055em;
}

.login-lede{
  max-width: 610px;
  color: #43515e;
  font-size: 17px;
  line-height: 1.65;
}

.login-index{
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.login-index-item{
  min-height: 150px;
  padding: 18px 20px 18px 0;
}

.login-index-item + .login-index-item{
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.login-index-item span{
  display: block;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.login-index-item strong{
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
}

.login-index-item p{
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.login-code-mark{
  position: absolute;
  right: 26px;
  bottom: 18px;
  color: rgba(15, 98, 254, 0.18);
  font-size: 44px;
  font-weight: 300;
}

.login-form-panel{
  padding: 48px 42px;
  color: #ffffff;
  background:
    linear-gradient(145deg, rgba(4, 32, 109, 0.98), rgba(15, 98, 254, 0.96)),
    #0f62fe;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-panel .panel-intro{
  align-items: flex-start;
  border-color: rgba(255, 255, 255, 0.28);
}

.login-form-panel h2,
.login-form-panel .field > span{
  color: #ffffff;
}

.login-form-panel h2{
  font-size: 42px;
}

.login-form-panel .eyebrow,
.login-form-panel .hint{
  color: #d7e5ff;
}

.section-index{
  color: #d7e5ff;
  font-size: 12px;
}

.login-instruction{
  margin-bottom: 24px;
}

.login-form-panel input{
  min-height: 48px;
  border-color: rgba(255, 255, 255, 0.72);
  background: #ffffff;
  color: #161616;
}

.login-form-panel input:focus{
  border-color: #101820;
  box-shadow: 0 0 0 3px rgba(16, 24, 32, 0.32);
}

.login-form-panel #login{
  min-height: 48px;
  margin-top: 4px;
  border-color: #101820;
  background: #101820;
}

.login-form-panel #login:hover{
  background: #253746;
}

.credential-card{
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 0;
  background: rgba(4, 23, 67, 0.34);
}

.credential-card strong{
  display: block;
  margin-bottom: 6px;
  color: #ffffff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.credential-card .hint{
  color: #d7e5ff;
  font-size: 12px;
}

.form,
.form-grid{
  gap: 14px;
}

.field{
  gap: 7px;
}

.field > span{
  color: #273746;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.025em;
}

input,
select,
textarea{
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #aab7c2;
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

input::placeholder,
textarea::placeholder{
  color: #7b8995;
}

input:focus,
select:focus,
textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.2);
  transform: none;
}

input:disabled,
textarea:disabled,
select:disabled{
  background: #edf1f4;
  color: #6c7a86;
}

button{
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 0;
  color: #ffffff;
  background: var(--accent);
  box-shadow: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:hover{
  filter: none;
  transform: none;
  border-color: var(--accent-deep);
  background: var(--accent-deep);
}

button:active{
  transform: none;
  background: #001d6c;
}

.btn-secondary{
  color: #161616;
  border-color: #8e9ca7;
  background: #ffffff;
  box-shadow: none;
}

.btn-secondary:hover{
  color: #ffffff;
  border-color: #273746;
  background: #273746;
}

.btn-danger{
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: none;
}

.btn-danger:hover{
  border-color: #8e111a;
  background: #8e111a;
}

.status-card{
  border: 1px solid #bdd1e0;
  border-radius: 0;
  background: var(--accent-soft);
  color: #263746;
  box-shadow: none;
}

.status-neutral{ background: var(--accent-soft); border-color: #bdd1e0; }
.status-ok{ background: var(--ok-soft); border-color: #9fd0b8; }
.status-warn{ background: var(--warn-soft); border-color: #e3c66e; }
.status-danger{ background: var(--danger-soft); border-color: #f0a3a8; }

.meta-box{
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
}

code{
  padding: 0.14rem 0.34rem;
  border-radius: 0;
  background: var(--accent-soft);
  color: #0530ad;
}

pre{
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #f7f9fb;
  box-shadow: none;
}

.stat-grid{
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card{
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  animation: stat-reveal 440ms cubic-bezier(.2,.7,.2,1) both;
}

.stat-card:nth-child(2){ animation-delay: 40ms; }
.stat-card:nth-child(3){ animation-delay: 80ms; }
.stat-card:nth-child(4){ animation-delay: 120ms; }
.stat-card:nth-child(5){ animation-delay: 160ms; }
.stat-card:nth-child(6){ animation-delay: 200ms; }

.stat-label{
  color: #5a6976;
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.stat-value{
  color: #161616;
  font-family: var(--font-title);
  font-size: 38px;
  font-weight: 300;
}

.mini-note,
.builder-card,
.builder-row,
.detail-row,
.detail-body,
.attachment-item,
.timeline-content,
.empty-state{
  border: 1px solid var(--line);
  border-radius: 0;
  background: #f7f9fb;
  box-shadow: none;
}

.mini-note strong,
.builder-row-head strong,
.detail-row strong,
.attachment-item strong,
.timeline-title strong{
  color: #1d2b36;
}

.shared-item.note-item{ border-left: 4px solid #0f62fe; }
.shared-item.url-item{ border-left: 4px solid #4589ff; }
.shared-item.file-item{ border-left: 4px solid #8a3ffc; }

.empty-state{
  color: #60717f;
}

.detail-heading,
.detail-row span,
.timeline-meta{
  color: #60717f;
}

.timeline-dot{
  border-radius: 0;
  border-color: #ffffff;
  box-shadow: 0 0 0 1px var(--line-strong);
}

table{
  border-collapse: collapse;
  border-spacing: 0;
  white-space: nowrap;
}

th,
td{
  padding: 11px 12px;
  border-radius: 0 !important;
}

thead th{
  color: #f3f8fb;
  border: 1px solid #273746;
  background: #101820;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

tbody tr{
  background: #ffffff;
  box-shadow: none;
}

tbody tr:hover{
  background: #edf5ff;
}

tbody td,
tbody td:first-child,
tbody td:last-child{
  border: 1px solid var(--line);
}

.badge,
.pill2,
.plan-block{
  border-radius: 0;
}

.badge.green,
.pill2.green{ background: var(--ok-soft); color: #0d613b; }
.badge.amber,
.pill2.amber{ background: var(--warn-soft); color: #6b4500; }
.badge.red,
.pill2.red{ background: var(--danger-soft); color: #8e111a; }

.kanban{
  gap: 14px;
}

.kanban-col{
  border: 1px solid var(--line);
  border-radius: 0;
  background: #edf2f6;
}

.card{
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.card:hover{
  transform: none;
  border-left-color: var(--accent-deep);
  box-shadow: var(--shadow-soft);
}

.kanban-col.dragover{ outline: 2px solid var(--accent); }

.modal-backdrop{
  background: rgba(5, 12, 18, 0.72);
}

.modal-dialog{
  padding: 24px;
  border: 1px solid #526675;
  border-top: 4px solid var(--accent);
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 32px 90px rgba(5, 12, 18, 0.36);
}

.toast{
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(16, 24, 32, 0.16);
}

.toast-tone-ok{ border-left-color: var(--ok); background: #ffffff; }
.toast-tone-warn{ border-left-color: #a56f00; background: #ffffff; }
.toast-tone-danger{ border-left-color: var(--danger); background: #ffffff; }
.toast-title{ color: #1d2b36; }
.toast-body{ color: #596775; }

@keyframes control-reveal{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}

@keyframes stat-reveal{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1100px){
  .header-rail{
    display: none;
  }

  .login-layout{
    grid-template-columns: 1fr 420px;
  }

  .login-manifesto{
    padding: 40px;
  }

  .login-manifesto h2{
    font-size: clamp(3rem, 6vw, 4.4rem);
  }
}

@media (max-width: 900px){
  .site-header{
    padding: 0 20px;
    flex-direction: row;
    align-items: stretch;
  }

  .brand-block{
    border-right: 0;
  }

  .brand-subtitle,
  .brand-edition{
    display: none;
  }

  .grid{
    padding: 20px;
  }

  .panel.wide{
    margin: 24px auto;
  }

  .login-layout{
    grid-template-columns: 1fr;
  }

  .login-manifesto{
    min-height: 520px;
  }

  .login-form-panel{
    padding: 42px 36px;
  }

  .workspace-hero{
    grid-template-columns: 1fr;
  }

  .workspace-hero .status-card{
    border-left: 0;
    border-top: 1px solid #7fa8fa;
  }
}

@media (max-width: 640px){
  :root{
    --gap: 14px;
  }

  .site-header{
    min-height: 68px;
    padding: 0 14px;
  }

  .brand-block{
    gap: 10px;
    padding-right: 8px;
  }

  .brand-mark{
    width: 40px;
    height: 40px;
  }

  .brand-kicker{
    display: none;
  }

  h1{
    font-size: 22px;
  }

  .site-header #who{
    display: none;
  }

  .site-header #logout{
    width: auto;
    padding-inline: 12px;
  }

  .grid{
    padding: 14px;
  }

  .panel{
    padding: 16px;
  }

  .panel-login{
    padding: 0;
    margin: 14px auto !important;
  }

  .login-manifesto{
    min-height: 0;
    padding: 28px 24px 32px;
  }

  .login-form-panel{
    order: -1;
  }

  .login-manifesto h2{
    margin: 10px 0 18px;
    font-size: 42px;
  }

  .login-lede{
    font-size: 14px;
  }

  .login-index{
    margin-top: 32px;
    grid-template-columns: 1fr;
  }

  .login-index-item{
    min-height: 0;
    padding: 14px 0;
  }

  .login-index-item + .login-index-item{
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .login-index-item span{
    margin-bottom: 7px;
  }

  .login-code-mark{
    display: none;
  }

  .login-form-panel{ padding: 30px 24px; }

  .login-form-panel h2{
    font-size: 36px;
  }

  .workspace-hero > div:first-child{
    padding: 22px 20px;
  }

  .workspace-hero h2{
    font-size: 34px;
  }

  .workspace-hero .status-card{
    padding: 20px;
  }

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

  .stat-card{
    min-height: 108px;
    padding: 14px;
  }

  .stat-value{
    font-size: 32px;
  }

  thead th,
  tbody td{
    padding: 10px;
  }
}
