:root {
  color-scheme: light;
  --app-height: 100dvh;
  --shell-pad: clamp(12px, 2vw, 24px);
  --bg: #08111f;
  --bg-2: #10243f;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --card: rgba(255, 255, 255, 0.95);
  --card-muted: rgba(248, 250, 252, 0.95);
  --text: #0f172a;
  --text-soft: #475569;
  --text-inverse: #f8fafc;
  --line: rgba(148, 163, 184, 0.22);
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: #ccfbf1;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --shadow: 0 24px 80px rgba(8, 17, 31, 0.22);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(circle at 20% 20%, rgba(15, 118, 110, 0.32), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(245, 158, 11, 0.22), transparent 24%),
    linear-gradient(140deg, #06101c 0%, #0a1730 48%, #09101f 100%);
  color: var(--text);
  overflow: hidden;
}

body.login-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

html.login-scroll,
body.login-scroll {
  height: auto;
  min-height: 100%;
}

html.login-scroll {
  overflow-y: auto;
  overflow-x: hidden;
}

body.app-fixed {
  overflow: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  min-height: var(--app-height);
  height: 100vh;
  height: var(--app-height);
  padding: var(--shell-pad);
  overflow: hidden;
}

.login-page,
.shell {
  width: min(100%, 1840px);
  margin: 0 auto;
}

.shell {
  height: 100%;
  min-height: 0;
}

.login-page {
  min-height: 100vh;
  min-height: var(--app-height);
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  min-height: 560px;
  border-radius: 26px;
  padding: 32px;
  color: var(--text-inverse);
  background:
    linear-gradient(160deg, rgba(12, 37, 59, 0.96), rgba(16, 185, 129, 0.22)),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.18), transparent 26%);
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(4px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  font-weight: 800;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.08;
  margin: 18px 0 14px;
}

.hero-copy {
  color: rgba(248, 250, 252, 0.82);
  line-height: 1.8;
  max-width: 58ch;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.hero-stat {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-stat strong {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.login-form-panel {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 26px;
  padding: 28px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.panel-title {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.panel-subtitle {
  margin: 0 0 20px;
  color: var(--text-soft);
  line-height: 1.7;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field label,
.section-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
}

.field input,
.field select,
.field textarea,
.inline-input,
.toolbar select {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: white;
  color: var(--text);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-input:focus,
.toolbar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.button-row,
.toolbar,
.subnav,
.tag-row,
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.button-secondary,
.button-danger,
.button-ghost,
.button-small {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover,
.button-secondary:hover,
.button-danger:hover,
.button-ghost:hover,
.button-small:hover {
  transform: translateY(-1px);
}

.button {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.22);
}

.button-secondary {
  background: var(--accent-soft);
  color: #92400e;
}

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

.button-ghost {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.button-small {
  padding: 9px 12px;
  border-radius: 12px;
  background: #e2e8f0;
  color: #0f172a;
}

.shell-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.sidebar,
.main-card,
.section-card,
.stat-card,
.mini-card,
.table-card,
.notice,
.profile-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  position: sticky;
  top: var(--shell-pad);
  align-self: start;
  max-height: calc(var(--app-height) - (var(--shell-pad) * 2));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* デスクトップではトグルボタンを隠す */
.mobile-sidebar-toggle {
  display: none;
}

.sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.user-card {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, #eff6ff, #ecfeff);
  border: 1px solid rgba(15, 118, 110, 0.12);
  margin-bottom: 16px;
}

.user-card h3 {
  margin: 0 0 4px;
  font-size: 1.02rem;
}

.user-meta {
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 700;
}

.nav-button.active {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(14, 165, 233, 0.08));
  border-color: rgba(15, 118, 110, 0.2);
  color: var(--primary-strong);
}

.main-card {
  padding: 22px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.main-card > * {
  min-width: 0;
}

.main-card .section-card,
.main-card .table-card,
.main-card .panel,
.main-card .profile-card,
.main-card .mini-card,
.main-card .stat-card,
.main-card .notice {
  min-width: 0;
  max-width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.topbar p {
  margin: 4px 0 0;
  color: var(--text-soft);
}

.badge,
.pill,
.status,
.role-badge,
.subtitle-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge,
.role-badge {
  background: #e2e8f0;
  color: #0f172a;
}

.role-badge.admin {
  background: #111827;
  color: white;
}

.role-badge.employee {
  background: #d1fae5;
  color: #065f46;
}

.hero-banner {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(245, 158, 11, 0.14));
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 18px;
}

.hero-banner h2 {
  margin: 0 0 6px;
  font-size: 1.22rem;
}

.hero-banner p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.employee-home-clock-card {
  margin-bottom: 14px;
  text-align: center;
  background: linear-gradient(160deg, rgba(15, 118, 110, 0.12), rgba(14, 165, 233, 0.08));
  border-color: rgba(15, 118, 110, 0.2);
}

.employee-now-label {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  font-weight: 700;
}

.employee-now-date {
  margin: 6px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.employee-now-time {
  margin: 6px 0 0;
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 1.05;
  font-weight: 800;
  color: #0f172a;
}

.employee-punch-card {
  margin-bottom: 14px;
}

.employee-punch-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.employee-punch-btn {
  width: 100%;
  min-height: 60px;
  font-size: 1.08rem;
  border-radius: 18px;
  padding: 14px 16px;
}

.employee-punch-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.employee-today-status {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.employee-today-status h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.employee-today-status p {
  margin: 4px 0;
  color: #334155;
  font-weight: 700;
}

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

.stat-grid,
.card-grid,
.dashboard-grid {
  display: grid;
  gap: 16px;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.dashboard-grid {
  grid-template-columns: 1.3fr 0.9fr;
}

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

.stat-card,
.mini-card,
.section-card,
.table-card,
.notice,
.profile-card {
  padding: 18px;
}

.stat-card {
  min-height: 130px;
}

.stat-card .label,
.mini-card .label,
.section-card .label {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
}

.stat-card .value {
  font-size: 1.9rem;
  font-weight: 800;
  margin: 0;
}

.stat-card .note,
.section-note,
.help-text {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 0.92rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2,
.section-head h3,
.profile-card h3,
.table-card h3 {
  margin: 0 0 4px;
}

.admin-today-head h3 {
  line-height: 1.35;
  padding-top: 2px;
}

.admin-employee-detail-layout {
  grid-template-columns: 1fr;
}

.section-card + .section-card,
.table-card + .table-card,
.profile-card + .profile-card {
  margin-top: 16px;
}

.table-card {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-card table {
  min-width: 720px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

th {
  font-size: 0.84rem;
  color: var(--text-soft);
  font-weight: 800;
  letter-spacing: 0.02em;
}

tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

.status.pending {
  background: #fef3c7;
  color: #92400e;
}

.status.approved,
.status.completed,
.status.verified {
  background: #dcfce7;
  color: #166534;
}

.status.rejected,
.status.error {
  background: #fee2e2;
  color: #b91c1c;
}

.status.draft,
.status.working {
  background: #dbeafe;
  color: #1d4ed8;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 0.8rem;
  font-weight: 700;
}

.muted {
  color: var(--text-soft);
}

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

.flash {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  font-weight: 700;
}

.flash.success {
  background: var(--success-soft);
  color: #166534;
}

.flash.warning {
  background: #fef3c7;
  color: #92400e;
}

.flash.error {
  background: var(--danger-soft);
  color: #b91c1c;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stack {
  display: grid;
  gap: 16px;
}

.toolbar {
  margin-bottom: 12px;
  align-items: center;
}

.export-toolbar {
  justify-content: flex-end;
}

.export-toolbar .button-small {
  min-width: 88px;
}

.payroll-toolbar-actions {
  position: relative;
  z-index: 20;
}

.payroll-action-menu-wrap {
  position: relative;
}

.payroll-menu-trigger {
  min-width: 44px;
  padding: 9px 10px;
}

.payroll-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12;
  border: 0;
  background: transparent;
}

.payroll-action-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, 92vw);
  display: grid;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  z-index: 30;
}

.payroll-action-item {
  border: 0;
  background: #ffffff;
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  color: #0f172a;
}

.payroll-action-item + .payroll-action-item {
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.payroll-action-item:hover:not(:disabled) {
  background: #f8fafc;
}

.payroll-action-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.payroll-summary-table {
  min-width: 680px;
}

.payroll-summary-table th.payroll-col-metric,
.payroll-summary-table td.payroll-col-metric {
  text-align: center;
}

.payroll-summary-table tbody tr {
  cursor: pointer;
}

.payroll-summary-table tbody tr.payroll-detail-row {
  cursor: default;
}

.payroll-summary-table tbody tr.payroll-detail-row:hover {
  background: transparent;
}

.payroll-detail-toggle {
  min-width: 38px;
  padding: 7px 10px;
}

.payroll-detail-row td {
  padding: 10px;
  background: #f8fafc;
}

.payroll-detail-panel {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  padding: 8px;
  background: #ffffff;
  overflow-x: auto;
}

.payroll-detail-table {
  width: max-content;
  min-width: 980px;
  border-collapse: collapse;
}

.payroll-detail-table th,
.payroll-detail-table td {
  border: 1px solid rgba(148, 163, 184, 0.24);
  padding: 7px 10px;
  white-space: nowrap;
  font-size: 0.82rem;
}

.payroll-detail-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 800;
}

.toolbar .toolbar-spacer {
  flex: 1;
}

.inline-input {
  min-width: min(210px, 100%);
  max-width: 100%;
  flex: 1 1 210px;
}

.toolbar > *,
.button-row > *,
.topbar > *,
.section-head > * {
  min-width: 0;
}

.kv .val,
.list-item,
.hero-copy,
.section-note,
.help-text,
.nav-button,
.user-meta,
.topbar p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.mini-card h4 {
  margin: 0 0 8px;
}

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

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card-muted);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.list-item strong {
  display: block;
}

.list-item small {
  color: var(--text-soft);
}

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

.kv {
  padding: 12px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.kv .key {
  display: block;
  color: var(--text-soft);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.kv .val {
  font-weight: 800;
}

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

.settings-grid .check {
  margin: 0;
}

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

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.check input {
  margin-top: 3px;
}

.empty-state {
  padding: 20px;
  border-radius: 18px;
  background: #f8fafc;
  color: var(--text-soft);
  text-align: center;
  border: 1px dashed #cbd5e1;
}

.login-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.login-demo button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 16px;
  border-radius: 16px;
  color: white;
  box-shadow: var(--shadow);
  z-index: 50;
}

.toast.success {
  background: linear-gradient(135deg, #0f766e, #115e59);
}

.toast.error {
  background: linear-gradient(135deg, #b91c1c, #7f1d1d);
}

.toast.warning {
  background: linear-gradient(135deg, #b45309, #92400e);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.nowrap {
  white-space: nowrap;
}

.payslip-preview-frame {
  max-height: 78vh;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 12px;
}

.payslip-sheet {
  width: 100%;
  max-width: 210mm;
  margin: 0 auto;
  background: white;
  color: #111827;
  padding: 16mm;
  box-sizing: border-box;
}

.payslip-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #111827;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.payslip-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.payslip-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.payslip-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.payslip-subtitle {
  font-size: 12px;
  color: #6b7280;
}

.payslip-period {
  text-align: right;
}

.payslip-period-label {
  font-size: 12px;
  color: #6b7280;
}

.payslip-period-value {
  font-size: 18px;
  font-weight: 800;
}

.payslip-period-sub {
  font-size: 11px;
  color: #374151;
}

.payslip-company-grid,
.payslip-summary-grid {
  display: grid;
  gap: 10px;
}

.payslip-company-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.payslip-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.payslip-box,
.payslip-summary,
.payslip-table-wrap {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.payslip-box-title,
.payslip-section-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.payslip-summary span {
  display: block;
  color: #6b7280;
  font-size: 11px;
}

.payslip-summary strong {
  display: block;
  font-size: 15px;
  margin-top: 4px;
}

.payslip-table {
  width: 100%;
  border-collapse: collapse;
}

.payslip-table th,
.payslip-table td {
  border-top: 1px solid #e5e7eb;
  padding: 8px 6px;
  font-size: 12px;
}

.payslip-table th {
  width: 25%;
  text-align: left;
  color: #374151;
  font-weight: 700;
}

.payslip-table td {
  width: 25%;
}

.payslip-total th,
.payslip-total td {
  font-size: 13px;
  font-weight: 800;
  border-top: 2px solid #111827;
}

.payslip-stamp-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 14px;
}

.payslip-stamp-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 700;
}

.payslip-stamp-image {
  max-width: 52mm;
  max-height: 52mm;
  object-fit: contain;
}

.payslip-monochrome * {
  color: #111827 !important;
}

.payslip-table td.right,
.payslip-total td.right {
  text-align: right;
}

@media (max-width: 767px) {
  .payslip-company-grid,
  .payslip-summary-grid,
  .payslip-header {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .payslip-period {
    text-align: left;
  }
}

@media print {
  .payslip-preview-frame {
    max-height: none;
    overflow: visible;
    border: 0;
    padding: 0;
    background: transparent;
  }
}

@media (max-width: 1180px) {
  .login-card,
  .dashboard-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 1279px) {
  .shell-layout {
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 14px;
  }

  .card-grid,
  .settings-grid,
  .split-grid,
  .check-grid,
  .kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .shell-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
  }

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

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

@media (max-width: 767px) {
  .app-shell {
    padding: 14px;
    height: var(--app-height);
    min-height: var(--app-height);
    overflow: hidden;
  }

  .login-page {
    padding: 14px;
    min-height: var(--app-height);
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    place-items: start center;
  }

  .shell-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    max-height: 38vh;
    max-height: 38dvh;
  }

  .main-card,
  .sidebar,
  .login-form-panel,
  .hero-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .main-card {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

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

  .card-grid,
  .settings-grid,
  .split-grid,
  .check-grid,
  .kv-grid,
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .table-card table {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  tbody td {
    border: 0;
    padding: 6px 0;
  }

  tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.76rem;
    color: var(--text-soft);
    margin-bottom: 4px;
    font-weight: 700;
  }

  .button-row,
  .toolbar,
  .topbar,
  .section-head {
    align-items: stretch;
  }

  .export-toolbar {
    justify-content: stretch;
  }

  .payroll-action-menu {
    width: min(340px, calc(100vw - 40px));
    right: 0;
  }

  .payroll-summary-table {
    min-width: 0;
  }

  .payroll-summary-table tbody tr.payroll-detail-row td::before {
    display: none;
  }

  .payroll-detail-table {
    min-width: 680px;
  }

  .employee-home-clock-card,
  .employee-punch-card,
  .employee-today-status {
    border-radius: 18px;
  }

  .employee-now-time {
    font-size: clamp(1.8rem, 10vw, 2.35rem);
  }

  .employee-punch-btn {
    min-height: 64px;
    font-size: 1.05rem;
  }

  .employee-home-stats {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1280px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .shell-layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .card-grid,
  .settings-grid,
  .split-grid,
  .check-grid,
  .kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@supports not (height: 100dvh) {
  :root {
    --app-height: 100vh;
  }
}

@media print {
  body {
    background: white !important;
  }

  .sidebar,
  .topbar .toolbar,
  .button,
  .button-small,
  .button-ghost,
  .button-secondary,
  .button-danger {
    display: none !important;
  }

  .main-card,
  .section-card,
  .table-card {
    box-shadow: none !important;
    border-color: #d1d5db !important;
  }
}

@media (min-width: 768px) {
  .mobile-sidebar-toggle {
    display: none;
  }

  .sidebar-content {
    display: block !important;
  }

  .detail-grid {
    grid-template-columns: minmax(360px, 1fr) minmax(520px, 1.2fr);
  }

  .admin-employee-detail-layout {
    grid-template-columns: 1fr;
  }

  .payroll-summary-table,
  .payroll-detail-table,
  .table-card table {
    min-width: 900px;
  }
}
