:root {
  --app-ink: #17212b;
  --app-muted: #5d6875;
  --app-line: #d8e1e8;
  --app-blue: #1769aa;
  --app-blue-dark: #124f80;
  --app-teal: #1a8f83;
  --app-bg: #eaf0f4;
  --app-panel: #ffffff;
}

body {
  background: var(--app-bg);
  color: var(--app-ink);
  font-family: Arial, Helvetica, sans-serif;
}

.container {
  width: min(100% - 1.5rem, 1140px);
}

.app-navbar {
  background: #ffffff;
}

.navbar-brand {
  color: var(--app-ink);
  font-weight: 700;
}

.btn {
  border-radius: 6px;
  font-weight: 600;
  min-height: 42px;
}

.nav-actions,
.hero-actions,
.form-actions,
.record-toolbar,
.report-actions,
.record-row-actions {
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--app-blue);
  border-color: var(--app-blue);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--app-blue-dark);
  border-color: var(--app-blue-dark);
}

.btn-success {
  background: var(--app-teal);
  border-color: var(--app-teal);
}

.app-home {
  min-height: 100vh;
}

.app-hero {
  padding-bottom: 4rem;
  padding-top: 4rem;
}

.app-hero h1,
.page-heading h1 {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.05;
  max-width: 850px;
}

.hero-copy {
  color: var(--app-muted);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 680px;
}

.section-kicker {
  color: var(--app-teal);
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin-bottom: .5rem;
  text-transform: uppercase;
}

.summary-panel,
.app-panel {
  background: var(--app-panel);
  border: 1px solid var(--app-line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(23, 33, 43, .06);
}

.summary-panel {
  padding: 1.25rem;
}

.summary-row {
  align-items: center;
  border-bottom: 1px solid var(--app-line);
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
}

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

.summary-row span {
  color: var(--app-muted);
}

.summary-row strong {
  color: var(--app-ink);
}

.page-heading {
  margin-bottom: 1.5rem;
}

.app-panel {
  margin-bottom: 1rem;
  padding: 1.25rem;
}

.app-panel h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.form-label {
  color: var(--app-muted);
  font-weight: 700;
}

.form-control,
.form-select {
  border-color: var(--app-line);
  border-radius: 6px;
  min-height: 42px;
}

.upload-box {
  align-items: center;
  border: 1px dashed #8da4b8;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  justify-content: center;
  min-height: 130px;
  padding: 1.5rem;
  text-align: center;
  width: 100%;
}

.upload-title {
  color: var(--app-ink);
  font-weight: 800;
}

.upload-meta {
  color: var(--app-muted);
}

.mobile-scan-actions {
  display: none;
}

.section-toolbar-actions {
  justify-content: flex-end;
}

.attendance-page-actions {
  align-items: center;
  display: flex;
  gap: .65rem;
  justify-content: flex-end;
  margin-top: .75rem;
}

.attendance-page-actions strong {
  color: var(--app-muted);
  font-size: .9rem;
  min-width: 7.5rem;
  text-align: center;
}

.upload-status {
  border-radius: 6px;
  font-weight: 700;
  margin-top: .75rem;
  padding: .75rem 1rem;
}

.upload-status.info {
  background: #e8f2fb;
  color: var(--app-blue-dark);
}

.upload-status.success {
  background: #e8f6f4;
  color: #0f645c;
}

.upload-status.warning {
  background: #fff5df;
  color: #795200;
}

.upload-status.danger {
  background: #fdecee;
  color: #9b1c2c;
}

.upload-read-actions {
  margin-top: .75rem;
}

.app-table th {
  color: var(--app-muted);
  font-size: .85rem;
  white-space: nowrap;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

.attendance-table-wrapper {
  overflow-x: hidden;
  width: 100%;
}

#attendance-table {
  table-layout: fixed;
  width: 100%;
}

#attendance-table tbody tr:nth-child(odd) {
  --bs-table-bg: #ffffff;
}

#attendance-table tbody tr:nth-child(even) {
  --bs-table-bg: #eef4f7;
}

#attendance-table th,
#attendance-table td {
  min-width: 0;
  padding: .55rem .35rem;
}

#attendance-table th:nth-child(1),
#attendance-table td:nth-child(1) {
  width: 7%;
}

#attendance-table th:nth-child(n+2):nth-child(-n+5),
#attendance-table td:nth-child(n+2):nth-child(-n+5) {
  width: 15%;
}

#attendance-table th:nth-child(6),
#attendance-table td:nth-child(6),
#attendance-table th:nth-child(7),
#attendance-table td:nth-child(7) {
  width: 9%;
}

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

#attendance-table .form-control {
  font-size: .9rem;
  min-width: 0;
  padding-left: .4rem;
  padding-right: .4rem;
  width: 100%;
}

.time-input-control {
  align-items: stretch;
  display: grid;
  gap: 3px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-width: 0;
  width: 100%;
}

.time-input-control > .time-input {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
}

.time-copy-actions {
  align-items: center;
  display: flex;
  gap: 2px;
  grid-column: 1;
  grid-row: 2;
}

.time-period-buttons {
  display: flex;
  flex-direction: column;
  gap: 1px;
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
}

.time-copy-button,
.time-period-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  line-height: 1;
}

.time-copy-button {
  border-radius: 50%;
  font-size: .72rem;
  height: 23px;
  padding: 0;
  width: 23px;
}

.time-copy-button--copy {
    background: #0d6efd;
    border: 1px solid #0d6efd;
    color: #ffffff;
    box-shadow: 0 1px 2px rgb(13 110 253 / 22%);
}

.time-copy-button--paste {
    background: #dc3545;
    border: 1px solid #dc3545;
    color: #ffffff;
    box-shadow: 0 1px 2px rgb(220 53 69 / 22%);
}

.time-period-button {
    background: #ecfdf5;
    border: 1px solid #198754;
    border-radius: 999px;
    color: #198754;
  font-size: .58rem;
  min-height: 15px;
  min-width: 29px;
  padding: 1px 3px;
}

.time-period-button.is-active {
    background: #198754;
    color: #ffffff;
    box-shadow: 0 1px 2px rgb(25 135 84 / 25%);
}

.time-copy-button:hover,
.time-copy-button:focus-visible {
    filter: brightness(.92);
}

.time-period-button:hover:not(:disabled),
.time-period-button:focus-visible:not(:disabled) {
    background: #d1fae5;
}

.time-period-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

#attendance-table .time-input-control > input.form-control {
  width: 100%;
}


.delete-attendance-row {
  min-width: 0;
  padding-left: .55rem;
  padding-right: .55rem;
  width: 100%;
}

.attendance-day-heading,
.attendance-day-cell {
  color: var(--app-muted);
  font-weight: 800;
  text-align: center;
}

.app-table td[data-result] {
  font-weight: 800;
}

.records-card-list {
  display: none;
}

.records-table {
  table-layout: fixed;
  width: 100%;
}

.records-table th,
.records-table td {
  min-width: 0;
}

.records-table-wrapper {
  overflow-x: hidden;
}

.records-col-name {
  width: 18%;
}

.records-col-month {
  width: 13%;
}

.records-col-hours {
  width: 12%;
}

.records-col-overtime {
  width: 11%;
}

.records-col-file {
  width: 16%;
}

.records-col-actions {
  width: 30%;
}

.records-file-cell a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.records-actions-cell .record-row-actions {
  flex-wrap: nowrap;
}

.records-actions-cell .record-row-actions .btn {
  min-height: 36px;
  padding: .35rem .55rem;
}

.record-card {
  background: #ffffff;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  padding: 1rem;
}

.record-card-header {
  align-items: flex-start;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
}

.record-card-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: anywhere;
}

.record-card-fields {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0;
}

.record-card-fields span,
.record-card-fields strong,
.record-card-fields a {
  display: block;
}

.record-card-fields span {
  color: var(--app-muted);
  font-size: .8rem;
  font-weight: 700;
}

.record-card-fields strong,
.record-card-fields a {
  color: var(--app-ink);
  font-size: .98rem;
  margin-top: .15rem;
  overflow-wrap: anywhere;
}

.report-meta {
  color: var(--app-muted);
  font-weight: 600;
}

.report-summary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-stat {
  background: #ffffff;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  padding: 1rem;
}

.report-stat strong,
.report-stat span {
  display: block;
}

.report-stat strong {
  color: var(--app-ink);
  font-size: 1.6rem;
  line-height: 1;
}

.report-stat span {
  color: var(--app-muted);
  font-weight: 700;
  margin-top: .35rem;
}

.report-section {
  margin-bottom: 2rem;
}

.report-section h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: .75rem;
}

.report-table {
  background: #ffffff;
  border: 1px solid var(--app-line);
}

.report-table th {
  background: var(--app-blue);
  color: #ffffff;
}

@media (max-width: 576px) {
  .container {
    width: min(100% - 1rem, 1140px);
  }

  .app-navbar {
    padding-bottom: .75rem;
    padding-top: .75rem;
  }

  .app-navbar .container {
    align-items: stretch;
    flex-direction: column;
    gap: .75rem;
  }

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

  .nav-actions,
  .hero-actions,
  .form-actions,
  .record-toolbar,
  .report-actions,
  .record-row-actions {
    width: 100%;
  }

  .nav-actions .btn,
  .hero-actions .btn,
  .form-actions .btn,
  .record-toolbar .btn,
  .report-actions .btn,
  .record-row-actions .btn {
    flex: 1 1 100%;
  }

  .app-hero {
    padding-bottom: 2rem;
    padding-top: 2rem;
  }

  .app-hero h1,
  .page-heading h1 {
    font-size: 2rem;
    line-height: 1.12;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .app-panel,
  .summary-panel {
    padding: 1rem;
  }

  .section-toolbar {
    align-items: stretch !important;
  }

  .section-toolbar h2 {
    width: 100%;
  }

  .section-toolbar-actions {
    width: 100%;
  }

  .section-toolbar .btn {
    flex: 1 1 100%;
  }

  .upload-box {
    min-height: 112px;
    padding: 1.25rem 1rem;
  }

  .mobile-scan-actions {
    display: block;
    margin-top: .75rem;
  }

  .mobile-scan-button {
    width: 100%;
  }

  .app-table {
    font-size: .92rem;
  }

  .app-table td,
  .app-table th {
    padding: .65rem .75rem;
  }

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

  .report-stat strong {
    font-size: 1.35rem;
  }
}

@media (max-width: 768px) {
  .app-hero h1,
  .page-heading h1 {
    font-size: 2.5rem;
  }

  .records-table-wrapper {
    display: none;
  }

  .records-card-list {
    display: grid;
    gap: .85rem;
  }

  .attendance-table-wrapper {
    overflow: visible;
  }

  #attendance-table,
  #attendance-table tbody {
    display: block;
    width: 100%;
  }

  #attendance-table {
    table-layout: auto;
  }

  #attendance-table thead {
    display: none;
  }

  #attendance-table tbody {
    display: grid;
    gap: .85rem;
  }

  #attendance-table tbody tr {
    background-color: var(--bs-table-bg);
    border: 1px solid var(--app-line);
    border-radius: 8px;
    display: grid;
    gap: .7rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: .85rem;
  }

  #attendance-table tbody td {
    border: 0;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 0;
    text-align: left;
    width: auto;
  }

  #attendance-table tbody td::before {
    color: var(--app-muted);
    content: attr(data-label);
    font-size: .78rem;
    font-weight: 800;
  }

  #attendance-table tbody td[data-result] {
    background: #f6f8fb;
    border-radius: 6px;
    min-height: 64px;
    padding: .55rem;
  }

  #attendance-table tbody td[data-label="Action"] {
    grid-column: 1 / -1;
  }

}

@media (min-width: 577px) and (max-width: 768px) {
  .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  body,
  .print-page {
    background: #ffffff;
  }

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

  .print-container {
    max-width: none;
    padding: 0 !important;
    width: 100%;
  }

  .page-heading {
    margin-bottom: 1rem;
  }

  .page-heading h1 {
    font-size: 24pt;
  }

  .section-kicker,
  .report-meta {
    color: #333333;
  }

  .report-summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .report-stat {
    border-color: #cccccc;
    break-inside: avoid;
    box-shadow: none;
  }

  .report-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table-responsive {
    overflow: visible;
  }

  .report-table {
    border-collapse: collapse;
    font-size: 9pt;
    width: 100%;
  }

  .report-table th,
  .report-table td {
    border: 1px solid #cccccc;
    color: #111111;
    min-width: 0;
    padding: 5px;
  }

  .report-table th {
    background: #eeeeee !important;
  }
}
