:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#14213d;
  --muted:#64748b;
  --line:#e2e8f0;
  --line-soft:#edf2f7;

  --primary:#1d4ed8;
  --primary-dark:#1e40af;
  --primary-soft:#eff6ff;

  --sidebar:#0f172a;
  --sidebar-hover:#1e293b;

  --success-bg:#ecfdf5;
  --success-text:#166534;
  --success-line:#86efac;

  --danger-bg:#fef2f2;
  --danger-text:#991b1b;
  --danger-line:#fecaca;

  --warning-bg:#fff7ed;
  --warning-text:#9a3412;
  --warning-line:#fdba74;

  --shadow-sm:0 1px 3px rgba(15,23,42,.05);
  --shadow-md:0 2px 10px rgba(15,23,42,.06);
  --shadow-lg:0 8px 24px rgba(15,23,42,.08);

  --radius-sm:8px;
  --radius-md:12px;
  --radius-lg:14px;
  --radius-xl:16px;
}

*{box-sizing:border-box}

html{
  -webkit-text-size-adjust:100%;
}

body{
  margin:0;
  font-family:Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.45;
}

a{
  color:var(--primary);
  text-decoration:none;
}

a:hover{
  text-decoration:underline;
}

img{
  max-width:100%;
  height:auto;
}

.app-shell{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width:250px;
  background:var(--sidebar);
  color:#fff;
  padding:20px;
}

.sidebar .brand{
  font-size:24px;
  font-weight:700;
  margin-bottom:20px;
}

.sidebar nav a{
  display:block;
  color:#e2e8f0;
  padding:10px 12px;
  border-radius:10px;
  margin-bottom:6px;
  transition:background .18s ease,color .18s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active{
  background:var(--sidebar-hover);
  text-decoration:none;
}

.main-content{
  flex:1;
  padding:24px;
  min-width:0;
}

.auth-main{
  display:flex;
  align-items:center;
  justify-content:center;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  background:#fff;
  padding:12px 16px;
  border-radius:var(--radius-md);
  margin-bottom:18px;
  box-shadow:var(--shadow-sm);
}

.card{
  background:var(--card);
  border-radius:var(--radius-md);
  padding:20px;
  box-shadow:var(--shadow-md);
  margin-bottom:20px;
  min-width:0;
}

.auth-card{
  width:100%;
  max-width:420px;
}

.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:18px;
}

.compact-head{
  align-items:center;
}

.page-head h2{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.section-count{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  padding:3px 9px;
  border-radius:999px;
  background:var(--primary-soft);
  color:var(--primary-dark);
  font-size:12px;
  font-weight:700;
  line-height:1.2;
}

.small-note{
  font-size:12px;
  color:var(--muted);
  line-height:1.45;
}

.mt-0{margin-top:0}
.mt-6{margin-top:6px}
.mt-12{margin-top:12px}
.text-center{text-align:center}

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

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

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

.wide-form{
  max-width:720px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.form-grid button{
  padding:10px 12px;
  border:1px solid #cbd5e1;
  border-radius:var(--radius-sm);
  width:100%;
  font:inherit;
  min-width:0;
}

.form-grid input,
.form-grid select,
.form-grid textarea{
  background:#fff;
  color:var(--text);
}

.form-grid textarea{
  resize:vertical;
  line-height:1.45;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus{
  outline:none;
  border-color:#93c5fd;
  box-shadow:0 0 0 3px rgba(29,78,216,.10);
}

.btn,
.form-grid button{
  background:var(--primary);
  color:#fff;
  border:none;
  cursor:pointer;
  padding:10px 14px;
  border-radius:var(--radius-sm);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  white-space:nowrap;
  font-weight:600;
  transition:background .18s ease,transform .08s ease,box-shadow .18s ease;
}

.btn:hover,
.form-grid button:hover{
  text-decoration:none;
  background:var(--primary-dark);
}

.btn:active,
.form-grid button:active{
  transform:translateY(1px);
}

.btn-secondary{
  background:#e2e8f0;
  color:#0f172a;
}

.btn-secondary:hover{
  background:#cbd5e1;
}

.btn-sm{
  padding:7px 10px;
  font-size:12px;
  line-height:1.2;
}

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

.checkbox{
  display:flex;
  align-items:center;
  gap:8px;
}

.checkbox input{
  width:auto;
}

.checkbox-wrap{
  display:flex;
  align-items:flex-end;
}

.stats-grid{
  display:grid;
  gap:16px;
  margin-bottom:20px;
}

.stats-grid-3{
  grid-template-columns:repeat(3,minmax(180px,1fr));
}

.stats-grid-4{
  grid-template-columns:repeat(4,minmax(180px,1fr));
}

.stat-card{
  text-align:center;
  border:1px solid var(--line-soft);
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
}

.stat-card-accent{
  background:linear-gradient(180deg,#ffffff 0%,#eff6ff 100%);
}

.stat-card-success{
  background:linear-gradient(180deg,#ffffff 0%,#ecfdf5 100%);
}

.stat-card-warn{
  background:linear-gradient(180deg,#ffffff 0%,#fff7ed 100%);
}

.stat-card-soft{
  background:linear-gradient(180deg,#ffffff 0%,#f8fafc 100%);
}

.stat-label{
  color:var(--muted);
  font-size:14px;
}

.stat-value{
  font-size:32px;
  font-weight:700;
  margin-top:8px;
}

.table{
  width:100%;
  border-collapse:collapse;
}

.table th,
.table td{
  padding:10px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
}

.table th{
  font-weight:700;
  color:#0f172a;
  background:transparent;
}

.compact-table th,
.compact-table td{
  padding:8px;
}

.alert{
  padding:12px 14px;
  border-radius:var(--radius-sm);
  margin-bottom:14px;
}

.alert-success{
  background:var(--success-bg);
  color:var(--success-text);
  border:1px solid var(--success-line);
}

.alert-error{
  background:var(--danger-bg);
  color:var(--danger-text);
  border:1px solid var(--danger-line);
}

.dashboard-grid,
.detail-grid{
  display:grid;
  grid-template-columns:1.4fr 1fr;
  gap:18px;
}

.pipeline-inline{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.metric-chip{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:10px;
  background:#f8fafc;
  border:1px solid var(--line);
  min-width:150px;
}

.metric-chip strong{
  font-size:18px;
}

.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid transparent;
  white-space:nowrap;
}

.pill-success{
  background:var(--success-bg);
  color:var(--success-text);
  border-color:var(--success-line);
}

.pill-danger{
  background:var(--danger-bg);
  color:var(--danger-text);
  border-color:var(--danger-line);
}

.status-new{background:#e0f2fe;color:#075985;border-color:#7dd3fc}
.status-qualified{background:#eef2ff;color:#3730a3;border-color:#c7d2fe}
.status-proposal_sent{background:#fff7ed;color:#9a3412;border-color:#fdba74}
.status-negotiation{background:#f5f3ff;color:#6d28d9;border-color:#ddd6fe}
.status-won{background:#ecfdf5;color:#166534;border-color:#86efac}
.status-lost{background:#fef2f2;color:#991b1b;border-color:#fecaca}
.status-dormant{background:#f8fafc;color:#475569;border-color:#cbd5e1}

.priority-low{background:#f8fafc;color:#475569;border-color:#cbd5e1}
.priority-medium{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
.priority-high{background:#fff7ed;color:#c2410c;border-color:#fdba74}
.priority-urgent{background:#fef2f2;color:#b91c1c;border-color:#fca5a5}

.kanban-grid{
  display:grid;
  grid-template-columns:repeat(7,minmax(220px,1fr));
  gap:14px;
  overflow:auto;
}

.kanban-col{
  background:#eef2f7;
  border-radius:12px;
  padding:10px;
  min-width:220px;
}

.kanban-head{
  font-weight:700;
  padding:10px;
  border-radius:8px;
  margin-bottom:10px;
  display:flex;
  justify-content:space-between;
}

.kanban-body{
  display:grid;
  gap:10px;
}

.kanban-card{
  display:block;
  background:#fff;
  border-radius:10px;
  padding:12px;
  border:1px solid var(--line);
  box-shadow:0 1px 4px rgba(15,23,42,.05);
}

.kanban-card:hover{
  text-decoration:none;
  border-color:#93c5fd;
}

.kanban-title{
  font-weight:700;
  margin-bottom:4px;
}

.timeline{
  display:grid;
  gap:10px;
}

.timeline-item{
  border:1px solid var(--line);
  border-radius:10px;
  padding:12px;
  background:#fff;
}

.timeline-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
  font-size:13px;
  color:var(--muted);
}

.detail-two-col{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.detail-label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
}

.compact-filter{
  align-items:end;
}

/* Booking/operations status styles */
.status-draft{background:#f8fafc;color:#475569;border-color:#cbd5e1}
.status-requested{background:#fff7ed;color:#9a3412;border-color:#fdba74}
.status-confirmed{background:#ecfdf5;color:#166534;border-color:#86efac}
.status-in_progress{background:#eef2ff;color:#3730a3;border-color:#c7d2fe}
.status-completed{background:#dcfce7;color:#166534;border-color:#86efac}
.status-cancelled{background:#fef2f2;color:#991b1b;border-color:#fecaca}
.status-traveling{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}

.mono-text{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
}

/* Reports */
.report-shell{
  display:grid;
  gap:18px;
}

.report-page-head{
  margin-bottom:0;
}

.report-breadcrumb{
  font-size:12px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:6px;
}

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

.report-link-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}

.report-link-card{
  display:grid;
  gap:6px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#f8fafc;
  color:var(--text);
}

.report-link-card:hover{
  text-decoration:none;
  border-color:#93c5fd;
  box-shadow:0 2px 10px rgba(15,23,42,.05);
}

.inline-report-form{
  display:flex;
  gap:8px;
  align-items:center;
}

.inline-report-form input,
.inline-report-form button{
  padding:8px 10px;
  border-radius:8px;
  border:1px solid #cbd5e1;
}

.inline-report-form button{
  background:var(--primary);
  color:#fff;
  border:none;
}

.print-meta{
  font-size:12px;
  color:var(--muted);
  margin-top:-8px;
}

.compact-stats{
  margin-bottom:14px;
}

/* Workflow dashboard polish */
.workflow-shell{
  overflow:hidden;
}

.workflow-head{
  align-items:flex-start;
  gap:16px;
}

.workflow-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  align-items:stretch;
}

.workflow-card-fill{
  display:flex;
  flex-direction:column;
}

.workflow-block{
  border:1px solid #dbe3ef;
  border-radius:14px;
  padding:16px;
  background:#fbfdff;
  min-width:0;
}

.workflow-block-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:12px;
}

.workflow-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.workflow-actions form{
  margin:0;
}

.workflow-actions .btn-sm,
.workflow-actions .btn,
.btn-sm{
  white-space:nowrap;
}

.workflow-inline-note{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}

.workflow-inline-note input{
  width:130px;
  min-width:130px;
}

.workflow-summary-list{
  display:grid;
  gap:10px;
  margin-top:4px;
}

.workflow-summary-list>div{
  display:flex;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid var(--line-soft);
  padding-bottom:8px;
}

.workflow-summary-list span{
  color:var(--muted);
  font-size:13px;
}

.table-wrap{
  width:100%;
  overflow-x:auto;
}

.workflow-table,
.workflow-mini-table{
  width:100%;
  table-layout:fixed;
}

.workflow-table th,
.workflow-table td,
.workflow-mini-table th,
.workflow-mini-table td{
  vertical-align:top;
  word-break:break-word;
}

.workflow-table .col-day{width:7%}
.workflow-table .col-stay{width:20%}
.workflow-table .col-property{width:16%}
.workflow-table .col-status{width:16%}
.workflow-table .col-lastsent{width:16%}
.workflow-table .col-actions{width:25%}

.workflow-mini-table .mini-message{width:24%}
.workflow-mini-table .mini-status{width:20%}
.workflow-mini-table .mini-lastsent{width:16%}
.workflow-mini-table .mini-actions{width:40%}

.workflow-mini-table td:last-child,
.workflow-table td:last-child{
  min-width:220px;
}

.card:hover{
  box-shadow:var(--shadow-lg);
  transition:box-shadow .18s ease;
}

@media(max-width:1200px){
  .workflow-mini-table .mini-message{width:24%}
  .workflow-mini-table .mini-status{width:20%}
  .workflow-mini-table .mini-lastsent{width:16%}
  .workflow-mini-table .mini-actions{width:40%}
}

@media(max-width:1100px){
  .dashboard-grid,
  .detail-grid,
  .grid-4,
  .grid-2,
  .stats-grid-3,
  .stats-grid-4,
  .workflow-grid{
    grid-template-columns:1fr;
  }

  .main-content{
    padding:16px;
  }

  .app-shell{
    display:block;
  }

  .sidebar{
    width:100%;
  }

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

  .workflow-inline-note input{
    width:100%;
    min-width:0;
  }
}

@media(max-width:768px){
  .page-head,
  .workflow-head,
  .workflow-block-head,
  .topbar{
    flex-direction:column;
    align-items:stretch;
  }

  .action-row,
  .workflow-actions{
    width:100%;
  }

  .action-row .btn,
  .workflow-actions .btn,
  .workflow-actions form{
    width:100%;
  }

  .workflow-mini-table,
  .workflow-table{
    table-layout:auto;
  }

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

@media print{
  body{
    background:#fff;
  }

  .sidebar,
  .topbar,
  .print-hide{
    display:none !important;
  }

  .main-content{
    padding:0;
  }

  .card{
    box-shadow:none;
    border:1px solid #ddd;
    break-inside:avoid;
  }

  .report-shell{
    gap:12px;
  }

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

  .page-head{
    margin-bottom:10px;
  }

  .print-sheet{
    padding:0;
  }

  .table th,
  .table td{
    padding:6px 8px;
    font-size:12px;
  }

  .btn{
    display:none !important;
  }
}
textarea[name="body_text"]{
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}


.readonly-field{
  min-height:42px;
  padding:10px 12px;
  border:1px dashed #cbd5e1;
  border-radius:var(--radius-sm);
  background:#f8fafc;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:2px;
}

.compact-readonly{
  min-height:44px;
}

.list-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.filter-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.pagination-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--line);
  flex-wrap:wrap;
}

.pagination-links{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.pagination-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:36px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid #cbd5e1;
  background:#fff;
  color:var(--text);
}

.pagination-link.is-active{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.finance-chip-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.finance-chip-row .btn{white-space:nowrap}
.mb-12{margin-bottom:12px}
