:root {
  --navy: #10243d;
  --navy-2: #183856;
  --orange: #ffea00;
  --orange-dark: #d9c700;
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #172438;
  --muted: #6e7c8d;
  --line: #e3e8ed;
  --green: #2a9d68;
  --blue: #377fbb;
  --red: #d95555;
  --yellow: #d99a22;
  --shadow: 0 10px 30px rgba(31, 48, 67, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
html, body { max-width: 100%; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: none; grid-template-columns: 250px 1fr; }
body.authenticated .app-shell { display: grid; }
body.authenticated .login-screen { display: none; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: white; }
.login-brand-panel {
  min-height: 100vh; padding: clamp(35px, 7vw, 100px); display: flex; flex-direction: column;
  justify-content: center; color: white; background:
  radial-gradient(circle at 85% 15%, rgba(255,234,0,.18), transparent 30%),
  linear-gradient(145deg, #0b1828, #173956);
}
.login-brand-panel > img { width: min(390px, 75%); background: white; border-radius: 9px; margin-bottom: 45px; }
.login-brand-panel .eyebrow { color: var(--orange); }
.login-brand-panel h1 { font-size: clamp(34px, 5vw, 64px); line-height: 1.05; margin: 12px 0 20px; max-width: 760px; }
.login-brand-panel > p:not(.eyebrow) { max-width: 600px; color: #c2cfdb; line-height: 1.65; font-size: 16px; }
.login-features { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 35px; color: #e9eff5; font-size: 13px; }
.login-form-panel { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: #f5f6f7; }
.login-card { width: min(430px, 100%); padding: 38px; background: white; border-radius: 18px; box-shadow: 0 24px 70px rgba(20,35,50,.14); }
.login-card h2 { margin: 6px 0 9px; font-size: 31px; }
.login-intro { margin: 0 0 28px; color: var(--muted); }
.login-card .field { margin-bottom: 16px; }
.password-field { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.password-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(55,127,187,.1); }
.password-field input { flex: 1; border: 0; border-radius: 0; box-shadow: none !important; min-width: 0; }
.password-field button { border: 0; background: white; padding: 0 12px; color: var(--blue); font-size: 11px; font-weight: 800; }
.login-submit { width: 100%; min-height: 48px; margin-top: 5px; }
.password-reset-link { display: block; margin: 16px auto 0; }
.login-error { min-height: 18px; margin: 3px 0; color: var(--red); font-size: 12px; font-weight: 700; }
.login-help { text-align: center; color: var(--muted); font-size: 11px; margin: 20px 0 0; }
.login-mobile-logo { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 26px 18px 18px;
  background: linear-gradient(180deg, var(--navy), #0d1c2f);
  color: white; display: flex; flex-direction: column; z-index: 20;
  overflow-y: auto; overscroll-behavior: contain;
}
.brand { display: block; margin: 0 5px 28px; }
.brand-logo { display: block; width: 100%; height: auto; border-radius: 6px; background: white; }
.brand-location { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 5px 0; }
.brand-location strong, .brand-location span, .user-card strong, .user-card span { display: block; }
.brand-location strong { color: white; font-size: 16px; letter-spacing: .03em; }
.brand-location span, .user-card span { color: #a9b9c9; font-size: 11px; margin-top: 2px; }
nav { display: grid; gap: 5px; }
.nav-button {
  border: 0; background: transparent; color: #b9c7d5; border-radius: 10px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left;
}
.nav-button:hover, .nav-button.active { background: rgba(255,255,255,.1); color: white; }
.nav-button.active { box-shadow: inset 3px 0 var(--orange); }
.nav-icon { width: 20px; text-align: center; font-size: 17px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 18px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #dce5ee; color: var(--navy); display: grid; place-items: center; font-weight: 800; }
.user-card strong { font-size: 13px; }

main { min-width: 0; }
.topbar {
  height: 96px; padding: 19px 32px; background: rgba(255,255,255,.94);
  display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px);
}
.topbar h1 { margin: 2px 0 0; font-size: 25px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-box {
  width: 290px; height: 42px; border: 1px solid var(--line); background: #f8fafb;
  border-radius: 10px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; }
.icon-button {
  width: 42px; height: 42px; border: 1px solid var(--line); background: white;
  border-radius: 10px; color: var(--text); font-size: 20px;
}
.notification-button { position: relative; }
.notification-button i {
  position: absolute; right: -4px; top: -5px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: white; font: 10px/18px Arial; font-style: normal;
}
.primary-button, .secondary-button, .danger-button {
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 750;
}
.primary-button { background: var(--orange); color: #171717; box-shadow: 0 5px 14px rgba(255,234,0,.2); }
.primary-button:hover { background: #fff13b; }
.secondary-button { background: #edf1f5; color: var(--text); }
.danger-button { background: #fff0f0; color: var(--red); }
.menu-button { display: none; }

.content { padding: 28px 32px 50px; max-width: 1600px; margin: auto; }
.hero {
  border-radius: 18px; padding: 24px 28px; color: white;
  background: linear-gradient(120deg, var(--navy-2), var(--navy));
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px;
  box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.hero::after { content: ""; position: absolute; width: 230px; height: 230px; right: -60px; border: 45px solid rgba(255,234,0,.1); border-radius: 50%; }
.hero h2 { margin: 5px 0 8px; font-size: 27px; }
.hero p { color: #c4d0db; margin: 0; max-width: 620px; }
.hero .primary-button { z-index: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card, .panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.stat-card { padding: 18px; }
.stat-card-button { width: 100%; text-align: left; color: inherit; cursor: pointer; }
.stat-card-button:hover { transform: translateY(-2px); border-color: #b8c5d0; }
.stat-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #eef3f7; }
.stat-value { font-size: 30px; font-weight: 850; margin: 11px 0 4px; }
.trend { font-size: 11px; color: var(--muted); }
.trend.good { color: var(--green); }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.panel { overflow: hidden; }
.panel-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 18px 20px; }
.link-button { border: 0; background: transparent; color: var(--blue); font-weight: 700; }

.task-list { display: grid; gap: 13px; }
.task {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 13px; align-items: center;
  padding-bottom: 13px; border-bottom: 1px solid var(--line);
}
.task:last-child { border: 0; padding-bottom: 0; }
.time-block { text-align: center; padding: 8px 4px; border-radius: 9px; background: #f0f3f6; font-size: 11px; }
.time-block strong { display: block; font-size: 14px; }
.task strong, .task span { display: block; }
.task span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chat-messages { display: grid; gap: 8px; max-height: 48vh; overflow: auto; }
.search-result { display: block; width: 100%; margin: 6px 0; text-align: left; }
.request-list { display: grid; gap: 12px; }
.request-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 17px; box-shadow: var(--shadow); cursor: pointer; }
.request-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.request-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 13px 0; }
.request-meta span { color: var(--muted); font-size: 10px; }
.request-meta strong { display: block; color: var(--text); font-size: 12px; margin-top: 3px; }
.request-actions { display: flex; gap: 8px; }
.photo-picker { padding: 13px; border: 1px dashed #bdc9d3; border-radius: 10px; }
.photo-picker-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.history-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 12px; }
.history-tabs button { flex: 0 0 auto; border: 1px solid var(--line); background: white; border-radius: 99px; padding: 8px 12px; font-weight: 700; }
.history-tabs button.active { background: var(--navy); color: white; }
.history-event { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-event p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.history-details { grid-column: 1 / -1; display: flex; gap: 8px; }
.history-details span { padding: 5px 8px; border-radius: 8px; background: #f1f4f7; color: var(--muted); font-size: 10px; }
.history-transition { border-radius: 8px; padding: 7px 9px; background: #f1f4f7; font-size: 11px; }
.chat-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 15px; min-height: 65vh; }
.chat-sidebar { padding: 10px; align-content: start; display: grid; gap: 6px; }
.chat-sidebar button { border: 0; border-radius: 9px; background: transparent; padding: 11px; text-align: left; font-weight: 750; overflow-wrap: anywhere; }
.chat-sidebar button span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.chat-sidebar button.active { background: #edf2f6; }
.chat-panel { display: grid; grid-template-rows: auto minmax(260px, 1fr) auto; }
.chat-bubbles { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.chat-bubble { align-self: flex-start; max-width: min(78%, 600px); padding: 10px 12px; border-radius: 4px 14px 14px 14px; background: #eef2f5; overflow-wrap: anywhere; }
.chat-bubble.mine { align-self: flex-end; border-radius: 14px 4px 14px 14px; background: #fff4a9; }
.chat-bubble p { margin: 5px 0; white-space: pre-wrap; }
.chat-bubble span { color: var(--muted); font-size: 9px; }
.chat-composer { border-top: 1px solid var(--line); padding: 12px; }
.chat-composer textarea { width: 100%; min-height: 65px; resize: vertical; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.chat-composer > div:last-child { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 8px; }
.chat-send-row #sendMessage { min-width: 120px; }
.chat-file-button { display: inline-flex; align-items: center; justify-content: center; }
.emoji-row { display: flex; gap: 4px; margin-bottom: 7px; }
.emoji-row button { border: 0; background: #f1f3f5; border-radius: 7px; padding: 5px 7px; }
.floating-chat { position: fixed; right: 22px; bottom: 22px; z-index: 45; border: 0; border-radius: 99px; padding: 12px 17px; background: var(--navy); color: white; box-shadow: 0 12px 28px rgba(13,28,47,.28); display: flex; gap: 8px; align-items: center; }
.floating-chat[hidden] { display: none; }
.floating-chat span { color: var(--orange); }
body[data-sync-status="offline"]::after { content: "Mode hors ligne"; position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 50; background: #9d6519; color: white; padding: 7px 12px; border-radius: 99px; font-size: 11px; }
.status {
  display: inline-flex; align-items: center; white-space: nowrap; border-radius: 99px;
  padding: 5px 9px; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .02em;
}
.status.disponible, .status.terminee { color: #17734a; background: #e5f6ed; }
.status.reservee, .status.confirmee { color: #285f91; background: #e7f1fb; }
.status.preparation, .status.brouillon { color: #946515; background: #fff3d8; }
.status.retour, .status.location { color: #7c4cb4; background: #f1e9fa; }
.status.nok, .status.annulee { color: #ae3838; background: #fde8e8; }
.status.prete { color: #257f79; background: #e1f7f4; }

.progress-row { margin-bottom: 18px; }
.progress-row:last-child { margin: 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.progress { height: 8px; border-radius: 10px; background: #edf1f4; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--orange); }
.mini-alert { padding: 13px; background: #fffde7; border-left: 3px solid var(--orange-dark); border-radius: 8px; font-size: 12px; margin-top: 18px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .field { min-width: 180px; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 11px; font-weight: 800; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: white;
  padding: 9px 11px; outline: none; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(55,127,187,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field.full { grid-column: 1 / -1; }
.field textarea { min-height: 85px; resize: vertical; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { background: #f8fafb; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; text-align: left; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
.machine-id { font-weight: 850; color: var(--navy-2); }
.subtext { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.row-actions { display: flex; gap: 5px; }
.small-button { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 7px 9px; font-weight: 700; font-size: 11px; }
.small-button:hover { border-color: #b7c4cf; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.work-card { background: white; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.work-card-top { height: 8px; background: var(--orange); }
.work-card-content { padding: 17px; }
.work-card h3 { margin: 5px 0 2px; font-size: 18px; }
.work-card p { margin: 7px 0; color: var(--muted); font-size: 12px; }
.work-meta { display: flex; justify-content: space-between; padding: 12px 0; margin-top: 12px; border-top: 1px solid var(--line); }
.work-meta span { font-size: 11px; color: var(--muted); }
.work-meta strong { display: block; color: var(--text); margin-top: 3px; font-size: 12px; }
.work-actions { display: flex; gap: 8px; margin-top: 10px; }
.work-actions button { flex: 1; }

.empty { text-align: center; padding: 55px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 5px; }

.profile-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding: 22px; background: linear-gradient(120deg, var(--navy-2), var(--navy));
  color: white; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.profile-title { display: flex; gap: 16px; align-items: center; }
.profile-machine-icon {
  width: 62px; height: 62px; border-radius: 14px; display: grid; place-items: center;
  background: var(--orange); color: #171717; font-size: 27px; font-weight: 900;
}
.profile-header h2 { margin: 3px 0 5px; font-size: 28px; }
.profile-header p { margin: 0; color: #c5d0db; }
.profile-actions { display: flex; gap: 8px; z-index: 1; }
.profile-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.info-item { background: white; padding: 16px 18px; min-height: 76px; }
.info-item span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; }
.info-item strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.profile-comment { color: var(--muted); line-height: 1.5; margin: 0; }
.photo-section { margin-top: 18px; }
.photo-toolbar { display: flex; align-items: center; gap: 10px; }
.photo-input { display: none; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.photo-card { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f4f6f8; aspect-ratio: 4/3; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card-footer {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 9px;
  color: white; background: linear-gradient(transparent, rgba(8,18,29,.86)); font-size: 10px;
}
.photo-delete {
  position: absolute; top: 8px; right: 8px; width: 31px; height: 31px; border: 0;
  border-radius: 8px; background: rgba(13,28,47,.86); color: white; font-size: 17px;
}
.photo-empty {
  grid-column: 1 / -1; min-height: 190px; border: 2px dashed #cad3dc; border-radius: 13px;
  display: grid; place-items: center; text-align: center; color: var(--muted); padding: 25px;
}
.photo-empty strong { color: var(--text); display: block; margin: 8px 0 4px; }
.back-button { color: white; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }

.admin-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.admin-card { padding: 17px; background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.admin-card span { color: var(--muted); font-size: 11px; font-weight: 750; }
.admin-card strong { display: block; margin-top: 7px; font-size: 24px; }
.user-identity { display: flex; align-items: center; gap: 10px; }
.user-identity .avatar { flex: 0 0 auto; }
.permission-groups { display: grid; gap: 13px; margin-top: 8px; }
.permission-group { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.permission-group h4 { margin: 0; padding: 11px 13px; font-size: 12px; background: #f5f7f9; }
.permission-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.permission-option { padding: 11px 13px; display: flex; align-items: flex-start; gap: 9px; border-top: 1px solid var(--line); font-size: 12px; }
.permission-option:nth-child(odd) { border-right: 1px solid var(--line); }
.permission-option input { margin-top: 2px; accent-color: var(--orange-dark); }
.permission-option strong, .permission-option span { display: block; }
.permission-option span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.session-switch { padding: 13px; border-radius: 10px; background: #fffde7; border: 1px solid #eee59c; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.session-switch strong { font-size: 12px; }
.session-switch select { margin-left: auto; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 7px 10px; }
.impersonation-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px;
  background: #171717; color: white; border: 2px solid var(--orange); border-radius: 12px;
  box-shadow: 0 14px 35px rgba(0,0,0,.3); font-size: 12px;
}
.impersonation-bar button { padding: 8px 11px; }

dialog {
  width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 30px); border: 0; border-radius: 17px;
  padding: 0; box-shadow: 0 30px 80px rgba(10,25,40,.3); color: var(--text);
}
dialog::backdrop { background: rgba(10,25,40,.55); backdrop-filter: blur(3px); }
.dialog-head { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 4px 0 0; font-size: 21px; }
.dialog-body { padding: 21px 22px; overflow-y: auto; max-height: 65vh; }
.dialog-actions { padding: 15px 22px; background: #f8fafb; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); }
.checklist { display: grid; gap: 10px; }
.check-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.check-item label { flex: 1; font-size: 13px; font-weight: 650; }
.check-item select { border: 1px solid var(--line); border-radius: 7px; padding: 7px; }
.machine-summary { background: #f3f7fa; border-radius: 11px; padding: 14px; margin-bottom: 16px; display: flex; justify-content: space-between; }
.machine-summary strong, .machine-summary span { display: block; }
.machine-summary span { color: var(--muted); font-size: 11px; margin-top: 3px; }

.toast {
  position: fixed; right: 24px; bottom: 24px; transform: translateY(120px);
  background: var(--navy); color: white; padding: 13px 18px; border-radius: 10px;
  box-shadow: 0 15px 35px rgba(10,25,40,.3); transition: .25s; z-index: 100;
}
.toast.show { transform: translateY(0); }
.mobile-nav { display: none; }
.overlay { display: none; }
.notification-setup {
  margin-bottom: 16px; padding: 14px 16px; border: 1px solid #eadb5d; border-radius: 12px;
  background: #fffbe0; display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.notification-setup strong, .notification-setup span { display: block; }
.notification-setup span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.notification-setup.denied { border-color: #efb4b4; background: #fff3f3; }
.accessory-choice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .search-box { display: none; }
}

@media (max-width: 760px) {
  body.authenticated .app-shell { display: block; }
  .login-screen { display: block; min-height: 100vh; background: #f1f3f5; padding: 24px 14px; }
  .login-brand-panel { display: none; }
  .login-form-panel { min-height: calc(100vh - 48px); padding: 0; background: transparent; }
  .login-card { padding: 27px 21px; }
  .login-mobile-logo { display: block; width: 210px; max-width: 80%; margin: 0 auto 28px; }
  .logout-button { width: 42px; height: 42px; padding: 0; overflow: hidden; font-size: 0; }
  .logout-button::after { content: "↪"; font-size: 20px; }
  .install-button { display: none !important; }
  .sidebar {
    position: fixed; left: -286px; width: min(280px, 86vw); transition: .25s;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
  .sidebar.open { left: 0; }
  .overlay { position: fixed; inset: 0; background: rgba(10,25,40,.42); z-index: 15; }
  .overlay.show { display: block; }
  .menu-button { display: inline-grid; place-items: center; }
  .topbar { min-height: 70px; height: auto; padding: 10px 10px; gap: 8px; }
  .topbar h1 { font-size: 20px; }
  .topbar .eyebrow { display: none; }
  .top-actions { gap: 6px; min-width: 0; }
  .top-actions .notification-button { display: inline-grid; place-items: center; }
  .top-actions .primary-button { width: 42px; height: 42px; padding: 0; font-size: 0; }
  .top-actions .primary-button::after { content: "+"; font-size: 24px; }
  .content { width: 100%; max-width: 100%; padding: 14px 10px 92px; overflow-x: hidden; }
  .hero { padding: 20px; display: block; }
  .hero h2 { font-size: 22px; }
  .hero .primary-button { margin-top: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 25px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .admin-summary { grid-template-columns: repeat(2, 1fr); }
  .profile-header { display: block; }
  .profile-actions { margin-top: 18px; display: grid; grid-template-columns: 1fr; }
  .profile-actions button { flex: 1; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .permission-options { grid-template-columns: 1fr; }
  .permission-option:nth-child(odd) { border-right: 0; }
  .session-switch { display: block; }
  .session-switch select { width: 100%; margin-top: 10px; }
  .impersonation-bar { left: 12px; right: 12px; bottom: 78px; transform: none; justify-content: space-between; }
  .field.full { grid-column: auto; }
  .toolbar .field { width: 100%; }
  .toolbar-actions { margin-left: 0; width: 100%; }
  .toolbar-actions button { flex: 1; }
  .panel, .request-card, .work-card, .hero, .profile-header { max-width: 100%; min-width: 0; }
  .panel-head { gap: 8px; flex-wrap: wrap; }
  .panel-head > * { min-width: 0; }
  .work-actions { flex-wrap: wrap; }
  .work-actions button { min-width: 120px; min-height: 44px; }
  .table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 620px; }
  .request-actions { display: grid; grid-template-columns: 1fr; }
  .request-actions button { min-height: 46px; }
  .request-meta { grid-template-columns: 1fr; }
  .history-event { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: flex; max-width: 100%; overflow-x: auto; padding: 7px; }
  .chat-sidebar button { min-width: 132px; padding: 9px; }
  .chat-panel { height: calc(100dvh - 245px); min-height: 500px; max-width: 100%; overflow: hidden; }
  .chat-bubbles { min-height: 0; padding: 12px; }
  .chat-composer { position: sticky; bottom: 0; z-index: 2; padding: 9px; background: white; }
  .chat-composer > div:last-child { align-items: stretch; flex-direction: column; }
  .chat-composer input, .chat-composer button { width: 100%; max-width: 100%; }
  .chat-send-row { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
  .chat-send-row .chat-file-button, .chat-send-row #sendMessage { width: 100%; min-height: 46px; }
  .chat-bubble { max-width: 88%; }
  .floating-chat { right: 10px; bottom: 76px; padding: 11px 14px; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(6,1fr); position: fixed; bottom: 0; left: 0; right: 0;
    height: 68px; background: white; border-top: 1px solid var(--line); z-index: 12; padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav .nav-button { display: grid; place-items: center; gap: 1px; font-size: 9px; padding: 7px 2px; color: var(--muted); border-radius: 0; }
  .mobile-nav .nav-button.active { color: var(--navy); box-shadow: inset 0 3px var(--orange); }
  .mobile-nav .nav-icon { font-size: 19px; }
  .task { grid-template-columns: 42px 1fr; }
  .task .status { grid-column: 2; justify-self: start; }
  .panel-head, .panel-body { padding-left: 15px; padding-right: 15px; }
  dialog { width: calc(100% - 10px); max-height: calc(100dvh - 10px); margin: auto; border-radius: 12px; }
  .dialog-head { padding: 13px 14px; }
  .dialog-head h2 { font-size: 18px; overflow-wrap: anywhere; }
  .dialog-body { padding: 13px 12px; max-height: calc(100dvh - 150px); }
  .dialog-actions { padding: 10px; display: grid; grid-template-columns: 1fr; }
  .dialog-actions button { width: 100%; min-height: 45px; }
  .check-item { align-items: flex-start; min-width: 0; }
  .check-item span, .check-item label { min-width: 0; overflow-wrap: anywhere; }
  .check-item select { max-width: 48%; }
  .accessory-choice-list { grid-template-columns: 1fr; }
  .notification-setup { align-items: stretch; flex-direction: column; }
  .notification-setup button { width: 100%; min-height: 44px; }
}

@media (max-width: 430px) {
  .topbar h1 { max-width: 105px; font-size: 17px; overflow-wrap: anywhere; }
  .icon-button, .logout-button, .top-actions .primary-button { width: 38px; height: 38px; }
  .mobile-nav .nav-button { font-size: 8px; }
  .profile-machine-icon { width: 52px; height: 52px; }
  .profile-header h2 { font-size: 23px; }
  .info-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: 1fr; }
}
