* {
  box-sizing: border-box
}

:root {
  --navy: #173d73;
  --blue: #2e5c9a;
  --pale: #eaf1fc;
  --gold: #f4c65b;
  --text: #19263a;
  --muted: #718096;
  --line: #dce3ed;
  --bg: #f4f7fb
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, Segoe UI, Arial, sans-serif
}

a {
  color: var(--blue);
  text-decoration: none
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 245px;
  background: #142f56;
  color: white;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  z-index: 5
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: white;
  padding: 0 8px 26px
}

.brand b,
.brand small {
  display: block
}

.brand b {
  font-size: 15px
}

.brand small {
  font-size: 11px;
  color: #bdcce2;
  margin-top: 3px
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gold);
  color: #19365f;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  flex-shrink: 0
}

.sidebar nav {
  display: grid;
  gap: 6px
}

.sidebar nav a {
  padding: 12px 13px;
  color: #d3deed;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: center
}

.sidebar nav a span {
  width: 18px;
  text-align: center;
  font-size: 17px
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #284b7b;
  color: white
}

.sidebar nav a.active {
  box-shadow: inset 3px 0 var(--gold)
}

.sidebar-bottom {
  margin-top: auto;
  padding: 15px 10px;
  border-top: 1px solid #385274;
  display: grid;
  gap: 5px
}

.sidebar-bottom small {
  color: #bdcce2;
  font-size: 11px
}

.sidebar-bottom a {
  color: #ffdf91;
  margin-top: 8px
}

.main {
  margin-left: 245px;
  padding: 25px 28px;
  max-width: 1800px
}

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

.topbar small {
  color: #718096;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 27px;
  letter-spacing: -.5px
}

.top-date {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 13px;
  color: #50617a;
  font-size: 12px
}

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

.stat-card,
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 3px 12px #203b5c05
}

.stat-card {
  padding: 18px
}

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

.stat-card span {
  font-size: 12px;
  font-weight: 700
}

.stat-card strong {
  display: block;
  font-size: 29px;
  margin: 9px 0 5px;
  letter-spacing: -1px
}

.stat-card small {
  font-size: 11px
}

.stat-card .period {
  font-size: 17px;
  letter-spacing: 0
}

.panel {
  margin-bottom: 18px;
  overflow: hidden
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf0f5;
  flex-wrap: wrap
}

.panel-head h2 {
  margin: 0;
  font-size: 16px
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px
}

.table-scroll {
  overflow: auto;
  width: 100%
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  white-space: nowrap
}

th {
  background: #edf3fc;
  color: #30435e;
  font-size: 11px;
  text-align: left;
  font-weight: 800
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid #edf0f5
}

tbody tr:hover {
  background: #f9fbfe
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #d4deeb;
  background: white;
  color: #35465e;
  padding: 9px 12px;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap
}

.btn:hover {
  filter: brightness(.97)
}

.btn.primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy)
}

.btn.danger {
  background: #fff0f0;
  color: #a32d36;
  border-color: #ffd6d6
}

.btn.small {
  padding: 6px 9px;
  font-size: 11px
}

.btn.full {
  width: 100%;
  margin-top: 18px
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 30px;
  font-size: 10px;
  font-weight: 800
}

.green {
  background: #e3f8ec;
  color: #167347
}

.amber {
  background: #fff4d8;
  color: #946200
}

.gray {
  background: #edf0f4;
  color: #5b6470
}

.empty {
  padding: 28px;
  text-align: center;
  color: #718096
}

.quick-links {
  padding: 18px 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.quick-links a {
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700
}

.quick-links a:hover {
  background: #f2f6fd
}

.two-col {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(450px, 1.5fr);
  gap: 18px
}

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

.form-grid label,
.inline-filter label,
.report-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #4c5c72
}

.form-grid input,
.form-grid select,
.inline-filter input,
.report-filters input,
.report-filters select,
.schedule-form select,
.attendance-select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfd8e5;
  border-radius: 7px;
  background: white;
  padding: 10px;
  color: #23334b;
  font: inherit;
  font-weight: 400
}

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

.form-grid .check {
  display: flex;
  flex-direction: row;
  align-items: center
}

.form-grid .check input {
  width: auto
}

.actions {
  display: flex;
  gap: 5px;
  align-items: center
}

.actions form {
  margin: 0
}

.inline-filter {
  display: flex;
  align-items: end;
  gap: 9px;
  flex-wrap: wrap
}

.inline-filter label {
  flex-direction: row;
  align-items: center
}

.inline-filter input {
  width: auto
}

.schedule-form {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.notes-input {
  width: 130px;
  padding: 8px;
  border: 1px solid #d5deea;
  border-radius: 6px
}

.report-filters {
  padding: 18px 20px;
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap
}

.report-filters label {
  min-width: 150px
}

.success {
  margin: 14px 20px 0;
  padding: 10px 12px;
  background: #e4f8ec;
  color: #176b43;
  border-radius: 7px
}

.alert {
  background: #fff2d5;
  color: #7e5600;
  border-radius: 7px;
  padding: 10px;
  margin: 12px 0;
  font-size: 12px
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: linear-gradient(140deg, #132f56, #28588c)
}

.login-card {
  width: min(420px, calc(100% - 32px));
  padding: 34px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 70px #0b203c55
}

.login-card .brand-mark {
  margin-bottom: 20px
}

.login-card h1 {
  margin: 0;
  font-size: 25px
}

.login-card p {
  margin: 6px 0 22px;
  color: var(--muted)
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin: 14px 0 6px
}

.login-card input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccd6e4;
  border-radius: 8px
}

.login-card small {
  display: block;
  text-align: center;
  color: var(--muted);
  margin-top: 16px
}

footer {
  text-align: center;
  color: #8793a5;
  font-size: 11px;
  padding: 12px
}

@media(max-width:1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .two-col {
    grid-template-columns: 1fr
  }

  .main {
    padding: 20px
  }
}

@media(max-width:720px) {
  .sidebar {
    position: relative;
    width: auto;
    inset: auto;
    padding: 12px
  }

  .brand {
    padding-bottom: 12px
  }

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

  .sidebar nav a {
    padding: 9px;
    font-size: 12px
  }

  .sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px
  }

  .sidebar-bottom a {
    margin: 0 0 0 auto
  }

  .main {
    margin-left: 0;
    padding: 14px
  }

  .topbar h1 {
    font-size: 23px
  }

  .top-date {
    display: none
  }

  .stats {
    gap: 9px
  }

  .stat-card {
    padding: 13px
  }

  .stat-card strong {
    font-size: 24px
  }

  .form-grid,
  .schedule-form {
    grid-template-columns: 1fr
  }

  .form-grid .wide {
    grid-column: auto
  }

  .panel-head {
    padding: 15px
  }

  .report-filters {
    padding: 15px
  }

  .report-filters label {
    flex: 1;
    min-width: 120px
  }
}

@media print {
  body {
    background: white;
    font-size: 10px
  }

  .sidebar,
  .topbar,
  .btn,
  .inline-filter,
  .report-filters,
  .quick-links,
  footer {
    display: none !important
  }

  .main {
    margin: 0;
    padding: 0;
    max-width: none
  }

  .panel,
  .stat-card {
    box-shadow: none;
    border: 1px solid #bbb;
    break-inside: avoid
  }

  .panel {
    margin-bottom: 10px
  }

  .stats {
    grid-template-columns: repeat(4, 1fr)
  }

  .table-scroll {
    overflow: visible
  }

  table {
    font-size: 9px;
    white-space: normal
  }

  th,
  td {
    padding: 5px;
    border: 1px solid #bbb
  }

  .panel-head {
    padding: 8px
  }

  .panel-head h2 {
    font-size: 13px
  }

  @page {
    size: landscape;
    margin: 8mm
  }
}

/* Dashboard analytics per staff */
.analytics-panel .panel-head {
  align-items: flex-end
}

.analytics-filter {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap
}

.analytics-filter label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #4c5c72
}

.analytics-filter input {
  border: 1px solid #cfd8e5;
  border-radius: 7px;
  background: #fff;
  padding: 9px 10px;
  color: #23334b;
  font: inherit
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid #edf0f5
}

.analytics-summary>div {
  background: #f7f9fd;
  border: 1px solid #e7edf6;
  border-radius: 9px;
  padding: 12px
}

.analytics-summary span,
.analytics-summary strong {
  display: block
}

.analytics-summary span {
  font-size: 11px;
  color: #718096;
  font-weight: 700
}

.analytics-summary strong {
  font-size: 19px;
  margin-top: 5px;
  overflow-wrap: anywhere
}

.analytics-chart {
  padding: 18px 20px;
  display: grid;
  gap: 13px
}

.analytics-row {
  display: grid;
  grid-template-columns: minmax(125px, 190px) minmax(100px, 1fr) 62px minmax(120px, 175px);
  gap: 12px;
  align-items: center
}

.analytics-person {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0
}

.analytics-person b {
  overflow-wrap: anywhere
}

.analytics-person .pill {
  flex-shrink: 0
}

.analytics-track {
  height: 15px;
  background: #edf2f8;
  border-radius: 20px;
  overflow: hidden
}

.analytics-bar {
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, #083f6d, #7cdeff);
  border-radius: 20px;
  transition: width .25s ease
}

.analytics-value {
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums
}

.analytics-detail {
  font-size: 11px;
  color: #718096
}

.analytics-note {
  padding: 0 20px 16px;
  margin: 0;
  color: #718096;
  font-size: 11px
}

@media(max-width:900px) {
  .analytics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .analytics-row {
    grid-template-columns: minmax(105px, 150px) minmax(70px, 1fr) 52px;
    gap: 8px
  }

  .analytics-detail {
    grid-column: 2/4;
    margin-top: -5px
  }
}

@media(max-width:520px) {
  .analytics-summary {
    padding: 12px;
    gap: 7px
  }

  .analytics-summary>div {
    padding: 9px
  }

  .analytics-summary strong {
    font-size: 16px
  }

  .analytics-chart {
    padding: 14px 12px
  }

  .analytics-row {
    grid-template-columns: minmax(90px, 1fr) 48px;
    gap: 6px 10px
  }

  .analytics-person {
    grid-column: 1/2
  }

  .analytics-value {
    grid-column: 2/3;
    grid-row: 1
  }

  .analytics-track {
    grid-column: 1/3;
    grid-row: 2
  }

  .analytics-detail {
    grid-column: 1/3;
    grid-row: 3;
    margin: 0
  }

  .analytics-note {
    padding: 0 12px 14px
  }
}

@media print {
  .analytics-filter {
    display: none
  }

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

  .analytics-row {
    break-inside: avoid
  }
}

/* Live dashboard analytics: period selector and per-task charts */
.analytics-filter select {
  border: 1px solid #cfd8e5;
  border-radius: 7px;
  background: #fff;
  padding: 9px 10px;
  color: #23334b;
  font: inherit;
  min-height: 39px
}

.analytics-filter label[hidden] {
  display: none !important
}

.analytics-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0
}

.analytics-section-title h3 {
  font-size: 15px;
  margin: 0
}

.analytics-section-title span {
  font-size: 11px;
  color: #718096
}

.analytics-category-list {
  padding: 12px 20px 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px
}

.analytics-person-card {
  border: 1px solid #e4eaf3;
  border-radius: 10px;
  padding: 13px;
  background: #fff;
  min-width: 0
}

.analytics-person-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px
}

.analytics-person-card-head b {
  overflow-wrap: anywhere
}

.analytics-person-card-head span {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: #173f78
}

.category-chart-row {
  display: grid;
  grid-template-columns: 110px minmax(55px, 1fr) 48px 45px;
  gap: 8px;
  align-items: center;
  margin: 10px 0
}

.category-chart-label {
  font-size: 11px;
  color: #53647c
}

.category-chart-row .analytics-track {
  height: 10px
}

.category-chart-row .analytics-bar {
  background: #315b92
}

.category-chart-row .analytics-bar.role-2 {
  background: #5486bf
}

.category-chart-row .analytics-bar.role-3 {
  background: #e7b94f
}

.category-chart-row .analytics-bar.role-4 {
  background: #3a9b83
}

.category-chart-row .analytics-bar.role-5 {
  background: #8b79bd
}

.category-chart-value {
  font-size: 11px;
  font-weight: 800;
  text-align: right
}

.category-chart-row small {
  font-size: 10px;
  color: #718096;
  text-align: right;
  white-space: nowrap
}

@media(max-width:1000px) {
  .analytics-category-list {
    grid-template-columns: 1fr
  }

  .category-chart-row {
    grid-template-columns: 105px minmax(40px, 1fr) 45px 40px
  }
}

@media(max-width:520px) {
  .analytics-section-title {
    padding-left: 12px;
    padding-right: 12px
  }

  .analytics-category-list {
    padding: 12px
  }

  .category-chart-row {
    grid-template-columns: 90px minmax(35px, 1fr) 42px
  }

  .category-chart-row small {
    grid-column: 2/4;
    text-align: right;
    margin-top: -5px
  }

  .analytics-filter {
    width: 100%
  }

  .analytics-filter label {
    flex: 1
  }
}

@media print {
  .analytics-filter {
    display: none
  }

  .analytics-category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .analytics-person-card {
    break-inside: avoid
  }
}

/* Live dashboard analytics: period selector and per-task charts */
.analytics-filter select {
  border: 1px solid #cfd8e5;
  border-radius: 7px;
  background: #fff;
  padding: 9px 10px;
  color: #23334b;
  font: inherit;
  min-height: 39px
}

.analytics-filter label[hidden] {
  display: none !important
}

.analytics-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0
}

.analytics-section-title h3 {
  font-size: 15px;
  margin: 0
}

.analytics-section-title span {
  font-size: 11px;
  color: #718096
}

.analytics-category-list {
  padding: 12px 20px 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px
}

.analytics-person-card {
  border: 1px solid #e4eaf3;
  border-radius: 10px;
  padding: 13px;
  background: #fff;
  min-width: 0
}

.analytics-person-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px
}

.analytics-person-card-head b {
  overflow-wrap: anywhere
}

.analytics-person-card-head span {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: #173f78
}

.category-chart-row {
  display: grid;
  grid-template-columns: 110px minmax(55px, 1fr) 48px 45px;
  gap: 8px;
  align-items: center;
  margin: 10px 0
}

.category-chart-label {
  font-size: 11px;
  color: #53647c
}

.category-chart-row .analytics-track {
  height: 10px
}

.category-chart-row .analytics-bar {
  background: #315b92
}

.category-chart-row .analytics-bar.role-2 {
  background: #5486bf
}

.category-chart-row .analytics-bar.role-3 {
  background: #e7b94f
}

.category-chart-row .analytics-bar.role-4 {
  background: #3a9b83
}

.category-chart-row .analytics-bar.role-5 {
  background: #8b79bd
}

.category-chart-value {
  font-size: 11px;
  font-weight: 800;
  text-align: right
}

.category-chart-row small {
  font-size: 10px;
  color: #718096;
  text-align: right;
  white-space: nowrap
}

@media(max-width:1000px) {
  .analytics-category-list {
    grid-template-columns: 1fr
  }

  .category-chart-row {
    grid-template-columns: 105px minmax(40px, 1fr) 45px 40px
  }
}

@media(max-width:520px) {
  .analytics-section-title {
    padding-left: 12px;
    padding-right: 12px
  }

  .analytics-category-list {
    padding: 12px
  }

  .category-chart-row {
    grid-template-columns: 90px minmax(35px, 1fr) 42px
  }

  .category-chart-row small {
    grid-column: 2/4;
    text-align: right;
    margin-top: -5px
  }

  .analytics-filter {
    width: 100%
  }

  .analytics-filter label {
    flex: 1
  }
}

@media print {
  .analytics-filter {
    display: none
  }

  .analytics-category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .analytics-person-card {
    break-inside: avoid
  }
}

/* Warna dropdown nama petugas pada Absensi Harian */
.attendance-select {
  color: #0fa5f6;
  background-color: #ffffff;
}

/* Warna opsi Belum ditentukan */
.attendance-select option[value=""] {
  color: #dc2626;
  background-color: #fff1f2;
}

/* Warna nama petugas lainnya */
.attendance-select option:not([value=""]) {
  color: #0fa5f6;
  background-color: #ffffff;
}

/* Jika yang dipilih adalah Belum ditentukan */
.attendance-select:has(option:checked[value=""]) {
  color: #dc2626;
}

/* Dropdown nama petugas di Isian Petugas */
.attendance-select {
  color: #0fa5f6;
  background-color: #ffffff;
}

/* Pilihan Belum ditentukan */
.attendance-select option[value=""] {
  color: #dc2626;
  background-color: #fff1f2;
}

/* Pilihan nama petugas */
.attendance-select option:not([value=""]) {
  color: #0fa5f6;
  background-color: #ffffff;
}

/* Warna ketika Belum ditentukan sedang dipilih */
.attendance-select:has(option:checked[value=""]) {
  color: #dc2626;
  background-color: #fff1f2;
}