:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #263445;
  background: #f3f5f7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --accent: #315d7b;
  --accent-hover: #264b65;
  --text-muted: #687584;
  --border: #d9dfe5;
  --surface: #fff;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f3f5f7;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #a9c5d8;
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  z-index: 5;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  transform: translateY(-150%);
  border-radius: 3px;
  background: #233f55;
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #27394b;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 3px;
  background: #315d7b;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
}

.brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.access-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #596878;
  font-size: 12px;
}

.access-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #59846a;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 0 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #667586;
  font-size: 11px;
}

.eyebrow span {
  padding: 0 4px;
  color: #9aa5b0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 0 0 6px;
  color: #26384a;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.page-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 550;
  transition: background-color 120ms ease;
}

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

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

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.add-button {
  flex: 0 0 auto;
}

.secondary-button {
  border-color: #cfd7df;
  background: #fff;
  color: #405164;
}

.secondary-button:hover {
  background: #f5f7f9;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.summary-card {
  min-height: 68px;
  padding: 12px 16px;
  border-right: 1px solid #e5e9ed;
}

.summary-card:last-child {
  border-right: 0;
}

.summary-card p {
  margin: 0 0 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.summary-card strong {
  color: #26384a;
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.records-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 13px;
}

.panel-heading h2 {
  margin: 0;
  color: #2a3b4c;
  font-size: 16px;
  font-weight: 650;
}

.records-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 13px;
}

.search-box {
  display: flex;
  min-width: 220px;
  max-width: 390px;
  height: 35px;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid #cfd7df;
  border-radius: 4px;
  background: #fff;
  color: #748191;
}

.search-box:focus-within {
  border-color: #789bb4;
  box-shadow: 0 0 0 2px rgb(89 131 160 / 12%);
}

.search-box svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #293a4b;
  font-size: 12px;
}

.search-box input::placeholder {
  color: #8c97a3;
}

.filter-label select {
  height: 35px;
  min-width: 140px;
  padding: 0 25px 0 9px;
  border: 1px solid #cfd7df;
  border-radius: 4px;
  background: #fff;
  color: #405164;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid #e0e5e9;
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  text-align: left;
}

th {
  height: 38px;
  padding: 0 9px;
  background: #f2f4f6;
  color: #4b5a69;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 18px;
}

th:last-child,
td:last-child {
  padding-right: 14px;
}

td {
  height: 55px;
  padding: 8px 9px;
  border-top: 1px solid #e9edf0;
  color: #465565;
  font-size: 12px;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f8fafb;
}

.project-cell {
  display: flex;
  min-width: 155px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.project-name {
  max-width: 190px;
  overflow: hidden;
  color: #293b4d;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.category-tag,
.status-tag {
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 550;
}

.category-kerja {
  border-color: #dbe3e9;
  background: #f4f6f8;
  color: #526476;
}

.category-bekalan {
  border-color: #d9e3eb;
  background: #f0f5f8;
  color: #496981;
}

.file-number {
  color: #536273;
  font-variant-numeric: tabular-nums;
}

.notes-cell {
  max-width: 220px;
  overflow: hidden;
  color: #667482;
  text-overflow: ellipsis;
}

.date-cell,
.duration-cell,
.cost-cell {
  font-variant-numeric: tabular-nums;
}

.duration-cell {
  color: #35485a;
}

.status-procurement {
  border-color: #e7dcc1;
  background: #fbf7ed;
  color: #856b34;
}

.status-in-progress {
  border-color: #d7e2eb;
  background: #f0f5f8;
  color: #45677f;
}

.status-done {
  border-color: #d5e4d8;
  background: #f0f7f1;
  color: #477151;
}

.progress-cell {
  display: flex;
  min-width: 75px;
  align-items: center;
  gap: 7px;
}

.progress-meter {
  display: block;
  width: 43px;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #e3e7ea;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #557f66;
}

.progress-value {
  color: #536273;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.cost-cell {
  color: #35485a;
  font-weight: 550;
}

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

.table-action {
  padding: 5px 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font-size: 11px;
  font-weight: 550;
}

.table-action:hover:not(:disabled) {
  background: #edf1f4;
}

.edit-action {
  color: #315d7b;
}

.delete-action {
  color: #9a5149;
}

.table-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.notice {
  margin: 0 18px 12px;
  padding: 9px 11px;
  border: 1px solid #cfe0d3;
  border-radius: 3px;
  background: #f2f7f3;
  color: #3e6748;
  font-size: 12px;
  line-height: 1.45;
}

.notice-error {
  border-color: #e8d1ce;
  background: #fbf4f3;
  color: #894940;
}

.empty-state {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-top: 1px solid #e9edf0;
  text-align: center;
}

.empty-state strong {
  color: #344658;
  font-size: 14px;
  font-weight: 600;
}

.empty-state p {
  max-width: 340px;
  margin: 6px 0 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.duration-note {
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid #e9edf0;
  color: #687584;
  font-size: 11px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 0;
  color: #6f7b88;
  font-size: 11px;
}

.record-dialog {
  width: min(650px, calc(100% - 32px));
  max-height: min(90vh, 820px);
  overflow: auto;
  padding: 0;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  background: #fff;
  color: #263445;
  box-shadow: 0 12px 36px rgb(28 43 57 / 18%);
}

.record-dialog::backdrop {
  background: rgb(25 39 52 / 42%);
}

.record-form {
  padding: 22px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-heading h2 {
  margin: 0;
  color: #293b4d;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #d6dde4;
  border-radius: 4px;
  background: #fff;
  color: #536273;
  font-size: 19px;
  line-height: 1;
}

.icon-button:hover {
  background: #f3f5f7;
}

.dialog-description {
  margin: 8px 0 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: #3c4d5e;
  font-size: 12px;
  font-weight: 550;
}

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

.form-field b {
  color: #a55249;
  font-weight: 600;
}

.form-field small {
  color: #6f7b88;
  font-size: 11px;
  font-weight: 400;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cfd7df;
  border-radius: 4px;
  background: #fff;
  color: #293a4b;
  font-size: 13px;
  font-weight: 400;
}

.form-field textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.45;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #8b97a2;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #789bb4;
  outline: 0;
  box-shadow: 0 0 0 2px rgb(89 131 160 / 12%);
}

.form-error {
  margin: 13px 0 0;
  padding: 9px 10px;
  border: 1px solid #e8d1ce;
  border-radius: 3px;
  background: #fbf4f3;
  color: #894940;
  font-size: 12px;
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid #e4e8ec;
}

.save-button {
  min-width: 126px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 900px) {
  .shell {
    width: calc(100% - 32px);
  }
}

@media (max-width: 620px) {
  .shell {
    width: calc(100% - 24px);
  }

  .topbar {
    min-height: 58px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 23px 0 17px;
  }

  .page-description {
    font-size: 12px;
  }

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

  .summary-card:nth-child(2) {
    border-right: 0;
  }

  .summary-card:nth-child(n + 3) {
    border-top: 1px solid #e5e9ed;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 14px 12px 11px;
  }

  .toolbar {
    flex-wrap: wrap;
    padding: 0 12px 11px;
  }

  .search-box {
    max-width: none;
    flex-basis: 100%;
  }

  .filter-label {
    flex: 1;
  }

  .filter-label select {
    width: 100%;
    min-width: 0;
  }

  .notice {
    margin-right: 12px;
    margin-left: 12px;
  }

  .duration-note {
    padding-right: 12px;
    padding-left: 12px;
  }

  .record-form {
    padding: 18px 15px;
  }
}

@media (max-width: 430px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .footer {
    flex-direction: column;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
