:root {
  color-scheme: light;
  --ink: #1f2523;
  --muted: #65716d;
  --soft: #8a9691;
  --line: #d7ded9;
  --line-strong: #c5cec8;
  --paper: #f3f5f2;
  --panel: #ffffff;
  --panel-soft: #f8faf7;
  --primary-action: #2d6fb0;
  --primary-action-hover: #245f99;
  --primary-action-soft: #edf4fb;
  --primary-action-soft-strong: #e3eef8;
  --nav: var(--primary-action);
  --nav-active: rgba(255, 255, 255, .14);
  --brand: var(--primary-action);
  --accent: #a96f22;
  --danger: #b43d32;
  --ok: #26734d;
  --warn-bg: #fff6df;
  --danger-bg: #fff1ef;
  --sidebar-width: 150px;
  --space-page: 18px;
  --space-card: 14px;
  --gap: 12px;
  --control-height: 36px;
  --control-pad-x: 11px;
  --body-size: 13px;
  --small-size: 12px;
  --title-size: 22px;
  --card-title-size: 15px;
  --kpi-size: 20px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  min-height: 100dvh;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--brand-background, var(--paper));
  font-size: var(--body-size);
  line-height: 1.45;
}

body.preview-open {
  overflow: hidden;
}

button, input, select, textarea {
  font: inherit;
  font-size: var(--body-size);
}

button, .button {
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--brand);
  color: #fff;
  min-height: var(--control-height);
  padding: 7px var(--control-pad-x);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  white-space: nowrap;
}

button:hover, .button:hover { filter: brightness(0.98); }

.ghost {
  background: #fff;
  color: var(--brand);
  border-color: var(--primary-action-soft-strong);
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.hidden { display: none !important; }

.app-watermark {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background-repeat: repeat;
  background-image: var(--watermark-image);
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: center;
  padding: 8vw;
  background: var(--brand-background, #e9eeea);
  color: var(--ink);
}

.login-copy h1 {
  font-size: 44px;
  line-height: 1.08;
  margin: 0;
  letter-spacing: 0;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.login-logo img {
  width: 60px;
  max-width: 23vw;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.login-copy p:last-child {
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
}

.login-panel {
  background: #fff;
  color: var(--ink);
  padding: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.login-panel h2 { margin: 0 0 18px; font-size: 18px; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--small-size);
  margin-bottom: 12px;
}

input, select, textarea {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  min-height: var(--control-height);
  padding: 7px 10px;
  min-width: 0;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.login-panel input {
  font-size: 16px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(31, 95, 157, .14);
}

input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background-color: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  cursor: pointer;
}

input[type="checkbox"]:checked {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2 7.2 12.4 14 5.6' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[type="checkbox"]:disabled {
  cursor: not-allowed;
  background-color: #eef3ef;
}

input[type="checkbox"]:disabled:checked {
  border-color: #9fb4aa;
  background-color: #9fb4aa;
}

.password-field {
  position: relative;
  display: block;
  min-width: 0;
}

.password-field input {
  width: 100%;
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  line-height: 1;
  z-index: 1;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: var(--panel-soft);
  color: var(--brand);
  filter: none;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

.file-field {
  margin: 0;
  gap: 6px;
}

.file-field input {
  width: 100%;
  padding: 7px 10px;
}

.file-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  width: fit-content;
  border-bottom: 1px solid currentColor;
  min-height: auto;
  cursor: pointer;
  line-height: 1.35;
  text-align: left;
}

.file-link:hover,
.file-link:focus-visible {
  filter: none;
  color: var(--brand);
}

.attachment-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.existing-attachments {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
}

.existing-attachments > strong {
  color: var(--ink);
  font-size: var(--small-size);
}

.editable-attachment-links {
  display: grid;
  gap: 6px;
}

.editable-attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.editable-attachment-item .file-link {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-button {
  width: auto;
  min-height: 30px;
  padding: 4px 10px;
  font-size: var(--small-size);
  flex: 0 0 auto;
}

.login-panel button { width: 100%; margin-top: 6px; }

.login-hint {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 5px;
  background: var(--primary-action-soft);
  color: var(--brand);
  font-size: var(--small-size);
  line-height: 1.5;
  text-align: center;
  white-space: pre-wrap;
}

.hint {
  color: var(--muted);
  font-size: var(--small-size);
}

.login-error {
  margin: 0 0 12px;
  padding: 9px 10px;
  border-radius: 5px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #efb0aa;
  font-size: var(--small-size);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 160ms ease;
}

.app-shell.sidebar-collapsed { --sidebar-width: 68px; }

.sidebar {
  position: sticky;
  top: 0;
  background: var(--nav);
  color: #fff;
  padding: 12px 7px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-width: 0;
  border-right: 1px solid rgba(255,255,255,.08);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 38px;
  padding-right: 32px;
}

.brand {
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
}

.brand strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  position: absolute;
  top: 14px;
  right: 8px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 5px;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.1);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  z-index: 3;
}

.mobile-menu-button {
  display: none;
}

nav {
  display: grid;
  gap: 3px;
}

.nav {
  gap: 6px;
  padding-inline: 7px;
  justify-content: flex-start;
  background: transparent;
  color: rgba(255,255,255,.78);
  border-color: transparent;
  min-width: 0;
  overflow: hidden;
  border-radius: 5px;
}

.nav-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav.active,
.nav:hover {
  background: var(--nav-active);
  color: #fff;
}

.sidebar-collapsed .sidebar {
  padding: 14px 10px;
  align-items: center;
}

.sidebar-collapsed .sidebar-head {
  display: grid;
  justify-items: center;
  padding-right: 0;
  padding-top: 36px;
}

.sidebar-collapsed .brand { justify-content: center; }

.sidebar-collapsed .brand-logo {
  content: var(--brand-favicon-url, url('/favicon.png'));
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
  object-position: center;
}

.sidebar-collapsed .user-box,
.sidebar-collapsed .brand strong,
.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-collapsed nav { width: 100%; }

.sidebar-collapsed .nav {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .nav-icon {
  width: 21px;
  height: 21px;
  flex-basis: 21px;
}

.sidebar-collapsed .icon-button {
  top: 14px;
  right: 19px;
}

.user-box {
  margin-top: auto;
  display: grid;
  gap: 7px;
  color: rgba(255,255,255,.74);
  min-width: 0;
}

.user-box span {
  min-width: 0;
}

.current-user {
  display: grid;
  gap: 2px;
  line-height: 1.35;
}

.current-user-name,
.current-user-role {
  color: rgba(255,255,255,.66);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.workspace {
  height: 100vh;
  height: 100dvh;
  padding: var(--space-page);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.app-banner {
  min-height: var(--banner-height, 40px);
  height: var(--banner-height, 40px);
  margin: 0 0 10px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--primary-action);
  color: var(--banner-color, #fff);
  font-size: var(--banner-font-size, 15px);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.app-banner.align-left,
.banner-preview.align-left {
  justify-content: flex-start;
}

.app-banner.align-center,
.banner-preview.align-center {
  justify-content: center;
}

.app-banner.align-right,
.banner-preview.align-right {
  justify-content: flex-end;
}

.app-banner span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-banner.scrolling,
.banner-preview.scrolling {
  justify-content: flex-start;
  position: relative;
}

.app-banner.scrolling span {
  position: absolute;
  top: 50%;
  left: 100%;
  max-width: none;
  min-width: auto;
  overflow: visible;
  text-overflow: clip;
  animation: banner-scroll var(--banner-scroll-duration, 18s) linear infinite;
}

@keyframes banner-scroll {
  from {
    left: 100%;
    transform: translate(0, -50%);
  }
  to {
    left: 0;
    transform: translate(-100%, -50%);
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0;
  font-size: var(--title-size);
  font-weight: 800;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.refresh-text-button {
  min-width: 58px;
  min-height: 34px;
  padding: 6px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  white-space: nowrap;
}

.refresh-text-button.loading {
  opacity: .72;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.notice {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
  min-height: 54px;
  padding: 15px 18px;
  border: 1px solid #cde0d6;
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  box-shadow: 0 18px 50px rgba(31, 37, 35, .18);
  transform: translate(-50%, -50%);
  text-align: center;
  font-weight: 700;
  overflow-wrap: anywhere;
  animation: notice-pop 160ms ease-out;
}

.notice.success {
  border-color: var(--primary-action-soft-strong);
  background: var(--primary-action-soft);
  color: var(--brand);
}

.notice.error {
  border-color: #efb0aa;
  background: #fff0ef;
  color: var(--danger);
}

@keyframes notice-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.filter-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 12px;
}

.filter-panel summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  user-select: none;
}

.filter-panel summary::after {
  content: "展开";
  margin-left: auto;
  color: var(--muted);
  font-size: var(--small-size);
  font-weight: 400;
}

.filter-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.filter-panel[open] summary::after {
  content: "收起";
}

.user-form-panel .form-grid {
  border: 0;
  border-radius: 0;
  margin-bottom: 0;
}

.user-form-panel summary span {
  min-width: 0;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  padding: 12px;
}

#attendanceRecordFilter {
  grid-template-columns: minmax(150px, 1.2fr) minmax(132px, 1fr) minmax(132px, 1fr) minmax(112px, .8fr) auto auto auto;
  align-items: center;
}

#attendanceRecordFilter button {
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

#attendanceRecordDetailFilter {
  grid-template-columns: minmax(180px, 1.6fr) minmax(132px, 1fr) minmax(132px, 1fr) minmax(120px, .9fr);
  align-items: center;
}

@media (max-width: 1180px) {
  #attendanceRecordFilter,
  #attendanceRecordDetailFilter {
    grid-template-columns: repeat(4, minmax(112px, 1fr));
  }
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}

.detail-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.detail-header h3 {
  margin: 0 0 3px;
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-delete-button {
  margin-left: auto;
  align-self: flex-start;
  min-width: 68px;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  min-height: 32px;
  padding-inline: 12px;
  border-bottom: 2px solid transparent;
  flex: 0 0 auto;
}

.detail-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
}

.detail-pane {
  min-width: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 8px;
  padding: 0;
  margin-bottom: 12px;
}

.info-grid div {
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.project-material-card {
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  display: grid;
  gap: 4px;
  align-content: start;
  justify-items: start;
  text-align: left;
  white-space: normal;
}

.info-grid span {
  display: block;
  color: var(--muted);
  font-size: var(--small-size);
  margin-bottom: 4px;
}

.info-grid strong {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.project-material-card span {
  display: block;
  color: var(--muted);
  font-size: var(--small-size);
  margin: 0;
}

.project-material-card strong {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.project-material-card small {
  color: var(--muted);
  font-size: var(--small-size);
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.project-edit-materials {
  display: grid;
  gap: 8px;
  margin: 2px 0 8px;
}

.project-edit-materials h4 {
  margin: 0;
  font-size: var(--card-title-size);
}

.project-edit-material-list {
  display: grid;
  gap: 8px;
}

.project-edit-material-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.project-edit-material-row span,
.project-edit-material-row small {
  display: block;
  min-width: 0;
}

.project-edit-material-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.project-edit-material-row:hover,
.project-edit-material-row:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(45, 111, 176, .1);
  filter: none;
}

.project-edit-material-row:disabled {
  cursor: default;
  border-color: var(--line);
  box-shadow: none;
}

.node-timeline-block {
  grid-column: 1 / -1;
}

.node-timeline {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.node-timeline article {
  min-width: 150px;
  padding: 8px 9px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

.node-timeline strong,
.node-timeline small,
.node-timeline em {
  display: block;
  font-style: normal;
}

.node-timeline small,
.node-timeline em {
  color: var(--muted);
  font-size: var(--small-size);
  margin-top: 3px;
}

.section-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.inline-filter {
  margin: 0;
}

.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 40px));
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  overflow: hidden;
}

.modal:not([open]) {
  display: none;
}

.modal::backdrop {
  background: rgba(24, 32, 30, .38);
}

.modal-form,
.modal .stack-form {
  max-height: calc(100dvh - 56px);
  overflow: auto;
  border: 0;
  border-radius: 8px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 calc(var(--space-card) * -1) 12px;
  padding: 12px var(--space-card);
  background: var(--brand);
  color: #fff;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.modal-head h3 {
  margin: 0;
  color: #fff;
  font-size: 17px;
}

.modal-head .ghost {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
}

.modal-head .ghost:hover,
.modal-head .ghost:focus-visible {
  background: rgba(255, 255, 255, .18);
  filter: none;
}

.attachment-preview-dialog {
  width: min(920px, calc(100vw - 28px));
  height: min(880px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
}

.attachment-preview {
  padding: 0 var(--space-card) var(--space-card);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.attachment-preview-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
}

.preview-tool-button {
  width: 38px;
  min-width: 38px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.preview-tool-button svg,
.preview-side-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-preview-tools .ghost:disabled,
.preview-side-button:disabled {
  cursor: not-allowed;
  opacity: .45;
  filter: none;
}

.attachment-preview-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
}

.attachment-preview-body {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: start center;
  height: 100%;
  max-height: 100%;
  padding: 16px 70px 64px;
  overflow: auto;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}

.preview-side-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--brand);
  box-shadow: 0 8px 20px rgba(31, 95, 157, .16);
}

.preview-side-button:hover:not(:disabled) {
  background: #fff;
  filter: none;
}

.preview-side-prev {
  left: 14px;
}

.preview-side-next {
  right: 14px;
}

.attachment-preview-loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  justify-self: stretch;
  color: var(--muted);
  font-weight: 700;
}

.attachment-preview-body img {
  display: block;
  max-width: none;
  max-height: none;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  margin-bottom: 24px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.invoice-extra {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: var(--gap);
}

.kpi,
article,
.stack-form,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
}

.kpi {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 13px 16px 12px;
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(38, 62, 91, .06);
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--kpi-accent, var(--primary));
}

.kpi-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  font-size: clamp(18px, 1.65vw, 23px);
  line-height: 1.15;
  overflow-wrap: anywhere;
  letter-spacing: 0;
}

.kpi small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.kpi-contract { --kpi-accent: #2f74b5; }
.kpi-receivable { --kpi-accent: #0f8f7a; }
.kpi-purchase { --kpi-accent: #b7791f; }
.kpi-invoice { --kpi-accent: #b64545; }

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: 12px;
}

.dashboard-payment-rank {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 12px;
}

#paymentStatusList {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 6px;
}

.payment-rank-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-width: 0;
}

.payment-rank-row {
  cursor: pointer;
}

.payment-rank-row.active {
  background: var(--panel-soft);
}

.payment-rank-title strong {
  overflow-wrap: anywhere;
}

.payment-rank-title small {
  flex: 1 1 260px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--small-size);
  overflow-wrap: anywhere;
}

.payment-rank-side {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
  min-width: 120px;
}

.small-action {
  min-height: 34px;
  padding: 6px 12px;
}

article,
.stack-form {
  border-radius: 6px;
  padding: var(--space-card);
}

article h3,
.stack-form h3 {
  margin: 0 0 10px;
  font-size: var(--card-title-size);
}

.list {
  display: grid;
  gap: 8px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(116px, 1fr));
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.stack-form {
  display: grid;
  gap: 8px;
}

.modal .stack-form {
  padding: 0 var(--space-card) var(--space-card);
}

#paymentDialog {
  height: min(720px, calc(100vh - 24px));
  height: min(720px, calc(100dvh - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

#paymentForm.modal-form {
  gap: 4px;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
  -ms-overflow-style: auto;
  padding-bottom: 0;
}

#paymentForm .modal-head {
  margin-bottom: 8px;
  padding: 10px var(--space-card);
}

#paymentForm label {
  gap: 4px;
  margin-bottom: 4px;
}

#paymentForm input,
#paymentForm select {
  min-height: 34px;
  padding: 7px 10px;
}

#paymentForm button[type='submit'] {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 8px calc(var(--space-card) * -1) 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-radius: 0 0 7px 7px;
  box-shadow: 0 -10px 18px rgba(255, 255, 255, .92);
}

.submit-status {
  margin: 4px 0 0;
  color: var(--brand);
  font-size: var(--small-size);
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: .72;
  filter: none;
}

.form-section-title {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.responsive-table {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

tr:last-child td { border-bottom: 0; }

th {
  color: var(--muted);
  font-size: var(--small-size);
  font-weight: 700;
  background: var(--panel-soft);
}

tbody tr:hover { background: #fbfcfa; }

.audit-subtabs {
  margin-bottom: 14px;
}

.audit-pane {
  display: grid;
  gap: 12px;
}

.audit-pane.hidden {
  display: none;
}

.browse-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.browse-summary article,
.browse-page-grid article {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 14px 16px;
}

.browse-summary span,
.browse-summary small,
.browse-page-grid span,
.browse-sub {
  display: block;
  color: var(--muted);
  font-size: var(--small-size);
}

.browse-summary strong {
  display: block;
  margin: 5px 0 2px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
}

.browse-pages {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 14px 16px;
}

.browse-pages h3 {
  margin: 0 0 10px;
  font-size: var(--body-size);
}

.browse-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.browse-page-grid article {
  padding: 10px 12px;
}

.browse-main {
  display: block;
  color: var(--ink);
  font-weight: 700;
}

.browse-table table {
  min-width: 1040px;
}

#projectTable tbody tr[data-open-project] {
  cursor: pointer;
}

#projectTable {
  border: 1px solid #c9d2cc;
  border-radius: 4px;
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
}

#projectTable table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

#projectTable th,
#projectTable td {
  height: 38px;
  padding: 8px 8px;
  border: 1px solid #d9e0dc;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

#projectTable th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3ef;
  color: #51605a;
  font-weight: 800;
  box-shadow: inset 0 -1px 0 #c9d2cc;
}

#projectTable th:nth-child(2),
#projectTable td:nth-child(2) {
  width: 19%;
}

#projectTable th:nth-child(3),
#projectTable td:nth-child(3) {
  width: 18%;
}

#projectTable th:nth-child(1),
#projectTable td:nth-child(1) {
  width: 10%;
}

#projectTable th:nth-child(4),
#projectTable td:nth-child(4),
#projectTable th:nth-child(5),
#projectTable td:nth-child(5),
#projectTable th:nth-child(6),
#projectTable td:nth-child(6) {
  width: 10%;
}

#projectTable th:nth-child(7),
#projectTable td:nth-child(7) {
  width: 17%;
  white-space: nowrap;
  overflow-wrap: normal;
}

#projectTable th:nth-child(8),
#projectTable td:nth-child(8) {
  width: 8%;
}

#projectTable td:nth-child(4),
#projectTable td:nth-child(5),
#projectTable td:nth-child(6),
#projectTable td:nth-child(7) {
  font-variant-numeric: tabular-nums;
}

#projectTable tbody tr:hover {
  background: #f8fbff;
}

#projectTable tbody tr:last-child td {
  border-bottom: 1px solid #d9e0dc;
}

.project-table-hint {
  display: none;
  padding: 7px 10px;
  margin-top: -1px;
  color: var(--muted);
  font-size: var(--small-size);
  text-align: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 12px;
}

.work-section + .work-section {
  margin-top: 14px;
}

.attendance-grid {
  display: grid;
  grid-template-columns: minmax(380px, .95fr) minmax(360px, 1.05fr);
  gap: var(--gap);
  margin-bottom: 12px;
  align-items: stretch;
}

.attendance-tabs {
  margin-bottom: 12px;
}

.attendance-review-tabs {
  margin-bottom: 12px;
}

.attendance-pane {
  display: grid;
  gap: 12px;
}

.attendance-review-pane {
  display: grid;
  gap: 12px;
}

.attendance-card {
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 12px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h3 {
  margin: 0;
}

.attendance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attendance-punch-area {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 12px 0;
}

.attendance-punch-button {
  appearance: none;
  width: clamp(172px, 38vw, 220px);
  height: clamp(172px, 38vw, 220px);
  border: 0;
  border-radius: 50%;
  background: var(--primary-action);
  color: #fff;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  box-shadow: 0 16px 34px rgba(31, 95, 157, .24);
}

.attendance-punch-button:hover:not(:disabled) {
  background: var(--primary-action-hover);
  color: #fff;
  filter: none;
  -webkit-text-fill-color: #fff;
}

.attendance-punch-button.disabled,
.attendance-punch-button:disabled {
  background: #5f8fbd !important;
  color: #fff !important;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
  filter: none;
  -webkit-text-fill-color: #fff;
}

.attendance-punch-button.disabled:hover,
.attendance-punch-button:disabled:hover {
  background: #5f8fbd !important;
  color: #fff !important;
  filter: none;
  -webkit-text-fill-color: #fff;
}

.attendance-punch-button:hover span,
.attendance-punch-button:disabled span,
.attendance-punch-button.disabled span {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
}

.attendance-punch-kind {
  display: block;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  line-height: 1.25;
}

.attendance-punch-date,
.attendance-punch-time {
  display: block;
  font-size: clamp(16px, 2.5vw, 22px);
  line-height: 1.25;
  opacity: .82;
}

.attendance-punch-hint {
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

.overtime-punch-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.overtime-punch-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  padding: 6px 0 2px;
}

.overtime-punch-btn {
  appearance: none;
  width: clamp(132px, 20vw, 168px);
  height: clamp(132px, 20vw, 168px);
  border: 0;
  border-radius: 50%;
  background: var(--primary-action);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 14px 30px rgba(31, 95, 157, .22);
  -webkit-text-fill-color: #fff;
}

.overtime-punch-btn:hover:not(:disabled) {
  background: var(--primary-action-hover);
  color: #fff;
  filter: none;
  -webkit-text-fill-color: #fff;
}

.overtime-punch-btn.disabled,
.overtime-punch-btn:disabled {
  background: #5f8fbd !important;
  color: #fff !important;
  opacity: 1;
  box-shadow: none;
  filter: none;
  cursor: not-allowed;
  -webkit-text-fill-color: #fff;
}

.attendance-card label {
  margin-bottom: 0;
}

.attendance-current {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.attendance-current div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px;
  background: var(--panel-soft);
}

.attendance-current span {
  display: block;
  color: var(--muted);
  font-size: var(--small-size);
}

.attendance-current strong {
  display: block;
  margin-top: 4px;
  font-size: var(--card-title-size);
}

.attendance-current small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.attendance-correction-list {
  display: grid;
  gap: 8px;
}

.attendance-leave-balance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.attendance-leave-balance div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.attendance-leave-balance span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.attendance-leave-balance strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.leave-form {
  margin-bottom: 12px;
}

.leave-form .wide {
  grid-column: 1 / -1;
}

.leave-create-panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.leave-create-panel summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
  color: var(--brand);
}

.leave-create-panel .leave-form {
  padding: 0 14px 14px;
}

.attendance-correction-row {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.attendance-leave-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  cursor: pointer;
}

.attendance-leave-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attendance-leave-row .attendance-correction-actions {
  white-space: nowrap;
}

.attendance-leave-item.expanded .attendance-leave-row {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.attendance-leave-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: #fff;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.attendance-correction-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.attendance-correction-row em {
  justify-self: end;
  font-style: normal;
  color: var(--brand);
  font-weight: 700;
}

.attendance-correction-review-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.attendance-correction-review-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) 110px 80px minmax(220px, 2fr) 80px auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.attendance-leave-review-row {
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.15fr) 80px minmax(260px, 2fr) 90px auto;
}

.attendance-correction-review-row strong,
.attendance-correction-review-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.attendance-leave-review-row strong,
.attendance-leave-review-row span,
.attendance-leave-review-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
}

.attendance-correction-review-row em {
  color: var(--brand);
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.attendance-correction-reason {
  color: var(--muted);
}

.attendance-correction-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 108px;
  white-space: nowrap;
}

.attendance-location {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-soft);
  color: var(--ink);
}

.attendance-location strong {
  display: block;
  margin-bottom: 3px;
}

.attendance-location small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.password-panel {
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
}

.password-form {
  display: grid;
  gap: 12px;
}

.password-form label {
  margin: 0;
}

.password-form button[type="submit"] {
  margin-top: 4px;
  width: 100%;
}

.receipt-list {
  display: grid;
  gap: 8px;
}

.receipt-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(120px, .8fr) minmax(112px, .7fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.receipt-row strong,
.receipt-row span,
.receipt-row time,
.receipt-note {
  min-width: 0;
  overflow-wrap: anywhere;
}

.receipt-row span {
  font-weight: 700;
}

.receipt-row time {
  color: var(--muted);
}

.receipt-note {
  color: var(--muted);
  font-style: normal;
}

.receipt-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.muted-location {
  color: var(--muted);
}

.fence-switch {
  width: fit-content;
  margin-bottom: 0;
}

.settings-subform {
  margin-bottom: 0;
}

.fence-address-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: var(--control-height);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--muted);
}

.fence-address-preview strong {
  color: var(--ink);
  white-space: nowrap;
}

.fence-address-preview span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.kpi-grid.compact {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin-top: 0;
  gap: 8px;
}

.attendance-card .kpi-grid.compact {
  align-items: stretch;
}

.attendance-stat-card {
  min-height: 0;
  padding: 8px 10px;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  cursor: pointer;
}

.attendance-stat-card:hover,
.attendance-stat-card.active {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--primary-action-soft);
  filter: none;
}

.attendance-stat-card small {
  display: block;
  color: var(--muted);
}

.attendance-stat-card strong {
  margin-top: 2px;
  font-size: 17px;
}

.attendance-stats-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.attendance-stats-list-title {
  color: var(--muted);
  font-size: var(--small-size);
  font-weight: 700;
}

.attendance-sheet-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  contain: inline-size paint;
  border: 1px solid #d5dde3;
  background: #fff;
  background:
    linear-gradient(90deg, #fff 30%, rgba(255, 255, 255, 0)) left center / 24px 100% no-repeat local,
    linear-gradient(270deg, #fff 30%, rgba(255, 255, 255, 0)) right center / 24px 100% no-repeat local,
    linear-gradient(90deg, rgba(31, 37, 35, .12), rgba(31, 37, 35, 0)) left center / 12px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(31, 37, 35, .12), rgba(31, 37, 35, 0)) right center / 12px 100% no-repeat scroll,
    #fff;
}

.attendance-sheet-table {
  width: 100%;
  min-width: 1440px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  color: #050505;
}

.attendance-sheet-table th,
.attendance-sheet-table td {
  height: 36px;
  padding: 5px 8px;
  border: 1px solid #dfe5e8;
  text-align: center;
  vertical-align: middle;
  font-weight: 500;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attendance-sheet-table th {
  height: 40px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
}

.attendance-sheet-table th:nth-child(2),
.attendance-sheet-table td:nth-child(2) {
  width: 100px;
}

.attendance-sheet-table th:nth-child(3),
.attendance-sheet-table td:nth-child(3) {
  width: 130px;
}

.attendance-sheet-table th:nth-child(4),
.attendance-sheet-table td:nth-child(4) {
  width: 118px;
}

.attendance-sheet-table th:nth-child(5),
.attendance-sheet-table td:nth-child(5),
.attendance-sheet-table th:nth-child(6),
.attendance-sheet-table td:nth-child(6) {
  width: 96px;
}

.attendance-sheet-table th:nth-child(7),
.attendance-sheet-table td:nth-child(7) {
  width: 120px;
}

.attendance-sheet-table th:nth-child(8),
.attendance-sheet-table td:nth-child(8) {
  width: 128px;
}

.attendance-sheet-table th:nth-child(9),
.attendance-sheet-table td:nth-child(9) {
  width: 132px;
}

.attendance-sheet-table th:nth-child(10),
.attendance-sheet-table td:nth-child(10) {
  width: 142px;
}

.attendance-sheet-table th:nth-child(11),
.attendance-sheet-table td:nth-child(11) {
  width: 138px;
}

.attendance-sheet-table th:nth-child(12),
.attendance-sheet-table td:nth-child(12) {
  width: 150px;
  overflow: visible;
}

.attendance-sheet-table .sheet-green {
  background: #fff;
}

.attendance-sheet-table .sheet-name {
  width: 92px;
  background: #fff;
}

.attendance-sheet-table th.sheet-name,
.attendance-sheet-table td.sheet-name {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 1px 0 0 #dfe5e8, 8px 0 12px rgba(31, 37, 35, .06);
}

.attendance-sheet-table th.sheet-name {
  z-index: 3;
}

.attendance-sheet-table tbody .sheet-name {
  background: #fff;
}

.attendance-sheet-table tbody tr:hover td {
  filter: none;
}

.attendance-sheet-hint {
  display: none;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--small-size);
  text-align: center;
}

.attendance-mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: var(--small-size);
  font-weight: 700;
  white-space: nowrap;
}

.attendance-mode-badge.office {
  background: var(--primary-action-soft);
  color: var(--brand);
}

.attendance-mode-badge.travel {
  background: #fff2dc;
  color: #9a5a00;
  border: 1px solid #f1c784;
}

.attendance-empty {
  color: var(--soft);
  font-weight: 700;
  letter-spacing: 0;
}

.attendance-detail-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.attendance-detail-head,
.attendance-detail-lines,
.attendance-detail-lines > div {
  min-width: 0;
}

.attendance-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}

.attendance-detail-head strong {
  font-size: var(--card-title-size);
}

.attendance-detail-head span {
  color: var(--muted);
}

.attendance-detail-head em,
.attendance-detail-lines em {
  color: var(--brand);
  font-style: normal;
  font-weight: 700;
}

.attendance-detail-lines {
  display: grid;
  gap: 6px;
}

.attendance-detail-lines > div {
  display: grid;
  grid-template-columns: 42px 72px 64px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.attendance-detail-lines strong {
  color: var(--muted);
  font-weight: 700;
}

.attendance-detail-lines small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.attendance-detail-lines em.warn {
  color: #805300;
}

.attendance-detail-row p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.card p,
.card h3,
.list-row span,
.meta span {
  overflow-wrap: anywhere;
}

.card h3 {
  margin: 0;
  font-size: var(--card-title-size);
}

.progress-stats {
  margin-top: 12px;
}

.progress-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.progress-stat-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  min-height: 68px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  text-align: center;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.progress-stat-card-static {
  cursor: default;
  justify-content: flex-start;
}

.progress-stat-card:hover,
.progress-stat-card:focus-visible {
  border-color: var(--brand);
  background: var(--primary-action-soft);
}

.progress-stat-card.active {
  border-color: var(--brand);
  background: var(--primary-action-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.progress-stat-card span {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: var(--small-size);
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.progress-stat-card strong {
  display: inline-flex;
  align-items: center;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 12px;
  align-items: start;
}

.progress-lane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  overflow: hidden;
}

.progress-lane header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.progress-lane h3 {
  margin: 0;
  font-size: var(--card-title-size);
  overflow-wrap: anywhere;
}

.progress-lane header span {
  min-width: 26px;
  min-height: 24px;
  border-radius: 999px;
  background: var(--primary-action-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.progress-card-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.progress-card {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.progress-card.expanded {
  border-color: var(--brand);
  cursor: default;
}

.progress-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.progress-card h4 {
  margin: 0;
  font-size: var(--card-title-size);
  overflow-wrap: anywhere;
}

.progress-card p {
  margin: 2px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.progress-card label {
  margin: 0;
}

.progress-card label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--small-size);
}

.progress-summary-side {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 120px;
}

.progress-summary-side small {
  color: var(--muted);
  font-size: var(--small-size);
  text-align: right;
}

.progress-card-detail {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.progress-update-form,
.progress-update-fields,
.progress-update-list {
  display: grid;
  gap: 10px;
}

.progress-update-form {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.progress-update-item {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.progress-update-item span,
.progress-update-item p {
  color: var(--muted);
  font-size: var(--small-size);
}

.progress-update-item p {
  margin: 0;
  overflow-wrap: anywhere;
}

.project-progress-list {
  display: grid;
  gap: 8px;
}

.project-progress-row {
  display: grid;
  grid-template-columns: 112px 96px minmax(180px, 1fr) minmax(140px, auto) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.project-progress-row time,
.project-progress-row em {
  color: var(--muted);
  font-style: normal;
}

.project-progress-row strong,
.project-progress-row span,
.project-progress-row a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-progress-actions {
  display: flex;
  justify-content: flex-end;
}

.project-payment-list {
  display: grid;
  gap: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
}

.project-payment-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.project-payment-row:hover {
  border-color: var(--brand);
  background: var(--panel-soft);
}

.project-payment-main {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.project-payment-main strong {
  font-size: var(--card-title-size);
  overflow-wrap: anywhere;
}

.project-payment-main span,
.project-payment-main em,
.project-payment-status {
  color: var(--muted);
  font-size: var(--small-size);
  font-style: normal;
  overflow-wrap: anywhere;
}

.project-payment-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.project-payment-side > strong {
  font-size: 16px;
  white-space: nowrap;
}

.progress-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: var(--small-size);
}

.progress-meta span {
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: var(--small-size);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: var(--small-size);
  background: var(--primary-action-soft);
  color: var(--brand);
}

.badge.warn { background: var(--warn-bg); color: #805300; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.invoice-status {
  background: #f4f7f6;
  color: var(--muted);
}

.badge.invoice-status.no-invoice {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f0c1bb;
}

.badge.invoice-status.partial-invoice {
  background: var(--warn-bg);
  color: #805300;
}

.invoice-status-button {
  min-height: 0;
  border-color: var(--primary-action-soft-strong);
  cursor: pointer;
}

.invoice-status-button:hover,
.invoice-status-button:focus-visible {
  color: var(--brand);
  filter: none;
}

.invoice-status-button.no-invoice:hover,
.invoice-status-button.no-invoice:focus-visible {
  color: var(--danger);
  background: #ffe5e1;
}

.payment-list {
  display: grid;
  gap: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
}

.payment-row {
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  overflow: visible;
}

.payment-row:last-child {
  border-bottom: 0;
}

.payment-row:hover,
.payment-row.expanded {
  background: var(--panel-soft);
}

.payment-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.payment-summary-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.payment-summary-side strong {
  font-size: 16px;
}

.payment-detail {
  display: grid;
  gap: 10px;
  padding: 0 0 14px;
  cursor: default;
}

.payment-detail p {
  margin: 0;
  overflow-wrap: anywhere;
}

.payment-group-detail {
  gap: 12px;
}

.payment-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payment-child-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 20px) / 3);
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}

.payment-child-row {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  min-width: 0;
  position: relative;
  scroll-snap-align: start;
}

.payment-child-invoice {
  position: absolute;
  top: 10px;
  right: 12px;
}

.payment-child-main {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding-right: 80px;
}

.payment-child-main p {
  margin: 0;
}

.payment-child-main small {
  color: var(--muted);
}

.payment-child-row .flow-position {
  padding: 8px;
}

.payment-child-row .flow-steps {
  gap: 6px;
}

.payment-child-row .actions.payment-actions {
  grid-template-columns: 1fr;
  align-items: start;
}

.payment-child-row .payment-primary-actions {
  gap: 5px;
  flex-wrap: nowrap;
}

.payment-child-row .payment-primary-actions button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 7px;
  font-size: var(--small-size);
}

.payment-group-attachments {
  min-width: 0;
}

.actions.payment-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px 14px;
}

.payment-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.payment-delete-action {
  justify-self: end;
}

#paymentViewDialog {
  width: min(760px, calc(100vw - 32px));
}

.payment-view-modal {
  max-height: calc(100dvh - 56px);
  overflow: auto;
  padding: 0 var(--space-card) var(--space-card);
  border: 0;
  background: #fff;
}

.payment-view-modal .modal-head {
  margin: 0 calc(var(--space-card) * -1) 14px;
}

.payment-view-modal .modal-head .ghost {
  flex: 0 0 auto;
}

.readonly-detail {
  display: grid;
  gap: 12px;
}

.readonly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.readonly-grid div,
.readonly-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
}

.readonly-grid span,
.readonly-section > span {
  display: block;
  color: var(--muted);
  font-size: var(--small-size);
  margin-bottom: 4px;
}

.readonly-grid strong,
.readonly-section p {
  margin: 0;
  overflow-wrap: anywhere;
}

.readonly-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.readonly-badges em {
  padding: 6px 9px;
  border-radius: 6px;
  background: #fff6db;
  color: #8a6100;
  font-style: normal;
  font-weight: 700;
}

.flow-position {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  width: fit-content;
  max-width: 100%;
}

.flow-position span {
  color: var(--muted);
  font-size: var(--small-size);
}

.flow-position strong {
  color: var(--brand);
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.flow-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.flow-step.approved {
  color: var(--brand);
}

.flow-step.approved .flow-check {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.record-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.table-action {
  min-height: 30px;
  padding: 5px 9px;
}

.settings-panel,
.settings-form,
.step-options {
  display: grid;
  gap: 12px;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.settings-tab {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  min-height: 32px;
  padding-inline: 12px;
  border-bottom: 2px solid transparent;
}

.settings-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
}

.settings-pane {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.settings-pane h3,
.settings-pane p {
  margin: 0;
}

.attendance-rules-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.attendance-place-grid {
  grid-template-columns: minmax(220px, 2fr) auto minmax(180px, 1.4fr) auto;
}

.attendance-fence-grid {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
}

.attendance-fence-grid #useCurrentLocationBtn,
.attendance-fence-grid .fence-address-preview {
  grid-column: span 3;
}

.holiday-calendar-panel {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.holiday-calendar-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.holiday-calendar-controls {
  grid-template-columns: minmax(150px, .7fr) minmax(96px, .35fr) minmax(130px, .45fr) repeat(2, minmax(220px, 1fr));
}

.holiday-calendar-controls textarea,
.holiday-cache-field textarea {
  width: 100%;
  resize: vertical;
}

.holiday-single-rest-check {
  align-self: end;
  min-height: var(--control-height);
}

.holiday-sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.holiday-sync-row .hint {
  margin: 0;
}

.holiday-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.holiday-calendar-weekday {
  padding: 3px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.holiday-calendar-empty {
  min-height: 46px;
}

.holiday-calendar-day {
  display: grid;
  gap: 1px;
  min-height: 46px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  align-content: start;
}

.holiday-calendar-day.offday {
  border-color: #f0c6bc;
  background: #fff6f3;
}

.holiday-calendar-day.workday {
  background: #f8fbf9;
}

.holiday-calendar-day.manualWorkday,
.holiday-calendar-day.manualOffday {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(42, 111, 176, .18);
}

.holiday-calendar-day strong {
  font-size: 12px;
  line-height: 1.1;
}

.holiday-calendar-day span {
  font-size: 11px;
  line-height: 1.15;
  font-weight: 700;
}

.holiday-calendar-day small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.holiday-cache-field {
  display: grid;
  gap: 6px;
}

.holiday-cache-field textarea {
  min-height: 112px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.watermark-preview {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #fff;
  background-repeat: repeat;
  background-image: var(--watermark-preview-image);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

.watermark-preview span {
  padding: 6px 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .82);
}

.brand-settings-grid {
  align-items: end;
  grid-template-columns:
    minmax(180px, 1fr)
    minmax(150px, .85fr)
    134px
    134px
    minmax(260px, 1fr);
  column-gap: 8px;
  row-gap: 8px;
}

.brand-settings-grid > label {
  margin: 0;
}

.brand-color-pair {
  display: grid;
  grid-template-columns: 56px 70px;
  gap: 4px;
  align-items: end;
  align-self: end;
  min-width: 0;
}

.brand-color-pair label {
  margin: 0;
  min-width: 0;
  gap: 4px;
}

.brand-color-pair input {
  height: var(--control-height);
}

.brand-opacity-field input {
  width: 70px;
  padding-inline: 8px;
}

.brand-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 12px;
}

.brand-preview div {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--small-size);
}

.brand-preview img {
  width: 100%;
  height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}

.banner-check {
  align-content: center;
  min-height: var(--control-height);
}

.banner-preview {
  min-height: var(--banner-preview-height, 40px);
  height: var(--banner-preview-height, 40px);
  padding: 0 16px;
  border-radius: 6px;
  background: var(--primary-action);
  color: var(--banner-preview-color, #fff);
  font-size: var(--banner-preview-font-size, 15px);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.banner-preview span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-preview.scrolling span {
  position: absolute;
  top: 50%;
  left: 100%;
  max-width: none;
  min-width: auto;
  overflow: visible;
  text-overflow: clip;
  animation: banner-scroll var(--banner-preview-scroll-duration, 18s) linear infinite;
}

.approval-builder {
  display: grid;
  grid-template-columns: minmax(160px, 260px) auto;
  gap: 8px;
  justify-content: start;
}

.approval-step-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.approval-step-row.dragging {
  opacity: .58;
}

.approval-step-row span,
.approval-step-row small {
  min-width: 0;
}

.approval-step-row small {
  display: block;
  color: var(--muted);
  font-size: var(--small-size);
  margin-top: 2px;
}

.approval-drag {
  width: 30px;
  min-width: 30px;
  padding-inline: 0;
  cursor: grab;
}

.settings-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--ink);
}

.check-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 auto;
}

.check-row span {
  display: grid;
  gap: 2px;
}

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

.permission-panel {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.permission-panel summary {
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}

.permission-copy {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(160px, 1fr) auto;
  gap: 8px;
  padding: 0 12px 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 12px 12px;
  align-items: start;
}

.permission-grid > section,
.permission-more-grid > section {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.permission-grid h4,
.permission-more-grid h4 {
  margin: 0;
  font-size: var(--body-size);
  line-height: 1.2;
  color: var(--ink);
}

.check-list {
  display: grid;
  gap: 6px;
}

#visibleTabOptions {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

#visibleTabOptions .permission-check {
  min-height: 32px;
  padding: 6px 7px;
}

.permission-more {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.permission-more > summary {
  min-height: 38px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
  color: var(--brand);
}

.permission-more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
  padding: 0 10px 10px;
  align-items: start;
}

.mini-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
}

.mini-check input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
}

.permission-check {
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
}

.permission-check:hover {
  border-color: var(--line);
}

.permission-check.disabled {
  color: var(--muted);
  background: #f4f7f5;
  opacity: .72;
}

.permission-check.disabled:hover {
  border-color: transparent;
}

.permission-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.permission-group.disabled {
  background: #f8faf8;
  border-style: dashed;
}

.permission-group.disabled summary {
  color: var(--muted);
}

.permission-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
  color: var(--brand);
  list-style-position: inside;
}

.permission-group summary small {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--small-size);
  white-space: nowrap;
}

.permission-group .check-list {
  padding: 0 8px 8px 8px;
}

@media (max-width: 1280px) {
  :root {
    --sidebar-width: 144px;
    --space-page: 16px;
    --space-card: 13px;
    --title-size: 21px;
    --kpi-size: 19px;
  }

  .form-grid { grid-template-columns: repeat(4, minmax(112px, 1fr)); }
  .brand-settings-grid { grid-template-columns: repeat(4, minmax(112px, 1fr)); }
  .filter-form { grid-template-columns: repeat(4, minmax(112px, 1fr)); }
  .permission-copy { grid-template-columns: 1fr 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
  .permission-grid > section,
  .permission-more-grid > section {
    padding-top: 2px;
  }
  .permission-more-grid {
    grid-template-columns: 1fr;
  }
  .info-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 220px)); }
}

@media (max-width: 980px) {
  :root {
    --space-page: 13px;
    --space-card: 12px;
    --gap: 10px;
    --title-size: 20px;
    --card-title-size: 14px;
    --kpi-size: 18px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .login-shell { grid-template-columns: 1fr; }

  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: clip;
    overflow-y: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    height: auto;
    overflow: visible;
    padding: 10px 12px;
    gap: 10px;
  }

  .sidebar-collapsed .nav-label {
    display: block;
  }

  .sidebar-collapsed .sidebar-head {
    display: flex;
    justify-items: initial;
    padding-top: 0;
    padding-right: 0;
  }

  .sidebar-collapsed .sidebar { align-items: stretch; }
  .icon-button { display: none !important; }

  .mobile-menu-button {
    display: inline-flex;
    margin-left: auto;
    min-height: 34px;
    padding: 6px 12px;
    border-color: rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: #fff;
  }

  .mobile-menu-button:hover,
  .mobile-menu-button:focus-visible {
    background: rgba(255,255,255,.14);
    filter: none;
  }

  .app-shell.mobile-nav-collapsed .sidebar {
    gap: 0;
  }

  .app-shell.mobile-nav-collapsed .sidebar nav,
  .app-shell.mobile-nav-collapsed .sidebar .user-box {
    display: none;
  }

  nav { grid-template-columns: repeat(3, 1fr); }

  .user-box {
    margin-top: 0;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,.1);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    height: auto;
    overflow-x: clip;
    overflow-y: visible;
  }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attendance-stat-card { padding: 7px 8px; }
  .attendance-stat-card strong { font-size: 16px; }
  .split { grid-template-columns: 1fr; }
  .attendance-grid { grid-template-columns: 1fr; }
  .attendance-correction-row {
    grid-template-columns: 1fr;
  }
  .attendance-leave-balance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .attendance-correction-row em {
    justify-self: start;
  }
  .attendance-correction-review-row {
    grid-template-columns: 1fr;
  }
  .attendance-correction-actions {
    justify-content: flex-start;
  }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attachment-preview-dialog {
    width: calc(100vw - 24px);
    height: min(620px, calc(100dvh - 116px));
    max-height: calc(100dvh - 116px);
  }
  .attachment-preview {
    padding: 0 10px 10px;
  }
  .attachment-preview-dialog .modal-head {
    padding: 12px 14px;
  }
  .attachment-preview-dialog .modal-head h3 {
    font-size: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .attachment-preview-tools {
    padding: 8px 0;
    gap: 6px;
  }
  .preview-tool-button {
    width: 34px;
    min-width: 34px;
    height: 32px;
    min-height: 32px;
  }
  .attachment-preview-body {
    padding: 12px 48px 34px;
  }
  .preview-side-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }
  .preview-side-prev {
    left: 6px;
  }
  .preview-side-next {
    right: 6px;
  }
  [data-panel="projectDetail"] .section-toolbar {
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
  }
  [data-panel="projectDetail"] .inline-filter .filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  :root {
    --space-page: 10px;
    --space-card: 11px;
    --gap: 8px;
    --control-height: 34px;
    --control-pad-x: 8px;
    --body-size: 12px;
    --small-size: 11px;
    --title-size: 18px;
    --card-title-size: 13px;
    --kpi-size: 17px;
  }

  .sidebar {
    padding: max(8px, env(safe-area-inset-top)) 8px 8px;
  }

  .sidebar-head {
    padding-right: 0;
    min-height: 38px;
  }

  .brand { gap: 8px; }

  .brand-logo {
    width: 74px;
    height: 34px;
  }

  .brand strong { font-size: 13px; }

  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .nav {
    min-height: 32px;
    justify-content: center;
    padding: 6px 4px;
    white-space: nowrap;
    gap: 5px;
  }

  .nav-icon {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }

  .user-box {
    display: grid;
  }

  .user-box .ghost {
    min-height: 34px;
    padding-inline: 12px;
  }

  .workspace {
    padding: 10px 8px calc(12px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 9px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }

  .top-actions .button,
  .top-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 7px;
  }

  .form-grid { grid-template-columns: 1fr; }
  .brand-settings-grid { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: 1fr; }
  [data-settings-pane="attendance"] .settings-subform {
    gap: 8px;
    padding: 9px;
  }
  .brand-color-pair {
    grid-template-columns: minmax(0, 1fr) 76px;
  }
  .brand-opacity-field input {
    width: 76px;
  }
  .attendance-rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .attendance-rules-grid label {
    gap: 4px;
    font-size: 12px;
    min-width: 0;
  }
  .attendance-rules-grid input,
  .attendance-rules-grid select {
    min-height: 38px;
    padding: 7px 8px;
  }
  .attendance-rules-grid .attendance-wide-field,
  .attendance-rules-grid #attendanceOvertimeDurationField {
    grid-column: span 2;
  }
  .holiday-calendar-controls {
    grid-template-columns: 1fr;
  }
  .holiday-calendar-grid {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
    overflow-x: auto;
  }
  .holiday-calendar-day {
    min-height: 44px;
    padding: 4px;
  }
  .holiday-calendar-day small {
    font-size: 9px;
  }
  .attendance-place-grid {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .attendance-place-grid #attendancePlaceResults {
    grid-column: 1;
  }
  .attendance-place-grid button {
    width: auto;
    min-width: 86px;
    padding-inline: 10px;
  }
  .attendance-fence-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .attendance-fence-grid #useCurrentLocationBtn,
  .attendance-fence-grid .fence-address-preview {
    grid-column: 1 / -1;
  }
  .kpi-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-detail-lines > div {
    grid-template-columns: 38px 64px 56px minmax(0, 1fr);
    gap: 6px;
  }
  .actions.payment-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .payment-primary-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .payment-primary-actions button {
    flex: 0 0 auto;
  }
  .payment-delete-action {
    justify-self: end;
  }
  .section-toolbar { grid-template-columns: 1fr; }
  .detail-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 9px;
    padding: 4px 0 10px;
  }
  .detail-header .ghost {
    min-width: 64px;
    min-height: 36px;
  }
  .detail-header h3 {
    font-size: 17px;
  }
  .detail-header .hint {
    margin: 2px 0 0;
  }
  .detail-delete-button {
    margin-left: 0;
    min-width: 64px;
    min-height: 36px;
  }
  .detail-tabs {
    position: sticky;
    top: 0;
    z-index: 1;
    overflow-x: auto;
    gap: 0;
    margin-inline: -8px;
    padding: 0 8px;
    background: var(--paper);
    scrollbar-width: none;
  }
  .detail-tabs::-webkit-scrollbar {
    display: none;
  }

  .browse-summary {
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: 8px;
  }

  .browse-summary article {
    padding: 10px;
  }

  .browse-summary strong {
    font-size: 22px;
  }

  .browse-pages {
    padding: 10px;
  }
  .detail-tab {
    min-height: 40px;
    padding-inline: 14px;
  }
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .info-grid div {
    min-height: 78px;
    padding: 10px;
  }
  .info-grid strong {
    display: block;
    line-height: 1.35;
  }
  [data-panel="projectDetail"] .section-toolbar {
    grid-template-columns: 1fr;
  }
  [data-panel="projectDetail"] .section-toolbar > button {
    width: 100%;
  }
  [data-panel="projectDetail"] .inline-filter .filter-form {
    grid-template-columns: 1fr;
  }
  [data-panel="projectDetail"] .filter-panel summary {
    min-height: 40px;
  }
  .record-actions,
  [data-panel="projectDetail"] .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .record-actions button,
  [data-panel="projectDetail"] .actions button {
    width: 100%;
  }
  .permission-panel summary {
    min-height: 42px;
    padding: 10px;
  }
  .permission-copy {
    grid-template-columns: 1fr;
    padding: 0 10px 10px;
  }
  .permission-copy button {
    width: 100%;
  }
  .permission-grid {
    gap: 10px;
    padding: 0 10px 10px;
  }
  .permission-grid h4,
  .permission-more-grid h4 {
    font-size: 13px;
  }
  .permission-more > summary {
    min-height: 42px;
    padding: 10px;
  }
  .permission-more-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 8px 8px;
  }
  .permission-group summary {
    min-height: 42px;
    padding: 10px;
  }
  .permission-group .check-list {
    padding: 0 8px 8px;
  }
  #visibleTabOptions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .permission-check {
    min-height: 42px;
    padding: 9px 8px;
    gap: 10px;
  }
  .permission-check input {
    width: 22px;
    height: 22px;
    min-height: 22px;
  }
  #visibleTabOptions .permission-check {
    min-height: 38px;
    padding: 8px;
  }
  .progress-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .progress-stat-card {
    min-height: 48px;
    padding: 7px 8px;
    gap: 6px;
    border-radius: 5px;
  }
  .progress-stat-card-static {
    justify-content: center;
  }
  .progress-stat-card span {
    font-size: 11px;
  }
  .progress-stat-card strong {
    font-size: 18px;
  }
  .progress-board {
    grid-template-columns: 1fr;
  }
  .progress-card {
    padding: 10px;
  }
  .progress-card .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .progress-card button {
    width: 100%;
  }
  .project-progress-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 10px;
  }
  .project-progress-row time,
  .project-progress-row strong,
  .project-progress-row span,
  .project-progress-row a,
  .project-progress-row em {
    grid-column: 1 / -1;
  }
  .project-progress-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .project-progress-actions button {
    width: 100%;
  }
  .project-payment-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }
  .project-payment-main {
    display: grid;
    gap: 3px;
  }
  .project-payment-side {
    justify-content: flex-start;
  }
  .receipt-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 12px;
    padding: 11px 12px;
  }
  .receipt-row > strong {
    grid-column: 1 / -1;
    font-size: var(--card-title-size);
  }
  .receipt-row > span {
    align-self: center;
  }
  .receipt-row > time {
    justify-self: end;
    align-self: center;
  }
  .receipt-note {
    grid-column: 1 / -1;
  }
  .receipt-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: flex-start;
  }
  .receipt-actions:empty {
    display: none;
  }
  .receipt-actions button {
    width: 100%;
  }
  .payment-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: start;
  }
  .payment-rank-title {
    min-width: 0;
  }
  .payment-summary-side {
    display: grid;
    grid-template-columns: auto auto;
    justify-self: end;
    justify-items: end;
    align-items: start;
    gap: 5px 7px;
  }
  .payment-summary-side > strong {
    grid-row: 1 / span 3;
    align-self: start;
    white-space: nowrap;
  }
  .payment-summary-side .badge {
    grid-column: 2;
    width: max-content;
    justify-content: center;
    white-space: nowrap;
  }
  .payment-group-header,
  .payment-child-row {
    grid-template-columns: 1fr;
  }
  .payment-child-list {
    grid-auto-columns: 520px;
  }
  .payment-child-row .payment-primary-actions {
    overflow-x: visible;
    padding-bottom: 0;
  }
  .payment-child-row .payment-delete-action {
    justify-self: auto;
  }
  .payment-child-row {
    display: grid;
  }

  .responsive-table {
    background: transparent;
    border: 0;
    overflow-x: clip;
    overflow-y: visible;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table { border-collapse: separate; }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 9px;
    padding: 6px 0;
  }

  td {
    display: grid;
    grid-template-columns: minmax(74px, 32%) minmax(0, 1fr);
    gap: 8px;
    padding: 7px 10px;
    white-space: normal;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--small-size);
  }

  .attendance-sheet-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    border: 1px solid #d5dde3;
    border-radius: 6px;
  }

  .attendance-sheet-table,
  .attendance-sheet-table thead,
  .attendance-sheet-table tbody,
  .attendance-sheet-table tr,
  .attendance-sheet-table th,
  .attendance-sheet-table td {
    width: auto;
  }

  .attendance-sheet-table {
    display: table;
    width: max-content;
    min-width: 1160px;
    border-collapse: collapse;
    font-size: 12px;
  }

  .attendance-sheet-table thead {
    display: table-header-group;
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .attendance-sheet-table tbody {
    display: table-row-group;
  }

  .attendance-sheet-table tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
  }

  .attendance-sheet-table th,
  .attendance-sheet-table td {
    display: table-cell;
    height: 34px;
    min-width: 0;
    padding: 5px 7px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #dfe5e8;
  }

  .attendance-sheet-table td::before {
    content: none;
  }

  .attendance-sheet-table .sheet-name {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
    white-space: normal;
  }

  .attendance-sheet-table th:nth-child(2),
  .attendance-sheet-table td:nth-child(2) {
    width: 88px;
    min-width: 88px;
  }

  .attendance-sheet-table th:nth-child(3),
  .attendance-sheet-table td:nth-child(3) {
    width: 108px;
    min-width: 108px;
  }

  .attendance-sheet-table th:nth-child(4),
  .attendance-sheet-table td:nth-child(4),
  .attendance-sheet-table th:nth-child(7),
  .attendance-sheet-table td:nth-child(7) {
    width: 96px;
    min-width: 96px;
  }

  .attendance-sheet-table th:nth-child(5),
  .attendance-sheet-table td:nth-child(5),
  .attendance-sheet-table th:nth-child(6),
  .attendance-sheet-table td:nth-child(6) {
    width: 76px;
    min-width: 76px;
  }

  .attendance-sheet-table th:nth-child(8),
  .attendance-sheet-table td:nth-child(8),
  .attendance-sheet-table th:nth-child(9),
  .attendance-sheet-table td:nth-child(9) {
    width: 112px;
    min-width: 112px;
  }

  .attendance-sheet-table th:nth-child(10),
  .attendance-sheet-table td:nth-child(10) {
    width: 126px;
    min-width: 126px;
  }

  .attendance-sheet-table th:nth-child(11),
  .attendance-sheet-table td:nth-child(11) {
    width: 118px;
    min-width: 118px;
  }

  .attendance-sheet-table th:nth-child(12),
  .attendance-sheet-table td:nth-child(12) {
    width: 128px;
    min-width: 128px;
    overflow: visible;
  }

  .attendance-sheet-hint {
    display: block;
  }

  .project-table-hint {
    display: block;
  }

  #projectTable {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #projectTable table,
  #projectTable thead,
  #projectTable tbody {
    width: auto;
    min-width: 0;
  }

  #projectTable table {
    display: table;
    width: 980px;
    min-width: 980px;
    border-collapse: collapse;
    table-layout: fixed;
  }

  #projectTable thead {
    display: table-header-group;
    position: static;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  #projectTable tbody {
    display: table-row-group;
  }

  #projectTable tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
  }

  #projectTable th,
  #projectTable td {
    display: table-cell;
    width: auto;
    height: 38px;
    padding: 7px 8px;
    border: 1px solid #d9e0dc;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.25;
  }

  #projectTable th {
    color: var(--muted);
    font-weight: 800;
    background: #eef3ef;
  }

  #projectTable td::before {
    content: none;
  }

  #projectTable th:nth-child(1),
  #projectTable td:nth-child(1) {
    width: 88px;
  }

  #projectTable th:nth-child(2),
  #projectTable td:nth-child(2) {
    width: 170px;
  }

  #projectTable th:nth-child(3),
  #projectTable td:nth-child(3) {
    width: 170px;
  }

  #projectTable th:nth-child(4),
  #projectTable td:nth-child(4),
  #projectTable th:nth-child(5),
  #projectTable td:nth-child(5),
  #projectTable th:nth-child(6),
  #projectTable td:nth-child(6) {
    width: 118px;
  }

  #projectTable th:nth-child(7),
  #projectTable td:nth-child(7) {
    width: 170px;
  }

  #projectTable th:nth-child(8),
  #projectTable td:nth-child(8) {
    width: 90px;
  }
}

@media (max-width: 560px) {
  :root {
    --space-card: 10px;
    --control-height: 32px;
    --title-size: 17px;
    --kpi-size: 16px;
  }

  .login-shell {
    align-content: center;
    gap: 18px;
    padding: max(22px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
  }

  .login-copy h1 { font-size: 30px; }
  .login-logo {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .login-logo img {
    width: 132px;
    max-width: 58vw;
  }
  .login-copy p:last-child { font-size: 13px; }
  .login-panel { padding: 18px; }
  .kpi-grid { grid-template-columns: 1fr; }
  #kpiGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  #kpiGrid .kpi {
    gap: 6px;
    min-height: 104px;
    padding: 12px 12px 10px;
  }
  #kpiGrid .kpi-head span {
    font-size: 12px;
    line-height: 1.25;
  }
  #kpiGrid .kpi strong {
    font-size: clamp(17px, 5.8vw, 22px);
  }
  #kpiGrid .kpi small {
    font-size: 12px;
    line-height: 1.25;
  }
  .card-grid { grid-template-columns: 1fr; }
  [data-panel="projectDetail"] .card {
    padding: 12px;
  }
  [data-panel="projectDetail"] .card .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  [data-panel="projectDetail"] .card button {
    width: 100%;
  }
  .settings-form button { width: 100%; }

  .kpi strong { font-size: 16px; }
}

@media (max-width: 380px) {
  :root {
    --space-page: 8px;
    --space-card: 9px;
    --gap: 7px;
    --control-height: 31px;
    --body-size: 12px;
    --small-size: 11px;
    --title-size: 16px;
    --card-title-size: 13px;
    --kpi-size: 15px;
  }

  .login-copy h1 { font-size: 28px; }

  #kpiGrid {
    gap: 7px;
  }

  #kpiGrid .kpi {
    min-height: 96px;
    padding: 11px 9px 9px;
  }

  #kpiGrid .kpi strong {
    font-size: clamp(15px, 5.4vw, 18px);
  }

  #kpiGrid .kpi-head span,
  #kpiGrid .kpi small {
    font-size: 11px;
  }

  .progress-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-stat-card {
    min-height: 46px;
  }

  .nav {
    min-height: 30px;
    padding: 5px 3px;
  }

  .brand-logo {
    width: 64px;
    height: 30px;
  }

  .brand strong { font-size: 12px; }

  .detail-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .detail-header .ghost {
    width: fit-content;
  }

  .detail-header > div {
    grid-column: 1 / -1;
  }

  .detail-delete-button {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

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

  td {
    grid-template-columns: minmax(64px, 31%) minmax(0, 1fr);
    gap: 7px;
    padding: 7px 9px;
  }
}

@media (max-width: 860px) and (orientation: landscape) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    padding: 18px 22px;
  }

  .login-copy h1 { font-size: 34px; }
  .login-copy p:last-child { font-size: 13px; }
}

@media (max-width: 720px) {
  #attendanceRecordFilter,
  #attendanceRecordDetailFilter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  #attendanceRecordFilter,
  #attendanceRecordDetailFilter {
    grid-template-columns: 1fr;
  }

  #attendanceRecordFilter button {
    width: 100%;
  }
}
