/* Living prototype extras on top of Material 3 */
.toast-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #2b3231;
  color: #ecf2f1;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--md-sys-elev-3);
  min-width: 240px;
  text-align: center;
}
.toast.ok { background: #1f497d; }
.toast.warn { background: #8a6d1d; }
.toast.err { background: #ba1a1a; }

.block-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
.block-dialog .box {
  width: 440px;
  background: #fff;
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--md-sys-elev-3);
}
.block-dialog h3 { margin: 0 0 8px; font-weight: 400; font-size: 24px; }
.block-dialog p { color: var(--md-sys-color-on-surface-variant); }

.click-row { cursor: pointer; }
.click-row:hover td { background: var(--md-sys-color-surface-container); }

/* 8px grid + shared gutters */
body.proto {
  --gutter: 24px;
  --drawer: 264px;
  --ctrl-h: 40px;
  --topbar-h: 64px;
  --devbar-h: 40px;
  --infobar-h: 36px;
  --chrome: calc(var(--devbar-h) + var(--infobar-h));
}

body.proto .hifi-devbar {
  height: var(--devbar-h);
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
}
body.proto .hifi-devbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
body.proto .hifi-dev-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
body.proto .hifi-dev-actions a {
  line-height: var(--ctrl-h);
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
}

.demo-bar {
  height: var(--infobar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 var(--gutter);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 12px;
  font-weight: 500;
  box-sizing: border-box;
}

.role-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  height: var(--ctrl-h);
  padding: 0;
  min-width: 168px;
  max-width: 260px;
  cursor: pointer;
  z-index: 1;
  position: relative;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
}

body.proto { margin: 0; }
body.proto #app { height: calc(100vh - var(--chrome)); }
body.proto .wf-app {
  height: 100%;
  display: flex;
}
body.proto .wf-sidebar {
  --drawer-w: var(--drawer);
  width: var(--drawer-w);
  flex: 0 0 var(--drawer-w);
  height: 100%;
  max-height: none;
  padding: 8px 8px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  transition: flex-basis 0.2s ease, width 0.2s ease;
}
body.proto .wf-app.is-collapsed .wf-sidebar {
  --drawer-w: 72px;
  padding: 8px 8px 24px;
}
body.proto .wf-side-nav { display: flex; flex-direction: column; gap: 2px; }
body.proto .wf-side-brand {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 8px 12px;
  margin-bottom: 4px;
  overflow: hidden;
}
body.proto .wf-side-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  margin: 0;
  overflow: hidden;
}
body.proto .wf-side-item .ms {
  width: 24px;
  height: 24px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
body.proto .wf-side-item .nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
body.proto .wf-side-group { margin: 4px 0 8px; }
body.proto .wf-side-group > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  column-gap: 8px;
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 32px;
  overflow: hidden;
}
body.proto .wf-side-group > summary::-webkit-details-marker { display: none; }
body.proto .wf-side-group > summary .nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.proto .wf-side-group > summary .nav-chevron {
  justify-self: end;
  transition: transform 0.15s ease;
}
body.proto .wf-side-group[open] > summary .nav-chevron { transform: rotate(180deg); }

body.proto .wf-app.is-collapsed .nav-label,
body.proto .wf-app.is-collapsed .nav-chevron { display: none; }
body.proto .wf-app.is-collapsed .wf-side-item {
  grid-template-columns: 24px;
  justify-content: center;
  padding: 8px;
}
body.proto .wf-app.is-collapsed .wf-side-group > summary {
  display: none;
}
body.proto .wf-app.is-collapsed .wf-side-group { margin: 0; }
body.proto .wf-app.is-collapsed .wf-side-brand { justify-content: center; padding: 8px; }

.nav-toggle {
  width: var(--ctrl-h);
  height: var(--ctrl-h);
  flex: 0 0 var(--ctrl-h);
  border: 0;
  border-radius: 20px;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.nav-toggle .ms { font-size: 22px; }
.nav-toggle:hover { background: var(--md-sys-color-secondary-container); }
body.proto .wf-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top app bar: search | role + avatar — satu baris, tinggi kontrol sama */
body.proto .wf-topbar {
  display: grid;
  grid-template-columns: var(--ctrl-h) minmax(160px, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding: 0 var(--gutter);
  box-sizing: border-box;
}
body.proto .topbar-search {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  column-gap: 8px;
  height: var(--ctrl-h);
  max-width: 520px;
  padding: 0 16px 0 12px;
  border-radius: 20px;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
}
body.proto .topbar-search .ms { font-size: 20px; line-height: 1; }
body.proto .topbar-search input {
  border: 0;
  outline: 0;
  background: transparent;
  height: var(--ctrl-h);
  width: 100%;
  min-width: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
}
body.proto .topbar-search input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
}
body.proto .topbar-end {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--ctrl-h);
}
body.proto .topbar-role {
  display: grid;
  grid-template-columns: 20px 1fr 16px;
  align-items: center;
  column-gap: 6px;
  height: var(--ctrl-h);
  padding: 0 10px 0 10px;
  border-radius: 20px;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}
body.proto .topbar-role::after {
  content: "expand_more";
  font-family: "Material Symbols Outlined";
  font-size: 18px;
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
}
body.proto .topbar-role .ms { font-size: 18px; color: var(--md-sys-color-on-surface-variant); }
body.proto .topbar-bell {
  position: relative;
  width: var(--ctrl-h);
  height: var(--ctrl-h);
  flex: 0 0 var(--ctrl-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  background: var(--md-sys-color-surface-container-highest);
}
body.proto .topbar-bell .ms { font-size: 22px; }
body.proto .topbar-bell:hover,
body.proto .topbar-bell.is-active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
body.proto .topbar-bell-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
body.proto .nav-demo {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}
body.proto .wf-app.is-collapsed .nav-demo { display: none; }
body.proto .wf-avatar {
  width: var(--ctrl-h);
  height: var(--ctrl-h);
  flex: 0 0 var(--ctrl-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
body.proto .role-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-height: 36px;
  padding: 6px var(--gutter);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 12px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
body.proto .role-bar .ms { font-size: 18px; }
body.proto .role-bar-note { opacity: 0.88; }
body.proto .role-select {
  cursor: pointer;
  min-width: 168px;
}
body.proto .wf-content {
  padding: 16px var(--gutter) 32px;
  flex: 1;
  overflow: auto;
}

.wf-two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.wf-grid { display: grid; gap: 12px; }
.wf-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.wf-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.wf-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.wf-kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.wf-kv .k { color: var(--md-sys-color-on-surface-variant); }
.wf-page-header { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 20px; }
.wf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wf-kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1100px) {
  .wf-grid.cols-4, .wf-kanban { grid-template-columns: 1fr 1fr; }
  .wf-two-col { grid-template-columns: 1fr; }
}

a.wf-btn, a.wf-side-item, a.wf-tab { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
a.wf-tab { color: inherit; }
.wf-side-item .ms { font-size: 20px; }

.flow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.flow-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: var(--md-sys-elev-1);
  text-decoration: none;
  color: inherit;
  min-height: 120px;
}
.flow-step:hover { background: var(--md-sys-color-secondary-container); }
.flow-step .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.flow-step .md-card-icon {
  position: absolute;
  top: 14px;
  right: 14px;
}
.flow-step .own { font-size: 11px; color: var(--md-sys-color-primary); font-weight: 500; }
.flow-step .note { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }

@media (max-width: 1100px) {
  .flow-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body.proto .wf-topbar {
    grid-template-columns: var(--ctrl-h) 1fr;
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px var(--gutter);
    row-gap: 8px;
  }
  body.proto .topbar-search { max-width: none; }
  body.proto .topbar-end { grid-column: 1 / -1; justify-content: flex-end; }
}