/* Ported 1:1 from the static site's style.css (header/sidebar section only —
   this is Phase 0 scope). Page-content rules (cards, panels, tables, forms)
   get added phase-by-phase as each page is ported, instead of porting
   everything up front. */

:root{
  --blue:#0097b2;
  --blue-dark:#007A91;
  --blue-light:#DFF7FC;
  --orange:#E2602D;
  --orange-dark:#C84D1D;
  --orange-light:#FFF1EA;
  --green:#16a05d;
  --green-dark:#0d7a45;
  --green-light:#E8F8EE;
  --bg:#f4fbfc;
  --text:#101828;
  --muted:#667085;
  --border:#e1e7ea;
  --nav-hover:#f2f4f6;
}

*{
  box-sizing:border-box;
}

a{
  color:inherit;
  text-decoration:none;
}

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

.topbar{
  background:#fff;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:normal;
  gap:24px;
  height:64px;
  padding:0 24px;
  position:sticky;
  top:0;
  z-index:100;
}

.logo-wrap{
  display:flex;
  align-items:center;
  width:auto;
  height:41px;
  flex:none;
}

.logo-wrap img{
  display:block;
  width:auto;
  height:41px;
}

.topbar-search{
  display:flex;
  align-items:center;
  gap:10px;
  background:#f4f6f8;
  border:1px solid var(--border);
  border-radius:5px;
  height:38px;
  padding:0 14px;
  flex:1;
  max-width:560px;
  margin:0 auto;
}

.topbar-search span{
  color:var(--muted);
  font-size:15px;
}

.topbar-search input{
  border:0;
  outline:0;
  background:transparent;
  width:100%;
  color:var(--text);
  font-weight:400;
  font-size:13.5px;
}

.user-wrap{
  display:flex;
  align-items:center;
  flex:none;
  gap:14px;
}

.user-menu{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  box-shadow:0 4px 16px rgba(16,24,40,0.08);
  min-width:140px;
  padding:6px;
  z-index:110;
}

.user-menu a{
  display:block;
  padding:8px 10px;
  border-radius:5px;
  font-size:13px;
  color:var(--text);
}

.user-menu a:hover{
  background:var(--nav-hover);
}

.top-icon{
  border:0;
  background:transparent;
  color:var(--muted);
  line-height:1;
  font-size:16px;
}

.avatar{
  border-radius:50%;
  background:var(--blue);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:500;
  width:32px;
  height:32px;
  font-size:12px;
}

.user-text strong{
  display:block;
  line-height:1.2;
  color:var(--text);
  font-weight:500;
  font-size:13px;
}

.user-text span{
  display:block;
  color:var(--muted);
  margin-top:2px;
  font-weight:400;
  font-size:11.5px;
}

.arrow{
  border:0;
  background:transparent;
  color:var(--muted);
  font-size:12px;
}

.app{
  display:flex;
  background:var(--bg);
  align-items:stretch;
  min-height:calc(100vh - 64px);
  padding:0;
  gap:0;
}

.sidebar{
  background:#fff;
  color:var(--text);
  display:flex;
  flex-direction:column;
  box-shadow:none;
  overflow:hidden;
  border-right:1px solid var(--border);
  width:220px;
  flex:none;
  height:calc(100vh - 64px);
  min-height:unset;
  border-radius:0;
  padding:16px 12px;
  position:sticky;
  top:64px;
  align-self:flex-start;
  z-index:90;
}

.menu{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.menu button{
  border:none;
  background:transparent;
  color:var(--text);
  text-align:left;
  font-weight:400;
  display:flex;
  align-items:center;
  border-bottom:none;
  height:38px;
  border-radius:5px;
  padding:0 12px;
  font-size:15.5px;
  gap:10px;
  width:100%;
  cursor:pointer;
}

.menu button:hover{
  background:var(--nav-hover);
}

.menu button span{
  line-height:1;
  text-align:center;
  color:var(--muted);
  width:20px;
  font-size:15px;
}

.menu button.active{
  color:var(--blue-dark);
  background:var(--blue-light);
  box-shadow:none;
  font-weight:500;
}

.menu button.active span{
  color:var(--blue-dark);
}

.collapse{
  margin-top:auto;
  border-top:1px solid var(--border);
  border-left:none;
  border-right:none;
  border-bottom:none;
  background:transparent;
  color:var(--muted);
  text-align:left;
  cursor:pointer;
  font-weight:400;
  padding-top:14px;
  font-size:12.5px;
  width:100%;
}

.main{
  padding:40px 44px 30px;
  flex:1;
  min-width:0;
}

/* Generic page-content rules, added as pages need them (Phase 1: Settings/
   Users) rather than porting everything up front. */

.settings-list{
  list-style:none;
  padding:0;
  margin:0 0 24px;
}

.settings-list li{
  padding:10px 0;
  border-bottom:1px solid var(--border);
  font-size:14px;
}

.settings-list a{
  color:var(--blue-dark);
  font-weight:500;
  margin-right:6px;
}

.banner{
  border-radius:5px;
  padding:10px 12px;
  font-size:13px;
  margin-bottom:16px;
}

.banner-error{
  background:#FEECEC;
  color:#B42318;
}

.banner-success{
  background:var(--green-light);
  color:var(--green-dark);
}

table.data-table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  overflow:hidden;
  margin-bottom:28px;
}

table.data-table th,
table.data-table td{
  text-align:left;
  padding:10px 14px;
  font-size:13px;
  border-bottom:1px solid var(--border);
}

table.data-table th{
  color:var(--muted);
  font-weight:600;
  text-transform:uppercase;
  font-size:11px;
  letter-spacing:0.03em;
  background:#f9fbfc;
}

table.data-table tr:last-child td{
  border-bottom:none;
}

.form-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  padding:24px;
  max-width:420px;
}

.form-card h2{
  margin:0 0 16px;
  font-size:16px;
}

.form-card label{
  display:block;
  font-size:13px;
  font-weight:500;
  margin:14px 0 6px;
}

.form-card label:first-of-type{
  margin-top:0;
}

.form-card input[type=text],
.form-card input[type=email],
.form-card input[type=password],
.form-card input[type=number],
.form-card select{
  width:100%;
  height:38px;
  border:1px solid var(--border);
  border-radius:5px;
  padding:0 12px;
  font-size:14px;
  font-family:inherit;
}

.form-card input[type=file]{
  display:block;
  margin-top:4px;
  font-size:13px;
}

.checkbox-label{
  display:flex !important;
  align-items:center;
  gap:8px;
  font-weight:400 !important;
}

.checkbox-label input{
  margin:0;
}

.category-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
  gap:12px;
}

.category-tile{
  display:flex;
  flex-direction:column;
  gap:6px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  padding:16px;
  text-decoration:none;
  color:var(--text);
}

.category-tile:hover{
  border-color:var(--blue);
}

.category-tile strong{
  font-size:14px;
}

.category-tile span{
  color:var(--muted);
  font-size:12px;
}

.btn-primary{
  height:38px;
  padding:0 18px;
  margin-top:20px;
  background:var(--blue);
  color:#fff;
  border:0;
  border-radius:5px;
  font-weight:600;
  font-size:13px;
  cursor:pointer;
}

.btn-primary:hover{
  background:var(--blue-dark);
}

.heading{
  margin-bottom:24px;
}

.heading h1{
  margin:0;
  font-weight:600;
  font-size:22px;
  letter-spacing:-0.3px;
}

.heading p{
  margin:6px 0 0;
  color:var(--muted);
  font-weight:400;
  font-size:13px;
}

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

/* Phase 2: Customers/Projects */

.back-link{
  display:inline-block;
  margin-bottom:16px;
  color:var(--muted);
  font-size:13px;
  font-weight:500;
}

.search-row{
  display:flex;
  gap:10px;
  margin-bottom:18px;
  max-width:420px;
}

.search-row input{
  flex:1;
  height:38px;
  border:1px solid var(--border);
  border-radius:5px;
  padding:0 12px;
  font-size:14px;
  font-family:inherit;
}

.row-subtext{
  color:var(--muted);
  font-size:12px;
  margin-top:2px;
}

.btn-secondary-link,
.btn-cancel-link,
.btn-danger-link{
  display:inline-block;
  height:38px;
  line-height:38px;
  padding:0 16px;
  border-radius:5px;
  font-size:13px;
  font-weight:600;
  text-decoration:none;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  cursor:pointer;
}

.btn-cancel-link{
  border:0;
  background:transparent;
  color:var(--muted);
  margin-left:8px;
}

.btn-danger-link{
  border-color:#FEE4E2;
  background:#fff;
  color:#B42318;
}

.link-btn-danger{
  border:0;
  background:none;
  color:#B42318;
  font-size:13px;
  cursor:pointer;
  padding:0;
  margin-left:10px;
}

.detail-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  padding:24px;
  margin-bottom:24px;
}

.detail-card-left{
  display:flex;
  align-items:center;
  gap:16px;
  margin-bottom:20px;
}

.detail-avatar{
  width:56px;
  height:56px;
  border-radius:50%;
  background:var(--blue);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
  font-size:18px;
  flex:none;
}

.detail-card-left h1{
  margin:0;
  font-size:20px;
}

.detail-subtitle{
  margin:4px 0 0;
  color:var(--muted);
  font-size:13px;
}

.detail-fields{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:16px;
  padding:16px 0;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
}

.field-label{
  display:block;
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.03em;
  margin-bottom:4px;
}

.field-value{
  display:block;
  font-size:14px;
}

.detail-summary{
  display:flex;
  gap:32px;
  padding:16px 0;
}

.detail-summary div{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.detail-summary span{
  color:var(--muted);
  font-size:12px;
}

.detail-summary strong{
  font-size:18px;
}

.detail-actions{
  display:flex;
  gap:10px;
  padding-top:16px;
  border-top:1px solid var(--border);
}

.panel-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  padding:20px;
}

.panel-card-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
  font-size:13px;
  color:var(--muted);
}

.calendar-nav{
  display:flex;
  gap:8px;
}

.calendar-table-wrap{
  overflow-x:auto;
}

.calendar-table{
  width:100%;
  min-width:700px;
  border-collapse:collapse;
  table-layout:fixed;
}

.calendar-table th{
  text-align:left;
  font-size:12px;
  font-weight:600;
  color:var(--muted);
  padding:6px 8px;
  border-bottom:1px solid var(--border);
}

.calendar-cell{
  vertical-align:top;
  border:1px solid var(--border);
  padding:6px;
  height:100px;
  width:14.28%;
}

.calendar-cell-muted{
  background:#fafbfc;
  color:var(--muted);
}

.calendar-cell-today{
  background:#eaf6f8;
}

.calendar-day-num{
  font-size:13px;
  font-weight:600;
  margin-bottom:4px;
}

.calendar-event{
  font-size:11px;
  line-height:1.4;
  background:#e6f4f6;
  color:#0e5c6b;
  border-radius:3px;
  padding:2px 4px;
  margin-bottom:2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.calendar-event-time{
  font-weight:600;
  margin-right:3px;
}

.calendar-event-more{
  font-size:11px;
  color:var(--muted);
}

@media (max-width: 880px){
  .calendar-cell{
    height:80px;
  }
}

.status-pill{
  display:inline-block;
  padding:3px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
}

.status-active{
  background:var(--green-light);
  color:var(--green-dark);
}

.status-pending{
  background:var(--orange-light);
  color:var(--orange-dark);
}

/* Phase 4: Estimates */

.field-grid-3{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:16px;
}

.field-grid-3 label{
  display:block;
  font-size:13px;
  font-weight:500;
  margin-bottom:6px;
}

.field-grid-3 input,
.field-grid-3 select{
  width:100%;
  height:38px;
  border:1px solid var(--border);
  border-radius:5px;
  padding:0 12px;
  font-size:14px;
  font-family:inherit;
}

.field-grid-3 input:disabled{
  background:#f9fbfc;
  color:var(--muted);
}

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

.form-card h2{
  margin:0 0 16px;
  font-size:16px;
}

.item-row{
  display:grid;
  grid-template-columns:1.2fr 2fr 0.6fr 0.8fr 0.8fr 32px;
  gap:10px;
  align-items:start;
  padding:8px 0;
  border-bottom:1px solid var(--border);
}

.item-row-head{
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.03em;
  font-weight:600;
  border-bottom:2px solid var(--border);
}

.item-row input[type=text],
.item-row input[type=number]{
  height:34px;
  border:1px solid var(--border);
  border-radius:5px;
  padding:0 10px;
  font-size:13px;
  font-family:inherit;
  width:100%;
}

.item-row textarea.item-description{
  min-height:34px;
  border:1px solid var(--border);
  border-radius:5px;
  padding:7px 10px;
  font-size:13px;
  font-family:inherit;
  line-height:1.4;
  width:100%;
  resize:vertical;
  overflow:hidden;
}

.item-row-title input,
.item-row-title{
  font-weight:600;
}

.item-row-title .item-title-text{
  grid-column:1 / span 4;
}

.item-row-spacer .item-spacer-label{
  grid-column:1 / span 4;
  color:var(--muted);
  font-style:italic;
  font-size:12px;
}

.item-total-display{
  font-weight:600;
  font-size:13px;
}

.remove-item-btn{
  border:0;
  background:transparent;
  color:#B42318;
  cursor:pointer;
  font-size:14px;
}

.item-search-row{
  position:relative;
  margin-top:14px;
}

.item-search-row input{
  width:100%;
  height:40px;
  border:1px solid var(--border);
  border-radius:5px;
  padding:0 14px;
  font-size:14px;
  font-family:inherit;
}

.search-results-dropdown{
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  right:0;
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  box-shadow:0 4px 16px rgba(16,24,40,0.1);
  max-height:320px;
  overflow-y:auto;
  z-index:50;
}

.search-result-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 14px;
  cursor:pointer;
  border-bottom:1px solid var(--border);
  font-size:13px;
}

.search-result-row:last-child{
  border-bottom:none;
}

.search-result-row:hover{
  background:var(--nav-hover);
}

.search-result-row span{
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
  margin-left:12px;
}

.totals-row{
  display:flex;
  justify-content:space-between;
  padding:8px 0;
  border-bottom:1px solid var(--border);
  font-size:14px;
}

.totals-row-grand{
  border-bottom:none;
  font-size:16px;
  padding-top:12px;
}

.status-completed{
  background:var(--blue-light);
  color:var(--blue-dark);
}

/* Phase 10: Dashboard */

.dashboard-tiles{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(160px, 1fr));
  gap:14px;
  margin-bottom:28px;
}

.dashboard-tile{
  background:#fff;
  border:1px solid var(--border);
  border-radius:5px;
  padding:16px 18px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.dashboard-tile span{
  color:var(--muted);
  font-size:12px;
  font-weight:500;
}

.dashboard-tile strong{
  font-size:24px;
  font-weight:700;
}

.dashboard-tile-money strong{
  color:var(--blue-dark);
}

.dashboard-columns{
  display:grid;
  grid-template-columns:1.6fr 1fr;
  gap:20px;
  align-items:start;
}

.activity-feed{
  list-style:none;
  margin:0;
  padding:0;
}

.activity-item{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
  font-size:13px;
}

.activity-item:last-child{
  border-bottom:none;
}

.activity-icon{
  flex:none;
  font-size:14px;
  line-height:1.4;
}

.activity-text{
  flex:1;
  line-height:1.5;
}

.activity-text strong{
  font-weight:600;
  margin-right:4px;
}

.activity-customer{
  color:var(--muted);
}

.activity-time{
  flex:none;
  color:var(--muted);
  font-size:11.5px;
  white-space:nowrap;
}

.quick-list-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 0;
  border-bottom:1px solid var(--border);
  font-size:13px;
  gap:10px;
}

.quick-list-item:last-child{
  border-bottom:none;
}

.quick-list-item a{
  color:var(--blue-dark);
  font-weight:600;
  flex:none;
}

.quick-list-item span{
  color:var(--muted);
  text-align:right;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Phase 11: PWA / mobile responsiveness. Sidebar becomes an off-canvas
   drawer (toggled by .menu-toggle, see layout.php) instead of a permanent
   220px column; wide grids collapse to 1-2 columns; tables/item-editor
   rows scroll horizontally instead of squeezing columns unreadably thin. */

.menu-toggle{
  display:none;
  border:0;
  background:transparent;
  color:var(--text);
  font-size:20px;
  line-height:1;
  flex:none;
  padding:4px 6px;
  cursor:pointer;
}

.sidebar-backdrop{
  display:none;
}

@media (max-width: 880px){
  .menu-toggle{
    display:block;
  }

  .topbar{
    gap:12px;
    padding:0 14px;
  }

  .topbar-search{
    min-width:0;
    margin:0;
  }

  .heading-row{
    flex-direction:column;
    align-items:stretch;
  }

  .user-text{
    display:none;
  }

  .sidebar{
    position:fixed;
    left:-260px;
    top:64px;
    height:calc(100vh - 64px);
    width:240px;
    background:#fff;
    box-shadow:2px 0 16px rgba(16,24,40,0.12);
    transition:left 0.2s ease;
  }

  .sidebar.open{
    left:0;
  }

  .sidebar-backdrop.visible{
    display:block;
    position:fixed;
    inset:64px 0 0 0;
    background:rgba(16,24,40,0.35);
    z-index:80;
  }

  .main{
    padding:20px 16px 24px;
  }

  .form-card{
    max-width:none;
  }

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

  .field-grid-3{
    grid-template-columns:1fr;
  }

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

  .detail-card-left{
    flex-wrap:wrap;
  }

  .detail-summary{
    flex-wrap:wrap;
    gap:16px;
  }

  .detail-actions{
    flex-wrap:wrap;
  }

  table.data-table{
    display:block;
    overflow-x:auto;
    white-space:nowrap;
  }

  .item-rows-scroll{
    overflow-x:auto;
  }

  .item-row{
    min-width:640px;
  }

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

  .preview-sheet{
    padding:24px 18px;
    margin:16px auto;
  }

  .preview-info-cards{
    grid-template-columns:1fr;
  }

  .preview-title-row{
    flex-direction:column;
    gap:12px;
  }

  .preview-doc-meta{
    text-align:left;
  }

  .preview-doc-meta div{
    justify-content:flex-start;
  }
}
