/* Mobile usability layer and shared feedback control. Loaded last on purpose. */
.feedback-button{position:fixed;left:max(18px,env(safe-area-inset-left));right:auto;bottom:max(18px,env(safe-area-inset-bottom));z-index:28;display:flex;align-items:center;gap:8px;min-height:42px;padding:0 14px;border:1px solid #ffffff42;border-radius:999px;background:var(--navy);color:#fff;box-shadow:0 10px 28px #10293636;font-size:var(--bs-text-11);font-weight:800}
.feedback-button:hover{background:#203d4c}.feedback-button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.feedback-dialog{width:min(520px,calc(100vw - 28px));max-height:min(720px,calc(100dvh - 28px));padding:0;border:0;border-radius:14px;color:var(--ink);box-shadow:0 24px 80px #08192259}
.feedback-dialog::backdrop{background:#0a1b246b;backdrop-filter:blur(3px)}
.feedback-dialog form{display:grid;max-height:inherit}.feedback-dialog header{display:flex;justify-content:space-between;gap:18px;padding:22px 24px 18px;border-bottom:1px solid var(--line)}
.feedback-dialog header p{margin:0 0 5px;color:var(--red);font-size:var(--bs-text-9);font-weight:900;letter-spacing:.1em}.feedback-dialog header h2{margin:0;font-size:var(--bs-text-20)}.feedback-dialog header span{display:block;margin-top:5px;color:var(--muted);font-size:var(--bs-text-11)}
.feedback-dialog header button{flex:none;width:36px;height:36px;border:0;border-radius:50%;background:#eef2f3;color:#536771;font-size:var(--bs-text-21)}.feedback-body{display:grid;gap:16px;overflow:auto;padding:20px 24px}
.feedback-body select,.feedback-body textarea{width:100%;border:1px solid #cbd5d9;border-radius:8px;background:#fff;color:var(--ink)}.feedback-body select{height:44px;padding:0 11px}.feedback-body textarea{min-height:150px;padding:12px;resize:vertical;line-height:1.5}
.feedback-privacy{margin:0;color:var(--muted);font-size:var(--bs-text-10-5);line-height:1.5}.feedback-inline-message{padding:10px 12px;border-radius:8px;background:var(--danger-bg);color:var(--danger);font-size:var(--bs-text-11);line-height:1.45}
.feedback-dialog footer{display:flex;justify-content:flex-end;gap:8px;padding:16px 24px;border-top:1px solid var(--line);background:#f7f9fa}.feedback-dialog footer button{min-height:42px}
.auth-inline-message{display:grid;gap:3px;margin:0 0 16px;padding:12px 13px;border:1px solid #efc3c1;border-left:4px solid var(--danger);border-radius:8px;background:var(--danger-bg);color:#7d292c}
.auth-inline-message.success{border-color:#b8dfcc;border-left-color:var(--green);background:var(--green-bg);color:#245f48}.auth-inline-message strong{font-size:var(--bs-text-12)}.auth-inline-message span{font-size:var(--bs-text-11);line-height:1.45}
.access-denied-identity{margin:-10px 0 18px;padding:10px 12px;border-radius:8px;background:#f0f4f5;color:#596c76;font-size:var(--bs-text-11)}.access-denied-identity strong{color:var(--ink)}

@media(max-width:760px){
  html,body{max-width:100%;overflow-x:hidden}body{font-size:var(--bs-text-14);-webkit-text-size-adjust:100%}.topbar{position:sticky;top:0;z-index:30;height:64px;min-height:64px;padding:0 14px}.byggspor-logo{min-width:0}.project-context,.sync-status{display:none}.top-meta{margin-left:auto}.user-button{width:42px;height:42px}
  .app-tabs{position:sticky;top:64px;z-index:25;height:52px;max-width:100%;padding:0;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch}.app-tabs::-webkit-scrollbar{display:none}.nav-inner{width:max-content;min-width:100%;padding:0 10px}.app-tab{flex:none;height:52px;min-width:76px;padding:0 10px;justify-content:center}.app-tab span:last-child{font-size:var(--bs-text-10)}
  .page{width:100%;max-width:100%;padding:18px 12px calc(86px + env(safe-area-inset-bottom))}.app-view,.card,.orders-layout,.diary-layout,.pour-layout,.rebar-detail-columns,.settings-grid,.shift-projects{min-width:0;max-width:100%}.card{padding:16px;border-radius:9px}.view-heading,.intro{align-items:stretch;flex-direction:column;gap:14px;margin-bottom:18px}.view-heading h1,.intro h1{font-size:var(--bs-text-24);line-height:1.12}.view-heading>button,.view-heading>div:last-child:not(:first-child),.rebar-heading-actions{width:100%}.view-heading>button,.rebar-heading-actions button{min-height:44px}.rebar-heading-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  button,.secondary-btn,.primary-small{min-height:42px}input,select,textarea{max-width:100%;font-size:16px}.section-head{align-items:flex-start}.section-head p{font-size:var(--bs-text-11)}.breadcrumbs{margin-bottom:18px}.orders-layout,.diary-layout,.pour-layout,.rebar-detail-columns,.settings-grid,.group-access-grid,.template-settings-layout,.shift-official-layout,.shift-admin-grid{grid-template-columns:minmax(0,1fr)}.day-list-card,.orders-list-card,.pour-area-card,.shift-publication-sidebar{position:static}.order-list{max-height:300px}
  .diary-toolbar,.diary-date-title,.order-detail-head,.order-footer,.rebar-toolbar,.rebar-detail-head,.pour-heading,.planning-heading{align-items:stretch;flex-direction:column}.diary-toolbar label,.diary-toolbar .project-field,.status-control,.rebar-controls,.rebar-controls label,.rebar-controls label:first-child{width:100%}.save-state{margin-left:0;align-self:flex-start;padding:0}.diary-grid{grid-template-columns:1fr;padding:15px}.diary-section{grid-template-columns:1fr}.diary-section label{border-right:0;border-bottom:1px solid #d5dade}.staffing-box{border-left:0;border-top:3px solid var(--navy);padding:12px 0 0}.diary-date-title{padding:17px}.editor-footer{gap:10px;align-items:center}.upload-actions{align-items:stretch}.upload-btn{flex:1}.upload-btn span{justify-content:center}
  .order-metrics,.rebar-metrics,.pour-metrics,.shift-directory-metrics{grid-template-columns:1fr 1fr}.order-form-grid,.rebar-form-grid,.pour-form-grid,.settings-form,.company-license-form{grid-template-columns:1fr}.order-form-grid .wide,.rebar-form-grid .span-two{grid-column:auto}.order-detail,.rebar-detail{padding:0}.order-detail-head,.order-form-grid,.attachments-section,.order-footer,.rebar-detail-head,.rebar-detail-body{padding-left:16px;padding-right:16px}.order-detail-actions,.rebar-detail-actions{width:100%;align-items:stretch;flex-direction:column}
  .table-wrap,.pour-table-wrap,.rebar-table-wrap,.planning-table-wrap,.shift-grid-wrap,.shift-holiday-timeline{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;background:linear-gradient(90deg,#fff 30%,#fff0),linear-gradient(270deg,#fff 30%,#fff0),linear-gradient(90deg,#10293624,#fff0 55%),linear-gradient(270deg,#10293624,#fff0 55%);background-attachment:local,local,scroll,scroll;background-position:left center,right center,left center,right center;background-repeat:no-repeat;background-size:36px 100%,36px 100%,14px 100%,14px 100%}.shift-grid .shift-worker-name{width:172px!important;min-width:172px!important;max-width:172px!important}.shift-project-head,.shift-official-head{padding:15px}.shift-project-head-actions,.shift-official-actions{display:grid;width:100%;grid-template-columns:1fr}.shift-project-head-actions button,.shift-official-actions button{width:100%}.shift-view-tabs{width:100%;overflow-x:auto;scrollbar-width:none}.shift-view-tabs button{flex:none;min-width:max-content}.shift-period-controls{grid-template-columns:42px minmax(0,1fr) minmax(0,1fr) 42px}.shift-period-controls>button{width:42px;height:42px}.shift-toolbar input,.shift-toolbar select{height:42px;font-size:var(--bs-text-16)}.shift-holiday-months,.shift-holiday-timeline-row{grid-template-columns:120px repeat(12,minmax(48px,1fr))}.shift-directory-head-actions,.planning-actions{display:grid;width:100%;grid-template-columns:1fr}.shift-directory-head-actions button,.planning-actions button{width:100%}
  .planning-week-toggles{grid-template-columns:1fr 1fr}.planning-controls,.planning-settings{width:100%}.planning-settings label{width:100%}
  dialog:not(.auth-dialog){width:calc(100vw - 16px);max-width:none;max-height:calc(100dvh - 16px);margin:auto}.auth-dialog{width:100vw;max-width:none;max-height:100dvh}.auth-dialog form,body.auth-locked .auth-dialog form{width:calc(100vw - 20px);max-width:440px;margin:10px 0;padding:22px}.auth-brand{margin-bottom:22px}.auth-dialog h2{font-size:var(--bs-text-23)}.auth-dialog input,.auth-submit{height:48px}.member-row,.member-row.pending{grid-template-columns:minmax(0,1fr) 42px}.member-row select,.pending-chip{grid-column:1/-1}.member-remove{grid-column:2;grid-row:1}.invite-row{grid-template-columns:1fr}
  .feedback-button{left:12px;right:auto;bottom:calc(12px + env(safe-area-inset-bottom));width:46px;height:46px;min-height:46px;padding:0;justify-content:center}.feedback-button span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.feedback-dialog{margin:auto 8px 8px;width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:14px 14px 8px 8px}.feedback-dialog header{padding:19px 18px 15px}.feedback-body{padding:17px 18px}.feedback-dialog footer{display:grid;grid-template-columns:1fr 1fr;padding:14px 18px calc(14px + env(safe-area-inset-bottom))}.feedback-body textarea{min-height:130px}.toast{left:68px;right:12px;bottom:calc(15px + env(safe-area-inset-bottom))}
}

@media(max-width:760px){.user-button{width:42px;min-width:42px;height:42px;padding:3px;border-radius:50%}.user-button-initials{width:34px;height:34px}.user-button-name,.user-button-chevron{display:none}.user-menu{position:fixed;top:58px;right:10px;left:10px;width:auto}.profile-project-switcher{display:grid}.settings-project-switcher{display:none!important}}

@media(max-width:420px){
  .page{padding-left:10px;padding-right:10px}.card{padding:14px}.order-metrics,.rebar-metrics,.pour-metrics,.shift-directory-metrics,.planning-week-toggles,.rebar-heading-actions{grid-template-columns:1fr}.view-heading h1,.intro h1{font-size:var(--bs-text-22)}.shift-period-controls{grid-template-columns:42px minmax(0,1fr) 42px}.shift-period-controls label:nth-of-type(2){grid-column:2}.shift-worker-search{grid-column:1/-1}.shift-grid .shift-worker-name{width:154px!important;min-width:154px!important;max-width:154px!important}.feedback-dialog footer{grid-template-columns:1fr}
}

/* Responsive regler for den forenklede dagbokflaten. */
@media(max-width:760px){
  #diaryView .view-heading{align-items:stretch}
  #diaryView .diary-heading-actions{display:grid;width:100%;grid-template-columns:1fr 1fr}
  #diaryView .diary-heading-actions button{width:100%}
  #diaryView .diary-heading-actions .save-state{grid-column:1/-1;justify-self:start}
  .diary-layout{grid-template-columns:minmax(0,1fr);gap:12px}
  .day-list-card{padding:14px}
  .diary-editor{padding:0}
  .diary-context-bar{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding:12px}
  .diary-date-picker{width:100%;min-height:58px;padding:9px 11px}
  .diary-date-copy strong{font-size:var(--bs-text-15)}
  .diary-date-copy small{font-size:var(--bs-text-9)}
  .diary-grid{display:grid;grid-template-columns:minmax(0,1fr);padding:8px 12px 14px}
  .diary-grid .staffing-box{grid-column:auto;margin:4px 0 0;padding:11px 12px;border:1px solid #d9e3e6;border-radius:9px;background:#fff}
  .diary-section{grid-template-columns:minmax(0,1fr)}
  .diary-section>label,.diary-section.is-empty:not(:focus-within)>label{align-items:center;padding:12px;border:0;border-bottom:1px solid #dce4e7;background:#f3f5f6}
  .diary-section .diary-note-cell,.diary-section.is-empty:not(:focus-within) .diary-note-cell{margin:0}
  .diary-section .diary-rich-editor{font-size:var(--bs-text-16)}
  .diary-section.is-empty:not(:focus-within) .diary-rich-editor{min-height:46px;padding:12px 13px!important}
  .diary-photos{padding:16px 12px}
  .editor-footer{padding:12px;align-items:flex-start}
}

@media(max-width:420px){
  #diaryView .diary-heading-actions{grid-template-columns:1fr}
  .diary-date-copy strong{font-size:var(--bs-text-16)}
  .diary-date-picker{grid-template-columns:20px minmax(0,1fr);grid-template-areas:"label label" "icon copy"}
}

/* Offisielle planer: stabil og lesbar mobilvisning uten å endre plandata. */
.shift-mobile-scroll-hint{display:none}
.official-grid .shift-worker-cell{display:grid;width:100%;grid-template-columns:22px minmax(0,1fr);align-items:center;gap:8px}
.official-grid .shift-worker-copy{display:block;min-width:0}

@media(max-width:760px){
  #shiftOfficialPreview.shift-official-preview{overflow:visible}
  #shiftOfficialPreview .shift-official-head{gap:12px;padding:14px}
  #shiftOfficialPreview .shift-official-head h2{font-size:var(--bs-text-17);line-height:1.2}
  #shiftOfficialPreview .shift-official-actions{display:grid;width:100%;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #shiftOfficialPreview .shift-official-actions button{width:100%;min-width:0;min-height:44px;padding:8px;font-size:var(--bs-text-11);white-space:normal}
  #shiftOfficialPreview .shift-mobile-scroll-hint{display:block;margin:0;padding:9px 12px;border-bottom:1px solid var(--line);background:#f6f9fa;color:#566d78;font-size:var(--bs-text-10);font-weight:800;line-height:1.35}
  #shiftOfficialPreview .shift-official-grid-wrap{position:relative;isolation:isolate;width:100%;max-width:100%;overflow-x:auto!important;overflow-y:visible;overscroll-behavior-inline:contain;scroll-padding-left:156px;scrollbar-width:thin;touch-action:pan-x pan-y;-webkit-overflow-scrolling:touch}
  #shiftOfficialPreview .official-grid{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}
  #shiftOfficialPreview .official-grid thead th:not(.shift-worker-name),
  #shiftOfficialPreview .official-grid td{width:64px;min-width:64px;max-width:64px}
  #shiftOfficialPreview .official-grid .shift-worker-name{position:sticky!important;left:0!important;z-index:6;width:156px!important;min-width:156px!important;max-width:156px!important;border-right:1px solid #c7d3d8;background:#fff;box-shadow:5px 0 10px rgba(20,44,58,.12);text-align:left}
  #shiftOfficialPreview .official-grid thead .shift-worker-name{z-index:9;padding:0 10px;background:#dce5e8}
  #shiftOfficialPreview .official-grid tbody .shift-worker-name{display:table-cell!important;height:64px;padding:0;vertical-align:middle}
  #shiftOfficialPreview .official-grid .shift-worker-cell{min-height:64px;padding:7px 8px;grid-template-columns:24px minmax(0,1fr);gap:7px}
  #shiftOfficialPreview .official-grid .shift-number{width:24px;height:24px}
  #shiftOfficialPreview .official-grid .shift-worker-name strong,
  #shiftOfficialPreview .official-grid .shift-worker-name small{overflow:hidden;text-overflow:clip;white-space:normal}
  #shiftOfficialPreview .official-grid .shift-worker-name strong{display:-webkit-box;font-size:var(--bs-text-10-5);line-height:1.18;-webkit-box-orient:vertical;-webkit-line-clamp:2}
  #shiftOfficialPreview .official-grid .shift-worker-name small{display:-webkit-box;margin-top:3px;font-size:var(--bs-text-7-5);line-height:1.2;-webkit-box-orient:vertical;-webkit-line-clamp:2}
  #shiftOfficialPreview .official-grid td{height:64px}
  #shiftOfficialPreview .shift-official-foot{padding-bottom:16px}
}

@media(max-width:420px){
  #shiftOfficialPreview .shift-official-grid-wrap{scroll-padding-left:142px}
  #shiftOfficialPreview .official-grid .shift-worker-name{width:142px!important;min-width:142px!important;max-width:142px!important}
  #shiftOfficialPreview .official-grid thead th:not(.shift-worker-name),
  #shiftOfficialPreview .official-grid td{width:62px;min-width:62px;max-width:62px}
  #shiftOfficialPreview .official-grid .shift-worker-cell{padding-left:7px;padding-right:6px;grid-template-columns:22px minmax(0,1fr);gap:6px}
  #shiftOfficialPreview .official-grid .shift-number{width:22px;height:22px}
}
