:root {
  color-scheme: light;
  --ink: #16211e;
  --muted: #66746f;
  --forest: #173f36;
  --forest-2: #246354;
  --mint: #e3f2eb;
  --cream: #f5f3eb;
  --card: #fff;
  --line: #dce3df;
  --danger: #a33e35;
  --shadow: 0 16px 50px rgba(23, 63, 54, .09);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--cream); color: var(--ink); font-family: Arial, "Noto Sans Hebrew", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; display: flex; flex-direction: column; color: #eef9f5; background: linear-gradient(180deg, #173f36 0%, #102c26 100%); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark, .mini-mark {
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
  flex-shrink: 0;
}
.brand-mark { width: 43px; height: 43px; }
.brand-mark img, .mini-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.mini-mark {
  width: 42px;
  height: 42px;
  background: #eef6f1;
  border: 1px solid rgba(23, 63, 54, .08);
}
.brand strong, .brand small, .user-chip strong, .user-chip small { display: block; }
.brand strong { font-size: 20px; letter-spacing: .02em; }
.brand small { color: #a8c2ba; margin-top: 3px; font-size: 11px; }
nav { display: grid; gap: 7px; margin-top: 26px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-radius: 10px; color: #bad0c9; background: transparent; text-align: right; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.nav-item span { font-size: 19px; }
.sidebar-foot { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot-label { display: block; color: #d8e8e2; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.sheets-connection { position: relative; display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.sheets-connection-label { color: #a8c2ba; font-size: 12px; font-weight: 600; }
.sheets-connection-status { padding: 0; border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 800; cursor: help; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.sheets-connection-status.ok { color: #7ddea8; }
.sheets-connection-status.error { color: #ff8f84; }
.sheets-connection-status.pending { color: #d6c27a; }
.sheets-connection-tooltip { position: absolute; inset-inline-start: 0; bottom: calc(100% + 10px); z-index: 5; display: none; width: min(260px, 70vw); padding: 12px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #eef6f2; background: #17342d; box-shadow: 0 12px 28px rgba(8, 24, 20, .35); text-align: right; direction: rtl; }
.sheets-connection:hover .sheets-connection-tooltip,
.sheets-connection:focus-within .sheets-connection-tooltip {
  display: grid;
  gap: 8px;
}
.sheets-connection-tooltip-title { color: #b8d6cb; font-size: 11px; font-weight: 700; }
.sheets-connection-tooltip-row { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; }
.sheets-connection-tooltip-row:first-of-type { border-top: 0; padding-top: 0; }
.sheets-connection-tooltip-row strong { color: #fff; font-size: 12px; }
.sheets-connection-tooltip-row span { color: #b8d6cb; }

main { min-width: 0; }
.topbar { height: 96px; display: flex; justify-content: space-between; align-items: center; padding: 0 44px; border-bottom: 1px solid var(--line); background: rgba(245,243,235,.86); backdrop-filter: blur(12px); }
.eyebrow { margin: 0 0 6px; color: var(--forest-2); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip small { color: var(--muted); margin-top: 2px; }
.avatar-wrap { position: relative; display: grid; place-items: center; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--mint); color: var(--forest); font-weight: 800; }
.user-permissions-popup {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #122821;
  color: #eef9f5;
  box-shadow: 0 12px 30px rgba(16, 44, 38, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.user-permissions-popup strong { display: block; margin-bottom: 8px; font-size: 12px; color: #a8c2ba; }
.user-permissions-popup ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.user-permissions-popup li { font-size: 13px; font-weight: 700; }
.user-permissions-popup span { font-size: 12px; color: #a8c2ba; }
.avatar-wrap:hover .user-permissions-popup,
.avatar-wrap:focus-within .user-permissions-popup {
  opacity: 1;
  pointer-events: auto;
}
.link-button { border: 0; background: transparent; color: var(--muted); margin-right: 8px; }
.refresh-link { margin: 0; padding: 0; color: var(--forest-2); font: inherit; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.refresh-link:hover, .refresh-link:focus-visible { color: var(--forest); }
.refresh-cluster { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cache-age { color: var(--muted); font-size: 12px; font-weight: 600; }
.banner { padding: 12px 44px; color: #6d541a; background: #fff0c9; border-bottom: 1px solid #ead7a7; font-size: 14px; }

.login-layout { min-height: calc(100vh - 96px); display: grid; grid-template-columns: minmax(360px, 1.15fr) minmax(330px, .85fr); gap: 70px; align-items: center; padding: 64px max(6vw, 44px); background: radial-gradient(circle at 82% 18%, #dfeee6 0, transparent 33%), var(--cream); }
.login-copy h2 { margin: 25px 0 18px; font-size: clamp(48px, 6.5vw, 88px); line-height: .98; letter-spacing: -.05em; }
.login-copy > p { max-width: 560px; color: var(--muted); font-size: 19px; line-height: 1.7; }
.tag { display: inline-block; padding: 8px 13px; color: var(--forest); border: 1px solid #adc7bd; border-radius: 999px; font-size: 12px; font-weight: 700; }
.role-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 35px; }
.role-list span { padding: 8px 13px; background: rgba(255,255,255,.66); border-radius: 7px; color: #50605a; font-size: 13px; }
.login-card { max-width: 440px; width: 100%; justify-self: end; padding: 35px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); border: 1px solid rgba(23,63,54,.08); }
.card-heading { display: flex; gap: 13px; align-items: center; margin-bottom: 28px; }
.card-heading h3 { margin: 0 0 3px; font-size: 21px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; }
label { display: grid; gap: 8px; margin: 17px 0; color: #384641; font-size: 13px; font-weight: 700; }
input, select { width: 100%; padding: 13px 14px; border: 1px solid #cfd9d5; border-radius: 9px; background: #fbfcfb; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(36,99,84,.12); }
.primary, .secondary { border-radius: 9px; font-weight: 800; }
.primary { display: flex; justify-content: space-between; width: 100%; margin-top: 24px; padding: 14px 18px; border: 0; color: white; background: var(--forest); }
.primary:hover { background: var(--forest-2); }
.primary:disabled, .approval-action:disabled { opacity: .45; cursor: not-allowed; background: #8a9b94; }
.primary:disabled:hover, .approval-action:disabled:hover { background: #8a9b94; }
.approval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.approval-action { margin-top: 0; justify-content: center; }
.approvals-controls { margin-bottom: 8px; }
.approvals-toolbar {
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 12px;
  gap: 0;
}
#approvals-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}
#approvals-table th,
#approvals-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#approvals-table .soldier-name-link {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.approval-action-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  padding-block: 4px;
}
.approval-action-stack {
  display: grid;
  justify-items: center;
  gap: 2px;
  line-height: 1.15;
}
.approval-status-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--forest);
  white-space: nowrap;
}
.approval-row-action {
  min-width: 0;
  margin: 0;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.approval-row-action:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.approval-row-action--approve {
  color: #fff;
  border-color: #1f7a45;
  background: #1f9d55;
}
.approval-row-action--approve:hover:not(:disabled) {
  background: #188649;
}
.approval-row-action--cancel {
  color: #fff;
  border-color: #9b2f24;
  background: #c0392b;
}
.approval-row-action--cancel:hover:not(:disabled) {
  background: #a83226;
}
.secondary { padding: 10px 15px; color: var(--forest); background: white; border: 1px solid #bdccc6; }
.form-error { min-height: 18px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }
.google-signin { display: flex; justify-content: center; margin: 8px 0 4px; min-height: 44px; }
.login-divider { margin: 14px 0 6px; text-align: center; color: var(--muted); font-size: 12px; }
.login-divider-button {
  display: block;
  width: 100%;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.login-divider-button:hover { color: var(--forest); }
.local-login-fields { margin-top: 10px; }

#app-view { padding: 38px 44px 65px; }
.welcome, .table-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 25px; }
.welcome h2, .table-toolbar h2 { margin: 0; font-size: 30px; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.metrics article, .panel, .action-card { padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: 0 8px 30px rgba(23,63,54,.04); }
.metrics span, .metrics small { display: block; color: var(--muted); }
.metrics span { font-size: 13px; font-weight: 700; }
.metrics strong { display: block; margin: 12px 0 8px; font-size: 32px; }
.metrics small { font-size: 11px; }
.metric-soldiers { display: grid; align-content: start; }
.metric-soldiers strong { margin-bottom: 10px; }
.metric-soldiers-scope { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-pluga-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.metric-pluga-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 6px; border-top: 1px solid #edf0ee; color: var(--ink); font-size: 13px; font-weight: 700; }
.metric-pluga-list li:first-child { border-top: 0; padding-top: 0; }
.metric-pluga-list span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-pluga-list strong { margin: 0; font-size: 14px; color: var(--forest); }
.metric-last-seen { display: grid; align-content: start; gap: 10px; }
.metric-last-seen > span { margin-bottom: 2px; }
.traffic-light {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 0;
}
.traffic-light-item {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 10px;
  background: #f7faf8;
  border: 1px solid #edf0ee;
}
.traffic-light-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.traffic-light-green .traffic-light-dot { background: #1f9d55; }
.traffic-light-yellow .traffic-light-dot { background: #d4a017; }
.traffic-light-red .traffic-light-dot { background: #c0392b; }
.traffic-light-item strong {
  margin: 0;
  font-size: 22px;
  color: var(--ink);
}
.traffic-light-item small {
  margin: 0;
  text-align: center;
  line-height: 1.35;
  font-size: 11px;
  color: var(--muted);
}
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.panel-full { margin-top: 15px; }
.equipment-matrix-wrap { margin-top: 8px; max-height: 420px; }
.equipment-matrix-wrap table { min-width: 100%; }
.equipment-matrix-wrap th {
  font-weight: 800;
  color: var(--forest);
  background: #f3f7f5;
}
.equipment-matrix-wrap tbody tr {
  transition: background-color .12s ease;
}
.equipment-matrix-wrap tbody tr:hover td {
  background: #e7f3ec;
}
.equipment-matrix-wrap th:first-child,
.equipment-matrix-wrap td:first-child {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 1;
}
.equipment-matrix-wrap th:first-child { background: #f3f7f5; }
.equipment-matrix-wrap tbody tr:hover td:first-child { background: #e7f3ec; }
.equipment-matrix-link {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--forest-2);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.equipment-matrix-link:hover, .equipment-matrix-link:focus-visible { color: var(--forest); }
.equipment-matrix-count {
  display: inline-block;
  min-width: 1.5em;
  padding: 2px 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.equipment-matrix-count:hover, .equipment-matrix-count:focus-visible {
  color: var(--forest-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.equipment-total-col {
  font-weight: 800;
  color: var(--forest);
  background: #eef6f2;
}
.equipment-matrix-wrap tbody tr:hover td.equipment-total-col {
  background: #dceee4;
}
.equipment-matrix-total {
  font-weight: 800;
}
.last-seen-cell { white-space: nowrap; }
.seen-col {
  width: 3.25rem;
  min-width: 3.25rem;
  max-width: 3.25rem;
  text-align: center;
  vertical-align: middle;
  padding-inline: 4px;
}
.equipment-detail-toolbar { align-items: start; }
.equipment-back-button { margin-bottom: 12px; }
.equipment-detail-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.equipment-detail-count { margin: 0 0 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
#equipment-detail-view .table-wrap {
  width: 98%;
  max-width: 98%;
  margin-inline: auto;
}
#equipment-detail-table {
  width: 100%;
  table-layout: auto;
  font-size: 12.5px;
}
#equipment-detail-table th,
#equipment-detail-table td {
  padding: 7px 8px;
  text-align: right;
  vertical-align: middle;
}
/* Pack identity + serial columns tightly on the right; leftover space goes to the action col. */
#equipment-detail-table th:nth-child(1),
#equipment-detail-table td:nth-child(1),
#equipment-detail-table th:nth-child(2),
#equipment-detail-table td:nth-child(2),
#equipment-detail-table th:nth-child(3),
#equipment-detail-table td:nth-child(3),
#equipment-detail-table th:nth-child(4),
#equipment-detail-table td.equipment-serial-cell {
  width: 1%;
  white-space: nowrap;
  padding-inline: 6px;
}
#equipment-detail-table th.seen-col,
#equipment-detail-table td.seen-col {
  width: auto;
  padding-inline-start: 18px;
}
.equipment-serial-with-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.equipment-serial-status {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
}
.equipment-serial-status--green { background: #1f9d55; }
.equipment-serial-status--yellow { background: #d4a017; }
.equipment-serial-status--red { background: #c0392b; }
.equipment-serial-value { font-variant-numeric: tabular-nums; }
.soldier-name-link {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--forest-2);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.soldier-name-link:hover, .soldier-name-link:focus-visible { color: var(--forest); }
.seen-action {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #9eb7ad;
  border-radius: 999px;
  color: var(--forest);
  background: var(--mint);
  font-size: 16px;
  line-height: 1;
}
.seen-action:hover, .seen-action:focus-visible { border-color: #9eb7ad; background: var(--mint); }
.seen-action:disabled { opacity: .55; cursor: not-allowed; }
.seen-action--done { color: var(--forest); background: var(--mint); border-color: #9eb7ad; }
.seen-action--locked { cursor: not-allowed; }
.panel-title { display: flex; justify-content: space-between; align-items: start; }
.panel h3 { margin-bottom: 18px; }
.badge { padding: 7px 10px; border-radius: 999px; color: var(--forest); background: var(--mint); font-size: 12px; font-weight: 800; }
.permission-list, .status-list { display: grid; gap: 10px; }
.permission-row, .status-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid #edf0ee; font-size: 13px; }
.check { color: var(--forest-2); font-weight: 800; }
.disabled { color: #9aa39f; }
.status-pill-group { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.status-pill { padding: 4px 8px; border-radius: 999px; font-size: 11px; background: #edf2ef; color: #53645e; white-space: nowrap; }
.status-pill.ready { background: var(--mint); color: var(--forest); }
.status-pill.blocked { background: #fff0c9; color: #73591c; }
.status-pill.connected { background: #dff2e9; color: #1f634c; }
.status-pill.disconnected { background: #f9e4e1; color: #943b34; }
.status-pill.pending { background: #edf2ef; color: #53645e; }

#table-count { margin: 0; color: var(--muted); }
.table-controls-above { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-start; gap: 12px; width: fit-content; max-width: 100%; margin: 0 0 14px auto; }
.table-search-above { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: min(380px, 42vw); margin: 0; }
.table-search-above input { min-width: 280px; padding-block: 10px; background: white; }
.item-search-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 22px; }
.item-search-form button { padding: 10px 18px; border: 0; border-radius: 10px; color: #fff; background: var(--forest); font-weight: 800; }
.item-search-form button:hover, .item-search-form button:focus-visible { background: var(--forest-2); }
#item-search-view { min-width: 0; max-width: 100%; }
.item-search-result { display: grid; gap: 15px; min-width: 0; max-width: 100%; }
.item-search-back { display: inline-flex; align-items: center; margin: 0 0 16px; }
.item-search-detail { display: grid; gap: 15px; min-width: 0; max-width: 100%; }
.item-search-detail .panel,
.item-search-detail .detail-table-wrap { min-width: 0; max-width: 100%; }
.item-search-detail .detail-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.item-search-fields { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.item-search-fields dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.item-search-fields dd { margin: 0; font-weight: 700; }
.item-search-holder-meta { color: var(--muted); font-weight: 600; }
.item-search-signed-at { display: block; margin-top: 4px; color: var(--muted); font-weight: 600; }
.item-search-matches-list { display: grid; gap: 8px; }
.item-search-match {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
}
.item-search-match:hover, .item-search-match:focus-visible {
  border-color: var(--forest);
  background: #f3f6f4;
}
.item-search-match-serial {
  color: var(--forest-2);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.item-search-match-name { font-weight: 700; }
.item-search-match-holder { color: var(--muted); font-weight: 600; }
.table-filter { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 120px; margin: 0; }
.table-filter select { min-width: 120px; padding-block: 10px; background: white; }
.table-wrap { overflow: auto; max-height: calc(100vh - 240px); border: 1px solid var(--line); border-radius: 12px; background: white; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 13px; }
th, td { padding: 13px 15px; text-align: right; border-bottom: 1px solid #e8ecea; }
th { position: sticky; top: 0; z-index: 1; color: #52615c; background: #f3f6f4; font-size: 11px; }
.sort-button { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: 800; }
.sort-button:hover, .sort-button:focus-visible { color: var(--forest-2); }
.sort-button:focus-visible { outline: 2px solid var(--forest-2); outline-offset: 4px; border-radius: 2px; }
.sort-indicator { color: #81908b; font-size: 9px; }
th[aria-sort="ascending"] .sort-indicator,
th[aria-sort="descending"] .sort-indicator { color: var(--forest-2); }
.column-filter-header { min-width: 150px; }
.column-header-wrap { position: relative; display: grid; gap: 8px; }
.column-header-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.column-filter-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid #d5ddd9; border-radius: 999px; color: #52615c; background: #fff; font: inherit; font-size: 10px; font-weight: 700; white-space: nowrap; }
.column-filter-toggle:hover, .column-filter-toggle:focus-visible { border-color: #9eb7ad; color: var(--forest-2); background: var(--mint); }
.column-filter-toggle.active { border-color: #9eb7ad; color: var(--forest-2); background: #eef6f2; }
.column-filter-count { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; color: #fff; background: var(--forest-2); font-size: 9px; line-height: 1; }
.column-filter-popover { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 4; display: grid; gap: 10px; width: min(220px, 70vw); padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(15, 39, 33, .14); }
.column-filter-popover.hidden { display: none; }
.column-filter-options { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.column-filter-option { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.column-filter-option input { width: 14px; height: 14px; margin: 0; accent-color: var(--forest-2); }
.column-filter-actions { display: flex; justify-content: flex-end; }
.column-filter-clear { padding: 4px 10px; border: 0; border-radius: 999px; color: var(--forest-2); background: #eef6f2; font: inherit; font-size: 11px; font-weight: 700; }
.column-filter-clear:hover, .column-filter-clear:focus-visible { background: var(--mint); }
tbody tr:hover { background: #f8faf9; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #eef6f2; }
.clickable-row:focus-visible { outline: 2px solid var(--forest-2); outline-offset: -2px; background: #eef6f2; }
.empty-table { padding: 28px; color: var(--muted); text-align: center; }
.inline-message { margin: 0 0 16px; padding: 14px 16px; border-radius: 9px; color: #73591c; background: #fff0c9; }
.action-card { max-width: 600px; }
.form-result { margin: 15px 0 0; color: var(--forest-2); }

.soldier-modal {
  isolation: isolate;
  width: min(900px, calc(100vw - 40px));
  max-height: calc(100vh - 50px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 24px 80px rgba(15, 39, 33, .28);
  overflow: visible;
  overscroll-behavior: contain;
}
.soldier-modal:not([open]) { display: none; }
.soldier-modal[open] {
  display: flex;
  flex-direction: column;
}
.soldier-modal::backdrop { background: rgba(13, 31, 27, .55); backdrop-filter: blur(3px); }
.soldier-modal > .modal-heading { flex: 0 0 auto; }
.soldier-modal > .modal-loading,
.soldier-modal > .inline-message,
.soldier-modal > .modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
html.modal-open, body.modal-open { overflow: hidden; overscroll-behavior: none; }
body.modal-open { position: fixed; inset-inline: 0; width: 100%; }
.modal-heading { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.modal-heading h2, .soldier-modal-title-row { margin: 0; font-size: 25px; }
.soldier-modal-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.storage-number-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.55em;
  height: 1.55em;
  padding: 0 0.4em;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #fff;
  font-size: 0.58em;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}
.storage-number-badge.is-light {
  color: #111;
  border-color: var(--line);
}
.modal-heading > div > p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.modal-close { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--forest); background: #f8faf9; font-size: 25px; line-height: 1; }
.modal-close:hover, .modal-close:focus-visible { border-color: #9eb7ad; background: var(--mint); }
.modal-loading { padding: 45px 26px; color: var(--muted); text-align: center; }
.soldier-modal > .inline-message { margin: 24px 26px; }
.modal-content { display: grid; gap: 28px; padding: 24px 26px 30px; }
#soldier-comments-section:not(.has-comments) { display: none !important; }
.modal-content section { min-width: 0; }
.modal-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.modal-section-heading h3 { margin: 0; font-size: 17px; }
.detail-table-wrap { overflow: auto; max-height: 280px; border: 1px solid var(--line); border-radius: 10px; }
.detail-table-wrap th { z-index: 2; }
.approvals-history-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--forest-2); background: #f8faf9; font: inherit; font-size: 13px; font-weight: 700; }
.approvals-history-toggle:hover, .approvals-history-toggle:focus-visible { border-color: #9eb7ad; background: var(--mint); }
.approvals-history-arrow { display: inline-block; transition: transform .15s ease; }
.approvals-history-toggle.expanded .approvals-history-arrow { transform: rotate(180deg); }
.approvals-history-wrap { margin-top: 10px; }
.decision { display: inline-block; min-width: 48px; padding: 4px 9px; border-radius: 999px; color: #596660; background: #edf2ef; text-align: center; font-size: 11px; font-weight: 800; }
.decision.approved { color: #1f634c; background: #dff2e9; }
.decision.denied { color: #943b34; background: #f9e4e1; }
.soldier-comment-text {
  white-space: pre-wrap;
  max-width: 420px;
  line-height: 1.4;
}
.signature-col { width: 44px; }
.signature-cell { text-align: center; }
.signature-icon { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--forest-2); background: #eef6f2; font-size: 14px; cursor: help; }
.signature-icon:hover, .signature-icon:focus-visible { background: var(--mint); outline: none; }
.signature-icon--missing { color: #8a9b94; cursor: default; }
.signature-icon--missing:hover, .signature-icon--missing:focus-visible { background: #eef6f2; }
.signature-missing-mark { position: absolute; inset: -2px; display: grid; place-items: center; border-radius: 50%; color: #b42318; background: rgba(255, 255, 255, .82); font-size: 18px; font-weight: 800; line-height: 1; pointer-events: none; }
.signature-tooltip-portal {
  position: fixed;
  z-index: 10050;
  display: grid;
  gap: 8px;
  width: max-content;
  min-width: 240px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  color: #fff;
  background: #17342d;
  box-shadow: 0 18px 48px rgba(8, 24, 20, .42);
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
  direction: rtl;
  text-align: right;
}
.signature-tooltip-portal[hidden], .signature-tooltip-portal.hidden { display: none !important; }
.signature-tooltip-line { display: grid; gap: 4px; }
.signature-tooltip-label { color: #b8d6cb; font-size: 12px; font-weight: 700; }
.signature-tooltip-value { color: #fff; font-size: 14px; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 88px 1fr; }
  .sidebar { padding-inline: 12px; }
  .brand span:last-child, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item.active { font-size: 0; }
  .nav-item span { font-size: 20px; }
  .sidebar-foot { padding: 12px 4px 0; }
  .sidebar-foot-label { font-size: 11px; }
  .sheets-connection { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sheets-connection-label { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 16px; flex-direction: row; align-items: center; gap: 12px; overflow: auto; }
  .brand { padding: 0 0 0 12px; border: 0; }
  .brand span:last-child { display: none; }
  nav { display: flex; margin: 0; gap: 4px; }
  .nav-item, .nav-item.active { width: auto; font-size: 0; padding: 10px; }
  .sidebar-foot {
    margin-top: 0;
    margin-inline-start: auto;
    padding: 0;
    border-top: 0;
    text-align: left;
  }
  .sidebar-foot-label {
    text-align: left;
    font-size: 11px;
  }
  .sheets-connection {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-top: 2px;
  }
  .sheets-connection-status {
    text-align: left;
  }
  .topbar { height: 80px; padding: 0 20px; }
  .user-chip span:nth-child(2) { display: none; }
  .login-layout { min-height: auto; grid-template-columns: 1fr; padding: 35px 20px; gap: 35px; }
  .login-copy h2 { font-size: 48px; }
  .login-card { justify-self: stretch; max-width: none; }
  #app-view { padding: 28px 20px 50px; }
  .metrics, .panel-grid { grid-template-columns: 1fr; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .approvals-toolbar {
    flex-direction: row;
    justify-content: flex-end;
    margin-bottom: 8px;
  }
  .table-controls-above { width: 100%; margin-inline: 0; }
  .table-search-above { width: 100%; }
  .table-search-above input, .table-filter select { min-width: 0; width: 100%; max-width: 100%; }
  .item-search-form { flex-direction: column; align-items: stretch; }
  .item-search-fields { grid-template-columns: 1fr; }
  .item-search-match { grid-template-columns: 1fr; gap: 4px; }
  #item-search-view {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
  }
  .item-search-back {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 800;
  }
  .item-search-detail .detail-table-wrap {
    overflow-x: auto;
    max-width: 100%;
  }
  .item-search-detail table {
    width: max-content;
    min-width: 100%;
    font-size: 12px;
  }
  .item-search-detail th,
  .item-search-detail td {
    padding: 8px 8px;
  }
  .table-filter { width: 100%; max-width: 100%; }
  .approvals-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    max-width: 100%;
  }
  #approval-view {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
  }
  #approval-view .table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  #approvals-table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    font-size: 12px;
  }
  #approvals-table th,
  #approvals-table td {
    padding: 8px 6px;
    white-space: normal;
    vertical-align: middle;
  }
  #approvals-table th {
    font-size: 10px;
    line-height: 1.25;
  }
  #approvals-table .approval-action-cell {
    width: auto;
    white-space: normal;
    padding-inline: 4px;
  }
  #approvals-table .approval-status-label {
    white-space: normal;
    text-align: center;
    font-size: 9px;
    line-height: 1.2;
  }
  #approvals-table .approval-row-action {
    padding: 4px 6px;
    font-size: 10px;
  }
  .soldier-modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
  .modal-heading, .modal-content { padding-inline: 18px; }
  .soldier-modal .part-number-col { display: none; }
  .signature-icon { width: 40px; height: 40px; font-size: 16px; }
  .signature-icon:not(.signature-icon--missing) { cursor: pointer; }
  .sheets-connection-label { display: none; }
  .banner { padding-inline: 20px; }
}
