/* Final portal layout system.
   Loaded last so older feature styles cannot shrink text or push content
   outside its card. Login styles are intentionally left untouched. */

:root {
  --ui-ink: #102e4a;
  --ui-muted: #60788c;
  --ui-line: #dbe7ee;
  --ui-canvas: #f3f8fb;
  --ui-surface: #ffffff;
  --ui-blue: #087fbd;
  --ui-blue-dark: #075b88;
  --ui-sky: #38b9e5;
  --ui-green: #0b8b67;
  --ui-radius: 16px;
  --ui-shadow: 0 12px 30px rgba(15, 66, 99, .08);
}

html:has(.app-shell),
body:has(.app-shell) {
  max-width: 100%;
  overflow-x: clip;
  background: var(--ui-canvas);
}

body:has(.app-shell),
.app-shell,
.app-shell button,
.app-shell input,
.app-shell select,
.app-shell textarea {
  font-family: "Manrope", Arial, sans-serif;
}

.app-shell,
.app-shell *,
.main-area,
.content,
.content > *,
.panel,
.form-card,
.table-wrap,
.team-tabs,
.warehouse-tabs,
.attendance-portal-root {
  min-width: 0;
}

.app-shell img,
.app-shell video,
.app-shell canvas,
.app-shell iframe {
  max-width: 100%;
}

.main-area,
.content {
  width: 100%;
  max-width: 100%;
}

.content {
  margin-inline: auto;
  color: var(--ui-ink);
}

.content > * {
  max-width: 100%;
}

.content h1,
.content h2,
.content h3,
.content h4,
.content p {
  overflow-wrap: anywhere;
}

.content h1 { font-size: clamp(27px, 2.25vw, 34px); line-height: 1.16; }
.content h2 { font-size: clamp(21px, 1.75vw, 27px); line-height: 1.2; }
.content h3 { font-size: 17px; line-height: 1.3; }
.content p { font-size: 13px; line-height: 1.6; }
.content small { font-size: 11px; line-height: 1.45; }

.page-title,
.section-intro {
  width: 100%;
  max-width: 100%;
}

.page-title h1,
.section-intro h1 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -.7px;
}

.page-title p,
.section-intro p {
  max-width: 760px;
  margin-top: 8px;
  font-size: 14px;
}

.panel,
.stat-card,
.form-card,
.profile-card,
.camera-card,
.location-card,
.payroll-card,
.settings-section,
.dashboard-warehouse,
.warehouse-card,
.attendance-settings-card {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow);
}

.panel,
.form-card,
.profile-card,
.payroll-card,
.settings-section,
.dashboard-warehouse,
.attendance-settings-card {
  padding: 21px;
}

.panel-title,
.warehouse-card-head,
.attendance-card-title,
.active-volunteers-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.panel-title > *,
.warehouse-card-head > *,
.attendance-card-title > *,
.active-volunteers-title > * {
  min-width: 0;
}

.panel-title h3,
.warehouse-card-head h3,
.attendance-card-title h3,
.active-volunteers-title h3 {
  margin: 0;
  color: var(--ui-ink);
  font-size: 17px;
}

.stats-grid,
.module-grid,
.admin-bottom,
.two-cols,
.attendance-layout,
.warehouse-grid,
.dashboard-warehouse-grid,
.security-grid,
.form-grid {
  max-width: 100%;
  gap: 16px;
}

.stat-card {
  min-height: 126px;
  padding: 18px;
}

.stat-card b { font-size: 27px; line-height: 1.05; }
.stat-card span,
.stat-card small { font-size: 12px; line-height: 1.45; }

.primary,
.outline-btn,
.danger-btn,
.edit-btn,
.team-tabs button,
.warehouse-tabs button,
.period-toolbar button,
.form-actions button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.form-grid,
.warehouse-form,
.attendance-location-fields,
.security-card {
  min-width: 0;
}

.form-grid label,
.modal label,
.security-card > label,
.period-toolbar label,
.warehouse-form label,
.attendance-settings-panel label {
  min-width: 0;
  color: #415b70;
  font-size: 12px;
  line-height: 1.4;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.modal input,
.modal select,
.security-card input,
.period-toolbar input,
.warehouse-form input,
.warehouse-form select,
.warehouse-form textarea,
.attendance-settings-panel input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ui-ink);
  font-size: 13px;
}

.team-tabs {
  width: fit-content;
  max-width: 100%;
}

.warehouse-tabs {
  width: 100%;
}

.team-tabs,
.warehouse-tabs {
  max-width: 100%;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: #eef5f8;
}

.team-tabs button,
.warehouse-tabs button {
  min-width: 0;
  flex: 1 1 auto;
}

.period-toolbar,
.warehouse-report-tools,
.warehouse-form-actions,
.warehouse-recap-actions,
.form-actions {
  max-width: 100%;
  flex-wrap: wrap;
}

.table-wrap,
.attendance-table-scroll,
.active-volunteers-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #a9c8d7 transparent;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.table-wrap th,
.active-volunteers-table th {
  padding: 13px 12px;
  color: #61798b;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .05em;
  white-space: nowrap;
}

.table-wrap td,
.active-volunteers-table td {
  padding: 14px 12px;
  color: #29475d;
  font-size: 13px;
  line-height: 1.5;
  vertical-align: middle;
}

.table-wrap td b,
.active-volunteers-table td b { font-size: 13px; }
.table-wrap .cell-sub,
.active-volunteers-table td small { font-size: 11px; line-height: 1.4; }
.status { padding: 6px 10px; font-size: 11px; }

.dashboard-warehouse .panel-title h3 { font-size: 18px; }
.dashboard-warehouse .panel-title button::after { font-size: 12px; }
.dashboard-warehouse-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-warehouse-grid > article { min-width: 0; padding: 16px; }
.dashboard-stock-title b { font-size: 13px; }
.dashboard-stock-title small { font-size: 10px; }
.dashboard-stock-row { gap: 10px; padding: 8px 1px; font-size: 11px; }
.dashboard-stock-row b { min-width: 0; }
.dashboard-stock-more { font-size: 10px; }
.dashboard-stock-list > p { font-size: 11px; }

/* Attendance pages ------------------------------------------------------- */
.attendance-portal-root {
  margin-top: 20px;
  font-size: 13px;
}

.attendance-portal-heading h2 { font-size: 25px; }
.attendance-portal-heading p { font-size: 13px; }
.attendance-eyebrow { font-size: 10px; }
.attendance-server-time { padding: 8px 12px; font-size: 11px; }

.attendance-period-toolbar {
  width: 100%;
  max-width: 100%;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
}

.attendance-period-heading b { font-size: 13px; }
.attendance-period-toolbar label,
.attendance-search-label { font-size: 11px; }
.attendance-period-toolbar input,
.attendance-staff-tools input {
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  font-size: 13px;
}

.attendance-period-actions { flex-wrap: wrap; }
.attendance-apply-button,
.attendance-reset-button,
.attendance-refresh-button,
.attendance-retry-button {
  min-height: 42px;
  padding: 0 15px;
  font-size: 12px;
}

.attendance-period-label { font-size: 11px; }
.attendance-summary-card { min-height: 108px; padding: 17px; }
.attendance-summary-card span { font-size: 11px; }
.attendance-summary-card strong { font-size: 27px; }
.attendance-summary-card small { font-size: 10px; }

.attendance-table-heading { padding: 18px 18px 14px; }
.attendance-table-heading h3 { font-size: 16px; }
.attendance-table-heading p { font-size: 11px; }
.attendance-count-badge,
.attendance-live-count { min-height: 29px; font-size: 11px; }

.attendance-data-table {
  width: 100%;
  min-width: 940px;
}

.attendance-data-table th {
  padding: 12px;
  font-size: 10px;
}

.attendance-data-table td {
  padding: 13px 12px;
  font-size: 12px;
}

.attendance-data-table td b { font-size: 12px; }
.attendance-data-table td small { font-size: 10px; }
.attendance-status { min-height: 28px; padding: 5px 9px; font-size: 10px; }
.attendance-photo-button { min-height: 36px; padding: 4px 8px 4px 4px; font-size: 10px; }
.attendance-photo-button img { width: 28px; height: 28px; }
.attendance-active-empty { padding: 20px 18px; font-size: 12px; }
.attendance-active-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 11px; padding: 0 14px 15px; }
.attendance-active-card { padding: 12px; }
.attendance-active-avatar { width: 37px; height: 37px; flex-basis: 37px; font-size: 14px; }
.attendance-active-identity strong,
.attendance-active-time b { font-size: 12px; }
.attendance-active-identity small,
.attendance-active-time small { font-size: 10px; }
.attendance-podium-card { padding: 17px; }
.attendance-podium-card strong { font-size: 14px; }
.attendance-podium-card small { font-size: 11px; }
.attendance-podium-card b { font-size: 13px; }
.attendance-loading-panel,
.attendance-error-panel,
.attendance-empty-panel { font-size: 12px; }
.attendance-empty-panel strong,
.attendance-error-panel strong { font-size: 14px; }
.attendance-empty-panel p,
.attendance-error-panel p { font-size: 12px; }

/* Desktop top navigation ------------------------------------------------ */
@media (min-width: 901px) {
  .sidebar {
    min-width: 0;
    padding-inline: 26px;
  }

  .sidebar .brand-copy {
    min-width: 0;
  }

  .sidebar .brand-copy b {
    font-size: 14px !important;
    line-height: 1.15;
  }

  .sidebar .brand-copy small {
    font-size: 10px !important;
    line-height: 1.25;
  }

  .sidebar nav {
    min-width: 0;
    gap: 4px;
  }

  .sidebar .nav-item {
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
  }

  .sidebar .nav-item span {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
  }

  .sidebar .sidebar-bottom .logout {
    min-height: 40px;
    padding-inline: 12px;
    font-size: 11px !important;
  }
}

@media (min-width: 1181px) {
  .sidebar .nav-item {
    font-size: 11px !important;
    line-height: 1.2;
  }
}

/* Tablet ---------------------------------------------------------------- */
@media (max-width: 1180px) and (min-width: 761px) {
  .content { padding: 30px 26px 48px !important; }
  .dashboard-warehouse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid.four,
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-period-label { width: 100%; margin-left: 0; }
}

/* Mobile ---------------------------------------------------------------- */
@media (max-width: 760px) {
  body:has(.app-shell) { font-size: 14px; }

  .app-shell,
  .main-area,
  .content {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  .content {
    padding: 18px 14px 32px !important;
  }

  .content h1 { font-size: 26px !important; line-height: 1.18 !important; }
  .content h2 { font-size: 22px !important; }
  .content h3 { font-size: 17px !important; }
  .content p { font-size: 13px !important; }
  .content small { font-size: 11px !important; }

  .main-area > .content > .page-title,
  .warehouse-page > .page-title {
    min-height: 0 !important;
    padding: 21px !important;
    border-radius: 18px !important;
  }

  .main-area > .content > .page-title h1,
  .warehouse-page > .page-title h1 { font-size: 25px !important; }
  .main-area > .content > .page-title p,
  .warehouse-page > .page-title p { font-size: 13px !important; }

  .panel,
  .form-card,
  .profile-card,
  .payroll-card,
  .settings-section,
  .dashboard-warehouse,
  .attendance-settings-card {
    margin-bottom: 14px !important;
    padding: 17px !important;
    border-radius: 17px !important;
  }

  .panel-title,
  .warehouse-card-head,
  .attendance-card-title,
  .active-volunteers-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .stats-grid,
  .stats-grid.four,
  .module-grid,
  .warehouse-grid,
  .dashboard-warehouse-grid,
  .admin-bottom,
  .two-cols,
  .attendance-layout,
  .security-grid,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stat-card { min-height: 104px; padding: 16px !important; }
  .stat-card b { font-size: 25px !important; }
  .stat-card span,
  .stat-card small { font-size: 11px !important; }

  .staff-identity-mobile {
    padding: 17px !important;
    border-radius: 17px !important;
  }

  .staff-identity-head { align-items: flex-start; }
  .staff-identity-logo { width: 52px; height: 52px; flex-basis: 52px; }
  .staff-identity-logo img { width: 43px; height: 43px; }
  .staff-identity-head small { font-size: 11px !important; }
  .staff-identity-head b {
    max-width: 100%;
    font-size: 18px !important;
    white-space: normal;
  }
  .staff-identity-head em { font-size: 11px; }
  .staff-identity-details { grid-template-columns: 1fr 1fr; gap: 9px; }
  .staff-identity-details span { padding: 11px; }
  .staff-identity-details small { font-size: 10px !important; }
  .staff-identity-details b { font-size: 13px !important; }

  .quick-actions-mobile { gap: 11px; }
  .quick-actions-heading span { font-size: 11px; }
  .quick-actions-heading b { font-size: 17px; }
  .quick-action,
  .quick-action:first-of-type {
    min-height: 96px;
    padding: 15px 13px;
    border-radius: 16px;
  }
  .quick-action-icon { width: 44px; height: 44px; flex-basis: 44px; margin-right: 11px; }
  .quick-action-copy b { font-size: 14px !important; }
  .quick-action-copy small { font-size: 11px !important; line-height: 1.4; }

  .dashboard-warehouse .panel-title h3 { font-size: 17px !important; }
  .dashboard-warehouse .panel-title button::after { font-size: 11px; }
  .dashboard-warehouse-grid > article { padding: 15px; }
  .dashboard-stock-title b { font-size: 14px !important; }
  .dashboard-stock-title small { font-size: 11px !important; }
  .dashboard-stock-row { padding: 9px 1px; font-size: 11px; }
  .dashboard-stock-more,
  .dashboard-stock-list > p { font-size: 11px !important; }

  .team-tabs,
  .warehouse-tabs {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: hidden !important;
  }

  .team-tabs button,
  .warehouse-tabs button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px;
    padding: 8px 9px;
    font-size: 11px;
  }

  .period-toolbar,
  .warehouse-report-tools,
  .warehouse-form-actions,
  .warehouse-recap-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .period-toolbar > *,
  .warehouse-report-tools > *,
  .warehouse-form-actions > *,
  .warehouse-recap-actions > *,
  .form-actions > * {
    width: 100% !important;
    max-width: 100%;
  }

  .table-wrap {
    width: 100% !important;
    margin-inline: 0 !important;
    border-radius: 13px;
  }

  .table-wrap table { min-width: 680px !important; }
  .table-wrap th { padding: 12px 10px !important; font-size: 10px !important; }
  .table-wrap td { padding: 13px 10px !important; font-size: 12px !important; }
  .table-wrap td b { font-size: 13px !important; }
  .table-wrap .cell-sub { font-size: 10px !important; }

  .sidebar .sidebar-bottom .logout {
    padding: 9px 12px !important;
    color: #496c83 !important;
    font-size: 11px !important;
  }

  /* Attendance toolbar is stacked, and the wide desktop table becomes a set
     of readable record cards with its own labels. */
  .attendance-portal-root { margin: 15px 0 22px; }
  .attendance-portal-heading { gap: 10px; }
  .attendance-portal-heading h2 { font-size: 24px !important; }
  .attendance-portal-heading p { font-size: 13px !important; }
  .attendance-eyebrow { font-size: 10px !important; }
  .attendance-server-time { max-width: 100%; font-size: 10px; white-space: normal; }

  .attendance-period-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 11px;
    padding: 15px;
  }
  .attendance-period-heading { min-width: 0; }
  .attendance-period-heading b { font-size: 14px; }
  .attendance-period-toolbar label { width: 100%; font-size: 11px; }
  .attendance-period-toolbar input { width: 100%; font-size: 13px; }
  .attendance-period-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .attendance-period-actions button { width: 100%; }
  .attendance-period-label { width: 100%; margin: 0; font-size: 11px; white-space: normal; }

  .attendance-summary-grid,
  .attendance-podium { grid-template-columns: 1fr !important; gap: 10px; }
  .attendance-summary-card { min-height: 92px; }
  .attendance-podium-card { min-height: 106px; }
  .attendance-staff-tools { align-items: stretch; }
  .attendance-staff-tools input { min-height: 44px; font-size: 13px; }
  .attendance-refresh-button { width: 100%; }
  .attendance-active-list { grid-template-columns: 1fr; padding: 0 12px 13px; }

  .attendance-table-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .attendance-table-heading {
    padding: 0 1px 12px;
  }
  .attendance-table-heading h3 { font-size: 17px !important; }
  .attendance-table-heading p { font-size: 12px !important; }
  .attendance-table-scroll { overflow: visible !important; }
  .attendance-data-table,
  .attendance-data-table tbody {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .attendance-data-table thead { display: none; }
  .attendance-data-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 12px;
    width: 100%;
    margin-bottom: 12px;
    padding: 15px;
    overflow: hidden;
    border: 1px solid var(--ui-line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 21px rgba(15, 66, 99, .06);
  }
  .attendance-data-table td {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    color: #28465b;
    font-size: 12px !important;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .attendance-data-table td::before {
    color: #718797;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
  }
  .attendance-data-table td b { font-size: 13px !important; }
  .attendance-data-table td small { font-size: 11px !important; overflow-wrap: anywhere; white-space: normal; }

  .attendance-portal-staff .attendance-data-table td:nth-child(1)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(1)::before { content: "Tanggal"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(2)::before { content: "Relawan"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(3)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(2)::before { content: "Divisi / Jadwal"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(4)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(3)::before { content: "Masuk"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(5)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(4)::before { content: "Pulang"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(6)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(5)::before { content: "Durasi"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(7)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(6)::before { content: "Terlambat"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(8)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(7)::before { content: "Status"; }
  .attendance-portal-staff .attendance-data-table td:nth-child(9)::before,
  .attendance-portal-history .attendance-data-table td:nth-child(8)::before { content: "Foto"; }

  .attendance-portal-ranking .attendance-data-table td:nth-child(1)::before { content: "Peringkat"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(2)::before { content: "Nama"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(3)::before { content: "Divisi"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(4)::before { content: "Hari hadir"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(5)::before { content: "Tepat waktu"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(6)::before { content: "Selesai"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(7)::before { content: "Terlambat"; }
  .attendance-portal-ranking .attendance-data-table td:nth-child(8)::before { content: "Skor"; }

  .attendance-photo-cell {
    grid-column: 1 / -1;
  }
  .attendance-photo-group { flex-wrap: wrap; }
  .attendance-photo-button { flex: 1 1 120px; justify-content: center; min-height: 40px; }
  .attendance-data-table .attendance-score-cell { align-content: start; }

  .attendance-photo-dialog { width: 100%; max-height: calc(100dvh - 28px); padding: 15px; }
}

@media (max-width: 380px) {
  .content { padding-inline: 12px !important; }
  .staff-identity-details { grid-template-columns: 1fr; }
  .staff-identity-details span:nth-child(n) { grid-column: auto; }
  .quick-actions-mobile { grid-template-columns: 1fr; }
  .quick-action:first-of-type { grid-column: auto; }
  .team-tabs,
  .warehouse-tabs { grid-template-columns: 1fr; }
  .attendance-data-table tr { grid-template-columns: 1fr; }
  .attendance-photo-cell { grid-column: auto; }
}

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