:root{
  --white:#ffffff;
  --sandstone:#c4b49a;
  --amber:#f5c842;
  --navy:#0c1829;
  --sandstone-tint:#f3efe8;
  --sandstone-line:#d9cdb8;
  --navy-soft:#2a3a4d;
}

*{
  box-sizing:border-box;
}

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family:'Manrope', Arial, Helvetica, sans-serif;
  color:var(--navy);
  background:var(--sandstone-tint);
}

button,
input,
textarea{
  font:inherit;
}

button{
  border:0;
  border-radius:10px;
  padding:12px 16px;
  font-weight:700;
  cursor:pointer;
  background:var(--white);
  color:var(--navy);
  border:1px solid var(--sandstone-line);
}

button:disabled{
  opacity:.45;
  cursor:not-allowed;
}

input,
textarea{
  width:100%;
  border:1px solid var(--sandstone-line);
  border-radius:10px;
  background:var(--white);
  color:var(--navy);
  padding:12px 13px;
  outline:none;
}

textarea{
  resize:vertical;
  line-height:1.5;
}

/* Print-only mirrors of each textarea's text (see app.js preparePrintView).
   Hidden here so they never show up in the normal editing view — only the
   @media print rules below make them visible. */
.print-mirror{
  display:none;
}

input:focus,
textarea:focus{
  border-color:var(--navy);
  box-shadow:0 0 0 3px rgba(12,24,41,.10);
}

.app{
  max-width:1000px;
  margin:0 auto;
  min-height:100vh;
  background:var(--white);
  box-shadow:0 0 28px rgba(12,24,41,.08);
}

.site-header{
  padding:22px 24px 18px;
  text-align:center;
  background:var(--navy);
  border-bottom:1px solid var(--navy);
}

.site-header h1{
  margin:0;
  font-size:34px;
  font-weight:800;
  color:var(--white);
  letter-spacing:.4px;
}

.subtitle{
  margin:5px 0 0;
  font-weight:700;
  color:var(--amber);
}

.save-status{
  margin-top:12px;
  font-size:13px;
  font-weight:700;
  color:var(--sandstone);
}

.top-actions{
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.top-actions button{
  background:var(--white);
  color:var(--navy);
  border:1px solid var(--white);
}

.top-actions button:active{
  background:var(--amber);
}

#printActionBtn{
  background:var(--white);
  color:var(--navy);
  border:1px solid var(--sandstone-line);
}

.past-meetings-panel{
  position:fixed;
  inset:0;
  background:rgba(12,24,41,.55);
  z-index:50;
  display:flex;
  align-items:flex-end;
  justify-content:center;
}

.past-meetings-panel[hidden]{
  display:none;
}

.past-meetings-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 20px;
  background:var(--navy);
}

.past-meetings-head h2{
  margin:0;
  color:var(--white);
  font-size:20px;
}

.past-meetings-head button{
  background:transparent;
  border:0;
  color:var(--white);
  font-size:26px;
  line-height:1;
  padding:4px 8px;
}

.past-meetings-list{
  background:var(--white);
  max-width:640px;
  width:100%;
  max-height:70vh;
  overflow-y:auto;
  border-radius:14px 14px 0 0;
}

.past-meeting-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:14px 18px;
  border-bottom:1px solid var(--sandstone-line);
  cursor:pointer;
  background:var(--white);
  border-radius:0;
  text-align:left;
  width:100%;
}

.past-meeting-row:hover{
  background:var(--sandstone-tint);
}

.past-meeting-title{
  font-weight:800;
  color:var(--navy);
}

.past-meeting-sub{
  font-size:13px;
  color:var(--navy-soft);
  font-weight:600;
}

.muted{
  color:var(--navy-soft);
  padding:18px;
}

main{
  padding:24px;
}

.meeting-sheet{
  border:1px solid var(--sandstone-line);
  border-radius:14px;
  overflow:hidden;
  background:var(--white);
}

.sheet-title{
  padding:16px 18px;
  background:var(--navy);
  color:var(--white);
  font-size:24px;
  font-weight:800;
}

.meeting-details,
.agenda-section{
  padding:18px;
}

.meeting-details{
  border-bottom:1px solid var(--sandstone-line);
}

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

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

.full{
  grid-column:1 / -1;
}

label{
  font-size:12px;
  font-weight:800;
  color:var(--navy-soft);
  text-transform:uppercase;
  letter-spacing:.3px;
}

.hint{
  text-transform:none;
  font-weight:600;
  color:var(--sandstone);
  letter-spacing:0;
}

.agenda-section h2{
  margin:0 0 14px;
  color:var(--navy);
  font-size:22px;
}

.agenda-item{
  margin-bottom:16px;
  border:1px solid var(--sandstone-line);
  border-radius:12px;
  overflow:hidden;
  background:var(--white);
}

.agenda-item:last-child{
  margin-bottom:0;
}

.agenda-head{
  display:grid;
  grid-template-columns:48px 1fr;
  align-items:center;
  background:var(--navy);
}

.agenda-number{
  color:var(--white);
  font-size:18px;
  font-weight:800;
  text-align:center;
  border-right:1px solid rgba(255,255,255,.25);
  padding:14px 8px;
}

.agenda-title{
  margin:9px 11px;
  padding:11px 12px;
  background:var(--white);
  border-radius:8px;
  color:var(--navy);
  font-weight:800;
}

.agenda-body{
  padding:14px;
  display:grid;
  gap:12px;
}

.topic-recording{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  padding:12px;
  background:var(--sandstone-tint);
  border:1px solid var(--sandstone-line);
  border-radius:12px;
}

.record-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:64px;
  min-width:220px;
  flex:1 1 220px;
  background:var(--navy);
  color:var(--white);
  border:1px solid var(--navy);
  font-size:18px;
  font-weight:800;
  justify-content:center;
  transition:background .15s ease;
}

.record-toggle .record-dot{
  width:16px;
  height:16px;
  border-radius:50%;
  background:var(--amber);
  flex-shrink:0;
}

.record-toggle[aria-pressed="true"]{
  background:var(--amber);
  color:var(--navy);
  border-color:var(--amber);
  animation:pulse 1.4s ease-in-out infinite;
}

.record-toggle[aria-pressed="true"] .record-dot{
  background:var(--navy);
  animation:blink 1s steps(1) infinite;
}

.record-toggle:disabled{
  opacity:.6;
}

@keyframes pulse{
  0%,100%{ box-shadow:0 0 0 0 rgba(245,200,66,.55); }
  50%{ box-shadow:0 0 0 10px rgba(245,200,66,0); }
}

@keyframes blink{
  0%,49%{ opacity:1; }
  50%,100%{ opacity:.25; }
}

.record-status{
  flex:1;
  min-width:180px;
  padding:10px 12px;
  border:1px solid var(--sandstone-line);
  border-radius:8px;
  background:var(--white);
  font-size:14px;
  font-weight:600;
}

[id^="purpose-"]{
  min-height:120px;
  background:var(--sandstone-tint);
}

[id^="minutes-"]{
  min-height:120px;
}

[id^="decision-"],
[id^="action-"]{
  min-height:80px;
}

.action-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) 150px 160px;
  gap:12px;
  align-items:start;
}

.action-field{
  min-width:0;
}

.action-summary{
  margin-top:26px;
  padding-top:18px;
  border-top:3px solid var(--navy);
}

.action-summary-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.action-summary-head h2{
  margin:0;
  color:var(--navy);
  font-size:24px;
}

table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}

th{
  padding:10px;
  background:var(--navy);
  color:var(--white);
  text-align:left;
  font-size:12px;
  text-transform:uppercase;
}

td{
  padding:10px;
  border:1px solid var(--sandstone-line);
  vertical-align:top;
  word-break:break-word;
}

th:nth-child(1),
td:nth-child(1){
  width:20%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4){
  width:18%;
}

@media(max-width:760px){
  body{
    background:var(--white);
  }

  .app{
    box-shadow:none;
  }

  .site-header{
    padding:18px 14px 16px;
  }

  .site-header h1{
    font-size:30px;
  }

  main{
    padding:14px;
  }

  .meeting-details,
  .agenda-section{
    padding:14px;
  }

  .meta-grid,
  .action-grid{
    grid-template-columns:1fr;
  }

  .full{
    grid-column:auto;
  }

  .topic-recording{
    display:grid;
    grid-template-columns:1fr;
  }

  .record-toggle{
    width:100%;
    min-height:72px;
    font-size:20px;
  }

  .record-status{
    min-width:0;
  }

  .agenda-head{
    grid-template-columns:42px 1fr;
  }

  .agenda-title{
    margin:8px;
    padding:10px;
  }

  .action-summary{
    overflow-x:auto;
  }

  table{
    min-width:680px;
    font-size:13px;
  }
}

@media print{
  @page{
    margin:12mm;
  }

  body{
    background:var(--white);
  }

  .app{
    max-width:none;
    box-shadow:none;
  }

  .site-header{
    padding:0 0 10px;
    background:var(--white);
    border-bottom:0;
  }

  .site-header h1,
  .subtitle{
    color:var(--navy);
  }

  .save-status,
  .top-actions,
  .topic-recording,
  .past-meetings-panel,
  #printActionBtn{
    display:none !important;
  }

  main{
    padding:0;
  }

  .meeting-sheet{
    border:0;
  }

  .meeting-details,
  .agenda-section{
    padding-left:0;
    padding-right:0;
  }

  .agenda-item{
    break-inside:avoid;
  }

  .action-summary{
    break-inside:avoid;
  }

  input,
  textarea{
    border:0 !important;
    box-shadow:none !important;
    padding-left:0;
    padding-right:0;
    background:var(--white) !important;
    color:var(--navy);
  }

  textarea{
    overflow:visible;
  }

  .agenda-title{
    border:1px solid var(--sandstone-line);
  }

  .hint{
    display:none;
  }

  /* ---- compact, content-scaled printing ----
     A field only takes print space when it actually has something written
     in it. Every textarea is mirrored into a plain auto-height block for
     print (so real notes never get clipped by the on-screen box height),
     and a topic with nothing recorded against it collapses down to just
     its heading and purpose line instead of four empty boxes. */

  textarea.has-print-mirror{
    display:none !important;
  }

  textarea.has-print-mirror + .print-mirror{
    display:block;
    white-space:pre-wrap;
    font-family:inherit;
    line-height:1.4;
    font-size:13px;
    padding:1px 0 2px;
  }

  [id^="purpose-"] + .print-mirror{
    font-style:italic;
    font-size:12px;
    color:var(--navy-soft);
  }

  .field.field-empty-print{
    display:none !important;
  }

  .agenda-item{
    margin-bottom:8px;
    padding-bottom:6px;
  }

  .agenda-head{
    margin-bottom:2px;
  }

  .field label{
    margin-bottom:1px;
    font-size:11px;
  }

  .agenda-item.topic-empty-print .action-grid{
    display:none !important;
  }

  .agenda-item.topic-empty-print .agenda-body{
    padding-bottom:2px;
  }

  body.print-action-summary-only .site-header,
  body.print-action-summary-only .meeting-sheet{
    display:none !important;
  }

  body.print-action-summary-only main{
    padding:0;
  }

  body.print-action-summary-only .action-summary{
    display:block !important;
    margin:0;
    padding:0;
    border-top:0;
  }

  body.print-action-summary-only .action-summary-head{
    display:block;
    margin-bottom:12px;
  }

  body.print-action-summary-only #printActionBtn{
    display:none !important;
  }
}
