/* Design tokens — Polimedia brand (LOCKED) */
:root {
  --color-primary: #5c2c70;
  --color-secondary: #eb532b;
  --color-surface: #ffffff;
  --color-text: #1f1a22;
  --color-text-muted: #5c5663;
  --color-border: #e6e1ea;
  --color-muted-bg: #f7f5f8;
  --gradient-brand: linear-gradient(135deg, #5c2c70 0%, #eb532b 100%);
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --radius-sm: 0.375rem;
  --max-width: 72rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-muted-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  min-height: 4rem;
  padding-block: var(--space-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.logo-slot {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-muted-bg);
  overflow: hidden;
}

.logo-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-mark {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.25rem;
  background: var(--gradient-brand);
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-main {
  min-height: calc(100vh - 8rem);
}

/* Super Admin public landing — no top brand header; content starts at top edge */
body.home-landing .site-main {
  min-height: calc(100vh - 4rem);
}

body.home-landing .hero-with-bg {
  margin-top: 0;
}

.hero {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.hero-with-bg {
  position: relative;
  border-bottom: none;
  background: #f3eef6;
  overflow: hidden;
}

.hero-bg-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
}

.hero-inner {
  padding: clamp(2.5rem, 8vw, 5rem) 0;
  position: relative;
  z-index: 1;
}

.hero-with-bg .hero-inner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: none;
  width: 100%;
  padding-top: 0;
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
  box-sizing: border-box;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-with-bg .hero-actions .btn-primary {
  background: var(--color-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.hero-with-bg .hero-actions .btn-primary:hover,
.hero-with-bg .hero-actions .btn-primary:focus-visible {
  background: #d24724;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-page {
  padding: clamp(2rem, 6vw, 4rem) 0;
}

.status-inner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.status-code {
  margin: 0;
  color: var(--color-secondary);
  font-size: 2rem;
  font-weight: 700;
}

.status-inner h1 {
  margin: var(--space-xs) 0 var(--space-sm);
  color: var(--color-primary);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
}

.status-inner p {
  margin: 0 0 var(--space-lg);
  color: var(--color-text-muted);
}

.btn-primary {
  display: inline-block;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #4a235a;
  text-decoration: none;
}

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg) 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 640px) {
  .header-inner {
    min-height: 3.5rem;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .hero-inner {
    padding-block: 2.25rem;
  }
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #4a235a;
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: #c8451f;
  color: #fff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: #d04522;
  border-color: #d04522;
  color: #fff;
  text-decoration: none;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(92, 44, 112, 0.15);
}

/* Password show/hide — global reusable field wrapper */
.password-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field .form-control {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  color: var(--color-primary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--color-accent);
  outline: none;
}

.password-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(235, 83, 43, 0.25);
}

.password-toggle-icon-hide {
  display: none;
}

.password-toggle.is-visible .password-toggle-icon-show {
  display: none;
}

.password-toggle.is-visible .password-toggle-icon-hide {
  display: block;
}

.form-actions {
  margin-top: var(--space-lg);
}

.form-hint {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.form-hint-warning {
  color: #9a3412;
}

/* ---------------------------------------------------------------------- */
/* Alerts / flash messages                                                 */
/* ---------------------------------------------------------------------- */

.alert {
  padding: 0.75rem 1rem;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
}

.alert-error {
  background: #fdecea;
  border-color: #f5c2bc;
  color: #9c2c1c;
}

.alert-success {
  background: #eaf7ee;
  border-color: #bfe6c9;
  color: #1e6b34;
}

.alert-info {
  background: #eef2fb;
  border-color: #c7d3ef;
  color: #2c3e70;
}

/* ---------------------------------------------------------------------- */
/* Tables                                                                   */
/* ---------------------------------------------------------------------- */

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table thead th {
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  background: var(--color-muted-bg);
}

.table tbody tr:hover {
  background: var(--color-muted-bg);
}

/* ---------------------------------------------------------------------- */
/* Auth pages (login)                                                       */
/* ---------------------------------------------------------------------- */

.auth-body {
  min-height: 100vh;
  background: var(--gradient-brand);
}

/* Super Admin login only — platform background image (not campus branding) */
.auth-body.auth-superadmin-bg {
  background-color: #1f1a22;
  background-image:
    linear-gradient(135deg, rgba(31, 26, 34, 0.3), rgba(92, 44, 112, 0.28)),
    url('/images/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  background: var(--color-surface);
  border-radius: 0.75rem;
  box-shadow: 0 20px 45px rgba(31, 26, 34, 0.25);
  padding: var(--space-xl) var(--space-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  min-width: 0;
}

.logo-slot-login {
  width: 3.25rem;
  height: 3.25rem;
  max-width: 4.5rem;
  max-height: 4.5rem;
}

.logo-slot-login img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.login-preview-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.65rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: rgba(31, 26, 34, 0.85);
}

.branding-preview-asset {
  margin-bottom: 0.5rem;
}

.branding-logo-preview {
  display: block;
  max-width: 8rem;
  max-height: 4rem;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0.35rem;
}

.branding-preview-bg {
  width: 100%;
  height: 7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.color-field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.color-picker {
  width: 3rem;
  height: 2.75rem;
  padding: 0.15rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0.65rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.auth-title {
  margin: 0 0 0.35rem;
  color: var(--color-primary);
  font-size: 1.4rem;
}

.auth-subtitle {
  margin: 0 0 var(--space-lg);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.auth-form {
  margin-top: var(--space-sm);
}

@media (max-width: 480px) {
  .auth-card {
    padding: var(--space-lg) var(--space-md);
  }
}

/* ---------------------------------------------------------------------- */
/* Dashboard shell — sidebar + topbar layout                                */
/* ---------------------------------------------------------------------- */

:root {
  --sidebar-width: 17rem;
  --topbar-height: 4rem;
}

.app-body {
  background: var(--color-muted-bg);
}

.app-shell {
  min-height: 100vh;
}

.sidebar-toggle-input {
  position: absolute;
}

.sidebar {
  position: fixed;
  inset-block: 0;
  left: 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-nav {
  padding: var(--space-md) 0;
}

.sidebar-group-label {
  margin: var(--space-md) var(--space-lg) 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem var(--space-lg);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}

a.nav-link:hover,
a.nav-link:focus-visible {
  background: var(--color-muted-bg);
  text-decoration: none;
}

.nav-link.is-active {
  border-left-color: var(--color-secondary);
  background: var(--color-muted-bg);
  color: var(--color-primary);
  font-weight: 700;
}

.nav-link.is-disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.badge-soon {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-muted-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31, 26, 34, 0.45);
  z-index: 30;
}

.app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: var(--topbar-height);
  padding-inline: var(--space-lg);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--color-muted-bg);
}

.hamburger-btn span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

.topbar-title {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
  color: var(--color-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
}

.app-content {
  flex: 1;
  padding: var(--space-lg);
}

/* Sidebar open state, toggled via the hidden checkbox + label (no JS needed) */
#sidebar-toggle:checked ~ .sidebar {
  transform: translateX(0);
}

#sidebar-toggle:checked ~ .sidebar-backdrop {
  display: block;
}

.page-header {
  margin-bottom: var(--space-lg);
}

.page-title {
  margin: 0 0 0.25rem;
  color: var(--color-primary);
  font-size: 1.4rem;
}

.page-subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.card h3 {
  margin-top: 0;
  color: var(--color-primary);
}

.text-muted {
  color: var(--color-text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-lg);
}

.kpi-label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Desktop: sidebar always visible, hamburger hidden */
@media (min-width: 961px) {
  .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .hamburger-btn {
    display: none;
  }

  .app-main {
    margin-left: var(--sidebar-width);
  }
}

@media (max-width: 960px) {
  .app-content {
    padding: var(--space-md);
  }
}

/* ---------------------------------------------------------------------- */
/* Research / Community Service / Monitoring modules                       */
/* ---------------------------------------------------------------------- */

.page-header-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.button-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: flex-end;
}

.filter-field {
  min-width: 10rem;
  margin-bottom: 0;
}

.filter-field-grow {
  flex: 1 1 14rem;
}

.filter-checkbox,
.filter-submit {
  display: flex;
  flex-direction: column;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-public {
  background: #eaf7ee;
  color: #1e6b34;
  border: 1px solid #bfe6c9;
}

.badge-private {
  background: #f7f5f8;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.badge-restricted {
  background: #f4eef7;
  color: var(--color-primary);
  border: 1px solid #d9c6e3;
}

.table-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  white-space: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--color-text-muted);
}

.empty-state p {
  margin: 0.25rem 0;
}

.inline-form,
.inline-form-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.form-control-inline {
  width: auto;
  display: inline-block;
}

.member-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-md);
  align-items: start;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-muted-bg);
}

.member-row .form-group {
  margin-bottom: 0.5rem;
}

.member-add-form {
  margin-top: var(--space-sm);
}

/* ---------------------------------------------------------------------- */
/* Admin modules — filters, badges, table actions, empty states            */
/* ---------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.filter-bar .form-group {
  min-width: 14rem;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-active {
  background: #eaf7ee;
  color: #1e6b34;
}

.badge-inactive {
  background: #fdecea;
  color: #9c2c1c;
}

.badge-neutral {
  background: var(--color-muted-bg);
  color: var(--color-text-muted);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  white-space: nowrap;
}

.actions-cell form {
  margin: 0;
  display: inline;
}

.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  color: var(--color-text-muted);
}

.field-error {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #9c2c1c;
}

.form-inline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 var(--space-md);
}

.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.5rem 0;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

/* ---------------------------------------------------------------------- */
/* Repository hub — Dosen 2-card landing                                   */
/* ---------------------------------------------------------------------- */

.repo-hub {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: var(--space-lg);
}

.repo-hub-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 14rem;
  padding: 1.5rem 1.5rem 1.35rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 0.75rem);
  background-image: linear-gradient(145deg, #ffffff 0%, #faf7fb 55%, #fff5f1 100%);
  box-shadow: 0 8px 24px rgba(92, 44, 112, 0.06);
}

.repo-hub-card-public {
  border-top: 3px solid var(--color-primary);
}

.repo-hub-card-mine {
  border-top: 3px solid var(--color-secondary);
}

.repo-hub-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: var(--color-primary);
}

.repo-hub-desc {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.repo-hub-cta {
  align-self: flex-start;
}

.repo-public-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
}

.repo-file-edit {
  display: inline-block;
}

.repo-file-edit > summary {
  list-style: none;
  cursor: pointer;
}

.repo-file-edit-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
  min-width: min(18rem, 80vw);
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.page-actions {
  margin: 0.5rem 0 0;
}

@media (max-width: 900px) {
  .repo-hub {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .repo-hub {
    grid-template-columns: 1fr;
  }

  .repo-hub-card {
    min-height: 0;
  }

  .repo-hub-cta {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------- */
/* Repository explorer — breadcrumb                                        */
/* ---------------------------------------------------------------------- */

.breadcrumb-bar {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------- */
/* Repository explorer — personal UX (UAT FIX 01)                          */
/* ---------------------------------------------------------------------- */

.repo-explorer-header .repo-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.repo-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.repo-header-copy {
  flex: 1 1 16rem;
  min-width: 0;
}

.repo-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.repo-mode-badge {
  font-weight: 700;
}

.repo-mode-manage {
  color: var(--color-primary);
}

.repo-mode-read {
  color: var(--color-text-muted);
}

.repo-primary-actions-mobile {
  display: none;
}

.repo-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: var(--space-md);
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.repo-breadcrumb a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.repo-breadcrumb a:hover,
.repo-breadcrumb a:focus-visible {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--color-text-muted);
}

.breadcrumb-current {
  font-weight: 700;
  color: var(--color-text);
}

.repo-primary-actions {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: var(--space-md);
  padding: 0.75rem 0;
  background: linear-gradient(180deg, #faf7fb 0%, rgba(250, 247, 251, 0.85) 70%, transparent 100%);
}

.repo-panel {
  margin-bottom: var(--space-md);
}

.repo-panel-hint {
  margin-top: -0.25rem;
  margin-bottom: var(--space-md);
  font-size: 0.85rem;
}

.repo-empty-state {
  padding: var(--space-xl) var(--space-md);
}

.repo-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: var(--space-md);
}

.repo-mobile-cards {
  display: none;
}

.repo-item-card {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.repo-item-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.repo-item-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--color-primary);
}

.repo-item-title a {
  color: inherit;
  text-decoration: none;
}

.repo-item-meta {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.repo-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

.repo-rename-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 12rem;
  align-items: center;
}

.repo-rename-form .form-control {
  flex: 1 1 8rem;
  min-width: 0;
}

@media (max-width: 768px) {
  .repo-header-actions {
    display: none;
  }

  .repo-primary-actions-mobile {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: var(--space-md);
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: 0 4px 12px rgba(92, 44, 112, 0.08);
  }

  .repo-primary-actions-mobile .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .repo-desktop-table {
    display: none;
  }

  .repo-mobile-cards {
    display: block;
  }

  .actions-cell .inline-form-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------------------------------------------------------------------- */
/* Responsive polish — phone / tablet / laptop (additive, non-breaking)    */
/* ---------------------------------------------------------------------- */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Horizontal scroll for any card that wraps a wide admin table */
.card:has(> .table),
.card.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Prefer dynamic viewport on modern mobile browsers (login + shell) */
.auth-body {
  min-height: 100dvh;
}

.app-shell {
  min-height: 100dvh;
}

/* Tablet (and below desktop sidebar breakpoint) */
@media (max-width: 960px) {
  .topbar {
    padding-inline: var(--space-sm);
    gap: var(--space-sm);
  }

  .topbar-title {
    font-size: 0.95rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .filter-bar .form-group,
  .filter-bar .filter-field,
  .filter-field-grow {
    min-width: min(100%, 14rem);
    flex: 1 1 12rem;
  }

  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  }

  .button-group,
  .form-inline-actions,
  .page-header-actions,
  .page-header-row {
    gap: var(--space-sm);
  }
}

/* Phone */
@media (max-width: 640px) {
  .app-content {
    padding: var(--space-sm);
  }

  .card {
    padding: var(--space-md);
  }

  .topbar-user .user-name {
    display: none;
  }

  .topbar-password-btn {
    padding-inline: 0.55rem;
    font-size: 0.78rem;
  }

  .hamburger-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .page-header-row > .btn,
  .page-header-actions .btn,
  .form-inline-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .page-header-row,
  .page-header-actions {
    align-items: stretch;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .form-group,
  .filter-bar .filter-field,
  .filter-field-grow {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .kpi-card {
    padding: var(--space-md);
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .table th,
  .table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.85rem;
  }

  .auth-page {
    padding: var(--space-md) var(--space-sm);
  }

  .auth-card {
    width: 100%;
  }

  .actions-cell {
    white-space: normal;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar-password-btn {
    display: none;
  }
}

.document-result-list {
  display: grid;
  gap: 1rem;
}

.document-result {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
}

.document-result:first-child {
  border-top: 0;
  padding-top: 0;
}

.document-result-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: var(--color-primary);
}

.document-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.55rem 1rem;
  margin: 0;
}

.document-meta dt {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.document-meta dd {
  margin: 0.15rem 0 0;
}

.document-result-actions {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .document-result {
    flex-direction: column;
  }

  .document-result-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Large desktop — keep content readable, don't stretch endlessly */
@media (min-width: 1400px) {
  .app-content {
    max-width: 90rem;
  }
}
