/* Hush light/dark theme — toggled via html[data-theme] */

html[data-theme="dark"] {
  color-scheme: dark;
}

/* Shell */
html[data-theme="dark"] body {
  background-color: #1c1917;
  color: #e7e5e4;
}

html[data-theme="dark"] .app-sidebar {
  background: linear-gradient(180deg, #292524 0%, #1c1917 100%) !important;
  border-color: rgba(68, 64, 60, 0.8) !important;
  box-shadow: 4px 0 24px -8px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .app-main {
  background: linear-gradient(145deg, #1c1917 0%, #292524 45%, #1c1917 100%) !important;
}

html[data-theme="dark"] .app-topbar {
  background: rgba(28, 25, 23, 0.88) !important;
  border-color: rgba(68, 64, 60, 0.7) !important;
  box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .sidebar-overlay {
  background: rgba(0, 0, 0, 0.55) !important;
}

/* Theme toggle */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(231, 229, 228, 0.9);
  background: rgba(255, 255, 255, 0.9);
  color: #57534e;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle-btn:hover {
  background: #fafaf9;
  color: #292524;
}

html[data-theme="dark"] .theme-toggle-btn {
  border-color: rgba(87, 83, 78, 0.9);
  background: rgba(41, 37, 36, 0.95);
  color: #fcd34d;
}

html[data-theme="dark"] .theme-toggle-btn:hover {
  background: #44403c;
  color: #fde68a;
}

.theme-toggle-btn i {
  font-size: 1.125rem;
  line-height: 1;
}

.theme-sidebar-item {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(231, 229, 228, 0.7);
}

html[data-theme="dark"] .theme-sidebar-item {
  border-top-color: rgba(68, 64, 60, 0.8);
}

/* Nav links */
.nav-link-active {
  background: rgba(255, 255, 255, 0.9);
  color: #1c1917 !important;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
  border: 1px solid rgba(231, 229, 228, 0.6);
}

html[data-theme="dark"] .nav-link-active {
  background: rgba(68, 64, 60, 0.85) !important;
  color: #fafaf9 !important;
  border-color: rgba(87, 83, 78, 0.7) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .nav-link:hover {
  background: rgba(68, 64, 60, 0.55) !important;
  color: #fafaf9 !important;
}

/* Text */
html[data-theme="dark"] .text-stone-900,
html[data-theme="dark"] .text-stone-800 {
  color: #fafaf9 !important;
}

html[data-theme="dark"] .text-stone-700 {
  color: #e7e5e4 !important;
}

html[data-theme="dark"] .text-stone-600 {
  color: #d6d3d1 !important;
}

html[data-theme="dark"] .text-stone-500 {
  color: #a8a29e !important;
}

html[data-theme="dark"] .text-stone-400 {
  color: #78716c !important;
}

/* Surfaces */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-white\/90,
html[data-theme="dark"] .bg-white\/95,
html[data-theme="dark"] .bg-white\/80,
html[data-theme="dark"] .bg-white\/75,
html[data-theme="dark"] .bg-white\/60 {
  background-color: rgba(41, 37, 36, 0.95) !important;
}

html[data-theme="dark"] .bg-stone-50,
html[data-theme="dark"] .bg-stone-50\/60,
html[data-theme="dark"] .bg-stone-50\/40,
html[data-theme="dark"] .bg-stone-100,
html[data-theme="dark"] .bg-stone-100\/80 {
  background-color: rgba(28, 25, 23, 0.85) !important;
}

html[data-theme="dark"] .hover\:bg-white\/70:hover,
html[data-theme="dark"] .hover\:bg-stone-50:hover,
html[data-theme="dark"] .hover\:bg-stone-100:hover {
  background-color: rgba(68, 64, 60, 0.7) !important;
}

html[data-theme="dark"] .border-stone-200,
html[data-theme="dark"] .border-stone-200\/90,
html[data-theme="dark"] .border-stone-200\/80,
html[data-theme="dark"] .border-stone-200\/70,
html[data-theme="dark"] .border-stone-200\/60 {
  border-color: rgba(87, 83, 78, 0.75) !important;
}

html[data-theme="dark"] .border-stone-100,
html[data-theme="dark"] .border-stone-100\/80 {
  border-color: rgba(68, 64, 60, 0.8) !important;
}

html[data-theme="dark"] .divide-stone-100 > :not([hidden]) ~ :not([hidden]) {
  border-color: rgba(68, 64, 60, 0.8) !important;
}

html[data-theme="dark"] .shadow-\[0_20px_60px_-24px_rgba\(15\,23\,42\,0\.12\)\],
html[data-theme="dark"] .shadow-\[0_16px_48px_-20px_rgba\(15\,23\,42\,0\.1\)\],
html[data-theme="dark"] .shadow-sm {
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.45) !important;
}

/* Inputs */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background-color: rgba(28, 25, 23, 0.9) !important;
  border-color: rgba(87, 83, 78, 0.8) !important;
  color: #fafaf9 !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #78716c !important;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus {
  background-color: #292524 !important;
}

html[data-theme="dark"] input[type="file"] {
  color: #d6d3d1 !important;
}

html[data-theme="dark"] input[type="file"]::file-selector-button {
  background-color: #44403c !important;
  color: #fafaf9 !important;
}

/* Notifications panel */
html[data-theme="dark"] .notif-toggle-btn {
  background: rgba(41, 37, 36, 0.95) !important;
  border-color: rgba(87, 83, 78, 0.85) !important;
  color: #d6d3d1 !important;
}

html[data-theme="dark"] .notif-toggle-btn:hover {
  background: rgba(68, 64, 60, 0.9) !important;
  color: #fafaf9 !important;
}

html[data-theme="dark"] .notif-badge {
  border-color: #292524 !important;
}

html[data-theme="dark"] .notif-backdrop {
  background: rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .notif-panel,
html[data-theme="dark"] #nav-notifications-panel {
  background: rgba(28, 25, 23, 0.98) !important;
  border-color: rgba(87, 83, 78, 0.85) !important;
  box-shadow: 0 20px 50px -16px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .notif-panel-header {
  background: linear-gradient(180deg, rgba(41, 37, 36, 0.95) 0%, rgba(28, 25, 23, 0.98) 100%) !important;
  border-bottom-color: rgba(68, 64, 60, 0.85) !important;
}

html[data-theme="dark"] .notif-panel-header h3,
html[data-theme="dark"] #nav-notifications-title {
  color: #fafaf9 !important;
}

html[data-theme="dark"] .notif-panel-close {
  color: #a8a29e !important;
}

html[data-theme="dark"] .notif-panel-close:hover {
  background: rgba(68, 64, 60, 0.75) !important;
  color: #e7e5e4 !important;
}

html[data-theme="dark"] .notif-panel-list {
  background: transparent;
}

html[data-theme="dark"] .notif-panel-list > li {
  border-color: rgba(68, 64, 60, 0.8) !important;
}

html[data-theme="dark"] .notif-item {
  color: #e7e5e4;
  text-decoration: none;
}

html[data-theme="dark"] .notif-item:hover {
  background: rgba(68, 64, 60, 0.55) !important;
}

html[data-theme="dark"] .notif-item-sender {
  color: #fafaf9 !important;
}

html[data-theme="dark"] .notif-item-kind,
html[data-theme="dark"] .notif-item-time {
  color: #78716c !important;
}

html[data-theme="dark"] .notif-item-code {
  color: #d6d3d1 !important;
}

html[data-theme="dark"] .notif-panel-empty,
html[data-theme="dark"] .notif-panel-loading,
html[data-theme="dark"] #nav-notifications-empty,
html[data-theme="dark"] #nav-notifications-loading {
  color: #a8a29e !important;
  background: transparent;
}

html[data-theme="dark"] .notif-panel-footer {
  background: rgba(41, 37, 36, 0.92) !important;
  border-top-color: rgba(68, 64, 60, 0.85) !important;
}

html[data-theme="dark"] .notif-panel-footer .text-stone-600 {
  color: #a8a29e !important;
}

html[data-theme="dark"] .notif-panel-link {
  color: #fb7185 !important;
}

html[data-theme="dark"] .notif-panel-link:hover {
  color: #fda4af !important;
}

html[data-theme="dark"] .notif-panel-btn {
  background: rgba(28, 25, 23, 0.95) !important;
  border-color: rgba(87, 83, 78, 0.85) !important;
  color: #fafaf9 !important;
}

html[data-theme="dark"] .notif-panel-btn:hover {
  background: rgba(68, 64, 60, 0.85) !important;
}

html[data-theme="dark"] .notif-panel-btn-muted {
  background: rgba(41, 37, 36, 0.95) !important;
  color: #e7e5e4 !important;
}

html[data-theme="dark"] .notif-panel-btn-muted:hover {
  background: rgba(68, 64, 60, 0.85) !important;
}

html[data-theme="dark"] .notif-panel-hint,
html[data-theme="dark"] #pwa-push-status,
html[data-theme="dark"] #pwa-ios-hint {
  color: #78716c !important;
}

html[data-theme="dark"] .notif-panel-hint strong,
html[data-theme="dark"] #pwa-ios-hint strong {
  color: #d6d3d1;
}

html[data-theme="dark"] #nav-notifications-list a:hover {
  background: rgba(68, 64, 60, 0.6) !important;
}

html[data-theme="dark"] .hover\:bg-gray-50:hover {
  background-color: rgba(68, 64, 60, 0.6) !important;
}

/* PWA nudge */
html[data-theme="dark"] #pwa-ios-standalone-nudge {
  background: rgba(120, 53, 15, 0.35) !important;
  border-color: rgba(180, 83, 9, 0.5) !important;
}

html[data-theme="dark"] #pwa-ios-standalone-nudge p {
  color: #fde68a !important;
}

/* Read message view */
html[data-theme="dark"] .message-focus-card {
  background: linear-gradient(145deg, #292524 0%, #1c1917 100%) !important;
  border-color: rgba(87, 83, 78, 0.8) !important;
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .message-focus-card.is-error {
  background: rgba(120, 53, 15, 0.25) !important;
  border-color: rgba(180, 83, 9, 0.5) !important;
}

html[data-theme="dark"] .message-body-text {
  color: #e7e5e4 !important;
}

html[data-theme="dark"] .message-loading {
  background: #292524 !important;
  border-color: rgba(87, 83, 78, 0.7) !important;
  color: #a8a29e !important;
}

html[data-theme="dark"] .read-inbox-toggle {
  background: rgba(41, 37, 36, 0.95) !important;
  border-color: rgba(87, 83, 78, 0.75) !important;
}

html[data-theme="dark"] .read-inbox-toggle:hover {
  background: rgba(68, 64, 60, 0.85) !important;
}

html[data-theme="dark"] .read-inbox-sender {
  color: #a8a29e !important;
}

html[data-theme="dark"] .read-inbox-preview {
  color: #e7e5e4 !important;
}

html[data-theme="dark"] .read-inbox-label {
  color: #78716c !important;
}

html[data-theme="dark"] .read-inbox-body {
  border-top-color: rgba(68, 64, 60, 0.8) !important;
}

.read-inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.read-inbox-meta {
  min-width: 0;
  flex: 1;
}

.read-inbox-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: #78716c;
  margin: 0;
}

.read-inbox-preview {
  font-size: 0.875rem;
  color: #292524;
  margin: 0.25rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.read-inbox-label {
  font-size: 0.75rem;
  color: #a8a29e;
  flex-shrink: 0;
}

.read-inbox-body {
  display: none;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f5f5f4;
}

.read-inbox-body:not(.hidden) {
  display: block;
}

/* Files */
html[data-theme="dark"] #file-result {
  background: rgba(28, 25, 23, 0.9) !important;
  border-color: rgba(87, 83, 78, 0.75) !important;
}

html[data-theme="dark"] #file-result-notice {
  background: rgba(120, 53, 15, 0.3) !important;
  border-color: rgba(180, 83, 9, 0.45) !important;
}

html[data-theme="dark"] #file-result-notice p {
  color: #fde68a !important;
}

/* Card top highlight line */
html[data-theme="dark"] .via-white\/90 {
  --tw-gradient-to: transparent !important;
  --tw-gradient-from: transparent !important;
}
