/* ==========================================================================
   IPM JAWA TIMUR - MODERN MVC PORTAL STYLESHEET
   Design System: Emerald & Amber Palette, Plus Jakarta Sans & Outfit
   ========================================================================== */

:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --primary-glow: rgba(5, 150, 105, 0.25);
  --secondary: #f59e0b;
  --secondary-hover: #d97706;
  --secondary-light: #fffbeb;
  
  --dark: #0f172a;
  --dark-light: #1e293b;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50:  #f8fafc;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0284c7;

  --sidebar-width: 270px;
  --topbar-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.25;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.app-wrapper {
  display: block;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

/* SIDEBAR */
.app-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #047857 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.brand-logo svg {
  width: 26px;
  height: 26px;
}

.brand-text h2 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--gray-900);
}

.brand-text p {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-menu {
  padding: 24px 16px;
  flex: 1;
  overflow-y: auto;
}

.menu-category {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  padding: 0 12px;
  margin-bottom: 8px;
  margin-top: 16px;
}

.menu-category:first-child {
  margin-top: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--gray-600);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 4px;
  transition: var(--transition);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  transform: translateX(3px);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.nav-link.active svg {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--gray-100);
  background: #fafafa;
}

.user-badge-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--gray-200);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  text-transform: uppercase;
}

/* MAIN CONTENT AREA */
.app-main {
  flex: 1 1 auto;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
}

/* TOPBAR */
.app-topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title-badge h1 {
  font-size: 1.25rem;
  color: var(--gray-900);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* QUICK ROLE SWITCHER FOR DEMO */
.role-switcher-dropdown {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  padding: 4px 8px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
}

.role-pill {
  padding: 4px 10px;
  border-radius: 20px;
  color: var(--gray-600);
  font-weight: 700;
  transition: var(--transition);
}

.role-pill:hover, .role-pill.active {
  background: var(--primary);
  color: #ffffff;
}

/* PAGE CONTENT CONTAINER */
.page-container {
  padding: 32px;
  flex: 1 1 auto;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  min-width: 0;
}

/* ==========================================================================
   CARDS, STATS & GRIDS
   ========================================================================== */

.card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition);
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
  box-sizing: border-box;
  max-width: 100%;
}

.card-title {
  font-size: 1.15rem;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-card.stat-amber::before { background: var(--secondary); }
.stat-card.stat-blue::before { background: var(--info); }
.stat-card.stat-emerald::before { background: var(--success); }

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 2rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-amber .stat-icon {
  background: var(--secondary-light);
  color: var(--secondary);
}

.stat-blue .stat-icon {
  background: #f0f9ff;
  color: var(--info);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.data-table th {
  background: var(--gray-50);
  padding: 14px 18px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 16px 18px;
  font-size: 0.88rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.table-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-sm);
}

.table-title {
  font-weight: 700;
  color: var(--gray-900);
}

.table-subtitle {
  font-size: 0.78rem;
  color: var(--gray-500);
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success { background: #d1fae5; color: #047857; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

/* ==========================================================================
   FILTER & SEARCH TOOLBAR
   ========================================================================== */

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  min-width: 280px;
  gap: 10px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.88rem;
  color: var(--gray-800);
  font-family: inherit;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select-filter {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.select-filter:focus {
  border-color: var(--primary);
  background: #ffffff;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.kelola-surat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 24px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-300);
  font-size: 0.9rem;
  color: var(--gray-900);
  background: #ffffff;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-helper {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 6px;
}

/* ==========================================================================
   FLASH MESSAGES & ALERTS
   ========================================================================== */

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 24px;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: #f0f9ff; border: 1px solid #bae6fd; color: #075985; }

/* ==========================================================================
   EKTA / CARD PREVIEW & PROFILE
   ========================================================================== */

.kader-card-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
}

.ekta-digital-preview {
  background: linear-gradient(135deg, #064e3b 0%, #059669 60%, #047857 100%);
  border-radius: var(--radius-xl);
  padding: 24px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.ekta-pattern {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.ekta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.ekta-photo {
  width: 90px;
  height: 110px;
  border-radius: 10px;
  object-fit: cover;
  border: 3px solid #f59e0b;
  margin-bottom: 16px;
}

.ekta-nba {
  font-family: 'Outfit', monospace;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: #fde68a;
  margin-bottom: 4px;
}

/* ==========================================================================
   OFFICIAL SURAT PRINT PREVIEW
   ========================================================================== */

.surat-paper {
  background: #ffffff;
  max-width: 800px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 48px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-family: 'Times New Roman', Times, serif;
  color: #000000;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.surat-kop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border-bottom: 3px double #000000;
  padding-bottom: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.kop-logo {
  width: 75px;
  height: 75px;
}

.kop-text h2 {
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.kop-text h3 {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.kop-text p {
  font-size: 0.82rem;
  color: #333333;
}

.surat-meta-table {
  width: 100%;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.surat-meta-table td {
  padding: 3px 0;
  vertical-align: top;
}

.surat-body {
  font-size: 0.95rem;
  text-align: justify;
  margin-bottom: 32px;
}

.surat-ttd-row {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  text-align: center;
}

.ttd-box {
  width: 250px;
}

/* ==========================================================================
   AUTH PAGES
   ========================================================================== */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, #ecfdf5 0%, #f8fafc 90%);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xl);
  padding: 36px;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header .brand-logo {
  margin: 0 auto 16px auto;
  width: 56px;
  height: 56px;
}

.auth-header h1 {
  font-size: 1.5rem;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.demo-account-box {
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 24px;
}

.demo-account-box h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 10px;
}

.demo-buttons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* ==========================================================================
   MOBILE TOGGLE & SIDEBAR BACKDROP
   ========================================================================== */

#mobileSidebarToggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVE & ROTATION BREAKPOINTS
   ========================================================================== */

@media (max-width: 992px) {
  #mobileSidebarToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }
  .app-sidebar {
    transform: translateX(-100%);
    width: min(290px, 84vw);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 100;
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  .app-topbar {
    padding: 0 16px;
    height: 60px;
  }
  .page-title-badge h1 {
    font-size: 1.15rem;
    max-width: 50vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .kader-card-layout {
    grid-template-columns: 1fr;
  }
  .page-container {
    padding: 16px 14px;
    max-width: 100%;
  }
  .kelola-surat-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  .surat-paper {
    padding: 28px 20px;
  }
}

@media (max-width: 640px) {
  .app-topbar {
    padding: 0 12px;
    height: 56px;
  }
  .page-title-badge h1 {
    font-size: 1rem;
    max-width: 44vw;
  }
  .topbar-actions .topbar-user-name {
    display: none;
  }
  .page-container {
    padding: 12px 10px;
  }
  .card {
    padding: 14px;
    border-radius: var(--radius-md);
  }
  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-title {
    font-size: 1.05rem;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-value {
    font-size: 1.6rem;
  }
  .auth-card {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .auth-wrapper {
    padding: 16px 12px;
  }
  .surat-paper {
    padding: 18px 12px !important;
    font-size: 9.5pt;
  }
  .surat-kop {
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }
  .kop-logo {
    width: 44px;
    height: 44px;
  }
  .kop-text h2 {
    font-size: 1rem;
  }
  .kop-text p {
    font-size: 0.72rem;
  }
  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .search-box {
    min-width: 100%;
    width: 100%;
  }
  .filter-group {
    width: 100%;
  }
  .select-filter {
    width: 100%;
  }
  .form-row-2col {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .data-table th, .data-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
  .dropdown-kategori-menu {
    min-width: 240px;
    right: 0;
    left: auto;
    max-width: 90vw;
  }
}

/* Landscape Phone Adaptation (Screen rotation with short height) */
@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --topbar-height: 50px;
  }
  .app-topbar {
    height: 50px;
    padding: 0 14px;
  }
  .sidebar-header {
    height: 50px;
    padding: 0 16px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .sidebar-menu {
    padding: 10px 8px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link {
    padding: 7px 10px;
    font-size: 0.84rem;
    margin-bottom: 2px;
  }
  .sidebar-footer {
    padding: 8px 12px;
  }
  .user-badge-card {
    padding: 6px 8px;
    gap: 8px;
  }
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  .page-container {
    padding: 12px 16px;
  }
  .stat-card {
    padding: 12px 14px;
  }
  .stat-value {
    font-size: 1.5rem;
  }
  .card-header {
    padding: 10px 14px;
  }
  .card-body, .card {
    padding: 12px 14px;
  }
  .auth-wrapper {
    padding: 10px 14px;
    min-height: auto;
  }
  .auth-card {
    padding: 16px;
  }
  .form-group {
    margin-bottom: 12px;
  }
}

/* ==========================================================================
   DROPDOWN MENU KATEGORI ARSIP SURAT & SIDEBAR (RAPI & MODERN)
   ========================================================================== */

/* 1. SIDEBAR SUBMENU NAVIGATION */
.nav-dropdown {
  margin-bottom: 2px;
}
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
}
.nav-dropdown-toggle .dropdown-chevron {
  transition: transform 0.2s ease;
  color: var(--gray-400);
}
.nav-dropdown.open .nav-dropdown-toggle .dropdown-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
.nav-dropdown-menu {
  display: none;
  padding: 4px 0 6px 10px;
  margin: 2px 0 4px 18px;
  border-left: 2px solid #e2e8f0;
}
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.nav-subitem:hover {
  color: var(--primary);
  background: var(--gray-100);
}
.nav-subitem.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
}
.nav-subitem-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.nav-subitem:hover .nav-subitem-dot {
  background: var(--primary);
  transform: scale(1.3);
}
.nav-subitem.active .nav-subitem-dot {
  background: var(--primary);
  transform: scale(1.3);
}
.nav-subgroup {
  margin: 3px 0 3px 6px;
  padding-left: 8px;
  border-left: 1.5px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-subgroup-label {
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  padding: 4px 8px 2px;
}
.nav-subitem.nav-subitem-child {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* 2. CARD HEADER DROPDOWN MENU KATEGORI */
.btn-dropdown-kategori {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 35px;
  padding: 0 13px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}
.btn-dropdown-kategori:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.btn-dropdown-kategori.open {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
.btn-dropdown-kategori .dropdown-chevron {
  transition: transform 0.2s ease;
  color: #64748b;
}
.btn-dropdown-kategori.open .dropdown-chevron {
  transform: rotate(180deg);
}

.dropdown-kategori-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 270px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  z-index: 1050;
  padding: 6px;
  animation: dropdownFadeIn 0.15s ease-out;
}
.dropdown-kategori-menu.show {
  display: block;
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-kategori-title {
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  padding: 6px 10px 4px;
}
.dropdown-kategori-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 0.82rem;
  color: #334155;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.12s ease;
}
.dropdown-kategori-link:hover {
  background: #f1f5f9;
  color: #059669;
}
.dropdown-kategori-link.active {
  background: #ecfdf5;
  color: #059669;
  font-weight: 700;
}
.dropdown-kategori-link.sublink {
  padding-left: 20px;
  font-size: 0.8rem;
}
.dropdown-kategori-link .link-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dropdown-kategori-link .link-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
}
.dropdown-kategori-link.active .link-badge {
  background: #d1fae5;
  color: #047857;
}

.dropdown-kategori-header {
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #059669;
  padding: 6px 10px 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dropdown-kategori-header .header-all-btn {
  font-size: 0.67rem;
  color: #059669;
  font-weight: 700;
  text-decoration: none;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 4px;
  transition: background 0.12s ease;
}
.dropdown-kategori-header .header-all-btn:hover {
  background: #d1fae5;
}
.dropdown-kategori-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 6px;
}
