/* ==========================================================================
   ORGANIZE — Organization Management System
   Modern SaaS Design System (Light & Dark Mode)
   ========================================================================== */

:root {
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-subtle: #F8FAFC;
  --surface-hover: #F1F5F9;
  --primary: #263B80;
  --primary-btn: #263B80;
  --primary-hover: #1C2D66;
  --primary-soft: rgba(38, 59, 128, 0.08);
  --primary-border: rgba(38, 59, 128, 0.22);
  --secondary: #64748B;
  --text: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --success: #16A34A;
  --success-soft: rgba(22, 163, 74, 0.11);
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.11);
  --warning: #D97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --info: #0284C7;
  --info-soft: rgba(2, 132, 199, 0.11);

  --sidebar-width: 256px;
  --sidebar-collapsed: 74px;
  --topbar-height: 68px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 44px rgba(15, 23, 42, 0.16);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #111827;
  --surface-subtle: #162033;
  --surface-hover: #1E293B;
  --primary: #7C9CFF;
  --primary-btn: #3B59C7;
  --primary-hover: #4C6BE0;
  --primary-soft: rgba(124, 156, 255, 0.14);
  --primary-border: rgba(124, 156, 255, 0.32);
  --secondary: #94A3B8;
  --text: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --border: #1F2B40;
  --border-strong: #334155;
  --success: #22C55E;
  --success-soft: rgba(34, 197, 94, 0.16);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --warning: #FBBF24;
  --warning-soft: rgba(251, 191, 36, 0.16);
  --info: #38BDF8;
  --info-soft: rgba(56, 189, 248, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body {
  letter-spacing: 0.008em;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--text);
  line-height: 1.25;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.mono,
.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-primary {
  color: var(--primary);
}

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

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

.text-xs {
  font-size: 12px;
}

.text-sm {
  font-size: 13px;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease), transform 140ms var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  min-height: 40px;
  min-width: 40px;
  padding: 8px;
}

.btn-icon-sm {
  min-height: 34px;
  min-width: 34px;
  padding: 6px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary-btn);
  color: #FFFFFF;
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: #FFFFFF;
}

.btn-success:hover {
  filter: brightness(0.94);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
}

/* ==================== FORMS ==================== */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 0;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrap input {
  padding-right: 64px;
}

.input-icon-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  border-radius: var(--radius-sm);
}

.input-icon-btn:hover {
  background: var(--primary-soft);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-btn);
}

.form-alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

/* ==================== AUTH SCREEN ==================== */
.auth-screen {
  min-height: 100vh;
  background: var(--bg);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
  min-height: 100vh;
}

.auth-visual {
  position: relative;
  overflow: hidden;
  background: #172554;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
}

.auth-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}

.auth-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, rgba(20, 34, 78, 0.90) 0%, rgba(15, 23, 42, 0.84) 100%);
}

.auth-visual-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 44px 48px;
  gap: 32px;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-logo-frame {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  background: #FFFFFF;
  padding: 3px;
  flex-shrink: 0;
}

.auth-logo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
}

.auth-wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #FFFFFF;
}

.auth-tagline {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

.auth-editorial {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
}

.auth-hero-title {
  font-size: clamp(1.75rem, 2.5vw, 2.35rem);
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.22;
}

.auth-hero-desc {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(241, 245, 249, 0.84);
}

.auth-metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 12px 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-metrics-strip dt {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
}

.auth-metrics-strip dd {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: rgba(241, 245, 249, 0.74);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 32px 44px;
  position: relative;
}

.auth-panel-top {
  position: absolute;
  top: 20px;
  right: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.auth-tab {
  min-height: 38px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-heading {
  margin-bottom: 22px;
}

.auth-heading h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-heading p {
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-demo-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.auth-demo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.auth-demo-label {
  color: var(--text-muted);
  font-weight: 500;
}

.auth-storage-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==================== APP SHELL & SIDEBAR ==================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: width 200ms var(--ease), transform 220ms var(--ease);
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.app-shell.sidebar-collapsed .sidebar-brand-text,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .sidebar-period-box,
.app-shell.sidebar-collapsed .nav-group-title {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 16px 12px;
}

.app-shell.sidebar-collapsed .nav-item,
.app-shell.sidebar-collapsed .sidebar-logout-btn {
  justify-content: center;
  padding: 10px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.sidebar-logo-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #FFFFFF;
  flex-shrink: 0;
}

.sidebar-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.sidebar-app-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--primary);
  line-height: 1.2;
}

.sidebar-org-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 165px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-group-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-period-box {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-period-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}

.sidebar-logout-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

/* ==================== WORKSPACE & TOPBAR ==================== */
.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.global-search-wrap {
  position: relative;
  width: 296px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.global-search-input {
  width: 100%;
  height: 38px;
  padding: 6px 12px 6px 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}

.global-search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 60;
  padding: 6px;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}

.search-result-item:hover {
  background: var(--surface-hover);
}

.search-result-cat {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

.search-result-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.search-result-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.popover-anchor {
  position: relative;
}

.topbar-action-btn {
  position: relative;
}

.notif-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--danger);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popover-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 60;
  overflow: hidden;
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 14px;
}

.notifications-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.notif-item:hover {
  background: var(--surface-hover);
}

.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.notif-msg {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.topbar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 40px;
}

.topbar-user-btn:hover {
  background: var(--surface-hover);
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.topbar-user-role {
  font-size: 11.5px;
  color: var(--text-muted);
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
  border-radius: 8px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 20px;
  border-radius: 14px;
}

/* ==================== MAIN CONTENT & LAYOUT ==================== */
.main-content {
  padding: 24px 28px 40px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  animation: fadeSlideIn 180ms var(--ease);
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.section-header p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.section-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header-padded {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 15.5px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 150ms var(--ease);
}

.kpi-card-clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.kpi-card-clickable:hover {
  border-color: var(--primary-border);
}

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 23px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.kpi-value.text-primary {
  color: var(--primary);
}

.kpi-value.text-success {
  color: var(--success);
}

.kpi-value.text-danger {
  color: var(--danger);
}

.kpi-value.text-warning {
  color: var(--warning);
}

.kpi-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.grid-main-side {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

/* ==================== CHARTS ==================== */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 245px;
}

.chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--surface);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 10;
  opacity: 0;
  transition: opacity 120ms var(--ease);
}

/* ==================== TABLES & TOOLBARS ==================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-input,
.toolbar-select {
  height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}

.toolbar-input {
  min-width: 220px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.segmented-btn {
  min-height: 32px;
  padding: 4px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.segmented-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th.text-right {
  text-align: right;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

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

.data-table tbody tr:hover {
  background: var(--surface-subtle);
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  padding: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.sort-btn:hover {
  color: var(--text);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* Semantic Status Labels (Clean flat tags, zero candy pills) */
.status-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.status-success {
  color: var(--success);
  background: var(--success-soft);
}

.status-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-primary {
  color: var(--primary);
  background: var(--primary-soft);
}

.status-info {
  color: var(--info);
  background: var(--info-soft);
}

.status-neutral {
  color: var(--text-muted);
  background: var(--surface-hover);
}

/* ==================== PROGRESS BARS & LISTS ==================== */
.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: var(--surface-hover);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary-btn);
  transition: width 240ms var(--ease);
}

.progress-fill.success {
  background: var(--success);
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--danger);
}

.list-stack {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.list-row:first-child {
  padding-top: 2px;
}

.list-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==================== PROKER & DIVISION CARDS ==================== */
.proker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.proker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proker-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.proker-card-title {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
}

.proker-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.proker-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==================== CALENDAR ==================== */
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.calendar-weekday {
  padding: 10px 8px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.calendar-day {
  min-height: 102px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  border-top: none;
  border-left: none;
  transition: background-color 120ms var(--ease);
}

.calendar-day:hover {
  background: var(--surface-subtle);
}

.calendar-day.other-month {
  background: var(--surface-subtle);
  opacity: 0.52;
}

.calendar-day.selected {
  background: var(--primary-soft);
}

.calendar-day-num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.calendar-day.is-today .calendar-day-num {
  background: var(--primary-btn);
  color: #FFFFFF;
}

.cal-event-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-cat-rapat {
  background: var(--primary-soft);
  color: var(--primary);
}

.cal-cat-proker {
  background: var(--success-soft);
  color: var(--success);
}

.cal-cat-iuran {
  background: var(--warning-soft);
  color: var(--warning);
}

.cal-cat-lainnya {
  background: var(--info-soft);
  color: var(--info);
}

/* ==================== ORG STRUCTURE CHART ==================== */
.org-chart-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 24px 16px;
  overflow-x: auto;
}

.org-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.org-tier-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.org-connector-v {
  width: 2px;
  height: 26px;
  background: var(--border-strong);
}

.org-nodes-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: 100%;
  position: relative;
}

.org-node {
  min-width: 210px;
  max-width: 245px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 150ms var(--ease);
}

.org-node:hover {
  border-color: var(--primary);
}

.org-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.org-node-role {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.org-node-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.org-node-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== REPORTS & LETTERHEAD ==================== */
.report-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.report-letterhead {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--text);
}

.report-letterhead-logo {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.report-letterhead h3 {
  font-size: 19px;
  font-weight: 800;
}

.report-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.report-summary-item span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.report-summary-item strong {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

/* ==================== MODALS & TOASTS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 140ms var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog.modal-lg {
  max-width: 780px;
}

.modal-dialog.modal-sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.lightbox-box {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lightbox-box img {
  max-height: 78vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.lightbox-close {
  align-self: flex-end;
}

.lightbox-caption {
  color: #FFFFFF;
  font-size: 13px;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fadeSlideIn 160ms var(--ease);
}

.toast-success {
  border-color: var(--success);
}

.toast-danger {
  border-color: var(--danger);
}

.toast-warning {
  border-color: var(--warning);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text);
}

.empty-state p {
  font-size: 13.5px;
  max-width: 380px;
}

.thumb-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.thumb-box {
  width: 82px;
  height: 82px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
}

.thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-picker-list {
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: var(--surface-subtle);
}

.dues-schedule-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

.dues-schedule-btn {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 215px;
  flex-shrink: 0;
}

.dues-schedule-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ==================== RESPONSIVE ==================== */
.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .proker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-main-side,
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-visual {
    display: none;
  }
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 35;
  }
  .global-search-wrap {
    width: 190px;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    height: 60px;
  }
  .topbar-subtitle {
    display: none;
  }
  .global-search-wrap {
    display: none;
  }
  .main-content {
    padding: 18px 14px 32px;
  }
  .kpi-grid,
  .kpi-grid-4,
  .grid-2,
  .grid-3,
  .proker-grid,
  .field-grid-2,
  .field-grid-3,
  .member-picker-list {
    grid-template-columns: 1fr;
  }
  .calendar-day {
    min-height: 68px;
    padding: 4px;
  }
  .popover-panel {
    width: calc(100vw - 28px);
    right: -44px;
  }
  .auth-card {
    padding: 24px 20px;
  }
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 36px;
  }
}

/* ==================== PRINT / PDF REPORT MODE ==================== */
@media print {
  body {
    background: #FFFFFF !important;
    color: #0F172A !important;
  }
  .sidebar,
  .topbar,
  .no-print,
  .modal-backdrop,
  .toast-container {
    display: none !important;
  }
  .workspace,
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .report-sheet {
    border: none !important;
    padding: 0 !important;
  }
  .data-table th,
  .data-table td {
    border-color: #CBD5E1 !important;
    padding: 8px 10px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
