/* ==========================================================================
   Akuntan Virtual Enterprise - SalesMonk Inspired Modern Light Design System
   Pixel-perfect SaaS Aesthetic: Off-white canvas, crisp cards, vibrant blue accents
   ========================================================================== */

:root {
  --bg-primary: #f6f8fb;
  --bg-app: #f6f8fb;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-sidebar: #ffffff;
  --border-light: #edf2f7;
  --border-subtle: #e2e8f0;
  
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  --hero-card-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.35);

  --accent-green: #10b981;
  --accent-green-bg: #ecfdf5;
  --accent-green-text: #059669;

  --accent-amber: #f59e0b;
  --accent-amber-bg: #fffbeb;
  --accent-amber-text: #d97706;

  --accent-red: #ef4444;
  --accent-red-bg: #fef2f2;
  --accent-red-text: #dc2626;

  --card-radius: 20px;
  --card-shadow: 0 2px 10px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.02);
  --card-shadow-hover: 0 12px 24px -4px rgba(15, 23, 42, 0.06), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   App Layout (Sidebar + Main Header + Content Area)
   ========================================================================== */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* 1. Left Sidebar */
aside.sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem 1.25rem;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 2rem;
}

.brand-avatar {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  border: 1.5px solid #edf2f7;
  flex-shrink: 0;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 155px;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav-group {
  margin-bottom: 2rem;
}

.sidebar-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link:hover {
  background: #f1f5f9;
  color: var(--text-main);
  transform: translateX(2px);
}

.sidebar-link.active {
  background: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 8px 20px -3px rgba(37, 99, 235, 0.35);
}

/* Elevated Icon Badge (SalesMonk Modern Aesthetic) */
.nav-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.nav-icon-badge.indigo { background: #eff6ff; color: #2563eb; }
.nav-icon-badge.emerald { background: #ecfdf5; color: #059669; }
.nav-icon-badge.violet { background: #f5f3ff; color: #7c3aed; }
.nav-icon-badge.amber { background: #fffbeb; color: #d97706; }
.nav-icon-badge.sky { background: #f0f9ff; color: #0284c7; }
.nav-icon-badge.cyan { background: #ecfeff; color: #0891b2; }
.nav-icon-badge.green { background: #f0fdf4; color: #16a34a; }
.nav-icon-badge.rose { background: #fff1f2; color: #e11d48; }

.sidebar-link.active .nav-icon-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: none;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 1.25rem;
}

/* 2. Main Content Canvas */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

/* Top App Header */
header.top-header {
  height: 72px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-search {
  position: relative;
  width: 340px;
}

.header-search input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.header-search input:focus {
  background: #fff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-search .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.header-right-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
}

.user-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.user-name-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Page Content Viewport */
.page-container {
  padding: 2rem;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.page-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Badges, Buttons & Interactive Elements
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-green {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.badge-amber {
  background: var(--accent-amber-bg);
  color: var(--accent-amber-text);
}

.badge-red {
  background: var(--accent-red-bg);
  color: var(--accent-red-text);
}

.badge-blue {
  background: #eff6ff;
  color: var(--primary-blue);
}

.badge-gray {
  background: #f1f5f9;
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-white {
  background: #ffffff;
  border-color: var(--border-light);
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-white:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-primary {
  background: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: var(--primary-blue-hover);
}

/* ==========================================================================
   Top Metrics 4-Card Grid (Matching SalesMonk)
   ========================================================================== */

.metrics-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--card-shadow);
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 155px;
}

.metric-card:hover {
  box-shadow: var(--card-shadow-hover);
}

/* Hero Accent Card (Blue Gradient like SalesMonk 'Total Profit') */
.metric-card.hero-blue {
  background: var(--primary-gradient);
  border: none;
  color: #ffffff;
  box-shadow: var(--hero-card-shadow);
}

.metric-card.hero-blue .metric-title {
  color: rgba(255, 255, 255, 0.85);
}

.metric-card.hero-blue .metric-value {
  color: #ffffff;
}

.metric-card.hero-blue .metric-subtext {
  color: rgba(255, 255, 255, 0.75);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.metric-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.arrow-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hero-blue .arrow-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 0.4rem;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Plus Jakarta Sans", sans-serif;
}

.metric-bottom-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.metric-subtext {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Sparkline Wave Container */
.sparkline-container {
  margin-top: 0.5rem;
  height: 38px;
  width: 100%;
}

/* ==========================================================================
   2-Column Section (PKP Radar Chart & Sales Activity Donut)
   ========================================================================== */

.grid-2-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* Radar Bar Visualization */
.radar-bars-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  height: 160px;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}

.radar-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.radar-bar-track {
  width: 48px;
  height: 100%;
  background: #f1f5f9;
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  position: relative;
}

.radar-bar-fill {
  width: 100%;
  border-radius: 12px;
  transition: height 0.6s ease;
}

.radar-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Donut Activity Meter */
.donut-meter-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.donut-svg-block {
  position: relative;
  width: 150px;
  height: 150px;
}

.donut-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-number {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.donut-center-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 0.2rem;
}

.donut-legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  margin-left: 1.5rem;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.legend-dot-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-val {
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   Modern Clean Tables
   ========================================================================== */

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th {
  background: #f8fafc;
  padding: 0.85rem 1.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

table.data-table td {
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-main);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr:hover td {
  background: #fafbfd;
}

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

.mono {
  font-family: "SF Mono", "Fira Code", monospace;
}

/* ==========================================================================
   Login Screen (Clean SaaS Card)
   ========================================================================== */

.login-page-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 10%, #eff6ff 0%, #f8fafc 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.login-brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--primary-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.login-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-bottom: 2rem;
}

.login-magic-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

.login-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.3em;
  outline: none;
  margin: 1rem 0;
  transition: all 0.15s ease;
}

.login-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1100px) {
  .metrics-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  aside.sidebar {
    display: none;
  }
  .metrics-grid-4 {
    grid-template-columns: 1fr;
  }
  header.top-header {
    padding: 0 1rem;
  }
  .page-container {
    padding: 1rem;
  }
}

/* ==========================================================================
   Global Natural Search Dropdown
   ========================================================================== */
.header-search {
  position: relative;
}

.search-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 440px;
  max-width: 620px;
  max-height: 420px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  padding: 0.5rem 0;
}

.search-group-title {
  padding: 0.5rem 1rem 0.25rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-top: 1px solid #f1f5f9;
}

.search-group-title:first-child {
  border-top: none;
}

.search-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s ease;
  cursor: pointer;
}

.search-item-row:hover {
  background: #f8fafc;
}

.search-item-main {
  flex: 1;
  min-width: 0;
  padding-right: 0.75rem;
}

.search-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-amount {
  color: var(--primary-blue);
  font-weight: 700;
}

.search-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.search-code {
  background: #f1f5f9;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: var(--primary-blue);
  font-weight: 600;
  font-size: 0.8rem;
}

.search-empty-state {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
