/*
 * Pointages MQB — V7 design system
 * This file deliberately sits after style.css: it refreshes the interface
 * without changing the application markup or the existing workflows.
 */

:root {
  --v7-ink: #102a4c;
  --v7-ink-soft: #27496f;
  --v7-muted: #637794;
  --v7-primary: #1257a7;
  --v7-primary-dark: #0b417f;
  --v7-primary-pale: #eaf2fc;
  --v7-surface: #ffffff;
  --v7-surface-soft: #f7faff;
  --v7-surface-strong: #eef4fb;
  --v7-line: #d6e2f2;
  --v7-line-strong: #afc7e6;
  --v7-success: #2f7d4b;
  --v7-success-pale: #e3f3e8;
  --v7-warning: #a96700;
  --v7-warning-pale: #fff2d9;
  --v7-danger: #b93535;
  --v7-danger-pale: #fce9e9;
  --v7-radius: 18px;
  --v7-radius-sm: 12px;
  --v7-shadow: 0 16px 40px rgba(29, 61, 105, .09);
  --v7-shadow-soft: 0 8px 24px rgba(29, 61, 105, .07);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: #eff4fb; scroll-behavior: smooth; }

body {
  min-width: 320px;
  color: var(--v7-ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(119, 173, 239, .18), transparent 28rem),
    radial-gradient(circle at 92% 4%, rgba(205, 229, 166, .22), transparent 28rem),
    #f3f7fc;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  line-height: 1.42;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { min-height: 42px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(38, 132, 233, .32);
  outline-offset: 2px;
}

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--v7-ink); letter-spacing: -.025em; }
small, .muted { color: var(--v7-muted); }

body > main:not(.auth-shell) {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 100px;
}

.card {
  border: 1px solid var(--v7-line);
  border-radius: var(--v7-radius);
  background: var(--v7-surface);
  box-shadow: var(--v7-shadow-soft);
}

label { color: var(--v7-ink); font-weight: 700; }
input:not([type="checkbox"]), select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--v7-line-strong);
  border-radius: var(--v7-radius-sm);
  color: var(--v7-ink);
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(38, 74, 120, .02);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:not([type="checkbox"]):hover, select:hover, textarea:hover { border-color: #89aedc; }
input:not([type="checkbox"]):focus, select:focus, textarea:focus {
  border-color: var(--v7-primary);
  box-shadow: 0 0 0 3px rgba(18, 87, 167, .14);
}
input:disabled, select:disabled, textarea:disabled { color: #8290a4; background: #f2f5f9; }
textarea { min-height: 104px; resize: vertical; }
input[type="checkbox"] { accent-color: var(--v7-primary); }

button, .upload-label {
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--v7-primary), var(--v7-primary-dark));
  box-shadow: 0 7px 15px rgba(15, 75, 145, .17);
  font-weight: 800;
  letter-spacing: -.01em;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
button:hover, .upload-label:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(15, 75, 145, .22); filter: brightness(1.02); }
button:active, .upload-label:active { transform: translateY(0); }
button.secondary, .secondary, .upload-label.secondary {
  color: var(--v7-primary-dark);
  border: 1px solid #c9d9ed;
  background: #f2f7fd;
  box-shadow: none;
}
button.secondary:hover, .secondary:hover, .upload-label.secondary:hover { background: #e7f0fb; box-shadow: none; }
button.delete, .delete {
  color: #992a2c;
  border: 1px solid #f0c9c9;
  background: var(--v7-danger-pale);
  box-shadow: none;
}
button.delete:hover, .delete:hover { background: #f9dada; box-shadow: none; }
button.compact, .compact { min-height: 34px; padding: 7px 11px; font-size: .9rem; }

/* Application masthead */
#appView > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}
#appView > header > div:first-child { min-width: 0; }
.brand-home { display: inline-flex; align-items: center; max-width: 100%; text-decoration: none; }
.brand-logo { display: block; width: min(390px, 100%); max-height: 108px; object-fit: contain; object-position: left center; }
#identity { margin: 10px 0 4px; color: #496c99; font-size: .95rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
#appView > header h1 { margin-bottom: 0; font-size: clamp(2rem, 3vw, 3.1rem); line-height: 1; }
.header-actions {
  display: flex;
  max-width: 690px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}
.header-actions > button { white-space: nowrap; }
.header-actions .total {
  min-width: 154px;
  padding: 11px 16px;
  border: 1px solid #c9de9b;
  border-radius: 14px;
  color: #365e37;
  background: linear-gradient(135deg, #eaf5d0, #d9eab1);
  box-shadow: none;
}
.header-actions .total span { display: block; font-size: .82rem; font-weight: 700; }
.header-actions .total strong { display: block; font-size: 1.5rem; line-height: 1.05; }

/* Week context */
.identity {
  display: grid;
  grid-template-columns: minmax(300px, 1.35fr) minmax(205px, .8fr) minmax(190px, .8fr);
  align-items: start;
  gap: 20px 26px;
  padding: 22px 24px;
  margin-bottom: 18px;
}
.identity > label, .identity .employee-identity { min-width: 0; }
.employee-identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  align-content: start;
}
.employee-identity label { display: grid; gap: 7px; }
.employee-identity #signature, .employee-identity #returnToMySheet { justify-self: start; }
.identity > label { display: grid; gap: 7px; }
.identity > label small { display: block; min-height: 18px; font-weight: 800; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  padding: 0;
  margin-bottom: 18px;
  background: var(--v7-line);
}
.quick-actions label {
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 14px 17px;
  background: #fbfdff;
  cursor: pointer;
  transition: background .16s ease;
}
.quick-actions label:hover { background: #f0f6fd; }
.quick-actions input { flex: 0 0 auto; }

#appView > .card:has(#employeeNote) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 17px 20px;
  margin-bottom: 16px;
}
#appView > .card:has(#employeeNote) label { display: grid; gap: 7px; }
#appView > .card:has(#employeeNote) textarea { min-height: 70px; }
#notice { min-height: 25px; padding: 0 4px; font-weight: 800; }

/* Daily time entries */
.days { display: grid; gap: 15px; }
.day {
  display: grid;
  grid-template-columns: minmax(125px, .55fr) minmax(250px, 1.18fr) minmax(290px, 1.5fr) minmax(220px, 1fr) minmax(202px, .9fr);
  align-items: end;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
}
.day > div { min-width: 0; }
.day .day-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  white-space: nowrap;
}
.day .day-title h2 { margin: 0; font-size: 1.27rem; }
.day > div > label:not(.day-title), .job-fields > label { display: grid; gap: 7px; }
.timing { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; }
.timing input { min-width: 0; }
.job-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .86fr); gap: 10px; }
.job-fields .project-connection { grid-column: 1 / -1; min-height: 0; margin: 0; padding: 8px 10px; border: 1px solid #d6e3f2; border-radius: 10px; color: #506b8e; background: #f1f6fc; font-size: .85rem; line-height: 1.28; }
.job-fields .project-connection strong { color: var(--v7-primary-dark); }
.job-fields .project-connection span { display: block; margin-top: 2px; }
.job-fields .project-connection.positive { border-color: #c7e3cf; color: #397050; background: #edf8f0; }
.job-fields .project-connection.negative, .job-fields .project-connection.unlinked { border-color: #f1d1c3; color: #9a4b30; background: #fff6f0; }
.hours {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  border: 1px solid #c6dc99;
  border-radius: 12px;
  color: #315f38;
  background: linear-gradient(135deg, #eaf5d1, #d9e9ad);
  font-size: 1.25rem;
  font-weight: 900;
}
.flags { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 13px; }
.flags label { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; white-space: nowrap; }
.flags select { width: 62px; min-height: 34px; padding: 4px 24px 4px 7px; }
.day.inactive { opacity: .68; background: #f8fafc; box-shadow: none; }
.day.inactive .hours { color: #687a90; border-color: #d8e0e8; background: #edf2f6; }
.job-fields { grid-template-columns: minmax(0, 1fr); }
.job-allocation-list { display: grid; gap: 10px; }
.job-allocation { padding: 12px; border: 1px solid #d6e3f2; border-radius: 12px; background: #fbfdff; }
.job-allocation > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--v7-primary-dark); }
.job-allocation > header strong { font-size: .88rem; }
.job-allocation-fields { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .8fr) minmax(112px, .42fr); gap: 9px; }
.job-allocation-fields label { display: grid; gap: 6px; font-size: .78rem; }
.job-allocation-fields .job-hours input { min-height: 42px; }
.job-allocation .project-connection { margin: 9px 0 0; }
.job-allocation-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding-top: 2px; }
.allocation-summary { flex: 1 1 210px; min-height: 37px; margin: 0; padding: 8px 10px; border: 1px solid #d6e3f2; border-radius: 9px; color: #506b8e; background: #f1f6fc; font-size: .78rem; font-weight: 750; line-height: 1.3; }
.allocation-summary.positive { border-color: #c7e3cf; color: #397050; background: #edf8f0; }
.allocation-summary.warning { border-color: #f0d499; color: #8a5b08; background: #fff9ec; }
.allocation-summary.negative { border-color: #efc7c2; color: #a53b30; background: #fff3f1; }

#appView > footer {
  position: sticky;
  z-index: 3;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 22px 0 0 auto;
  padding: 10px;
  border: 1px solid rgba(204, 218, 236, .95);
  border-radius: 15px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--v7-shadow);
  backdrop-filter: blur(12px);
}
.app-version { margin: 0 0 18px; color: #7b8aa1; text-align: center; font-size: .84rem; font-weight: 700; }

/* Authentication */
.auth-shell {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 22px;
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}
.auth-shell .brand-home { justify-content: center; }
.auth-shell .brand-logo { width: min(390px, 100%); }
.auth-card { padding: clamp(22px, 5vw, 38px); }
.auth-card h1 { margin-bottom: 22px; font-size: clamp(2rem, 8vw, 2.8rem); }
.auth-card h2 { margin: 24px 0 15px; font-size: 1.25rem; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 6px; }
.auth-card hr { margin: 28px 0 0; border: 0; border-top: 1px solid var(--v7-line); }
#authNotice { min-height: 18px; margin: 14px 0 0; font-weight: 700; }

/* Shared modal shell */
dialog {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: min(900px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--v7-ink);
  background: var(--v7-surface);
  box-shadow: 0 30px 90px rgba(10, 37, 73, .34);
}
dialog::backdrop { background: rgba(13, 35, 65, .55); backdrop-filter: blur(3px); }
dialog > form { max-height: inherit; overflow: auto; }
dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
dialog header h2 { margin-bottom: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 0 0; }

/* Administration */
.admin-dialog { width: min(1360px, calc(100vw - 32px)); }
.admin-dialog > form { padding: clamp(20px, 3.3vw, 42px); }
.admin-dialog .dialog-actions { padding-top: 24px; }
.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(125deg, #103e77, #1765ad 62%, #4f8dc9);
}
.admin-hero h2, .admin-hero .eyebrow, .admin-hero .muted { color: #fff; }
.admin-hero h2 { margin: 3px 0 6px; font-size: clamp(1.8rem, 3vw, 2.5rem); }
.admin-hero .muted { max-width: 620px; margin-bottom: 0; opacity: .84; }
.admin-date { flex: 0 0 auto; padding: 9px 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 10px; color: #e8f2ff; background: rgba(6, 40, 82, .23); font-weight: 800; }
.admin-metrics, .dashboard-kpis, .profitability-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 17px 0;
}
.admin-metrics > div, .dashboard-kpis > div, .profitability-kpis > div {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--v7-line);
  border-radius: 14px;
  background: var(--v7-surface-soft);
}
.admin-metrics strong, .dashboard-kpis strong, .profitability-kpis strong { display: block; color: var(--v7-primary-dark); font-size: clamp(1.35rem, 2vw, 1.75rem); line-height: 1.1; }
.admin-metrics span, .dashboard-kpis span, .profitability-kpis span { display: block; margin-top: 4px; color: var(--v7-muted); font-size: .85rem; font-weight: 800; }
.admin-metrics .metric-profit.positive, .profitability-kpis .positive { border-color: #b9dfc3; background: var(--v7-success-pale); }
.admin-metrics .metric-profit.negative, .profitability-kpis .negative { border-color: #edc4c4; background: var(--v7-danger-pale); }
.admin-metrics .metric-profit.negative strong, .profitability-kpis .negative strong { color: var(--v7-danger); }
.admin-tabs, .operations-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 23px -2px 18px;
  padding: 3px 2px 8px;
  scrollbar-width: thin;
}
.admin-tab, .operations-nav a {
  display: inline-flex;
  min-height: 39px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid #d5e2f1;
  border-radius: 10px;
  color: #49698e;
  background: #f6f9fd;
  box-shadow: none;
  font-size: .9rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.admin-tab:hover, .operations-nav a:hover { transform: none; color: var(--v7-primary-dark); background: var(--v7-primary-pale); box-shadow: none; }
.admin-tab.active, .admin-tab[aria-selected="true"] { border-color: var(--v7-primary); color: #fff; background: var(--v7-primary); box-shadow: 0 6px 13px rgba(18, 87, 167, .18); }
.admin-tab span, .operations-nav b { display: inline-grid; min-width: 20px; min-height: 20px; place-items: center; padding: 0 5px; border-radius: 99px; color: inherit; background: rgba(18, 87, 167, .12); font-size: .77rem; }
.admin-tab.active span { background: rgba(255,255,255,.2); }
.admin-panel {
  padding: clamp(17px, 2.7vw, 28px);
  border: 1px solid var(--v7-line);
  border-radius: 16px;
  background: #fff;
}
.admin-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 19px;
}
.admin-panel-heading h3 { margin-bottom: 4px; font-size: 1.35rem; }
.admin-panel-heading p { margin-bottom: 0; color: var(--v7-muted); }
.admin-filter, .admin-search, .admin-filters label { display: grid; min-width: min(230px, 100%); gap: 6px; color: var(--v7-muted); font-size: .84rem; }
.admin-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.dashboard-grid, .journal-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 17px; }
.admin-chart, .admin-table-wrap, .profitability-health, .manager-form { border: 1px solid var(--v7-line); border-radius: 13px; background: #fbfdff; }
.admin-chart { padding: 18px; }
.admin-chart h4 { margin-bottom: 16px; }
.admin-table-wrap { overflow-x: auto; }
.timesheet-table { width: 100%; min-width: 620px; border-collapse: collapse; }
.timesheet-table th { padding: 12px 13px; color: #4b6687; background: #f0f5fb; font-size: .77rem; font-weight: 900; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.timesheet-table td { padding: 13px; border-top: 1px solid #e5edf7; vertical-align: middle; }
.timesheet-table tr:hover td { background: #f8fbff; }
.table-action { display: inline-flex; align-items: center; min-height: 32px; margin: 2px 4px 2px 0; padding: 5px 9px; border-radius: 8px; color: #fff; background: var(--v7-primary); font-size: .84rem; font-weight: 800; text-decoration: none; }
.table-action.secondary { color: var(--v7-primary-dark); background: #eaf2fc; }
.admin-empty, .ops-empty { padding: 22px; border: 1px dashed #c8d7e9; border-radius: 12px; color: var(--v7-muted); background: #fbfdff; text-align: center; }
.admin-stack { display: grid; gap: 10px; }
.admin-note, .admin-user, .audit-row, .changelog-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border: 1px solid var(--v7-line);
  border-radius: 13px;
  background: #fbfdff;
}
.admin-note-body, .admin-user-body { min-width: 0; }
.admin-note-body p, .admin-user-body p, .audit-row p, .changelog-row p { margin: 3px 0 0; color: var(--v7-muted); }
.admin-note-body time, .audit-row time, .changelog-row time { color: #7b8da7; font-size: .82rem; font-weight: 700; }
.admin-note-status, .role-badge, .signature-badge, .project-health, .profitability-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #466989;
  background: #e9f1fb;
  font-size: .75rem;
  font-weight: 900;
  white-space: nowrap;
}
.admin-note-status:not(.is-read), .role-badge.admin { color: #1d6853; background: #dff2e6; }
.signature-badge { color: #725c0d; background: #fff0bc; }
.admin-avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: var(--v7-primary-dark); background: #dceaf9; font-weight: 900; }
.admin-user-title { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.project-form, .ops-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  align-items: end;
  padding: 16px;
  margin-bottom: 13px;
  border: 1px solid #d8e4f2;
  border-radius: 13px;
  background: #f8fbff;
}
.project-form label, .ops-form label { display: grid; min-width: 0; gap: 6px; }
.project-form button, .ops-form button { align-self: end; }
.manager-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; margin-bottom: 13px; }
.manager-form input { width: min(250px, 100%); }
.tec-code { color: #53749c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; font-weight: 800; }
.project-health.positive, .profitability-status.positive { color: #237249; background: #dff3e6; }
.project-health.negative, .profitability-status.negative { color: #a22d32; background: #fae2e2; }
.project-health.neutral, .profitability-status.warning { color: #856300; background: #fff1c8; }
.manager-bar { display: grid; gap: 6px; margin-bottom: 14px; }
.manager-bar > div { display: flex; justify-content: space-between; gap: 10px; }
.manager-bar > div span { color: var(--v7-muted); font-weight: 700; }
.manager-bar i { display: block; height: 9px; overflow: hidden; border-radius: 99px; background: #e4edf7; }
.manager-bar i b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4c8bd0, #1a5da9); }
.journal-layout h4 { margin: 0 0 12px; }
.journal-layout .audit-row, .journal-layout .changelog-row { grid-template-columns: auto minmax(0, 1fr); }
.changelog-row > span { display: inline-grid; min-width: 44px; min-height: 30px; place-items: center; border-radius: 8px; color: var(--v7-primary-dark); background: #e7f0fb; font-size: .82rem; font-weight: 900; }
.profitability-legend { display: inline-flex; max-width: 270px; padding: 8px 10px; border-radius: 9px; color: #725c0d; background: #fff4d5; font-size: .81rem; font-weight: 700; }
.profitability-health { display: flex; flex-wrap: wrap; gap: 9px; padding: 11px; margin-bottom: 13px; }
.profitability-health > span { padding: 4px 8px; border-radius: 99px; font-size: .82rem; font-weight: 800; }
.profitability-health .positive { color: #237249; background: #e3f4e8; }
.profitability-health .warning { color: #866100; background: #fff2ca; }
.profitability-health .negative { color: #9d3030; background: #fbe5e5; }
.admin-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 13px; }
.admin-photo-card { display: grid; min-height: 0; padding: 0; overflow: hidden; border: 1px solid var(--v7-line); color: var(--v7-ink); background: #fff; box-shadow: none; text-align: left; }
.admin-photo-card:hover { transform: translateY(-2px); box-shadow: var(--v7-shadow-soft); }
.admin-photo-card img { display: block; width: 100%; height: 145px; object-fit: cover; }
.admin-photo-card span { display: grid; gap: 2px; padding: 10px; }
.admin-photo-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Operations / terrain */
.operations-dialog { width: min(1280px, calc(100vw - 32px)); }
.operations-shell { padding: clamp(20px, 3vw, 36px); overflow: auto; }
.operations-shell > header h2 { margin: 2px 0 4px; font-size: clamp(1.75rem, 3vw, 2.4rem); }
.operations-shell > header .muted { margin-bottom: 0; }
.operations-nav { position: sticky; z-index: 2; top: -1px; margin-top: 22px; padding: 9px 2px; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.operations-section { padding: 21px 0; border-top: 1px solid var(--v7-line); }
.operations-section:first-of-type { border-top: 0; }
.operations-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.operations-heading h3 { margin-bottom: 3px; font-size: 1.3rem; }
.operations-heading p { margin-bottom: 0; color: var(--v7-muted); }
.ops-alerts { display: grid; gap: 9px; }
.ops-alert { padding: 13px 15px; border: 1px solid var(--v7-line); border-left: 4px solid var(--v7-primary); border-radius: 10px; background: #f8fbff; }
.ops-alert.warning { border-left-color: var(--v7-warning); background: #fffbf2; }
.ops-alert.danger { border-left-color: var(--v7-danger); background: #fff8f8; }
.ops-two-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ops-subcard, .team-timesheet, .weather-result, .tool-row, .onboarding-item, .ops-plan, .ops-document {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--v7-line);
  border-radius: 13px;
  background: #fbfdff;
}
.ops-subcard { display: grid; align-content: start; gap: 10px; }
.ops-subcard h4 { margin: 0; }
.ops-subcard p { margin: 0; color: var(--v7-muted); }
.ops-planning-list, .ops-document-list, .tool-list { display: grid; gap: 9px; }
.ops-plan, .ops-document, .tool-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ops-plan p, .ops-document p, .tool-row p { margin: 3px 0 0; color: var(--v7-muted); }
.ops-form .wide { grid-column: span 2; }
.site-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.site-form .wide { grid-column: span 3; }
.team-timesheet { display: grid; gap: 14px; }
.team-member-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.team-member-list label { display: flex; align-items: center; gap: 7px; padding: 9px; border-radius: 9px; background: #f2f7fc; }
.team-member-list small { margin-left: auto; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.onboarding-form { display: grid; gap: 9px; }
.onboarding-item { display: flex; align-items: center; gap: 10px; }
.onboarding-complete { padding: 12px; border-radius: 10px; color: #236b47; background: var(--v7-success-pale); font-weight: 800; }
.qr-result { display: grid; min-height: 60px; place-items: center; overflow: auto; }

/* Profiles */
.profile-dialog, .profiles-dialog, .public-profile-dialog { width: min(820px, calc(100vw - 32px)); }
.profile-form, .profiles-directory { padding: clamp(20px, 4vw, 34px); }
.profile-photo-editor { display: grid; grid-template-columns: 90px auto; align-items: center; gap: 12px; margin: 20px 0; }
.profile-photo-editor img { width: 86px; height: 86px; grid-row: span 2; border: 3px solid #dbe8f8; border-radius: 50%; object-fit: cover; }
.profile-photo-editor small { grid-column: 2; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.profile-fields label { display: grid; min-width: 0; gap: 6px; }
.profile-fields label:has(textarea), .profile-fields label:nth-child(3), .profile-fields label:nth-child(4) { grid-column: 1 / -1; }
.employee-profile-summary { display: flex; align-items: center; gap: 16px; padding: 17px 0; }
.employee-profile-summary img { width: 80px; height: 80px; border: 3px solid #dbe8f8; border-radius: 50%; object-fit: cover; }
.employee-profile-summary p { margin: 4px 0 0; color: var(--v7-muted); }
.employee-profile-details, .public-profile-contact dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.employee-profile-details div, .public-profile-contact dl div { padding: 12px; border: 1px solid var(--v7-line); border-radius: 10px; background: #f8fbff; }
.employee-profile-details dt, .public-profile-contact dt { color: var(--v7-muted); font-size: .78rem; font-weight: 800; }
.employee-profile-details dd, .public-profile-contact dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 800; }
.profiles-directory header { margin-bottom: 18px; }
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 11px; margin-top: 17px; }
.profile-card { display: flex; min-height: 0; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--v7-line); color: var(--v7-ink); background: #fbfdff; box-shadow: none; text-align: left; }
.profile-card:hover { color: var(--v7-primary-dark); background: #f1f7fd; box-shadow: none; }
.profile-card img { width: 47px; height: 47px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
.profile-card span { display: grid; min-width: 0; gap: 2px; }
.profile-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-profile { overflow: hidden; }
.public-profile-cover { position: relative; display: block; min-height: 166px; padding: 22px; background: linear-gradient(135deg, #0e407c, #2b72bd); }
.public-profile-avatar { position: absolute; bottom: -46px; left: 34px; width: 94px; height: 94px; padding: 4px; border-radius: 50%; background: #fff; }
.public-profile-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.image-viewer-close { position: absolute; top: 12px; right: 12px; display: grid; width: 38px; min-height: 38px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: var(--v7-ink); background: rgba(255,255,255,.93); box-shadow: none; font-size: 1.55rem; line-height: 1; }
.image-viewer-close:hover { background: #fff; box-shadow: none; }
.public-profile-content { padding: 61px 34px 34px; }
.public-profile-content h2 { margin-bottom: 1px; font-size: 2rem; }
.public-profile-title, .public-profile-location { margin-bottom: 5px; color: var(--v7-muted); }
.public-profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0; }
.social-icon { display: inline-grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #fff; background: var(--v7-primary); }
.social-icon svg { width: 18px; height: 18px; fill: currentColor; }
.social-icon.instagram { background: #c03a76; }.social-icon.facebook { background: #2370c8; }.social-icon.linkedin { background: #1674a6; }
.public-profile-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 22px 0; border: 1px solid var(--v7-line); border-radius: 12px; overflow: hidden; }
.public-profile-stats > div { padding: 12px; border-right: 1px solid var(--v7-line); background: #f9fbfe; text-align: center; }
.public-profile-stats > div:last-child { border-right: 0; }
.public-profile-stats strong, .public-profile-stats span { display: block; }.public-profile-stats strong { color: var(--v7-primary-dark); }.public-profile-stats span { color: var(--v7-muted); font-size: .78rem; font-weight: 700; }
.public-profile-content section { margin-top: 21px; }.public-profile-content section h3 { margin-bottom: 8px; font-size: 1.05rem; }
.public-profile-bio { color: var(--v7-ink-soft); white-space: pre-wrap; }
.public-profile-skills { display: flex; flex-wrap: wrap; gap: 7px; }.public-profile-skills span { padding: 5px 9px; border-radius: 999px; color: #3b628e; background: #e8f1fc; font-size: .87rem; font-weight: 800; }.public-profile-skills .empty-skill { color: var(--v7-muted); background: #f0f3f6; }

/* Messaging and media */
.chat-dialog { width: min(1200px, calc(100vw - 32px)); }
.chat-shell { padding: clamp(17px, 3vw, 30px); }
.chat-shell > header { margin-bottom: 14px; }
.chat-shell > header h2 { margin: 2px 0 0; font-size: 1.9rem; }
.chat-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chat-create { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 12px; margin-bottom: 13px; border: 1px solid var(--v7-line); border-radius: 12px; background: #f8fbff; }
.chat-create details { min-width: 0; }.chat-create summary { color: #496a8f; font-weight: 800; cursor: pointer; }.chat-create details > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 5px; padding-top: 8px; }
.chat-layout { display: grid; grid-template-columns: minmax(220px, .38fr) minmax(0, 1fr); min-height: 520px; border: 1px solid var(--v7-line); border-radius: 15px; overflow: hidden; }
.chat-layout > aside { padding: 14px; border-right: 1px solid var(--v7-line); background: #f6f9fd; overflow: auto; }.chat-layout > aside h3 { margin: 5px 0 9px; font-size: 1rem; }.chat-layout > aside h3:not(:first-child) { margin-top: 22px; }
#chatConversationList, #chatPeopleList { display: grid; gap: 7px; }
.chat-conversation, .chat-person { display: flex; width: 100%; min-height: 0; align-items: center; gap: 8px; padding: 9px; border: 1px solid transparent; border-radius: 10px; color: var(--v7-ink); background: transparent; box-shadow: none; text-align: left; }
.chat-conversation:hover, .chat-person:hover, .chat-conversation.active { color: var(--v7-primary-dark); border-color: #cadcf1; background: #eaf2fc; box-shadow: none; }
.chat-thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: #fff; }.chat-thread > header { padding: 15px 18px; border-bottom: 1px solid var(--v7-line); }.chat-thread > header h3 { margin: 0; }.chat-thread > header p { margin: 2px 0 0; color: var(--v7-muted); }
.chat-messages { display: grid; align-content: start; gap: 12px; max-height: 500px; padding: 17px; overflow: auto; background: linear-gradient(180deg, #fbfdff, #fff); }
.chat-message { display: flex; align-items: flex-start; gap: 8px; max-width: 78%; }.chat-message.mine { justify-self: end; flex-direction: row-reverse; }.chat-message > div:last-child { padding: 10px 12px; border-radius: 13px 13px 13px 3px; background: #edf4fc; }.chat-message.mine > div:last-child { border-radius: 13px 13px 3px 13px; color: #fff; background: linear-gradient(135deg, #1d65ae, #164f94); }.chat-message strong { display: block; font-size: .84rem; }.chat-message p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }.chat-message time { display: block; color: #617898; font-size: .72rem; font-weight: 700; }.chat-message.mine time { color: rgba(255,255,255,.77); }
.chat-avatar { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 50%; color: #315f90; background: #dfeaf7; font-size: .8rem; font-weight: 900; }.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-image-button { display: block; min-height: 0; max-width: 100%; margin-top: 7px; padding: 0; overflow: hidden; background: transparent; box-shadow: none; }.chat-image-button:hover { transform: none; box-shadow: none; }.chat-image { display: block; max-width: 260px; max-height: 250px; border-radius: 8px; object-fit: cover; }
.chat-send { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--v7-line); background: #fff; }.chat-send textarea { min-height: 44px; max-height: 110px; padding: 11px; }.chat-photo-button { display: grid; width: 43px; min-height: 43px; padding: 10px; place-items: center; }.chat-photo-button svg { width: 21px; height: 21px; fill: currentColor; }.chat-image-preview { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }.chat-image-remove { width: 35px; min-height: 35px; padding: 0; font-size: 1.1rem; }
.image-viewer-dialog { width: min(1100px, calc(100vw - 28px)); background: rgba(12, 28, 52, .97); }.image-viewer { position: relative; display: grid; max-height: calc(100vh - 40px); place-items: center; padding: 46px 22px 22px; }.image-viewer img { display: block; max-width: 100%; max-height: calc(100vh - 118px); object-fit: contain; }.image-viewer p { margin: 9px 0 0; color: #e7f0fa; font-weight: 700; }.image-viewer .image-viewer-close { color: #173c66; }
.timesheet-preview-dialog { width: min(1240px, calc(100vw - 32px)); }.timesheet-preview { height: min(880px, calc(100vh - 32px)); padding: 17px; }.timesheet-preview > header { padding: 0 0 13px; }.timesheet-preview > header h2 { margin: 2px 0 0; }.timesheet-preview > header > div:last-child { display: flex; align-items: center; gap: 8px; }.timesheet-preview iframe { display: block; width: 100%; height: calc(100% - 80px); border: 1px solid var(--v7-line); border-radius: 11px; background: #f2f4f7; }

@media (max-width: 1260px) {
  .day { grid-template-columns: minmax(130px, .55fr) minmax(240px, 1fr) minmax(280px, 1.2fr) minmax(210px, .85fr); }
  .day > div:last-child { grid-column: 4; }
  .day > div:nth-child(4) { grid-column: 1 / 3; }
  .day > div:nth-child(5) { grid-column: 3 / 5; }
  .ops-two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  body > main:not(.auth-shell) { width: min(100% - 32px, 900px); padding-top: 22px; }
  #appView > header { display: grid; gap: 16px; }.header-actions { justify-content: flex-start; max-width: none; }
  .identity { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }.identity .employee-identity { grid-column: 1 / -1; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day { grid-template-columns: minmax(135px, .55fr) minmax(0, 1fr) minmax(0, 1fr); }
  .day > div:nth-child(3) { grid-column: 2 / 4; }.day > div:nth-child(4) { grid-column: 1 / 3; }.day > div:nth-child(5) { grid-column: 3; }
  .admin-metrics, .dashboard-kpis, .profitability-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .journal-layout { grid-template-columns: 1fr; }
  .project-form, .ops-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }.site-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }.site-form .wide { grid-column: 1 / -1; }
  .chat-create { grid-template-columns: minmax(0, 1fr) auto; }.chat-create details { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  body > main:not(.auth-shell) { width: calc(100% - 24px); padding: 16px 0 88px; }
  .brand-logo { width: min(300px, 100%); max-height: 80px; }
  #appView > header h1 { font-size: 2.12rem; }.header-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }.header-actions > button { width: 100%; padding-inline: 8px; font-size: .88rem; }.header-actions .total { grid-column: 1 / -1; width: 100%; }
  .identity { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 12px; padding: 18px; }.identity .employee-identity { grid-column: 1 / -1; }.identity input:not([type="checkbox"]) { min-width: 0; font-size: .98rem; }
  .quick-actions { grid-template-columns: 1fr; }.quick-actions label { min-height: 53px; padding: 11px 14px; }
  #appView > .card:has(#employeeNote) { grid-template-columns: 1fr; padding: 15px; } #appView > .card:has(#employeeNote) button { width: 100%; }
  .day { grid-template-columns: 1fr; gap: 14px; padding: 16px; }.day > div:nth-child(n) { grid-column: auto; }.day .day-title h2 { font-size: 1.22rem; }.job-fields { grid-template-columns: 1fr; }.job-allocation-fields { grid-template-columns: 1fr; }.job-allocation > header { align-items: flex-start; }.job-allocation > header .remove-job { min-height: 34px; }.job-allocation-tools { align-items: stretch; }.job-allocation-tools > button { width: 100%; }.timing { gap: 8px; }.flags { gap: 7px 11px; }
  #appView > footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin-top: 17px; padding: 8px; bottom: 8px; } #appView > footer button { width: 100%; min-height: 43px; padding-inline: 7px; font-size: .9rem; }
  dialog, .admin-dialog, .operations-dialog, .profile-dialog, .profiles-dialog, .public-profile-dialog, .chat-dialog, .timesheet-preview-dialog, .image-viewer-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 16px; }
  .admin-dialog > form, .operations-shell, .profile-form, .profiles-directory, .chat-shell { padding: 18px; }.admin-hero { display: grid; gap: 13px; padding: 19px; }.admin-date { justify-self: start; }.admin-metrics, .dashboard-kpis, .profitability-kpis { gap: 8px; }.admin-metrics > div, .dashboard-kpis > div, .profitability-kpis > div { padding: 12px; }.admin-panel-heading { display: grid; gap: 13px; }.admin-filter, .admin-search, .admin-filters label { width: 100%; min-width: 0; }.admin-filters { display: grid; width: 100%; justify-content: stretch; }
  .admin-note, .admin-user { grid-template-columns: auto minmax(0, 1fr); align-items: start; }.admin-note .admin-actions, .admin-user .admin-actions { grid-column: 1 / -1; justify-content: flex-start; }.admin-actions button, .admin-actions .admin-link { flex: 1 1 auto; }.admin-avatar { width: 37px; height: 37px; }
  .project-form, .ops-form, .site-form { grid-template-columns: 1fr; }.project-form .wide, .ops-form .wide, .site-form .wide { grid-column: auto; }.project-form button, .ops-form button { width: 100%; }
  .ops-two-columns { grid-template-columns: 1fr; }.operations-heading { display: grid; }.operations-heading .secondary { justify-self: start; }.operations-nav { margin-inline: -2px; }.ops-plan, .ops-document, .tool-row { align-items: flex-start; }.team-member-list { grid-template-columns: 1fr; }
  .profile-photo-editor { grid-template-columns: 72px 1fr; }.profile-photo-editor img { width: 68px; height: 68px; }.profile-fields, .employee-profile-details, .public-profile-contact dl { grid-template-columns: 1fr; }.profile-fields label:has(textarea), .profile-fields label:nth-child(3), .profile-fields label:nth-child(4) { grid-column: auto; }
  .public-profile-cover { min-height: 132px; }.public-profile-avatar { left: 22px; bottom: -40px; width: 80px; height: 80px; }.public-profile-content { padding: 55px 20px 24px; }.public-profile-stats > div { padding: 9px 5px; }.public-profile-stats strong { font-size: .93rem; }.public-profile-stats span { font-size: .67rem; }
  .profiles-grid { grid-template-columns: 1fr; }
  .chat-shell > header { display: grid; gap: 12px; }.chat-header-actions { justify-content: flex-start; }.chat-create { grid-template-columns: 1fr; }.chat-create button { width: 100%; }.chat-layout { grid-template-columns: 1fr; min-height: 0; }.chat-layout > aside { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--v7-line); }.chat-messages { max-height: 430px; }.chat-message { max-width: 92%; }.chat-send { grid-template-columns: minmax(0, 1fr) auto auto; }.chat-send textarea { grid-column: 1 / -1; }.chat-send #chatImageName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
  .timesheet-preview { height: calc(100vh - 16px); padding: 11px; }.timesheet-preview > header { gap: 8px; }.timesheet-preview > header h2 { font-size: 1.15rem; }.timesheet-preview > header .eyebrow { display: none; }.timesheet-preview iframe { height: calc(100% - 57px); }.timesheet-preview .admin-link { display: none; }
}

@media (max-width: 430px) {
  #identity { font-size: .8rem; }.header-actions { grid-template-columns: 1fr 1fr; }.header-actions > button { font-size: .79rem; }.identity { grid-template-columns: 1fr; }.identity > label { grid-column: auto; }.identity .employee-identity { grid-column: auto; }.quick-actions label { font-size: .93rem; }
  .timing { grid-template-columns: 1fr; }.day > div:nth-child(2) .timing, .day > div:nth-child(4) .timing { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }.flags label { font-size: .93rem; }.hours { min-height: 47px; }.admin-metrics, .dashboard-kpis, .profitability-kpis { grid-template-columns: 1fr 1fr; }.admin-metrics strong, .dashboard-kpis strong, .profitability-kpis strong { font-size: 1.2rem; }.admin-tabs, .operations-nav { margin-top: 17px; }.admin-tab, .operations-nav a { font-size: .82rem; }.admin-note, .admin-user, .audit-row, .changelog-row { padding: 12px; }.admin-actions button { font-size: .8rem; }.chat-message { max-width: 96%; }.chat-image { max-width: 205px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
