  :root{
    --red:#355E3B;
    --red-dark:#2b4d30;
    --black:#1A1A1A;
    --gray:#686869;
    --light-gray:#f4f4f4;
    --border:#dcdcdc;
    --white:#ffffff;
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    font-family:system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background:var(--light-gray);
    color:var(--black);
  }
  header.site-header{
    background:var(--white);
    border-bottom:4px solid var(--red);
    padding:18px 32px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:12px;
  }
  header.site-header img{
    height:56px;
  }
  .header-right{
    text-align:right;
    color:var(--gray);
    font-size:13px;
  }
  .header-right strong{color:var(--black);}

  /* LOGIN SCREEN */
  #login-screen{
    max-width:420px;
    margin:80px auto;
    background:var(--white);
    border:1px solid var(--border);
    border-top:5px solid var(--red);
    border-radius:4px;
    padding:36px 32px;
    text-align:center;
  }
  #login-screen img{height:70px;max-width:100%;object-fit:contain;margin-bottom:18px;}
  #login-screen h1{
    font-size:20px;
    margin:0 0 4px 0;
    color:var(--black);
  }
  #login-screen p.sub{
    color:var(--gray);
    font-size:13px;
    margin-bottom:24px;
  }
  #login-screen input[type=password]{
    width:100%;
    padding:11px 12px;
    border:1px solid var(--border);
    border-radius:3px;
    font-size:15px;
    margin-bottom:14px;
  }
  #login-screen button{
    width:100%;
    background:var(--red);
    color:#fff;
    border:none;
    padding:12px;
    font-size:15px;
    font-weight:600;
    border-radius:3px;
    cursor:pointer;
  }
  #login-screen button:hover{background:var(--red-dark);}
  #login-error{
    color:var(--red);
    font-size:13px;
    margin-top:10px;
    min-height:16px;
  }
  .login-note{
    margin-top:22px;
    font-size:11px;
    color:var(--gray);
    border-top:1px solid var(--border);
    padding-top:14px;
    text-align:left;
  }
  .login-toggle{
    display:flex;
    gap:8px;
    margin-bottom:18px;
    background:var(--light-gray);
    border-radius:3px;
    padding:4px;
  }
  .login-toggle button{
    flex:1;
    background:none;
    border:none;
    padding:9px;
    font-size:12.5px;
    font-weight:600;
    color:var(--gray);
    border-radius:3px;
    cursor:pointer;
  }
  .login-toggle button.active{
    background:var(--white);
    color:var(--red);
    box-shadow:0 1px 3px rgba(0,0,0,0.12);
  }

  /* MAIN APP */
  nav.tabs{
    background:var(--black);
    display:flex;
    flex-wrap:wrap;
  }
  nav.tabs button{
    background:none;
    border:none;
    color:#fff;
    padding:16px 22px;
    font-size:14px;
    font-weight:600;
    cursor:pointer;
    border-bottom:3px solid transparent;
    letter-spacing:.3px;
  }
  nav.tabs button:hover{background:rgba(255,255,255,0.08);}
  nav.tabs button.active{
    border-bottom:3px solid var(--red);
    background:rgba(53,94,59,0.15);
  }
  main{
    max-width:1100px;
    margin:0 auto;
    padding:32px;
  }
  .panel{display:none;}
  .panel.active{display:block;}
  .panel h2{
    color:var(--red);
    border-bottom:2px solid var(--red);
    padding-bottom:8px;
    margin-top:0;
    font-size:22px;
  }
  .card{
    background:var(--white);
    border:1px solid var(--border);
    border-radius:4px;
    padding:24px;
    margin-bottom:20px;
  }
  .pending-banner{
    background:#fff4e5;
    border:1px solid #f0c36d;
    color:#7a5400;
    padding:10px 14px;
    border-radius:3px;
    font-size:12.5px;
    margin-bottom:18px;
  }

  /* TIME CLOCK */
  .field-group{margin-bottom:16px;}
  .field-group label{
    display:block;
    font-weight:600;
    font-size:13px;
    margin-bottom:6px;
    color:var(--black);
  }
  .field-group input, .field-group select{
    width:100%;
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:3px;
    font-size:14px;
  }
  .clock-row{
    display:flex;
    gap:14px;
    flex-wrap:wrap;
  }
  .clock-row button{
    flex:1;
    min-width:150px;
    padding:14px;
    font-size:15px;
    font-weight:700;
    border:none;
    border-radius:3px;
    cursor:pointer;
    color:#fff;
  }
  #clock-in-btn{background:#2e7d32;}
  #clock-in-btn:hover{background:#256628;}
  #clock-out-btn{background:var(--red);}
  #clock-out-btn:hover{background:var(--red-dark);}
  #clock-status{
    margin-top:14px;
    padding:10px 14px;
    border-radius:3px;
    font-size:13px;
    background:var(--light-gray);
    border-left:4px solid var(--gray);
  }
  #clock-status.live{border-left-color:#2e7d32; background:#eef7ee;}

  table.log-table{
    width:100%;
    border-collapse:collapse;
    margin-top:10px;
    font-size:13px;
  }
  table.log-table th{
    background:var(--red);
    color:#fff;
    text-align:left;
    padding:9px 10px;
  }
  table.log-table td{
    padding:9px 10px;
    border-bottom:1px solid var(--border);
  }
  table.log-table tr:nth-child(even){background:var(--light-gray);}

  .manager-only-badge{
    display:inline-block;
    background:var(--black);
    color:#fff;
    font-size:10.5px;
    text-transform:uppercase;
    letter-spacing:.4px;
    padding:3px 9px;
    border-radius:2px;
    margin-left:10px;
    vertical-align:middle;
  }
  .filter-row{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    align-items:flex-end;
    margin-bottom:16px;
  }
  .filter-row .field-group{
    flex:1;
    min-width:160px;
    margin-bottom:0;
  }
  .filter-row button{
    background:var(--black);
    color:#fff;
    border:none;
    padding:10px 18px;
    border-radius:3px;
    cursor:pointer;
    font-size:13px;
    font-weight:600;
    height:41px;
  }
  .filter-row button:hover{background:#333;}
  .locked-panel{
    text-align:center;
    color:var(--gray);
    padding:50px 20px;
  }
  .locked-panel .lock-icon{font-size:34px; margin-bottom:10px;}

  /* DIRECTORY EDIT TAB */
  .edit-form-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
  }
  .edit-form-grid .field-group.full{grid-column:1 / -1;}
  table.admin-table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
    margin-top:6px;
  }
  table.admin-table th{
    background:var(--black);
    color:#fff;
    text-align:left;
    padding:9px 10px;
  }
  table.admin-table td{
    padding:8px 10px;
    border-bottom:1px solid var(--border);
    vertical-align:middle;
  }
  table.admin-table tr:nth-child(even){background:var(--light-gray);}
  .row-btn{
    border:none;
    border-radius:3px;
    padding:5px 10px;
    font-size:11.5px;
    font-weight:600;
    cursor:pointer;
    color:#fff;
    margin-right:5px;
  }
  .row-btn.edit{background:var(--gray);}
  .row-btn.edit:hover{background:#54545a;}
  .row-btn.delete{background:var(--red);}
  .row-btn.delete:hover{background:var(--red-dark);}
  .save-btn{
    background:var(--red);
    color:#fff;
    border:none;
    padding:11px 24px;
    border-radius:3px;
    font-weight:700;
    font-size:14px;
    cursor:pointer;
  }
  .save-btn:hover{background:var(--red-dark);}
  .cancel-btn{
    background:none;
    color:var(--gray);
    border:1px solid var(--border);
    padding:11px 24px;
    border-radius:3px;
    font-weight:600;
    font-size:14px;
    cursor:pointer;
    margin-left:8px;
  }
  .form-actions{margin-top:18px;}

  /* DOCUMENT UPLOAD (MANAGER ONLY) */
  .upload-zone{
    border:2px dashed var(--border);
    border-radius:4px;
    padding:24px;
    text-align:center;
    background:var(--light-gray);
  }
  .upload-zone input[type=file]{
    margin-top:10px;
  }
  table.doc-table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
    margin-top:14px;
  }
  table.doc-table th{
    background:var(--red);
    color:#fff;
    text-align:left;
    padding:9px 10px;
  }
  table.doc-table td{
    padding:8px 10px;
    border-bottom:1px solid var(--border);
  }
  table.doc-table tr:nth-child(even){background:var(--light-gray);}
  .doc-icon{margin-right:6px;}
  a.site-logo-link{display:inline-block; line-height:0;}
  a.site-logo-link img{cursor:pointer;}

  /* DIRECTORY */
  .directory-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(250px,1fr));
    gap:16px;
  }
  .dir-card{
    background:var(--white);
    border:1px solid var(--border);
    border-left:4px solid var(--red);
    border-radius:4px;
    padding:16px;
  }
  .dir-card .name{font-weight:700; font-size:15px;}
  .dir-card .role{color:var(--red); font-size:12.5px; font-weight:600; margin:3px 0 8px;}
  .dir-card .meta{color:var(--gray); font-size:12.5px; line-height:1.5;}
  .dir-search{
    width:100%;
    padding:11px 14px;
    border:1px solid var(--border);
    border-radius:3px;
    font-size:14px;
    margin-bottom:18px;
  }
  .dept-tag{
    display:inline-block;
    font-size:10.5px;
    text-transform:uppercase;
    letter-spacing:.4px;
    background:var(--light-gray);
    color:var(--gray);
    padding:2px 7px;
    border-radius:2px;
    margin-top:6px;
  }

  /* POLICIES */
  .policy-item{
    border-bottom:1px solid var(--border);
    padding:14px 0;
  }
  .policy-item:last-child{border-bottom:none;}
  .policy-item .ptitle{font-weight:700; font-size:14.5px;}
  .policy-item .pdesc{color:var(--gray); font-size:13px; margin-top:3px;}
  .placeholder-box{
    border:2px dashed var(--border);
    border-radius:4px;
    padding:30px;
    text-align:center;
    color:var(--gray);
    font-size:13.5px;
  }

  footer.portal-footer{
    text-align:center;
    color:var(--gray);
    font-size:11.5px;
    padding:24px;
    border-top:1px solid var(--border);
  }

  /* ---------- added for the live app ---------- */
  [hidden]{display:none !important;}
  #app{display:block;}
  #login-screen input[type=text], #login-screen input[type=password]{
    width:100%; padding:11px 12px; border:1px solid var(--border); border-radius:3px;
    font-size:16px; margin-bottom:14px;
  }
  #login-screen label{display:block; text-align:left; font-size:12.5px; font-weight:600; margin-bottom:5px;}
  #login-screen .form-error, .form-error{color:var(--red); font-size:13px; margin-top:10px; min-height:16px;}
  #loading{ text-align:center; color:var(--gray); margin:120px auto; font-size:14px; }
  .header-right a{color:var(--red);}
  .header-right .sep{margin:0 6px; color:var(--border);}
  h3.card-title{margin-top:0; color:var(--black); font-size:15px;}
  p.hint{color:var(--gray); font-size:12.5px; margin-top:-6px;}
  .field-group input, .field-group select, .field-group textarea{font-size:16px; font-family:inherit; background:#fff;}
  .field-group input[type=checkbox]{width:auto; margin-right:8px;}
  .check-row{display:flex; align-items:flex-start; gap:10px; padding:12px 0; border-bottom:1px solid var(--border); font-size:14px;}
  .check-row:last-child{border-bottom:none;}
  .check-row input{margin-top:3px; width:18px; height:18px; flex:none;}
  .check-row .sub{display:block; color:var(--gray); font-size:12.5px; margin-top:2px;}
  .clock-row button:disabled{opacity:.35; cursor:not-allowed;}
  .grid-3{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px;}
  .table-wrap{overflow-x:auto;}
  table.log-table td.num, table.log-table th.num{text-align:right;}
  .tag{display:inline-block; font-size:10.5px; text-transform:uppercase; letter-spacing:.4px; padding:2px 7px; border-radius:2px; background:var(--light-gray); color:var(--gray); margin-left:6px; white-space:nowrap;}
  .tag.live{background:#eef7ee; color:#2e7d32;}
  .tag.mgr{background:var(--black); color:#fff;}
  .tag.warn{background:#fff4e5; color:#7a5400;}
  .totals{font-size:13px; color:var(--gray); margin-top:10px;}
  .totals strong{color:var(--black);}
  .btn-dark{background:var(--black); color:#fff; border:none; padding:10px 18px; border-radius:3px; cursor:pointer; font-size:13px; font-weight:600;}
  .btn-dark:hover{background:#333;}
  .btn-green{background:#2e7d32; color:#fff; border:none; padding:10px 18px; border-radius:3px; cursor:pointer; font-size:13px; font-weight:600;}
  .btn-green:hover{background:#256628;}
  .btn-row{display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:14px;}
  a.doc-link{color:var(--red); font-weight:600; text-decoration:none;}
  a.doc-link:hover{text-decoration:underline;}
  .copy-box{display:flex; gap:8px; margin-top:12px;}
  .copy-box input{flex:1; padding:10px 12px; border:1px solid var(--border); border-radius:3px; font-family:Consolas,Menlo,monospace; font-size:12.5px; background:var(--light-gray);}
  ol.steps{font-size:13.5px; line-height:1.7; padding-left:20px; margin:10px 0 0;}
  #toast{position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:var(--black); color:#fff; padding:12px 20px; border-radius:4px; font-size:14px; box-shadow:0 4px 14px rgba(0,0,0,.25); z-index:50; max-width:90vw;}
  #toast.error{background:var(--red);}
  dialog{border:none; border-top:5px solid var(--red); border-radius:4px; padding:24px; width:min(520px,92vw); box-shadow:0 10px 40px rgba(0,0,0,.3);}
  dialog::backdrop{background:rgba(0,0,0,.45);}
  dialog h3{margin-top:0;}
  @media (max-width:640px){
    header.site-header{padding:12px 16px;}
    header.site-header img{height:40px;}
    main{padding:16px;}
    nav.tabs button{padding:13px 14px; font-size:13px;}
    .card{padding:16px;}
    .edit-form-grid{grid-template-columns:1fr;}
    #login-screen{margin:30px 14px;}
  }
  td.nw{white-space:nowrap;}
  @media (max-width:640px){ table.log-table{font-size:12.5px;} table.log-table th, table.log-table td{padding:8px 6px;} }

  /* ---------- two doors, staff view, administrator fixes ---------- */
  #login-screen.admin-door{border-top-color:var(--black);}
  #login-screen.admin-door button{background:var(--black);}
  #login-screen.admin-door button:hover{background:#333;}
  .login-note a{color:var(--red);}
  a.door-btn{display:block; text-decoration:none; border-radius:4px; padding:18px 16px; margin-bottom:12px; color:#fff; text-align:left;}
  a.door-btn strong{display:block; font-size:17px;}
  a.door-btn span{display:block; font-size:12.5px; opacity:.85; margin-top:3px;}
  a.door-btn.staff{background:var(--red);}
  a.door-btn.staff:hover{background:var(--red-dark);}
  a.door-btn.admin{background:var(--black);}
  a.door-btn.admin:hover{background:#333;}
  .card-head{display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:8px;}
  .card-head h3{margin:0;}
  .card-head select{padding:8px 10px; border:1px solid var(--border); border-radius:3px; font-size:14px; background:#fff;}
  .card-head + p.hint{margin-top:0;}
  .card.attention{border-left:4px solid #f0c36d;}
  .still-row{display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--border);}
  .still-row small{color:var(--gray);}
  .tag.fix{background:#e8eef7; color:#1f4e8c;}
  td small{color:var(--gray);}
  #clock-in-btn, #clock-out-btn{padding:20px; font-size:19px;}
  #clock-status{font-size:14.5px; line-height:1.5;}

  /* the staff sheet: name, job, date, clock in / clock out */
  .sheet-row{display:flex; flex-direction:column; gap:4px; padding:10px 0; border-bottom:1px solid var(--border);}
  .sheet-label{font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--gray);}
  .sheet-name{font-size:24px; font-weight:700; color:var(--black);}
  .sheet-value{font-size:16px;}
  .sheet-row input{width:100%; padding:12px; border:1px solid var(--border); border-radius:3px; font-size:16px; font-family:inherit;}
  #clock-card .clock-row{margin-top:18px; flex-wrap:nowrap;}
  .clock-cell{flex:1; min-width:0; text-align:center;}
  .clock-cell button{width:100%; min-width:0;}
  .clock-time{font-size:13px; color:var(--gray); margin-top:8px;}
  .clock-time strong{color:var(--black);}
  td.date{white-space:nowrap;}
  .narrow{display:none;}
  @media (max-width:640px){ .wide{display:none;} .narrow{display:inline;} table.log-table th{white-space:nowrap;} .header-right{font-size:12px;} #mgr-log-body .wide{display:inline;} #mgr-log-body .narrow{display:none;} }
  @media (max-width:640px){
    #my-log-body .tag{display:block; white-space:normal; margin:3px 0 0; width:fit-content; font-size:9.5px; padding:1px 5px;}
    table.log-table th, table.log-table td{padding:8px 5px;}
    #my-log-body td.nw, #my-log-body td.date{font-size:12px;}
    .card{padding:14px;}
  }

  /* ---------- phones: iPhone and Android ---------- */
  html{-webkit-text-size-adjust:100%; text-size-adjust:100%;}
  body{-webkit-tap-highlight-color:transparent; overflow-wrap:anywhere;}
  button, a.door-btn, nav.tabs button, select, input{touch-action:manipulation; font-family:inherit;}
  button{-webkit-appearance:none; appearance:none;}
  input, select{border-radius:3px;}
  input[type=date], input[type=time]{min-height:44px; -webkit-appearance:none; appearance:none; background:#fff;}
  /* keep clear of notches, rounded corners and the gesture bar */
  header.site-header{padding-top:max(18px, env(safe-area-inset-top)); padding-left:max(32px, env(safe-area-inset-left)); padding-right:max(32px, env(safe-area-inset-right));}
  footer.portal-footer{padding-bottom:max(24px, env(safe-area-inset-bottom));}
  #toast{bottom:calc(24px + env(safe-area-inset-bottom));}
  #install-area{margin-top:14px; font-size:12.5px; color:var(--gray); text-align:left;}
  #install-area button{width:100%; background:#fff !important; color:var(--black); border:1px solid var(--border); padding:12px; border-radius:3px; font-size:14px; font-weight:600; cursor:pointer;}
  @media (max-width:640px){
    header.site-header{padding-top:max(12px, env(safe-area-inset-top)); padding-left:max(16px, env(safe-area-inset-left)); padding-right:max(16px, env(safe-area-inset-right));}
    .header-right{text-align:left; width:100%;}
    .header-right a{display:inline-block; padding:10px 0;}            /* thumb-sized targets */
    .row-btn{padding:9px 12px; font-size:12.5px; margin-bottom:4px;}
    .filter-row .field-group{min-width:100%;}
    .filter-row button{flex:1; height:46px;}
    .still-row{flex-direction:column; align-items:stretch;}
    .still-row button{padding:13px;}
    .btn-dark, .btn-green, .save-btn, .cancel-btn{padding:13px 18px; font-size:14px;}
    .copy-box{flex-direction:column;}
    dialog{padding:18px;}
    dialog .grid-3{grid-template-columns:1fr 1fr;}
  }
  @media (max-width:360px){ .sheet-name{font-size:21px;} #clock-in-btn, #clock-out-btn{font-size:17px; padding:18px 8px;} }
  td.num, th.num{white-space:nowrap;}
  @media (max-width:380px){
    main{padding:12px;} .card{padding:12px;}
    #my-log-body td, #my-log-body ~ * th{padding:8px 3px;}
    table.log-table th{padding:8px 3px; font-size:12px;}
    #my-log-body td{font-size:12px; padding:8px 3px;}
    #my-log-body td.nw, #my-log-body td.date, #my-log-body td.num{font-size:11px;}
  }

  /* ---------- export bar at the bottom of every administrator screen, OneDrive card ---------- */
  #export-bar{max-width:1100px; margin:0 auto 24px; padding:16px 32px; display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; border-top:2px solid var(--border);}
  #export-bar .export-label{font-weight:700; font-size:14px; margin-right:auto;}
  #export-bar select{padding:10px; border:1px solid var(--border); border-radius:3px; font-size:14px; background:#fff;}
  a.as-link{display:inline-block; text-decoration:none; text-align:center;}
  .od-status{display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:14px; font-size:14.5px;}
  .od-note{margin-top:14px !important;}
  @media (max-width:640px){
    #export-bar{padding:14px 16px;}
    #export-bar .export-label{width:100%;}
    #export-bar select{width:100%;}
    #export-bar button{flex:1;}
  }

  /* OneDrive setup directions inside the app */
  details.od-help{margin-top:18px; border-top:1px solid var(--border); padding-top:14px;}
  details.od-help summary{cursor:pointer; font-weight:700; font-size:14.5px; color:var(--red); padding:6px 0;}
  details.od-help h4{margin:20px 0 4px; font-size:14.5px; color:var(--black);}
  details.od-help h4 .who{display:block; font-weight:400; font-size:12.5px; color:var(--gray); margin-top:2px;}
  details.od-help ul.steps{font-size:13.5px; line-height:1.7; padding-left:20px; margin:10px 0 0;}
  details.od-help code{background:var(--light-gray); padding:2px 6px; border-radius:3px; font-size:12.5px; overflow-wrap:anywhere;}
  details.od-help li{margin-bottom:6px;}

  /* privacy and support pages */
  main.legal{max-width:760px; margin:0 auto; padding:32px 20px 60px; background:#fff; min-height:100vh; line-height:1.6;}
  main.legal .legal-logo{height:54px; margin-bottom:18px;}
  main.legal h3{margin:26px 0 6px; font-size:16px; color:var(--black);}
  main.legal ul{padding-left:22px;} main.legal li{margin-bottom:8px;}
  main.legal a{color:var(--red);}

/* Schedule and payroll report (custom work on top of the template) */
.week-nav{margin:0 0 14px;}
.week-nav button{flex:1; min-width:120px;}
.rate-input{width:110px; padding:8px 10px; border:1px solid var(--border); border-radius:3px; font-size:16px; font-family:inherit;}
.log-table tr.total-row td{border-top:2px solid var(--black); background:#fff;}
#my-shifts-card .hint{margin-top:0;}
#pay-warn .pending-banner{margin-bottom:10px;}

/* Projects (custom work on top of the template) */
.sheet-pick{flex:1; display:flex; flex-direction:column; gap:8px; min-width:0;}
.sheet-pick select,.sheet-pick input{width:100%; padding:12px; border:1px solid var(--border); border-radius:3px; font-size:16px; font-family:inherit; background:#fff;}
.switch-row{display:flex; flex-direction:column; align-items:stretch; gap:8px; margin-top:16px; padding-top:16px; border-top:1px solid var(--border);}
.switch-row .btn-dark{width:100%; padding:14px; font-size:16px;}
@media (min-width:641px){
  .switch-row{display:grid; grid-template-columns:1fr auto; align-items:end; gap:8px 12px;}
  .switch-row .sheet-label{grid-column:1 / -1;}
  .switch-row .btn-dark{width:auto; white-space:nowrap; padding:12px 20px;}
}
/* The pop-up message never blocks a tap. On phones it sits at the top, clear of the clock buttons. */
#toast{pointer-events:none;}
@media (max-width:640px){
  #toast{top:calc(12px + env(safe-area-inset-top)); bottom:auto; width:max-content; max-width:calc(100vw - 32px); text-align:center;}
}
