@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root{
  color-scheme:light;
  --ink:#0A2A36;
  --muted:#5B8A9A;
  --blue:#0099cc;
  --blue2:#007aad;
  --line:#e0f0f7;
  --soft:#f7fbfd;
  --bg:#f8fafb;
  --danger:#b91c1c;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  background:var(--bg);
  font-family:'Plus Jakarta Sans',sans-serif;
  color:var(--ink);
}

.topbar{
  height:64px;
  background:#003d52;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 28px;
  position:sticky;
  top:0;
  z-index:10;
  box-shadow:0 4px 18px #003d5218;
}

.brand{
  color:#fff;
  text-decoration:none;
  font-weight:700;
  letter-spacing:.08em;
}

.container{
  max-width:1280px;
  margin:auto;
  padding:28px 22px;
}

.hero{
  text-align:center;
  padding:42px 0 26px;
}

.logo{
  width:58px;
  height:58px;
  border-radius:14px;
  background:var(--blue);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:22px;
  font-weight:700;
  margin:0 auto 14px;
}

.hero h1,
.auth-card h1{
  margin:0;
  font-size:28px;
}

.hero p,
.auth-card p,
.page-head p{
  color:var(--muted);
}

.portal-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:18px;
}

.portal{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:28px;
  text-decoration:none;
  color:var(--ink);
  display:flex;
  flex-direction:column;
  gap:7px;
  box-shadow:0 8px 30px #003d5208;
  transition:.2s;
}

.portal:hover{
  transform:translateY(-3px);
  border-color:#9bd7e8;
}

.portal b{
  font-size:28px;
}

.portal span{
  font-size:18px;
  font-weight:700;
}

.portal small{
  color:var(--muted);
}

.auth-card,
.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:24px;
  box-shadow:0 8px 30px #003d5208;
}

.auth-card{
  max-width:440px;
  margin:60px auto;
  text-align:center;
}

.auth-card form{
  text-align:left;
}

.back{
  display:inline-block;
  margin-top:18px;
  color:var(--muted);
  text-decoration:none;
}

.page-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:20px;
}

.page-head h1{
  font-size:24px;
  margin:0;
}

.metric-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:18px 0;
}

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

.metric small{
  display:block;
  color:var(--muted);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:600;
}

.metric strong{
  font-family:'JetBrains Mono';
  font-size:25px;
}

.panel{
  margin:16px 0;
}

.panel h2{
  font-size:17px;
  margin-top:0;
}

.feature-toggle-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.feature-toggle-row p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:13px;
}

.feature-toggle-row + .feature-toggle-row{
  margin-top:16px;
  padding-top:16px;
  border-top:1px solid var(--line);
}

.panel h3{
  color:var(--muted);
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.05em;
  margin:20px 0 8px;
}

.narrow{
  max-width:760px;
  margin:30px auto;
}

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

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

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

label{
  display:block;
  color:var(--muted);
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.05em;
  margin:10px 0;
}

input,
select,
textarea{
  width:100%;
  margin-top:6px;
  border:1px solid #C8E8F0;
  border-radius:8px;
  background:var(--soft);
  padding:11px 12px;
  font:inherit;
  color:var(--ink);
}

input:focus,
select:focus{
  outline:2px solid #0099cc33;
  border-color:var(--blue);
  background:#fff;
}

button,
.button{
  border:0;
  border-radius:8px;
  padding:10px 18px;
  font:600 13px 'Plus Jakarta Sans';
  cursor:pointer;
  text-decoration:none;
  display:inline-block;
}

.primary{
  background:var(--blue);
  color:#fff;
}

.primary:hover{
  background:var(--blue2);
}

.ghost{
  background:#e0f2f9;
  color:#003d52;
  border:1px solid #C8E8F0;
}

.danger{
  background:#dc2626;
  color:#fff;
}

.warn{
  background:#f59e0b;
  color:#fff;
}

.small{
  padding:6px 9px;
}

.alert[hidden]{
  display:none;
}

.alert{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  border-radius:10px;
  padding:13px 15px;
  margin-bottom:14px;
  transition:opacity .25s ease;
}

.alert.is-hiding{
  opacity:0;
}

.alert-countdown{
  flex:0 0 auto;
  min-width:32px;
  padding:3px 7px;
  border-radius:999px;
  background:rgba(0, 35, 48, .08);
  font-size:12px;
  font-weight:700;
  text-align:center;
}

.alert.success{
  background:#dcfce7;
  color:#15803d;
  border:1px solid #bbf7d0;
}

.alert.error{
  background:#fef2f2;
  color:#b91c1c;
  border:1px solid #fecaca;
}

.table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:10px;
}

table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

th,
td{
  padding:11px 12px;
  text-align:left;
  border-bottom:1px solid var(--line);
  font-size:13px;
}

th{
  background:var(--soft);
  font-size:10px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.06em;
}

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

.inline input{
  width:140px;
  margin:0;
  padding:7px;
}

.badge{
  background:#e0f2f9;
  color:#003d52;
  border-radius:99px;
  padding:4px 8px;
  font-size:11px;
}

.camera{
  margin:16px 0;
  padding:12px;
  border:1px dashed #9bd7e8;
  border-radius:10px;
  background:var(--soft);
}

video{
  width:100%;
  max-height:300px;
  border-radius:8px;
  background:#dbeafe;
  display:block;
  margin-bottom:10px;
}

@media(max-width:900px){
  .portal-grid,
  .columns{
    grid-template-columns:1fr 1fr;
  }

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

@media(max-width:600px){
  .portal-grid,
  .columns,
  .form-grid,
  .metric-grid{
    grid-template-columns:1fr;
  }

  .container{
    padding:18px 12px;
  }

  .page-head{
    align-items:flex-start;
    gap:12px;
  }

  .topbar{
    padding:0 16px;
  }

  .span2{
    grid-column:auto;
  }
}


/* =========================================================
   ÁREA MODERNA DO COLABORADOR
   ========================================================= */

body.ponto-modern{
  background:#eef8fc;
  min-height:100vh;
}

.ponto-modern .topbar{
  display:none;
}

.ponto-modern .container{
  max-width:none;
  margin:0;
  padding:0;
}

.ponto-modern .alert{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  width:min(520px,calc(100% - 32px));
  margin:12px auto;
  box-shadow:0 10px 35px #003d5220;
  transition:opacity .25s ease;
}

.ponto-modern .alert.is-hiding{
  opacity:0;
}

.ponto-modern .alert-countdown{
  flex:0 0 auto;
  min-width:32px;
  padding:3px 7px;
  border-radius:999px;
  background:rgba(255,255,255,.65);
  font-size:12px;
  font-weight:700;
  text-align:center;
}

.ponto-app{
  min-height:100vh;
  background:#eef8fc;
  color:#101010;
}


/* Navegação Ponto / Registos */
.ponto-tabs{
  height:52px;
  background:#fff;
  border-bottom:1px solid #e7dfda;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  padding:6px 8px;
  position:sticky;
  top:0;
  z-index:20;
}

.ponto-tab{
  border:0;
  background:transparent;
  border-radius:12px;
  color:#9a918c;
  text-transform:uppercase;
  letter-spacing:.04em;
  font:500 10px 'Plus Jakarta Sans';
  cursor:pointer;
}

.ponto-tab.is-active{
  background:#dff3fb;
  color:#0097ca;
}


/* Estrutura principal */
.ponto-shell{
  width:min(344px,calc(100% - 32px));
  margin:0 auto;
  padding:28px 0 72px;
}


/* =========================================================
   CABEÇALHO COMUM DO COLABORADOR
   ========================================================= */

.ponto-user-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  width:100%;
  margin:0 0 20px;
  padding:0;
}

.ponto-user-info{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  flex:1;
}

.ponto-user-avatar{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:50%;
  background:#d8f0fa;
  display:grid;
  place-items:center;
  color:#0a2a36;
  font-size:0;
}

.ponto-user-avatar:after{
  content:attr(data-initials);
  font-size:11px;
  font-weight:700;
  letter-spacing:.02em;
}

.ponto-user-name{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#111;
  font-size:12px;
  font-weight:600;
  line-height:1.2;
}

.ponto-header-logout{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:9px 12px;
  border:1px solid #f2b8b8;
  border-radius:9px;
  background:#fff5f5;
  color:#d33b3b;
  text-decoration:none;
  font-size:9px;
  font-weight:600;
  line-height:1;
  white-space:nowrap;
  transition:
    background-color .15s ease,
    border-color .15s ease,
    color .15s ease;
}

.ponto-header-logout:hover{
  background:#ffe8e8;
  border-color:#e99696;
  color:#bd2525;
}

.ponto-header-logout:focus-visible{
  outline:2px solid #d33b3b33;
  outline-offset:2px;
}


/* Data */
.ponto-date{
  text-align:center;
  color:#168bb8;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:9px;
  margin:0 0 12px;
}


/* Separadores internos */
.ponto-view{
  display:none;
}

.ponto-view.is-active{
  display:block;
}


/* Relógio */
.ponto-clock{
  text-align:center;
  font-family:'JetBrains Mono',monospace;
  font-size:46px;
  line-height:1;
  font-weight:500;
  letter-spacing:-.08em;
  color:#111;
}

.ponto-context{
  text-align:center;
  text-transform:uppercase;
  letter-spacing:.14em;
  color:#9d8f88;
  font-size:8px;
  font-weight:700;
  margin:13px 0 24px;
}


/* Formulário do ponto */
.ponto-form select,
.filter-field select,
.filter-grid input{
  margin:6px 0 0;
  background:#fff;
  border:1px solid #e5dcd6;
  color:#141414;
  min-height:48px;
  height:48px;
  border-radius:12px;
  padding:11px 13px;
  font-size:13px;
}

.field-label,
.filter-field>span,
.filter-grid label>span{
  display:block;
  color:#168bb8;
  text-transform:uppercase;
  letter-spacing:.07em;
  font-size:10px;
  font-weight:500;
  margin:0;
}

.cliente-wrap{
  margin-top:14px;
}

.cliente-wrap.is-compact{
  margin-top:12px;
}


/* Turno em curso */
.current-shift{
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#fff;
  border:1px solid #e5dcd6;
  border-radius:10px;
  padding:10px 12px;
  margin-bottom:12px;
  font-size:10px;
  text-transform:uppercase;
  color:#8b817c;
}

.current-shift strong{
  font-family:'JetBrains Mono';
  font-size:15px;
  color:#111;
}

.pause-status{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  min-height:54px;
  margin-top:18px;
  padding:12px 16px;
  border:1px solid #f3c45b;
  border-radius:13px;
  background:#fff3bf;
  color:#76520a;
  font-size:13px;
  font-weight:700;
}

.pause-status strong{
  font-family:'JetBrains Mono',monospace;
  font-size:16px;
  color:#5f4309;
  font-variant-numeric:tabular-nums;
}


/* Botões do ponto */
.ponto-action{
  width:100%;
  min-height:54px;
  height:auto;
  padding:14px 16px;
  border-radius:13px;
  margin-top:32px;
  color:#fff;
  font-weight:600;
  font-size:13px;
  line-height:1.2;
}

.action-entry,
.action-resume{
  background:#18a94d;
}

.action-entry:hover,
.action-resume:hover{
  background:#138d40;
}

.action-pause{
  background:#e6a51d;
  margin-top:18px;
}

.action-exit{
  background:#e44d4d;
  margin-top:10px;
}


/* Filtros */
.section-rule{
  display:flex;
  align-items:center;
  gap:10px;
  margin:9px 0 10px;
  color:#168bb8;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:9px;
  font-weight:600;
}

.section-rule:after{
  content:"";
  height:1px;
  background:#9ad1e5;
  flex:1;
}

.filter-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.filter-field{
  margin:16px 0 0;
}

.date-input-shell{
  position:relative;
  display:block;
  width:100%;
}

.date-input-shell > input[type="text"]{
  width:100%;
  padding-right:45px;
}

.date-picker-control{
  position:absolute;
  top:0;
  right:0;
  bottom:0;
  width:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
  cursor:pointer;
  pointer-events:none;
}

.date-picker-native{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  margin:0;
  opacity:0;
  pointer-events:auto;
  cursor:pointer;
}

.records-filter-form{
  margin:0;
}

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

.filter-submit,
.filter-clear{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:54px;
  border-radius:13px;
  padding:14px 16px;
  font:600 13px 'Plus Jakarta Sans';
  line-height:1.2;
  text-align:center;
  text-decoration:none;
}

.filter-submit{
  border:0;
  background:#168bb8;
  color:#fff;
  cursor:pointer;
  flex:1;
}

.filter-clear{
  border:1px solid #9ad1e5;
  background:#fff;
  color:#168bb8;
  flex:1;
}

.filter-error{
  margin:12px 0 0;
  padding:9px 10px;
  border-radius:10px;
  background:#fff1f1;
  color:#b42318;
  font-size:9px;
}


/* Resumo dos registos */
.filter-selection-summary{
  display:flex;
  flex-wrap:wrap;
  gap:5px 12px;
  margin:18px 0 10px;
  padding:10px 12px;
  border:1px solid #b9dfee;
  border-radius:11px;
  background:#f5fcff;
  color:#52646b;
  font-size:10px;
  line-height:1.4;
}

.filter-selection-summary strong{
  color:#168bb8;
  font-weight:700;
}

.record-summary{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:0 0 14px;
}

.record-summary>div{
  background:#fff;
  border:1px solid #e5dcd6;
  border-radius:13px;
  padding:12px;
}

.record-summary small{
  display:block;
  color:#8f8580;
  text-transform:uppercase;
  letter-spacing:.09em;
  font-size:7px;
  margin-bottom:8px;
}

.record-summary strong{
  font-family:'JetBrains Mono';
  font-size:18px;
}

.record-summary span{
  font-size:9px;
  color:#8f8580;
}

.account-view{
  max-width:520px;
  margin:0 auto;
  padding-bottom:30px;
}

.account-view > h2{
  margin:0 0 6px;
  font-size:19px;
}

.account-help{
  margin:0 0 16px;
  color:#756e69;
  font-size:11px;
  line-height:1.5;
}

.account-readonly-data{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin:0 0 14px;
}

.account-readonly-data div,
.account-card{
  border:1px solid #e5dcd6;
  border-radius:13px;
  background:#fff;
}

.account-readonly-data div{
  padding:10px 12px;
}

.account-readonly-data dt{
  color:#8f8580;
  font-size:8px;
  text-transform:uppercase;
}

.account-readonly-data dd{
  margin:4px 0 0;
  font-size:12px;
  font-weight:700;
  overflow-wrap:anywhere;
}

.account-card{
  margin-top:12px;
  padding:14px;
}

.account-card h3{
  margin:0 0 5px;
  font-size:15px;
}

.account-card p{
  margin:0 0 12px;
  color:#756e69;
  font-size:10px;
  overflow-wrap:anywhere;
}

.account-card label{
  display:block;
  margin-top:10px;
  color:#168bb8;
  font-size:9px;
  font-weight:700;
  text-transform:uppercase;
}

.account-card input{
  width:100%;
  min-height:48px;
  margin-top:6px;
  padding:11px 13px;
  border:1px solid #e5dcd6;
  border-radius:12px;
  background:#fff;
  color:#111;
  font-size:13px;
}

.account-card button{
  width:100%;
  min-height:48px;
  margin-top:10px;
}

.account-code-form{
  margin-top:14px;
  padding-top:4px;
  border-top:1px solid #edf0f1;
}

.account-channel-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.whatsapp-button{
  border:1px solid #25d366;
  border-radius:12px;
  background:#effcf4;
  color:#117a37;
  font-weight:700;
}

.whatsapp-button:disabled{
  border-color:#d8d8d8;
  background:#f4f4f4;
  color:#999;
}

.recovery-confirm-form{
  margin-top:20px;
  padding-top:18px;
  border-top:1px solid #e5dcd6;
}

@media(max-width:420px){
  .account-readonly-data,
  .account-channel-actions{
    grid-template-columns:1fr;
  }
}


/* Lista de registos */
.records-list{
  display:grid;
  gap:9px;
}

.record-card{
  position:relative;
  background:#fff;
  border:1px solid #e5dcd6;
  border-radius:13px;
  padding:12px;
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px 12px;
}

.record-card time{
  display:block;
  color:#168bb8;
  font-size:8px;
  margin-bottom:3px;
}

.record-card strong{
  display:block;
  font-size:11px;
}

.record-time{
  text-align:right;
  font-size:9px;
}

.record-time span{
  display:block;
  color:#8f8580;
}

.record-time b{
  font-family:'JetBrains Mono';
  font-size:12px;
}

.record-pausas{
  margin-top:4px;
  font-size:8px;
  color:#8f8580;
  text-align:right;
}

.record-pausas small{
  text-transform:uppercase;
  letter-spacing:.04em;
}

.record-pausas ul{
  list-style:none;
  margin:2px 0 0;
  padding:0;
}

.record-pausas li{
  font-family:'JetBrains Mono';
}

.record-status{
  grid-column:1/-1;
  width:max-content;
  border-radius:99px;
  padding:3px 7px;
  font-size:7px;
  text-transform:uppercase;
  letter-spacing:.06em;
}

.record-status.approved{
  background:#dcfce7;
  color:#15803d;
}

.record-status.pending{
  background:#dff3fb;
  color:#087b9f;
}

.record-status.rejected{
  background:#fee2e2;
  color:#b91c1c;
}

.empty-state{
  text-align:center;
  color:#8f8580;
  font-size:11px;
  padding:18px;
}


/* Janela de confirmação */
.capture-dialog{
  border:0;
  padding:0;
  border-radius:18px;
  width:min(420px,calc(100% - 28px));
  box-shadow:0 24px 80px #003d5240;
}

.capture-dialog::backdrop{
  background:#003d5270;
  backdrop-filter:blur(3px);
}

.capture-card{
  position:relative;
  padding:22px;
  margin:0;
}

.capture-card h2{
  font-size:18px;
  margin:0 0 5px;
}

.capture-card p{
  font-size:11px;
  color:#5b8a9a;
  margin:0 0 15px;
}

.capture-card video{
  max-height:300px;
  aspect-ratio:4/3;
  object-fit:cover;
  margin:0;
}

.capture-close{
  position:absolute;
  right:12px;
  top:10px;
  background:transparent;
  color:#5b8a9a;
  font-size:24px;
  padding:4px 8px;
}

.capture-state{
  font-size:10px;
  color:#5b8a9a;
  margin:10px 0;
}

.capture-button,
.confirm-button{
  width:100%;
  margin-top:8px;
}

.capture-button{
  background:#dff3fb;
  color:#006f96;
}

.confirm-button{
  background:#18a94d;
  color:#fff;
}

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


/* =========================================================
   RESPONSIVIDADE DA ÁREA DO COLABORADOR
   ========================================================= */

@media(min-width:700px){
  .ponto-shell{
    padding-top:47px;
  }

  .ponto-tabs{
    gap:0;
  }

  .ponto-tab{
    border-radius:12px;
  }

}

@media(max-width:420px){
  .ponto-shell{
    width:calc(100% - 28px);
    padding-top:22px;
  }

  .ponto-user-header{
    gap:10px;
    margin-bottom:18px;
  }

  .ponto-user-info{
    gap:9px;
  }

  .ponto-user-avatar{
    width:32px;
    height:32px;
    flex-basis:32px;
  }

  .ponto-user-name{
    font-size:11px;
  }

  .ponto-header-logout{
    min-height:44px;
    padding:11px 13px;
    font-size:10px;
  }

  .ponto-clock{
    font-size:42px;
  }
}


/* =========================================================
   PAINEL ADMINISTRATIVO POR ABAS
   ========================================================= */

.admin-page-head p{
  margin:6px 0 0;
  color:var(--muted);
}

.admin-tabs{
  display:flex;
  gap:6px;
  overflow-x:auto;
  padding:6px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:13px;
  position:sticky;
  top:76px;
  z-index:8;
  box-shadow:0 8px 25px #003d5208;
}

.admin-tab{
  flex:1;
  min-width:125px;
  background:transparent;
  color:var(--muted);
  border:1px solid transparent;
  white-space:nowrap;
}

.admin-tab:hover{
  background:var(--soft);
  color:var(--ink);
}

.admin-tab.is-active{
  background:#003d52;
  color:#fff;
  box-shadow:0 5px 14px #003d5228;
}

.admin-tab-panel{
  display:none;
  padding-top:2px;
}

.admin-tab-panel.is-active{
  display:block;
}

.admin-welcome{
  min-height:150px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.admin-welcome p{
  color:var(--muted);
  max-width:650px;
  line-height:1.6;
}

.admin-section-grid{
  display:grid;
  grid-template-columns:minmax(280px,360px) minmax(0,1fr);
  gap:16px;
  align-items:start;
}

.admin-form-panel{
  position:sticky;
  top:148px;
}

.admin-list-panel{
  min-width:0;
}

.admin-location-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  align-items:start;
}

.admin-form-card{
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--soft);
  padding:16px;
}

.admin-form-card h3{
  margin:0 0 12px;
  font-size:14px;
}

.association-cards{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:18px;
}

.association-card{
  min-width:0;
  padding:16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--soft);
}

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

.association-card-head h3{
  margin:2px 0 0;
  font-size:14px;
}

.association-card-kicker{
  display:block;
  color:var(--muted);
  font-size:10px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.association-count{
  display:grid;
  place-items:center;
  min-width:28px;
  height:28px;
  padding:0 8px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:var(--blue);
  font-size:12px;
  font-weight:700;
}

.association-groups{
  display:grid;
  gap:10px;
}

.association-group{
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
}

.association-group-head{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  background:#eef7fa;
}

.association-type-label{
  flex:0 0 auto;
  color:var(--muted);
  font-size:9px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.association-group-local{
  min-width:0;
  color:#193946;
  font-size:12px;
  line-height:1.35;
  overflow-wrap:anywhere;
}

.association-group-body{
  padding:10px 12px 11px;
}

.association-group-body > .association-type-label{
  display:block;
  margin-bottom:6px;
}

.edit-user-locais-list{
  margin-top:8px;
}

.association-members{
  display:grid;
  gap:5px;
  margin:0;
  padding:0;
  list-style:none;
}

.association-members li{
  position:relative;
  min-width:0;
  padding:6px 9px 6px 25px;
  border-radius:7px;
  background:var(--soft);
  color:#426775;
  font-size:11px;
  line-height:1.35;
  overflow-wrap:anywhere;
}

.association-members li::before{
  content:'→';
  position:absolute;
  left:9px;
  top:6px;
  color:var(--blue);
  font-weight:700;
}

.association-empty{
  margin:0;
  padding:13px;
  border:1px dashed var(--line);
  border-radius:10px;
  background:#fff;
  color:var(--muted);
  font-size:12px;
  text-align:center;
}

.admin-filter-action{
  display:flex;
  align-items:end;
  padding-bottom:10px;
}

@media(max-width:1000px){
  .admin-section-grid{
    grid-template-columns:1fr;
  }

  .admin-form-panel{
    position:static;
  }

  .admin-location-grid{
    grid-template-columns:1fr 1fr;
  }

  .admin-tabs{
    top:70px;
  }
}

@media(max-width:600px){
  .admin-tabs{
    top:64px;
    border-radius:10px;
  }

  .admin-tab{
    min-width:112px;
    padding:9px 12px;
  }

  .admin-location-grid{
    grid-template-columns:1fr;
  }

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

  .admin-filter-action{
    padding-bottom:0;
  }

  .admin-page-head{
    align-items:center;
  }
}


/* =========================================================
   CREDENCIAIS APRESENTADAS UMA ÚNICA VEZ APÓS CRIAR CLIENTE
   ========================================================= */

.credentials-card{
  border:1px solid #8bd8b1;
  background:#f0fdf6;
  box-shadow:0 10px 28px #15803d12;
}

.credentials-card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
}

.credentials-card-head h2{
  margin:4px 0 0;
}

.credentials-eyebrow{
  color:#15803d;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.credentials-once{
  background:#dcfce7;
  color:#166534;
  border-radius:99px;
  padding:6px 10px;
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
}

.credentials-note{
  color:#436456;
  font-size:13px;
  line-height:1.5;
  max-width:850px;
}

.credentials-grid{
  display:grid;
  grid-template-columns:1.2fr 1fr 1.4fr;
  gap:12px;
}

.credentials-grid input[readonly]{
  background:#fff;
  border-color:#a7dfbf;
  color:#123f29;
  font-family:'JetBrains Mono',monospace;
}

.credential-password{
  display:flex;
  gap:7px;
  align-items:center;
  margin-top:6px;
}

.credential-password input{
  margin:0;
  min-width:0;
}

.credential-password button{
  flex:none;
}

.credentials-actions{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:13px;
}

.copy-feedback{
  color:#15803d;
  font-size:12px;
  font-weight:600;
}

@media(max-width:800px){
  .credentials-grid{
    grid-template-columns:1fr;
  }

  .credentials-card-head{
    flex-direction:column;
  }

  .credentials-once{
    align-self:flex-start;
  }
}


/* =========================================================
   HISTÓRICO OPERACIONAL DO DIA
   ========================================================= */

.daily-history{
  margin-top:34px;
  padding-top:20px;
  border-top:1px solid #cfe6ef;
}

.daily-history-heading{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  margin-bottom:12px;
  color:#111;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:10px;
  font-weight:600;
}

.daily-history-heading time{
  color:#168bb8;
  font-family:'JetBrains Mono',monospace;
  font-weight:500;
  letter-spacing:0;
}

.daily-turn-groups{
  display:grid;
  gap:13px;
}

.daily-turn-group{
  display:grid;
  gap:7px;
}

.daily-turn-context{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:5px;
  margin:0;
  padding:0 8px;
  color:#111;
  font-size:12px;
  font-weight:500;
  line-height:1.25;
  text-align:center;
}

.daily-turn-client,
.daily-turn-local{
  min-width:0;
  overflow-wrap:anywhere;
}

.daily-turn-separator{
  flex:0 0 auto;
}

.daily-turn-group+.daily-turn-group{
  margin-top:2px;
}

.daily-events{
  display:grid;
  gap:9px;
}

.daily-event{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:43px;
  padding:9px 12px 9px 15px;
  background:#fff;
  border:1px solid #e5dcd6;
  border-radius:11px;
  box-shadow:0 3px 12px #5d3b2808;
  overflow:hidden;
}

.daily-event:before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:4px;
  background:#168bb8;
}

.daily-event-main{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}

.daily-event-label{
  font-size:10px;
  font-weight:600;
  color:#4c4541;
}

.daily-event-main small{
  max-width:210px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#9a918c;
  text-transform:uppercase;
  letter-spacing:.06em;
  font-size:7px;
}

.daily-event>time{
  flex:0 0 auto;
  margin-left:12px;
  font-family:'JetBrains Mono',monospace;
  font-size:15px;
  font-weight:600;
  color:#111;
}

.daily-event-entrada:before,
.daily-event-reinicio:before{
  background:#18a94d;
}

.daily-event-pausa:before{
  background:#e6a51d;
}

.daily-event-saída:before,
.daily-event-saida:before{
  background:#e44d4d;
}

.daily-history-empty{
  text-align:center;
  margin:0;
  padding:12px 8px;
  color:#8f8580;
  font-size:10px;
}

/* =========================================================
   EDIÇÃO DE UTILIZADORES — MODAL RESPONSIVO
   ========================================================= */
.user-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.user-actions form{
  margin:0;
}

.user-edit-button{
  background:#e0f2f9;
  color:#003d52;
  border:1px solid #c8e8f0;
}

.user-delete-button{
  padding:10px 16px;
}

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

.edit-user-modal[hidden]{
  display:none;
}

.edit-user-modal{
  position:fixed;
  inset:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.edit-user-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0, 35, 48, .56);
  backdrop-filter:blur(2px);
}

.edit-user-dialog{
  position:relative;
  z-index:1;
  width:min(720px, 100%);
  max-height:min(90vh, 820px);
  overflow:auto;
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 22px 70px rgba(0, 35, 48, .25);
}

.edit-user-header{
  position:sticky;
  top:0;
  z-index:2;
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:flex-start;
  padding:20px 22px 15px;
  background:#fff;
  border-bottom:1px solid var(--line);
}

.edit-user-header h2{
  margin:0;
}

.edit-user-header p{
  margin:6px 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

.edit-user-close{
  flex:0 0 auto;
  width:38px;
  height:38px;
  padding:0;
  border-radius:50%;
  background:var(--soft);
  color:var(--ink);
  font-size:24px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

.edit-user-form{
  padding:20px 22px 22px;
}

.edit-user-modal-body{
  padding:20px 22px 24px;
}

.justification-dot{
  display:inline-block;
  width:9px;
  height:9px;
  border-radius:50%;
  background:#d92d20;
  margin-right:6px;
  vertical-align:middle;
}

.justification-callout{
  background:#fef3f2;
  border:1px solid #fda29b;
  border-radius:8px;
  padding:10px 12px;
  margin:0 0 16px;
}

.edit-user-fields{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px 16px;
}

.optional-label{
  color:var(--muted);
  font-size:11px;
  font-weight:500;
}

.edit-user-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:22px;
  padding-top:16px;
  border-top:1px solid var(--line);
}

body.modal-open{
  overflow:hidden;
}

@media(max-width:600px){
  .users-table th:nth-child(3),
  .users-table td:nth-child(3),
  .users-table th:nth-child(4),
  .users-table td:nth-child(4){
    display:none;
  }

  .edit-user-modal{
    align-items:flex-end;
    padding:0;
  }

  .edit-user-dialog{
    width:100%;
    max-height:94vh;
    border-radius:16px 16px 0 0;
    border-bottom:0;
  }

  .edit-user-header{
    padding:17px 16px 13px;
  }

  .edit-user-form{
    padding:16px;
  }

  .edit-user-fields{
    grid-template-columns:1fr;
    gap:11px;
  }

  .edit-user-actions{
    position:sticky;
    bottom:0;
    margin:18px -16px -16px;
    padding:12px 16px calc(12px + env(safe-area-inset-bottom));
    background:#fff;
    box-shadow:0 -8px 24px rgba(0, 35, 48, .08);
  }

  .edit-user-actions button{
    flex:1;
    padding:12px 10px;
  }
}

/* Credenciais automáticas na criação de utilizadores */
.generated-label{
  font-size:10px;
  font-weight:600;
  color:var(--muted);
  text-transform:none;
  letter-spacing:0;
}

#create-user-form input[readonly]{
  background:#eef5f8;
  cursor:not-allowed;
  font-weight:600;
}

.generated-password-field{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:7px;
  align-items:center;
}

.generated-password-field .small{
  white-space:nowrap;
  min-height:38px;
}

.credential-generation-status{
  margin:-2px 0 9px;
  padding:8px 10px;
  border-radius:8px;
  background:var(--soft);
  color:var(--muted);
  font-size:11px;
  line-height:1.35;
}

.credential-generation-status.is-ready{
  color:#176b43;
  background:#edf9f2;
}

.credential-generation-status.is-error{
  color:#9d2b2b;
  background:#fff1f1;
}

.record-card .record-local{
  display:block;
  margin-top:2px;
  color:#8f8580;
  font-size:9px;
  line-height:1.3;
}

@media(max-width:600px){
  .clients-table th:nth-child(3),
  .clients-table td:nth-child(3){
    display:none;
  }
}

/* =========================================================
   EDIÇÃO INLINE DAS ASSOCIAÇÕES POR LOCAL
   ========================================================= */
.association-local-heading{
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
}

.association-edit-button{
  flex:0 0 auto;
  min-height:30px;
  padding:5px 10px;
  border:1px solid #9bc8d7;
  border-radius:8px;
  background:#fff;
  color:var(--blue);
  font-size:10px;
  font-weight:700;
  cursor:pointer;
}

.association-edit-button:hover,
.association-edit-button:focus-visible{
  border-color:var(--blue);
  background:#f3fbfd;
}

.association-group.is-editing .association-group-head{
  background:#e9f6fa;
}

.association-editor{
  padding:11px 12px 12px;
  border-top:1px solid var(--line);
  background:#fff;
}

.association-editor[hidden]{
  display:none !important;
}

.association-editor-title{
  display:grid;
  gap:4px;
  margin-bottom:9px;
}

.association-editor-title small{
  color:var(--muted);
  font-size:10px;
  line-height:1.4;
}

.association-options{
  display:grid;
  gap:6px;
  max-height:230px;
  overflow:auto;
  padding:2px;
}

.association-option{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:34px;
  margin:0;
  padding:7px 9px;
  border:1px solid #e1e8eb;
  border-radius:8px;
  background:var(--soft);
  color:#315a69;
  font-size:11px;
  line-height:1.3;
  cursor:pointer;
}

.association-option:hover{
  border-color:#acd2de;
  background:#f2fafc;
}

.association-option input[type="checkbox"]{
  flex:0 0 auto;
  width:16px;
  height:16px;
  margin:0;
  accent-color:var(--blue);
}

.association-option span{
  min-width:0;
  overflow-wrap:anywhere;
}

.association-option small{
  color:var(--muted);
  font-size:9px;
}

.association-option.is-inactive{
  opacity:.72;
}

.association-editor-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:11px;
  padding-top:10px;
  border-top:1px solid #edf0f2;
}

.association-editor-actions button{
  min-height:32px;
  padding:6px 11px;
  font-size:10px;
}

@media(max-width:600px){
  .association-group-head{
    align-items:flex-start;
  }

  .association-local-heading{
    align-items:flex-start;
    flex-direction:column;
    gap:3px;
  }

  .association-editor-actions{
    flex-wrap:wrap;
  }
}

/* =========================================================
   UTILIZADORES E CLIENTES — MANTER AÇÕES NA MESMA LINHA
   ========================================================= */
.users-table th:last-child,
.users-table td:last-child,
.clients-table th:last-child,
.clients-table td:last-child{
  width:1%;
  white-space:nowrap;
}

.users-table .user-actions,
.clients-table .user-actions{
  flex-wrap:nowrap;
  gap:6px;
  min-width:max-content;
}

.users-table .user-actions form,
.users-table .user-actions button,
.clients-table .user-actions form,
.clients-table .user-actions button{
  flex:0 0 auto;
}

.users-table .user-actions button,
.clients-table .user-actions button{
  padding:10px 12px;
  white-space:nowrap;
}

/* =========================================================
   AUTORIZAÇÕES DE REGISTO DE COLABORADORES
   ========================================================= */
.authorization-created-card,
.registration-authorizations-panel{
  margin-bottom:16px;
}

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

.authorization-code-row input{
  flex:1 1 280px;
  font-weight:800;
  letter-spacing:.7px;
}

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

.authorization-panel-head h2{
  margin:3px 0 0;
}

.authorization-panel-head p{
  max-width:600px;
  margin:0;
}

.authorization-admin-grid{
  display:grid;
  grid-template-columns:minmax(280px, .8fr) minmax(520px, 1.8fr);
  gap:18px;
  align-items:start;
}

.authorization-create-form{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.authorization-table{
  min-width:720px;
}

.authorization-table code{
  white-space:nowrap;
  font-weight:800;
}

.authorization-status{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-size:10px;
  font-weight:800;
}

.authorization-status-pendente{background:#fff4cf;color:#795d00;}
.authorization-status-utilizada{background:#e5f7ed;color:#176b3a;}
.authorization-status-revogada{background:#fde9e9;color:#9d2c2c;}
.authorization-empty{text-align:center;color:var(--muted);}

.authorization-form{
  display:grid;
  gap:14px;
  margin-top:20px;
}

.register-panel{
  max-width:760px;
}

.register-authorization-ok{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:11px 14px;
  margin-bottom:18px;
  border:1px solid #cfe9dc;
  border-radius:12px;
  background:#f1fbf6;
}

.register-authorization-ok span{
  color:#27714b;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.45px;
}

.register-authorization-ok strong{
  white-space:nowrap;
}

.locked-field{
  background:#f1f3f5 !important;
  color:#4c5963 !important;
  cursor:not-allowed;
}

.register-change-code{
  margin-top:14px;
  text-align:right;
}

@media(max-width:900px){
  .authorization-admin-grid{grid-template-columns:1fr;}
  .authorization-panel-head{flex-direction:column;}
}

@media(max-width:600px){
  .authorization-create-form{grid-template-columns:1fr;}
  .authorization-create-form .span2{grid-column:auto;}
  .register-authorization-ok{align-items:flex-start;flex-direction:column;}
}

/* Ações alternativas no cartão temporário de credenciais */
.credentials-inline-form{
  display:inline-flex;
  margin:0;
}
.credentials-inline-form button{
  margin:0;
}

/* Estado do envio de autorização por SMS */
.sms-send-feedback{
  font-size:.9rem;
  font-weight:600;
  color:#16784a;
  align-self:center;
}

/* Pesquisa e paginação da auditoria */
.audit-heading{display:flex;justify-content:space-between;align-items:end;margin-bottom:18px;}
.audit-heading h2{margin-bottom:3px;}
.audit-heading p{margin:0;color:var(--muted);}
.audit-filter-form{display:grid;grid-template-columns:repeat(5,minmax(140px,1fr));gap:12px;align-items:end;margin-bottom:20px;}
.audit-filter-form label{display:grid;gap:6px;font-size:.82rem;font-weight:700;color:var(--muted);margin:0;}
.audit-filter-form input,.audit-filter-form select{width:100%;}
.audit-search{grid-column:span 3;}
.audit-filter-actions{grid-column:span 2;display:flex;align-items:center;gap:12px;}
.audit-filter-actions a,.audit-pagination a{font-weight:700;color:var(--primary);text-decoration:none;}
.audit-changes{margin:0;padding-left:18px;}
.audit-empty{text-align:center;color:var(--muted);padding:28px !important;}
.audit-pagination{display:flex;justify-content:center;align-items:center;gap:18px;margin-top:20px;}
.audit-pagination span{font-weight:700;color:var(--muted);}
@media(max-width:1000px){.audit-filter-form{grid-template-columns:repeat(2,minmax(0,1fr));}.audit-search,.audit-filter-actions{grid-column:span 2;}}
@media(max-width:600px){.audit-filter-form{grid-template-columns:1fr;}.audit-search,.audit-filter-actions{grid-column:auto;}}
