:root {
  color-scheme: light;
  --font-display: "Zen Kaku Gothic New", "Noto Sans JP", system-ui, sans-serif;
  --font-body: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --brand: #2a66b8;
  --brand-strong: #1f529b;
  --brand-ink: #0e2342;
  --cta: #e08a00;
  --cta-strong: #b86e00;
  --success: #1e9e6a;
  --warning: #e08a00;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #131820;
  --muted: #6b7686;
  --subtle: #9ba5b5;
  --line: #e1e5ec;
  --line-strong: #cbd2dd;
  --accent: var(--brand);
  --accent-dark: var(--brand-strong);
  --danger: #d8453b;
  --paper: #ffffff;
  --shadow: 0 10px 26px rgba(14, 35, 66, 0.08);
  --shadow-soft: 0 1px 2px rgba(14, 35, 66, 0.06);
  --ring: 0 0 0 3px rgba(42, 102, 184, 0.35);
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

body.login-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
}

.pdf-page {
  background: #eef2f6;
  padding: 16px;
}

.pdf-document-wrap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pdf-paper {
  width: 820px;
  max-width: none;
  min-height: 1080px;
  margin-inline: auto;
  padding: 48px;
}

.pdf-paper .invoice-parties,
.pdf-paper .invoice-footer {
  grid-template-columns: 1fr 1fr;
}

.pdf-paper .invoice-title {
  flex-direction: row;
}

.pdf-paper .preview-table {
  table-layout: fixed;
}

.pdf-paper .preview-table th:first-child,
.pdf-paper .preview-table td:first-child {
  width: 48%;
  word-break: break-word;
}

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 16px 0 8px;
}

.pdf-mail-status {
  flex: 0 0 100%;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.image-pdf-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

#invoiceCanvas,
#estimateCanvas {
  display: block;
  width: min(100%, 820px);
  height: auto;
  background: #fff;
  box-shadow: var(--shadow);
}

.image-pdf-canvas {
  display: block;
  width: min(100%, 820px);
  height: auto;
  background: #fff;
  box-shadow: var(--shadow);
}

#payrollCanvas {
  display: block;
  width: min(100%, 980px);
  height: auto;
  background: #fff;
  box-shadow: var(--shadow);
}

.primary-link {
  min-width: 220px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button,
input,
select,
textarea {
  font: inherit;
}

input[type="date"],
input[type="month"] {
  width: 90%;
  max-width: 100%;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.58rem 0.86rem;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

#newInvoiceButton,
#newEstimateButton,
[data-employee-new],
#newPayrollButton,
#noticeNewButton,
#noticePublishButton {
  background: var(--cta);
  border-color: var(--cta);
  color: #fff;
}

#newInvoiceButton:hover,
#newEstimateButton:hover,
[data-employee-new]:hover,
#newPayrollButton:hover,
#noticeNewButton:hover,
#noticePublishButton:hover {
  background: var(--cta-strong);
  border-color: var(--cta-strong);
}

.approve-button {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.approve-button:hover {
  background: #15803d;
  border-color: #15803d;
}

.danger-button {
  border-color: #f5c4c0;
  color: var(--danger);
}

.danger-button:hover {
  background: #fff1f2;
}

button.primary:hover {
  background: var(--accent-dark);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand-title {
  display: inline-flex;
  min-width: 0;
  align-items: center;
}

.brand-title-logo {
  display: block;
  width: min(190px, 100%);
  height: auto;
  max-height: 72px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-title-copy {
  display: grid;
  min-width: 0;
  gap: 0.08rem;
}

.brand-title-copy h1 {
  margin: 0;
  color: var(--brand-ink);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand-title-copy p {
  margin: 0;
  color: var(--brand);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.3;
  white-space: nowrap;
}

.logout-link {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.logout-link:hover {
  color: var(--accent);
}

.topbar .logout-link {
  color: var(--muted);
}

.topbar .logout-link:hover {
  color: var(--brand-strong);
}

.app-version {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: center;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  align-content: center;
  justify-content: center;
  place-items: center;
  padding: 1rem;
}

.login-panel {
  width: min(360px, calc(100vw - 32px));
  margin: 0;
  align-self: center;
  justify-self: center;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand-title {
  justify-content: center;
  margin-bottom: 1rem;
}

.login-panel .brand-title-logo {
  width: min(280px, 100%);
  max-height: 126px;
  filter: none;
}

.login-panel .brand-title-copy h1 {
  color: var(--ink);
}

.login-panel .brand-title-copy p {
  color: var(--brand);
}

.login-heading {
  margin: 0;
  font-size: 1.42rem;
}

.error-message {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff1f2;
  color: #b42318;
  font-size: 0.9rem;
}

.success-message {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  background: #f0fdf4;
  color: #166534;
  font-size: 0.9rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  padding: 0.65rem 0.9rem;
}

.kicker,
.subtext {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.kicker {
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.08rem;
}

.view-tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.25rem;
  background: #eef0f4;
  border-radius: 8px;
  scrollbar-width: thin;
}

.mobile-view-tabs {
  display: none !important;
}

.tab-button {
  position: relative;
  flex: 0 0 auto;
  min-height: 38px;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.75rem;
  white-space: nowrap;
}

.tab-button::before {
  display: none;
}

.tab-button > span:not(.tab-icon):not(.nav-notification-badge) {
  white-space: nowrap;
}

.tab-icon {
  display: none;
}

.tab-button.active {
  background: #fff;
  color: var(--brand-strong);
  box-shadow: 0 2px 8px rgba(14, 35, 66, 0.08);
}

.nav-notification-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  z-index: 2;
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 0.35rem 0 1.05rem;
  border: 2px solid #fff;
  border-radius: 999px;
  background-color: #fff1f2;
  background-image: url("assets/nav-notification-badge.png");
  background-position: 0.18rem center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(180, 35, 24, 0.16);
}

.invoice-subtabs,
.payroll-subtabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f9;
}

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

.invoice-document-subtabs,
.estimate-subtabs,
.settings-subtabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mail-test-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.mail-test-panel strong {
  color: var(--ink);
  font-weight: 900;
}

.mail-test-panel p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.mail-test-panel .status-message {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
}

.invoice-subtab,
.payroll-subtab {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #344054;
  font-weight: 700;
}

.invoice-subtab.active,
.payroll-subtab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(20, 33, 61, 0.1);
}

.app-shell {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.main-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 1rem;
  padding: 0.82rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.main-topbar h2 {
  margin: 0.12rem 0 0;
  color: var(--brand-ink);
  font-family: var(--font-display);
  font-size: 1.18rem;
}

.topbar-breadcrumb {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.main-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.system-status-pill,
.system-version-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  background: #fff;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
}

.system-status-pill {
  border-color: rgba(30, 158, 106, 0.28);
  background: rgba(30, 158, 106, 0.08);
  color: #13734d;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

#createView.active,
#estimateCreateView.active {
  grid-template-columns: minmax(520px, 0.95fr) minmax(420px, 1.05fr);
}

.editor,
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.panel.narrow {
  max-width: 760px;
}

.panel,
.history-item,
.history-item > div,
.history-amount,
.month-filter,
.summary-strip > div {
  min-width: 0;
}

.toolbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.actions.left {
  justify-content: flex-start;
}

.status-message {
  min-height: 1.4rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

form,
.stack {
  display: grid;
  gap: 1rem;
}

form {
  margin-top: 1.2rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

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

fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  padding: 1rem;
}

legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

label {
  display: grid;
  gap: 0.35rem;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.55rem;
}

.checkbox-label input {
  width: 20px;
  height: 20px;
}

.discount-options {
  background: #fff;
}

.discount-toggle {
  align-self: end;
  min-height: 44px;
  margin-top: 0;
  color: var(--danger);
}

.discount-amount-field {
  color: var(--danger);
}

.discount-amount-field input {
  color: var(--danger);
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.discount-detail-row dt,
.discount-detail-row dd {
  color: var(--danger);
}

label + label {
  margin-top: 0.8rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.58rem 0.72rem;
  color: var(--ink);
  background: #fff;
  font-weight: 500;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: var(--ring);
}

.line-editor {
  display: grid;
  gap: 0.7rem;
}

.line-table {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}

#lineItems,
#estimateLineItems {
  counter-reset: lineNo;
}

.line-row.item {
  counter-increment: lineNo;
}

.line-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 76px 72px 122px 120px 92px 110px;
  gap: 0.55rem;
  align-items: end;
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.line-actions {
  display: flex;
  gap: 0.2rem;
  align-self: end;
  min-width: 0;
}

.line-actions button {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 0;
}

.line-field {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  align-self: end;
}

.line-field input {
  width: 100%;
  min-width: 0;
}

.line-field select {
  width: 100%;
  min-width: 0;
}

.line-field span {
  display: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

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

.line-row.item output {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.removeLine {
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--danger);
}

.moveLineUp,
.moveLineDown {
  height: 44px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
}

.preview-panel {
  position: sticky;
  top: 5.5rem;
  align-self: start;
}

.invoice-paper {
  width: min(100%, 820px);
  min-height: 1160px;
  margin-inline: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 48px;
}

.invoice-preview-canvas {
  display: block;
  width: min(100%, 820px);
  height: auto;
  margin-inline: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.invoice-preview-pages {
  display: grid;
  gap: 1rem;
}

.invoice-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 1rem;
  position: relative;
}

.invoice-brand {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-width: 0;
}

.invoice-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  flex: 0 0 auto;
}

.issuer-party {
  min-width: 0;
}

.issuer-text {
  min-width: 0;
}

.issuer-address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: start;
  gap: 0.6rem;
}

.issuer-address-text {
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: normal;
  word-break: normal;
}

.invoice-stamp {
  width: 82px;
  height: 82px;
  object-fit: contain;
  justify-self: end;
}

.invoice-title h2 {
  font-size: 3rem;
  line-height: 1;
}

.invoice-meta {
  display: grid;
  gap: 0.35rem;
  position: absolute;
  right: 0;
  top: 0.45rem;
  text-align: right;
  color: var(--ink);
  font-size: 0.9rem;
}

.invoice-parties,
.invoice-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.party-label {
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.party-name {
  margin: 0 0 0.6rem;
  font-size: 1.36rem;
  font-weight: 700;
}

.multiline {
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.65;
  font-size: 1.04rem;
}

.amount-box {
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  background: #eef4fb;
  border-left: 6px solid var(--accent);
}

.amount-box p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.amount-box strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 2rem;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.preview-table th,
.preview-table td {
  border: 1px solid #1f2937;
  padding: 0.7rem 0.45rem;
  text-align: left;
}

.preview-table th {
  background: #d9d9d9;
  color: var(--ink);
  font-size: 0.8rem;
}

.preview-table tbody tr:nth-child(odd) td {
  background: #fff;
}

.preview-table tbody tr:nth-child(even) td {
  background: #f0f0f0;
}

.preview-table .number,
.totals .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.totals {
  width: min(360px, 100%);
  margin: 1.4rem 0 0 auto;
  border-top: 2px solid var(--ink);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.totals-row.grand {
  font-size: 1.25rem;
  font-weight: 700;
}

.invoice-footer h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.summary-strip div {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-strip strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.35rem;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.dashboard-cards div,
.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.dashboard-cards div {
  position: relative;
  padding: 1rem;
}

.dashboard-cards div::before {
  display: inline-grid;
  width: 42px;
  height: 42px;
  margin-bottom: 0.6rem;
  place-items: center;
  border: 2px solid rgba(42, 102, 184, 0.22);
  border-radius: 50%;
  background: #eef4fb;
  color: var(--brand-strong);
  font-size: 1.35rem;
  font-weight: 700;
}

.dashboard-cards div:nth-child(1)::before { content: "¥"; }
.dashboard-cards div:nth-child(2)::before { content: "□"; }
.dashboard-cards div:nth-child(3)::before { content: "¥"; }

.dashboard-cards span,
.compact-item p,
.employee-card p {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-cards strong {
  display: block;
  margin-top: 0.3rem;
  color: var(--brand-ink);
  font-family: var(--font-mono);
  font-size: 1.35rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 1rem;
  margin-top: 1rem;
}

.dashboard-panel {
  padding: 1rem;
  min-width: 0;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 0.65rem;
  min-height: 190px;
  margin-top: 1rem;
}

.bar-chart .empty {
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
}

.bar-item {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.bar-value {
  max-width: 100%;
  color: var(--ink);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  height: 130px;
  border-radius: 6px;
  background: #eef0f4;
  overflow: hidden;
}

.bar-track span {
  display: block;
  width: 70%;
  max-width: 34px;
  border-radius: 6px 6px 0 0;
  background: var(--brand);
}

.bar-label {
  font-size: 0.78rem;
  font-weight: 700;
}

.compact-list,
.employee-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.compact-item,
.employee-card {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 240px;
  align-items: center;
}

.employee-card .list-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  grid-auto-flow: row;
  gap: 0.4rem;
  width: 240px;
  justify-self: end;
  justify-content: stretch;
}

.employee-card .list-actions button {
  min-height: 36px;
  padding: 0.35rem 0.45rem;
  font-size: 0.82rem;
  width: 100%;
}

.compact-item > div,
.employee-card > div {
  min-width: 0;
}

.compact-item strong,
.employee-card strong {
  overflow-wrap: anywhere;
}

.employee-card p {
  overflow-wrap: anywhere;
}

.compact-item span {
  flex: 0 0 auto;
  font-weight: 700;
}

.employee-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: end;
}

.employee-password-reset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.employee-password-reset[hidden] {
  display: none;
}

.employee-password-reset strong {
  display: block;
  margin-bottom: 0.2rem;
}

.employee-password-reset p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.employee-password-reset button {
  min-height: 42px;
  font-weight: 800;
}

.employee-password-reset-message {
  grid-column: 1 / -1;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-weight: 700;
}

.employee-password-reset-message.error {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b42318;
}

.employee-password-reset-message.success {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.payroll-result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.payroll-result div {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.payroll-result span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.payroll-result strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.35rem;
}

.payroll-history-head {
  margin-top: 1.5rem;
}

.employee-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.employee-code-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
}

.employee-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5d7f86, #3f666e);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  padding: 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-badge.inactive {
  background: #f2f4f7;
  color: #475467;
}

.daily-report-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(360px, 1.05fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.daily-report-list-panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.daily-report-preview-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.daily-report-preview-card > .grid,
.daily-report-preview-card > label {
  display: none;
}

.daily-report-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.daily-report-preview-head h2 {
  margin: 0.2rem 0 0;
}

.daily-report-preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 1rem 0;
}

.daily-report-preview-meta div {
  min-height: 76px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.daily-report-preview-meta dt {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.daily-report-preview-meta dd {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  word-break: break-word;
}

.daily-report-preview-body {
  display: grid;
  gap: 0.75rem;
}

.daily-report-preview-body section {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.daily-report-preview-body h3 {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.daily-report-preview-body p {
  min-height: 48px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.daily-report-photo-preview-section {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.daily-report-photo-preview-section[hidden] {
  display: none;
}

.daily-report-photo-preview-section .section-head {
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.daily-report-photo-preview-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.daily-report-photo-preview-section img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.daily-report-preview-card .button-link.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.attendance-calendar-panel {
  min-width: 0;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.attendance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.attendance-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.attendance-legend-note {
  min-height: 24px;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
}

.attendance-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.attendance-dot.submitted,
.attendance-cell.submitted {
  background: #e0f2fe;
  color: #075985;
}

.attendance-dot.approved,
.attendance-cell.approved {
  background: #dcfce7;
  color: #166534;
}

.attendance-dot.rejected,
.attendance-cell.rejected {
  background: #fff1f2;
  color: #b42318;
}

.attendance-calendar {
  min-width: 0;
  max-width: 100%;
  margin-top: 0.85rem;
  overflow: visible;
}

.attendance-calendar-scroll {
  display: block;
  width: 100%;
  inline-size: 100%;
  max-width: 100%;
  max-inline-size: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.35rem;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.attendance-scroll-controls {
  position: sticky;
  left: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.2rem 0.05rem;
  background: linear-gradient(180deg, rgba(251, 252, 254, 0), #fbfcfe 34%, #fbfcfe);
}

.attendance-scroll-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 116px;
  min-height: 42px;
  border: 1px solid #cbd2dd;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-strong);
  font-size: 0.92rem;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.attendance-scroll-button span {
  font-size: 1.35rem;
  line-height: 1;
}

.attendance-scroll-button:hover {
  border-color: var(--brand);
  background: #eef4fb;
}

.attendance-calendar-grid {
  --attendance-name-col: 190px;
  --attendance-count-col: 104px;
  --attendance-day-col: 42px;
  display: grid;
  width: max-content;
  inline-size: max-content;
  max-width: none;
  min-width: 100%;
  background: var(--line);
  gap: 1px;
}

.attendance-header-cell,
.attendance-employee,
.attendance-count,
.attendance-cell {
  min-height: 48px;
}

.attendance-header-cell {
  display: grid;
  place-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 700;
}

.attendance-header-cell.day-header {
  gap: 0.05rem;
  align-content: center;
  line-height: 1.05;
}

.attendance-header-cell.day-header strong,
.attendance-header-cell.day-header span {
  display: block;
}

.attendance-header-cell.day-header span {
  font-size: 0.68rem;
}

.attendance-header-cell.sticky-name,
.attendance-header-cell.sticky-count {
  z-index: 4;
}

.attendance-header-cell.sticky-name {
  left: 0;
}

.attendance-header-cell.sticky-count {
  left: var(--attendance-name-col);
}

.attendance-header-cell.saturday,
.attendance-cell.empty.saturday {
  background: #eef6ff;
  color: #1d4ed8;
}

.attendance-header-cell.sunday,
.attendance-cell.empty.sunday {
  background: #fff1f2;
  color: #b42318;
}

.attendance-employee {
  position: sticky;
  left: 0;
  z-index: 3;
  display: grid;
  align-content: center;
  gap: 0.14rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
}

.attendance-employee strong,
.attendance-employee span,
.attendance-employee small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-employee span,
.attendance-employee small {
  color: var(--muted);
  font-size: 0.76rem;
}

.attendance-employee small {
  color: #667085;
  font-weight: 700;
}

.attendance-count {
  position: sticky;
  left: var(--attendance-name-col);
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.35rem 0.25rem;
  background: #f8fafc;
}

.attendance-count strong {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  color: #0f172a;
  font-size: 1.16rem;
}

.attendance-count span,
.attendance-count small {
  color: var(--muted);
  font-size: 0.76rem;
}

.attendance-count small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.attendance-cell {
  display: grid;
  place-items: center;
  width: var(--attendance-day-col);
  min-height: 48px;
  border-top: 0;
  border-left: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  outline: 0;
}

.attendance-cell span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.attendance-cell.empty {
  background: #fcfcfd;
}

.attendance-empty-row {
  grid-column: 1 / -1;
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.attendance-cell.saturday:not(.empty) {
  box-shadow: inset 0 0 0 2px rgba(29, 78, 216, 0.16);
}

.attendance-cell.sunday:not(.empty) {
  box-shadow: inset 0 0 0 2px rgba(180, 35, 24, 0.18);
}

button.attendance-cell {
  cursor: pointer;
}

button.attendance-cell:hover {
  box-shadow: inset 0 0 0 2px rgba(42, 102, 184, 0.32), 0 0 0 2px rgba(42, 102, 184, 0.08);
}

button.attendance-cell.is-selected {
  box-shadow: inset 0 0 0 3px var(--brand), 0 0 0 2px rgba(42, 102, 184, 0.18);
}

button.attendance-cell.is-selected span {
  background: #fff;
  color: #0f172a;
}

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

.daily-report-actions {
  min-width: 220px;
}

.daily-report-toolbar-actions {
  align-items: stretch;
}

.daily-report-toolbar-actions button,
.daily-report-toolbar-actions .button-link {
  min-height: 46px;
}

.daily-report-closing-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.daily-report-closing-actions span {
  padding: 0 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.daily-report-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
}

.daily-report-status.draft {
  background: #f2f4f7;
  color: #475467;
}

.daily-report-status.submitted {
  background: #e0f2fe;
  color: #075985;
}

.daily-report-status.approved {
  background: #dcfce7;
  color: #166534;
}

.daily-report-status.rejected {
  background: #fff1f2;
  color: #b42318;
}

.is-hidden {
  display: none !important;
}

.icon-daily-report {
  position: relative;
}

.icon-daily-report::before {
  content: "日";
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #e7f5f3;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.icon-estimate {
  position: relative;
}

.icon-estimate::before {
  content: "見";
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.84rem;
  font-weight: 700;
}

.icon-notice {
  background-image: url("assets/nav-notice.png");
}

.icon-schedule {
  background-image: url("assets/nav-daily-report.png");
}

.schedule-toolbar-actions {
  min-width: 270px;
}

.schedule-summary {
  margin: 0.65rem 0 1rem;
}

.schedule-admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
  gap: 1rem;
  align-items: start;
}

.schedule-form,
.schedule-list-panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.schedule-filters {
  min-width: min(100%, 420px);
}

.schedule-calendar {
  margin-top: 0.75rem;
}

.schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.schedule-calendar-weekday,
.schedule-calendar-empty,
.schedule-calendar-day {
  min-width: 0;
}

.schedule-calendar-weekday {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.schedule-calendar-weekday.sunday {
  color: #b42318;
}

.schedule-calendar-weekday.saturday {
  color: #155eef;
}

.schedule-calendar-day {
  display: grid;
  grid-template-rows: auto minmax(34px, 1fr) auto;
  gap: 0.18rem;
  min-height: 96px;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.schedule-calendar-date-button {
  display: inline-grid;
  width: max-content;
  min-width: 28px;
  min-height: 28px;
  place-items: center;
  padding: 0.1rem 0.3rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
}

.schedule-calendar-date-button:hover {
  background: #eef4fb;
}

.schedule-calendar-day.today {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.schedule-calendar-day.has-schedule {
  background: #eef4fb;
}

.schedule-calendar-day strong {
  font-size: 0.9rem;
}

.schedule-calendar-events {
  display: grid;
  align-content: start;
  gap: 0.16rem;
  min-width: 0;
}

.schedule-calendar-day span,
.schedule-calendar-day small,
.schedule-calendar-event {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-calendar-event {
  width: 100%;
  min-height: 24px;
  padding: 0.16rem 0.28rem;
  border: 1px solid #c8d9f0;
  border-radius: 6px;
  background: #ffffff;
  color: var(--brand-strong);
  text-align: left;
}

.schedule-calendar-event:hover {
  border-color: var(--brand);
  background: #eef4fb;
}

.schedule-calendar-day span.cancelled,
.schedule-calendar-event.cancelled {
  color: #b42318;
  text-decoration: line-through;
}

.schedule-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.schedule-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.schedule-item.is-cancelled {
  background: #fff7f7;
}

.schedule-item div:first-child {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.schedule-item time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.schedule-item strong,
.schedule-item p,
.schedule-item small {
  overflow-wrap: anywhere;
}

.schedule-item p,
.schedule-item small {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.schedule-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.schedule-status {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #eef4fb;
  color: var(--brand-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.schedule-status.cancelled {
  background: #fff1f2;
  color: #b42318;
}

.notice-toolbar-actions {
  min-width: 220px;
}

.notice-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0.65rem 0 1rem;
}

#noticesView .notice-summary > div {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  width: auto;
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #f8fafc;
}

#noticesView .notice-summary span {
  display: inline;
  font-size: 0.76rem;
  font-weight: 800;
}

#noticesView .notice-summary strong {
  display: inline;
  margin: 0;
  font-size: 0.94rem;
  line-height: 1;
}

#noticesView .notice-summary > div:nth-child(3) strong {
  color: var(--danger);
}

.notice-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.notice-form,
.notice-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.notice-form-section,
.notice-preview-panel,
.notice-list-panel,
.notice-read-panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.notice-form-section {
  display: grid;
  gap: 0.85rem;
}

.notice-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notice-segment legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.notice-segment label {
  margin: 0;
}

.notice-segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.notice-segment span {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.notice-segment input:checked + span {
  border-color: var(--accent);
  background: #ecfdf3;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.notice-target-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
}

.notice-target-box[hidden] {
  display: none;
}

.notice-target-title {
  grid-column: 1 / -1;
  margin: 0;
  color: #3730a3;
  font-size: 0.84rem;
  font-weight: 800;
}

.notice-target-list {
  display: grid;
  grid-column: 1 / -1;
  gap: 0.55rem;
}

.notice-employee-dropdown {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  gap: 0.4rem;
}

.notice-employee-dropdown-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.8rem;
  border-color: #c7d2fe;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.notice-employee-dropdown-button span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-employee-dropdown-caret {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-top: 6px solid #475467;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}

.notice-employee-dropdown.is-open .notice-employee-dropdown-caret {
  transform: rotate(180deg);
}

.notice-employee-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  z-index: 24;
  display: grid;
  gap: 0.45rem;
  max-height: 260px;
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(20, 33, 61, 0.16);
}

.notice-employee-dropdown-menu[hidden] {
  display: none;
}

.notice-target-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #fff;
}

.notice-target-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.notice-target-row span {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.notice-target-row strong,
.notice-target-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-target-row strong {
  color: var(--ink);
}

.notice-target-row small {
  color: #667085;
  font-size: 0.78rem;
  font-weight: 700;
}

.notice-target-box label:not(.notice-target-row),
.notice-option-grid label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  font-weight: 800;
}

.notice-target-box input,
.notice-option-grid input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.notice-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.notice-badge {
  display: inline-grid;
  width: max-content;
  min-height: 28px;
  align-items: center;
  align-self: flex-start;
  padding: 0.25rem 0.58rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.notice-badge.company {
  background: #e0f2fe;
  color: #075985;
}

.notice-badge.personal {
  background: #ede9fe;
  color: #5b21b6;
}

.notice-badge.normal {
  background: #f2f4f7;
  color: #475467;
}

.notice-badge.important {
  background: #fff1f2;
  color: #b42318;
}

.notice-preview-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notice-preview-card.is-important {
  border-color: #fecaca;
  background: #fff7f7;
}

.notice-preview-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.notice-preview-card time {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.notice-preview-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.45;
}

.notice-preview-card p {
  margin: 0;
  color: #344054;
  line-height: 1.65;
}

.notice-preview-card button {
  width: min(100%, 220px);
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-weight: 800;
}

.notice-history-list {
  display: grid;
  gap: 0.6rem;
}

.notice-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notice-history-item div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.notice-history-item strong,
.notice-history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-history-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.notice-history-item button {
  min-height: 36px;
  padding: 0.45rem 0.7rem;
  font-weight: 800;
}

.notice-history-item .notice-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.notice-history-actions .danger-button {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b42318;
}

.read-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.read-status-grid div {
  display: grid;
  gap: 0.2rem;
  min-height: 68px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.read-status-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.read-status-grid strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.month-filter {
  width: 190px;
}

.month-filter input {
  max-width: 90%;
}

.history-filters {
  display: grid;
  grid-template-columns: 170px minmax(160px, 1fr) minmax(170px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  min-width: 0;
}

.history-filters button {
  align-self: end;
}

.list,
.history-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.list-item,
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.list-item p,
.history-item p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-amount {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 420px;
}

.history-amount strong {
  flex: 0 0 100%;
  text-align: right;
}

.modified-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.45rem;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: #e8f5f4;
  color: #087b78;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.modified-mark::before {
  content: "✎";
  font-size: 0.75rem;
}

.photo-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.45rem;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: #eef4ff;
  color: #175cd3;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.detail-modal.open {
  display: block;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 33, 61, 0.42);
}

.detail-modal__panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 820px);
  transform: translate(-50%, -50%);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(20, 33, 61, 0.22);
}

.detail-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.detail-modal__head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 8px;
  font-size: 1.4rem;
  line-height: 1;
}

.detail-modal__body {
  max-height: calc(min(86vh, 820px) - 73px);
  overflow: auto;
  padding: 1rem 1.1rem 1.2rem;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.detail-summary div {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-summary strong {
  display: block;
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.detail-modal__body h3 {
  margin: 1rem 0 0.6rem;
  font-size: 1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.75rem;
  margin: 0;
}

.detail-row {
  min-width: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-row dt {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.detail-note {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.detail-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.detail-table th {
  background: #f1f5f9;
}

.detail-table .num {
  text-align: right;
  white-space: nowrap;
}

.detail-grid.totals {
  margin-top: 0.75rem;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.mobile-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.mobile-shortcut-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  min-height: 82px;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  text-align: left;
}

.mobile-shortcut-card:hover,
.mobile-shortcut-card:focus-visible {
  border-color: rgba(42, 102, 184, 0.42);
  background: #ffffff;
  outline: none;
}

.mobile-shortcut-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #eef4fb;
  color: var(--brand-strong);
  font-weight: 800;
}

.mobile-shortcut-card strong,
.mobile-shortcut-card small {
  display: block;
  min-width: 0;
}

.mobile-shortcut-card strong {
  margin-bottom: 0.18rem;
  font-size: 0.96rem;
}

.mobile-shortcut-card small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 1100px) {
  #createView.active,
  #estimateCreateView.active {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .desktop-view-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

@media (min-width: 1101px) {
  body {
    padding-left: 248px;
  }

  body.login-page {
    padding-left: 0;
  }

  .topbar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    z-index: 40;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem 0.85rem;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: var(--panel);
    box-shadow: 8px 0 26px rgba(14, 35, 66, 0.06);
  }

  .topbar > div {
    padding: 0.1rem 0.2rem 0.55rem;
    border-bottom: 1px solid var(--line);
  }

  .topbar .brand-title-copy h1 {
    margin-top: 0;
    font-size: 1.05rem;
    line-height: 1.35;
  }

  .view-tabs {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(42px, auto);
    align-content: start;
    gap: 0.24rem;
    overflow: visible;
    padding: 0;
    background: transparent;
  }

  .mobile-view-tabs {
    display: none !important;
  }

  .tab-button {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.34rem 0.68rem;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    text-align: left;
  }

  .tab-button:hover {
    background: #eef4fb;
    color: var(--brand-strong);
  }

  .tab-icon {
    display: block;
    width: 36px;
    height: 36px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.78;
  }

  .tab-icon::before,
  .tab-icon::after {
    display: none;
    content: none;
  }

  .icon-dashboard { background-image: url("assets/nav-dashboard.png"); }
  .icon-invoice { background-image: url("assets/nav-invoice.png"); }
  .icon-estimate { background-image: url("assets/nav-invoice.png"); }
  .icon-employees { background-image: url("assets/nav-employees.png"); }
  .icon-payroll { background-image: url("assets/nav-payroll.png"); }
  .icon-daily-report { background-image: url("assets/nav-daily-report.png"); }
  .icon-schedule { background-image: url("assets/nav-daily-report.png"); }
  .icon-settings { background-image: url("assets/nav-settings.png"); }

  .tab-button.active {
    color: var(--brand-strong);
    background: #eef4fb;
    box-shadow: none;
  }

  .tab-button.active .tab-icon {
    opacity: 1;
  }

  .nav-notification-badge {
    top: 0.06rem;
    right: auto;
    left: 0.55rem;
    min-width: 22px;
    height: 22px;
    padding: 0 0.28rem 0 0.95rem;
    background-size: 12px 12px;
    font-size: 0.64rem;
  }

  .logout-link {
    margin-top: 0;
    padding: 0.58rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
  }

  .logout-link:hover {
    border-color: var(--brand);
    color: var(--brand-strong);
  }

  .app-version {
    display: block;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px solid var(--line);
    color: var(--subtle);
  }

  .app-shell {
    max-width: 1500px;
    margin-inline: auto;
    padding: 1.35rem 1.5rem 2rem;
  }

  #createView.active,
  #estimateCreateView.active {
    grid-template-columns: minmax(560px, 0.96fr) minmax(390px, 0.74fr);
    align-items: start;
  }

  .preview-panel {
    top: 1.35rem;
  }

  .invoice-preview-canvas {
    width: min(100%, 620px);
  }
}

.editor,
.panel,
.dashboard-panel,
.dashboard-cards div,
.history-item,
.compact-item,
.employee-card,
.summary-strip div {
  border-radius: 12px;
}

.editor,
.panel {
  box-shadow: var(--shadow);
}

.editor {
  padding: 1.1rem;
}

.toolbar {
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--line);
}

.toolbar + form,
.status-message + form {
  margin-top: 1rem;
}

fieldset {
  padding: 1.05rem;
  background: #fbfcfe;
}

legend {
  color: var(--ink);
}

.grid label + label {
  margin-top: 0;
}

label {
  gap: 0.42rem;
}

input,
select,
textarea {
  border-color: #cfd6e2;
  background: #fff;
}

.section-head h2,
fieldset legend {
  font-size: 0.96rem;
}

.invoice-form-actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 2;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(20, 33, 61, 0.09);
}

.dashboard-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.dashboard-cards div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  align-items: center;
  min-height: 104px;
  padding: 1rem;
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.05);
}

.dashboard-cards div::before {
  grid-row: 1 / 3;
  margin-bottom: 0;
}

.dashboard-cards span {
  align-self: end;
}

.dashboard-cards strong {
  align-self: start;
  font-size: 1.28rem;
  line-height: 1.25;
}

.history-item {
  align-items: center;
  padding: 0.85rem 0.9rem;
  box-shadow: 0 3px 12px rgba(20, 33, 61, 0.045);
}

.history-item > div:first-child strong {
  font-size: 1rem;
}

.history-amount {
  min-width: 500px;
}

.history-amount button {
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.history-amount strong {
  color: var(--ink);
  font-size: 1.18rem;
  font-variant-numeric: tabular-nums;
}

.line-table {
  background: #fff;
}

.line-row {
  gap: 0.5rem;
  padding: 0.55rem;
}

.invoice-subtabs,
.payroll-subtabs {
  margin-bottom: 0.85rem;
}

.invoice-subtab.active,
.payroll-subtab.active {
  color: var(--brand-strong);
}

@media (min-width: 761px) {
  .line-field span {
    display: block;
  }

  .line-row.item {
    grid-template-columns: 30px repeat(5, minmax(0, 1fr)) 80px;
    grid-template-areas:
      "no desc desc desc desc desc actions"
      "no qty unit price total tax actions";
    column-gap: 0.5rem;
    row-gap: 0.5rem;
  }

  .line-row.item {
    border-bottom: 2px solid #b6bfca;
  }

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

  .line-row.item::before {
    content: counter(lineNo);
    grid-area: no;
    align-self: center;
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .line-row.item .description {
    grid-area: desc;
  }

  .line-row.item .quantity-field {
    grid-area: qty;
  }

  .line-row.item .unit-field {
    grid-area: unit;
  }

  .line-row.item .unit-price-field {
    grid-area: price;
  }

  .line-row.item .lineTotal {
    grid-area: total;
  }

  .line-row.item .line-tax-field {
    grid-area: tax;
  }

  .line-row.item .line-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    align-self: stretch;
    align-content: center;
  }

  .line-row.item .line-actions button {
    width: auto;
    min-width: 0;
    height: 38px;
    padding: 0;
  }

  .line-row.item .removeLine {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  #createView .preview-panel,
  #estimateCreateView .preview-panel {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    min-height: 64px;
    padding: 0.4rem 0.75rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(14, 35, 66, 0.06);
  }

  .topbar::before,
  .topbar::after {
    display: none;
    content: none;
  }

  .topbar::before {
    content: none;
  }

  .topbar::after {
    content: none;
    transform: none;
  }

  .topbar > div {
    min-width: 0;
    justify-self: start;
    text-align: center;
  }

  .topbar .kicker {
    display: none;
  }

  .topbar .brand-title-copy h1 {
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logout-link {
    display: none;
  }

  .app-shell {
    padding: 0.75rem 0.75rem calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .main-topbar {
    min-height: auto;
    align-items: flex-start;
    padding: 0.75rem;
  }

  .main-topbar h2 {
    font-size: 1rem;
  }

  .main-topbar-actions {
    display: none;
  }

  .editor,
  .panel {
    padding: 1rem;
  }

  .invoice-form-actions {
    position: static;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .toolbar,
  .section-head,
  .history-item,
  .list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .daily-report-closing-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .desktop-view-tabs {
    display: none !important;
  }

  .mobile-view-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100vw;
    max-width: 100vw;
    align-items: stretch;
    gap: 0.24rem;
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior: none;
    padding: 0.42rem 0.45rem calc(0.42rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
    box-shadow: 0 -10px 28px rgba(14, 35, 66, 0.11);
    scrollbar-width: none;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    contain: layout paint;
    isolation: isolate;
    will-change: transform;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
  }

  .mobile-view-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    display: grid !important;
    flex: 1 1 auto;
    grid-template-rows: 26px auto;
    align-content: center;
    align-items: center;
    justify-content: center;
    justify-items: center;
    gap: 0.18rem;
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 58px;
    padding: 0.18rem 0.05rem;
    border-radius: 10px;
    overflow: visible;
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1.12;
    text-align: center;
    white-space: nowrap;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
  }

  .tab-button > span:not(.tab-icon):not(.nav-notification-badge) {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
  }

  .tab-button::before {
    display: none;
  }

  .tab-icon {
    position: relative;
    display: block;
    width: 26px;
    height: 26px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.78;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
  }

  .tab-icon::before,
  .tab-icon::after {
    display: none;
    content: none;
  }

  .icon-dashboard {
    background-image: url("assets/nav-dashboard.png");
  }

  .icon-invoice {
    background-image: url("assets/nav-invoice.png");
  }

  .icon-estimate {
    background-image: url("assets/nav-invoice.png");
  }

  .icon-employees {
    background-image: url("assets/nav-employees.png");
  }

  .icon-payroll {
    background-image: url("assets/nav-payroll.png");
  }

  .icon-daily-report {
    background-image: url("assets/nav-daily-report.png");
  }

  .icon-schedule {
    background-image: url("assets/nav-daily-report.png");
  }

  .icon-notice {
    background-image: url("assets/nav-notice.png");
  }

  .icon-settings {
    background-image: url("assets/nav-settings.png");
  }

  .tab-button.active {
    color: var(--brand-strong);
    background: #eef4fb;
    box-shadow: none;
  }

  .tab-button.active::before {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }

  .tab-button.active .tab-icon {
    opacity: 1;
  }

  .nav-notification-badge {
    top: 0.1rem;
    right: auto;
    left: 50%;
    transform: translateX(-1.55rem);
    min-width: 20px;
    height: 20px;
    padding: 0 0.28rem 0 0.9rem;
    background-size: 11px 11px;
    font-size: 0.62rem;
  }

  .actions button,
  .section-head button,
  .history-amount button,
  .list-actions button {
    width: 100%;
  }

  .list-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .grid.two,
  .invoice-parties,
  .invoice-footer,
  .summary-strip,
  .mobile-shortcut-grid,
  .dashboard-grid,
  .employee-tools,
  .employee-password-reset,
  .payroll-result,
  .daily-report-layout,
  .daily-report-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .dashboard-cards div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .dashboard-cards div {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 108px;
    padding: 0.75rem;
    min-width: 0;
    box-shadow: 0 2px 10px rgba(20, 33, 61, 0.06);
  }

  .dashboard-cards div::before {
    width: 38px;
    height: 38px;
    margin-bottom: 0.35rem;
    font-size: 1.15rem;
  }

  .dashboard-cards span {
    min-width: 0;
    font-size: 0.75rem;
  }

  .dashboard-cards strong {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: 100%;
    font-size: 1rem;
    line-height: 1.18;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .bar-chart {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-item,
  .employee-card {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    padding: 0.85rem;
    box-shadow: 0 2px 10px rgba(20, 33, 61, 0.06);
  }

  .employee-card > div:not(.employee-avatar):not(.list-actions) {
    min-width: 0;
  }

  .employee-card .list-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

.employee-card .list-actions button {
    min-height: 38px;
    padding: 0.35rem 0.3rem;
    font-size: 0.82rem;
    white-space: normal;
  }

  .attendance-calendar-panel {
    padding: 0.75rem;
  }

  .attendance-calendar-scroll {
    margin-inline: -0.35rem;
  }

  .attendance-scroll-controls {
    gap: 0.45rem;
    padding-top: 0.55rem;
  }

  .attendance-scroll-button {
    flex: 1;
    min-width: 0;
    min-height: 40px;
  }

  .attendance-calendar-grid {
    --attendance-name-col: 96px;
    --attendance-count-col: 68px;
    --attendance-day-col: 38px;
  }

  .attendance-header-cell,
  .attendance-employee,
  .attendance-count,
  .attendance-cell {
    min-height: 44px;
  }

  .attendance-header-cell {
    font-size: 0.72rem;
  }

  .attendance-header-cell.day-header span {
    font-size: 0.62rem;
  }

  .attendance-employee {
    padding: 0.45rem 0.4rem;
  }

  .attendance-employee strong {
    font-size: 0.78rem;
  }

  .attendance-employee span {
    display: none;
  }

  .attendance-employee small {
    font-size: 0.61rem;
  }

  .attendance-header-cell.sticky-count,
  .attendance-count {
    position: static;
    left: auto;
    z-index: 1;
    gap: 0.05rem;
  }

  .attendance-count strong {
    font-size: 0.96rem;
  }

  .attendance-count span {
    font-size: 0.66rem;
  }

  .attendance-count small {
    font-size: 0.58rem;
  }

  .attendance-cell {
    font-size: 0.7rem;
  }

  .attendance-cell span {
    width: 28px;
    height: 28px;
  }

  .employee-avatar {
    width: 42px;
    height: 42px;
  }

  .checkbox-label {
    margin-top: 0;
  }

  .month-filter {
    width: 80%;
    max-width: 100%;
  }

  .history-filters {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .month-filter input {
    display: block;
    width: 90%;
    min-width: 0;
    max-width: 90%;
  }

  .line-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    align-items: end;
  }

  .line-row.item {
    border-bottom: 2px solid #b6bfca;
    padding-bottom: 0.8rem;
  }

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

  .line-row.item::before {
    content: "行 " counter(lineNo);
    order: 0;
    grid-column: 1 / -1;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .line-row.item .description,
  .line-row.item .lineTotal {
    grid-column: 1 / -1;
  }

  .line-row.item .description {
    order: 1;
  }

  .quantity-field {
    order: 2;
  }

  .unit-field {
    order: 3;
  }

  .unit-price-field {
    order: 4;
  }

  .line-tax-field {
    order: 5;
  }

  .line-row.item .lineTotal {
    order: 6;
  }

  .line-actions {
    order: 7;
  }

  .line-field span {
    display: block;
  }

  .unit-price-field {
    grid-column: auto;
  }

  .line-tax-field {
    grid-column: auto;
  }

  .line-actions {
    align-self: end;
    width: 100%;
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .moveLineUp,
  .moveLineDown,
  .removeLine {
    flex: 1;
  }

  .history-amount {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    justify-items: stretch;
    min-width: 0;
  }

  .history-amount strong {
    grid-column: 1 / -1;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    text-align: left;
    font-size: 1.2rem;
  }

  .detail-modal__panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 88vh;
    transform: none;
    border-radius: 12px 12px 0 0;
  }

  .detail-modal__body {
    max-height: calc(88vh - 73px);
    padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  }

  .detail-summary,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .history-item strong,
  .history-item p {
    overflow-wrap: anywhere;
  }

  .invoice-paper {
    min-height: 0;
    padding: 24px 16px;
  }

  .invoice-title,
  .invoice-parties,
  .invoice-footer {
    gap: 1rem;
  }

  .invoice-title h2 {
    font-size: 1.5rem;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
    padding-left: 0;
  }

  .topbar,
  .editor,
  .panel {
    display: none;
  }

  .app-shell {
    display: block;
    min-height: auto;
    padding: 0;
  }

  .view,
  #createView.active,
  #estimateCreateView.active {
    display: block;
  }

  .preview-panel {
    position: static;
  }

  .invoice-paper {
    width: 100%;
    min-height: auto;
    border: 0;
    box-shadow: none;
    padding: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .pdf-page {
    padding: 0;
    background: #fff;
  }

  .pdf-document-wrap {
    overflow: visible;
    padding: 0;
  }

  .pdf-paper {
    width: 100%;
    min-height: auto;
    padding: 0;
  }

  .pdf-actions {
    display: none;
  }

  .invoice-title,
  .amount-box,
  .totals,
  .invoice-footer,
  .preview-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

@media (max-width: 960px) {
  #noticesView .notice-admin-layout,
  #scheduleView .schedule-admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  #scheduleView .schedule-toolbar-actions,
  #scheduleView .schedule-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    width: 100%;
  }

  #scheduleView .schedule-form,
  #scheduleView .schedule-list-panel {
    padding: 0.85rem;
  }

  #scheduleView .schedule-calendar {
    overflow-x: auto;
    padding-bottom: 0.45rem;
  }

  #scheduleView .schedule-calendar-grid {
    min-width: 720px;
  }

  #scheduleView .schedule-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  #scheduleView .schedule-item-actions {
    justify-content: stretch;
  }

  #scheduleView .schedule-item-actions button,
  #scheduleView .schedule-status {
    flex: 1 1 96px;
  }

  #noticesView .notice-target-box,
  #noticesView .notice-option-grid,
  #noticesView .read-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #noticesView .notice-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    width: 100%;
  }

  #noticesView .notice-history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  #noticesView .notice-history-actions {
    justify-content: stretch;
  }

  #noticesView .notice-history-actions button {
    flex: 1 1 96px;
  }

  .icon-notice {
    background-image: url("assets/nav-notice.png");
  }

  .icon-notice::before {
    display: none !important;
    content: none !important;
  }
}
