/* Corporate Airy Design System for "Простір ідеятворення" */
:root {
  --primary-yellow: #FFD51C; /* RGB 255 213 28 */
  --primary-yellow-light: #FFFBEA;
  --primary-yellow-hover: #E6BD00;
  
  --accent-blue: #0047DF;    /* RGB 0 71 223 */
  --accent-blue-light: #F0F4FE;
  --accent-blue-hover: #0038B3;

  --surface-bg: #FAF9FB;
  --card-bg: #FFFFFF;
  --text-dark: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --border-subtle: #F1F5F9;

  --status-new-bg: #F0F9FF;
  --status-new-text: #0284C7;

  --status-progress-bg: #FFFBEB;
  --status-progress-text: #D97706;

  --status-completed-bg: #F0FDF4;
  --status-completed-text: #16A34A;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 6px 24px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--surface-bg);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none; /* Prevent long-press on mobile */
  user-select: none; /* Prevent text selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Light & Airy App Header */
.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.9rem 2.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-yellow), #FFC000);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(255, 213, 28, 0.35);
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.3px;
}

.brand-title span {
  color: var(--accent-blue);
}

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

.user-switcher-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.user-header-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: white;
  padding: 0.4rem 1rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.user-header-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  background: var(--primary-yellow-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border: 1.5px solid var(--primary-yellow);
}

.notif-badge-dot {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 9px;
  height: 9px;
  background-color: #EF4444;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
  animation: pulseNotif 2s infinite ease-in-out;
}

@keyframes pulseNotif {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notif-item {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.notif-item:hover {
  background: #F8FAFC;
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.notif-item.unread {
  background: #F0F4FE;
  border-left: 4px solid var(--accent-blue);
  font-weight: 500;
}

.connects-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-yellow-light);
  color: #784700;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 213, 28, 0.5);
}

.connects-badge.zero-balance {
  background: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
}

.treasury-label-desktop {
  display: inline;
}

.treasury-label-mobile {
  display: none;
}

/* Main Layout */
.main-wrapper {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 2rem;
  width: 100%;
  flex: 1;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 2rem;
  background: white;
  padding: 0.5rem;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}

.tab-btn.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 4px 14px rgba(0, 71, 223, 0.25);
}

/* Action Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 71, 223, 0.2);
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-1px);
}

.btn-yellow {
  background: var(--primary-yellow);
  color: #3F3100;
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(255, 213, 28, 0.3);
}

.btn-yellow:hover {
  background: var(--primary-yellow-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #F1F5F9;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #E2E8F0;
}

.btn-danger {
  background: #FEE2E2;
  color: #991B1B;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #FECACA;
}

.btn-disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
}

/* Tree Structure View */
.tree-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.direction-node {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.direction-node:hover {
  box-shadow: var(--shadow-md);
}

.direction-header {
  background: white;
  padding: 1.2rem 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-left: 5px solid var(--accent-blue);
  border-bottom: 1px solid var(--border-subtle);
}

.direction-title-box {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-dark);
}

.direction-badge {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.tree-body {
  padding: 1.5rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  background: #FAF9FB;
}

/* Request Node */
.request-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  border-left: 4px solid var(--primary-yellow);
  box-shadow: var(--shadow-sm);
}

.request-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.request-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
}

.reward-pill {
  background: var(--primary-yellow-light);
  color: #784700;
  border: 1px solid rgba(255, 213, 28, 0.6);
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

/* Proposal Status Categories Grid */
.status-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.status-column {
  background: #FAFAFC;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 1rem;
}

.status-column-header {
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-column-header.New {
  background: var(--status-new-bg);
  color: var(--status-new-text);
}

.status-column-header.In-progress {
  background: var(--status-progress-bg);
  color: var(--status-progress-text);
}

.status-column-header.Completed {
  background: var(--status-completed-bg);
  color: var(--status-completed-text);
}

/* Proposal Cards */
.proposal-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.proposal-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.proposal-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
}

.proposal-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.proposal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

.btn-action-chekayu {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-action-chekayu:hover:not(.btn-disabled) {
  background: #DCFCE7;
}

.btn-action-neviryu {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-action-neviryu:hover:not(.btn-disabled) {
  background: #FEE2E2;
}

.btn-action-join {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-action-join:hover:not(.btn-disabled) {
  background: var(--accent-blue-hover);
}

/* Team Node */
.team-node-box {
  margin-top: 0.8rem;
  background: #F8FAFC;
  padding: 0.8rem;
  border-radius: 10px;
  border: 1px dashed #CBD5E1;
}

.team-node-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.team-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.team-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  background: white;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-badge.Approved {
  background: #DCFCE7;
  color: #166534;
}

.status-badge.Pending {
  background: #FEF3C7;
  color: #92400E;
}

.status-badge.New {
  background: var(--status-new-bg);
  color: var(--status-new-text);
}

.status-badge.In-progress {
  background: var(--status-progress-bg);
  color: var(--status-progress-text);
}

.status-badge.Completed {
  background: var(--status-completed-bg);
  color: var(--status-completed-text);
}

/* Discussions & Comments */
.comments-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.comment-card.pinned {
  border: 2px solid var(--primary-yellow);
  background: #FFFDF0;
}

.pinned-tag {
  position: absolute;
  top: -10px;
  right: 15px;
  background: var(--primary-yellow);
  color: #4A3B00;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.comment-text {
  font-size: 0.95rem;
  color: var(--text-dark);
  line-height: 1.5;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start; /* changed from center to avoid cutoff */
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: white;
  width: 100%;
  max-width: 620px;
  margin: auto; /* Centers vertically if space allows, otherwise top-aligned */
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: var(--accent-blue);
  color: white;
  padding: 1.3rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-weight: 700;
  font-size: 1.15rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  max-height: 75vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.form-input, .form-select, .form-textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 223, 0.12);
}

/* User Cabinet */
.cabinet-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.8rem;
}

.profile-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.8rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-avatar-large {
  width: 90px;
  height: 90px;
  font-size: 3.5rem;
  background: var(--primary-yellow-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  border: 3px solid var(--primary-yellow);
}

.transactions-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.8rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--surface-bg);
}

.tx-amount.positive {
  color: #166534;
  font-weight: 700;
}

.tx-amount.negative {
  color: #C53030;
  font-weight: 700;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.toast {
  background: #0F172A;
  color: white;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.95rem;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid var(--primary-yellow);
}

.toast.error {
  border-left-color: #EF4444;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive & Mobile Layout Optimization */
@media (max-width: 850px) {
  .cabinet-grid {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
  }
  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .app-header {
    padding: 0.6rem 0.8rem;
  }
  
  .header-container {
    gap: 0.6rem;
  }

  .header-brand-wrap,
  .header-container > div:first-child {
    flex-direction: column !important;
    gap: 0.6rem !important;
    align-items: center !important;
    width: 100%;
  }

  .main-wrapper {
    padding: 0 0.8rem;
    margin: 0.8rem auto;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  
  /* Brand text & logo */
  .brand-logo {
    gap: 10px !important;
    justify-content: center;
  }
  .brand-logo img {
    height: 50px !important;
  }
  .brand-title {
    font-size: 1rem !important;
  }
  .brand-logo div[style*="font-size: 32px"],
  .brand-logo div[style*="font-size:32px"] {
    font-size: 20px !important;
  }
  .brand-logo div[style*="font-size: 26px"],
  .brand-logo div[style*="font-size:26px"] {
    font-size: 16px !important;
  }
  .brand-logo div[style*="font-size: 22px"],
  .brand-logo div[style*="font-size:22px"] {
    font-size: 14px !important;
  }

  /* Treasury & User badge */
  .treasury-label-desktop {
    display: none !important;
  }
  .treasury-label-mobile {
    display: inline !important;
  }

  .header-treasury-row {
    justify-content: center;
  }

  #header-treasury-balance {
    font-size: 0.82rem;
    padding: 0.25rem 0.65rem;
    text-align: center;
  }

  .user-header-card {
    padding: 0.3rem 0.7rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  .header-actions {
    gap: 0.5rem;
  }

  /* Nav Tabs */
  .nav-tabs {
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 0.4rem;
    padding: 0.4rem;
  }
  .tab-btn {
    padding: 0.55rem 0.6rem;
    font-size: 0.82rem;
    flex: 1 1 calc(50% - 0.4rem);
    min-width: 130px;
    justify-content: center;
    box-sizing: border-box;
  }

  /* Toolbar */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
  }
  .toolbar > div {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.6rem !important;
    align-items: stretch !important;
  }
  .toolbar input[type="text"] {
    width: 100% !important;
    box-sizing: border-box;
  }
  .toolbar .btn-primary {
    width: 100%;
    justify-content: center;
  }

  /* Tree & Direction Nodes */
  .tree-container {
    gap: 1rem;
  }
  .direction-header {
    padding: 0.9rem 1rem;
  }
  .direction-title-box {
    font-size: 0.95rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .direction-badge {
    font-size: 0.75rem;
  }
  .tree-body {
    padding: 0.9rem 0.8rem;
    gap: 1rem;
  }

  /* Request Card */
  .request-card {
    padding: 1rem;
    box-sizing: border-box;
  }
  .request-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }
  .request-header > div:last-child {
    text-align: left !important;
    margin-top: 0;
    align-items: stretch !important;
    width: 100%;
  }
  .request-header > div:last-child button,
  .request-header > div:last-child .reward-pill {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
  .reward-pill {
    white-space: normal;
    text-align: center;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.35rem 0.6rem;
  }

  /* Proposal inside tree */
  .request-card .proposals-list-container > div > div {
    padding: 0.7rem !important;
  }
  .request-card .proposals-list-container > div > div > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.6rem !important;
  }
  .request-card .proposals-list-container > div > div > div:first-child > div:last-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    width: 100% !important;
  }

  /* Top proposals & Standalone proposal cards */
  .proposal-card {
    padding: 0.9rem;
    box-sizing: border-box;
  }
  .proposal-card > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }
  .proposal-card > div:first-child > div:last-child {
    align-self: flex-start;
    white-space: normal !important;
  }
  .proposal-meta {
    flex-direction: column;
    gap: 0.3rem;
  }
  .proposal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.8rem;
  }
  .proposal-actions button {
    flex: 1 1 auto;
    font-size: 0.78rem !important;
    padding: 0.4rem 0.6rem !important;
    justify-content: center;
    margin: 0 !important;
  }
  .proposal-actions button:last-child {
    margin-left: 0 !important;
  }

  /* Status categories grid (if used) */
  .status-categories-grid {
    grid-template-columns: 1fr;
  }

  /* Comments */
  .comment-card {
    padding: 0.8rem;
  }
  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .comment-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }

  /* Modals on Mobile */
  .modal-card {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto;
    border-radius: var(--radius-sm);
  }
  .modal-header {
    padding: 0.9rem 1.1rem;
  }
  .modal-title {
    font-size: 1rem;
  }
  .modal-body {
    padding: 1rem;
    max-height: 80vh;
  }

  /* Cabinet Details */
  .cabinet-grid {
    gap: 1rem;
  }
  .profile-card {
    padding: 1.2rem;
  }
  .transactions-card {
    padding: 1.2rem;
  }
  #section-cabinet > div:last-child {
    flex-direction: column;
    gap: 1rem !important;
  }
  #section-cabinet > div:last-child > div {
    min-width: 100% !important;
  }

  /* Admin panel */
  #section-admin > div:first-child {
    flex-direction: column;
    gap: 0.5rem !important;
  }
  #section-admin > div:first-child > button {
    width: 100%;
    margin-bottom: 0.2rem;
  }
  
  /* Filter controls */
  .view-section div[style*="display:flex; align-items:center; gap:1rem;"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.4rem !important;
  }
  .direction-select,
  #filter-proposal-request {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Toast notification */
  .toast-container {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }
  .toast {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
  }
}
