/* ============================================
   YuanTech Clean White Theme for Redmine
   Modern Light UI - Professional & Clean
   ============================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-page: #f8fafc;
  --bg-content: #ffffff;
  --bg-card: #f8fafc;
  --bg-header: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  /* Border Colors */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-dark: #94a3b8;

  /* Accent Colors - Indigo */
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --accent-light: #eef2ff;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);

  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-link: #4f46e5;
  --text-link-hover: #4338ca;

  /* Status Colors - Light Theme */
  --success-bg: #dcfce7;
  --success-border: #86efac;
  --success-text: #166534;
  --error-bg: #fee2e2;
  --error-border: #fca5a5;
  --error-text: #991b1b;
  --warning-bg: #fef3c7;
  --warning-border: #fcd34d;
  --warning-text: #92400e;
  --info-bg: #dbeafe;
  --info-border: #93c5fd;
  --info-text: #1e40af;

  /* Shadows - Soft for light theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

  /* Borders & Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Table Stripes */
  --stripe-even: #f8fafc;
  --divider-subtle: #e2e8f0;
}

/* ============================================
   Base & Body Styling
   ============================================ */
html {
  background: var(--bg-page);
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Main Wrapper & Layout
   ============================================ */
#wrapper {
  position: relative;
  min-height: 100vh;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
}

/* ============================================
   Top Menu Bar
   ============================================ */
#top-menu {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 8px 20px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

#top-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-right: 16px;
  font-weight: 500;
  transition: var(--transition-normal);
  position: relative;
}

#top-menu a:hover {
  color: var(--accent-primary);
}

#top-menu a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition-normal);
}

#top-menu a:hover::after {
  transform: scaleX(1);
}

#account {
  display: flex;
  align-items: center;
  gap: 12px;
}

#loggedas {
  color: var(--text-muted);
  font-size: 0.8rem;
}

#loggedas a {
  color: var(--text-link);
}

/* ============================================
   Header
   ============================================ */
#header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 20px 0 20px;
  box-shadow: var(--shadow-sm);
}

#header h1 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
}

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

/* Quick Search */
#quick-search {
  float: right;
  margin-top: -8px;
}

#quick-search input[type="text"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  color: var(--text-primary);
  width: 200px;
  transition: var(--transition-normal);
}

#quick-search input[type="text"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
  width: 280px;
  outline: none;
}

#quick-search input[type="text"]::placeholder {
  color: var(--text-muted);
}

#quick-search label {
  color: var(--text-secondary);
}

#quick-search a {
  color: var(--text-link);
}

/* Project Jump Box */
.drdn {
  position: relative;
}

.drdn-trigger {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 32px 8px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-normal);
}

.drdn-trigger:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.drdn-content {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.drdn-content a {
  color: var(--text-secondary);
  padding: 10px 16px;
  display: block;
  transition: var(--transition-fast);
}

.drdn-content a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================
   Main Menu (Tabs)
   ============================================ */
#main-menu {
  background: transparent;
  padding: 0;
  margin: 0;
  border: none;
}

#main-menu ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#main-menu li {
  margin: 0;
}

#main-menu li a {
  display: block;
  padding: 10px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-bottom: none;
  transition: var(--transition-normal);
  position: relative;
}

#main-menu li a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#main-menu li a.selected {
  background: var(--bg-content);
  color: var(--accent-primary);
  font-weight: 600;
  border-color: var(--border-light);
}

#main-menu li a.selected::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
}

/* Submenu dropdowns */
#main-menu .menu-children {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

#main-menu .menu-children li a {
  border-radius: 0;
  background: transparent;
  padding: 10px 20px;
  border: none;
}

#main-menu .menu-children li a:hover {
  background: var(--bg-hover);
}

/* ============================================
   Main Content Area
   ============================================ */
#main {
  flex-grow: 1;
  display: flex;
  flex-direction: row-reverse;
  background: var(--bg-page);
  padding: 20px;
  gap: 20px;
}

#content {
  flex-grow: 1;
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  overflow-x: auto;
}

#content h2 {
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

#content h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 24px 0 12px 0;
}

#content h4 {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
}

/* ============================================
   Sidebar
   ============================================ */
#sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
}

#sidebar h3 {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

#sidebar a {
  color: var(--text-link);
  text-decoration: none;
  transition: var(--transition-fast);
}

#sidebar a:hover {
  color: var(--text-link-hover);
}

#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

#sidebar li {
  padding: 6px 0;
  border-bottom: 1px solid var(--divider-subtle);
}

#sidebar li:last-child {
  border-bottom: none;
}

/* ============================================
   Boxes & Cards
   ============================================ */
.box,
.wiki-box,
fieldset {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.box:hover,
fieldset:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

fieldset legend {
  color: var(--text-primary);
  font-weight: 600;
  padding: 0 8px;
  font-size: 0.95rem;
}

/* Issue boxes */
div.issue {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

div.issue .subject h3 {
  margin: 0;
  font-size: 1.1rem;
}

div.issue .subject h3 a {
  color: var(--text-primary);
}

/* Sticky header */
div#sticky-issue-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
}

/* ============================================
   Tables
   ============================================ */
table.list,
.table-list,
table.issues {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

table.list th,
.table-list th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

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

table.list tbody tr,
.table-list tbody tr {
  background: var(--bg-content);
  transition: var(--transition-fast);
}

table.list tbody tr:nth-child(even),
.table-list tbody tr:nth-child(even) {
  background: var(--stripe-even);
}

table.list tbody tr:hover,
.table-list tbody tr:hover {
  background: var(--bg-hover);
}

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

table.list td a,
.table-list td a {
  color: var(--text-link);
}

table.list td a:hover,
.table-list td a:hover {
  color: var(--text-link-hover);
}

/* Checkboxes in tables */
table.list td.checkbox,
table.list th.checkbox {
  width: 20px;
  text-align: center;
}

/* ============================================
   Forms & Inputs
   ============================================ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition-normal);
  width: auto;
}

input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover,
select:hover {
  border-color: var(--border-medium);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-secondary);
}

/* Select dropdown */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Labels */
label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}

/* Checkboxes & Radio */
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--bg-content);
  border: 2px solid var(--border-medium);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  vertical-align: middle;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--accent-gradient);
  border-color: transparent;
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ============================================
   Buttons
   ============================================ */
input[type="submit"],
input[type="button"],
button,
.button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

input[type="submit"]:hover,
input[type="button"]:hover,
button:hover,
.button:hover,
a.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 4px 12px var(--accent-glow);
}

input[type="submit"]:active,
button:active {
  transform: translateY(0);
}

/* Secondary buttons */
.button-secondary,
input.button-secondary {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  box-shadow: none;
}

.button-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Icon buttons */
a.icon,
span.icon {
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

a.icon:hover {
  color: var(--accent-primary);
}

/* Context menu buttons */
.contextual {
  color: var(--text-muted);
}

.contextual a {
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.contextual a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================
   Flash Messages
   ============================================ */
div.flash,
#flash_error,
#flash_notice,
#flash_warning,
#errorExplanation {
  padding: 14px 20px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  animation: flashSlideIn 0.4s ease forwards;
}

@keyframes flashSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

div.flash.notice,
#flash_notice {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

div.flash.error,
#flash_error,
#errorExplanation {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

div.flash.warning,
#flash_warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.nodata,
.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  padding: 20px;
  text-align: center;
  border-radius: var(--radius-md);
}

/* ============================================
   Links
   ============================================ */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--text-link-hover);
}

/* ============================================
   Pagination
   ============================================ */
ul.pages,
.pagination {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

ul.pages li,
.pagination li {
  margin: 0;
}

ul.pages li a,
.pagination a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

ul.pages li a:hover,
.pagination a:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

ul.pages li.current,
.pagination .current {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  font-weight: 600;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.tabs ul {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tabs a {
  display: block;
  padding: 10px 18px;
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--bg-secondary);
  transition: var(--transition-normal);
}

.tabs a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tabs a.selected {
  background: var(--bg-content);
  color: var(--accent-primary);
  font-weight: 600;
}

/* ============================================
   Progress Bars
   ============================================ */
.progress {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  height: 8px;
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  transform-origin: left center;
  transition: transform 0.5s ease;
}

table.progress {
  border: none;
  background: transparent;
}

td.closed {
  background: var(--accent-gradient);
}

td.open {
  background: var(--bg-secondary);
}

/* ============================================
   Tooltips
   ============================================ */
.tooltip {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
}

/* ============================================
   Modals
   ============================================ */
div.modal {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 24px;
}

div.modal h3.title {
  color: var(--text-primary);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* ============================================
   Wiki & Markdown Content
   ============================================ */
.wiki {
  color: var(--text-secondary);
  line-height: 1.7;
}

.wiki h1, .wiki h2, .wiki h3, .wiki h4 {
  color: var(--text-primary);
  margin-top: 24px;
  margin-bottom: 12px;
}

.wiki code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.9em;
  color: var(--accent-primary);
}

.wiki pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
}

.wiki pre code {
  background: transparent;
  padding: 0;
}

.wiki blockquote {
  border-left: 3px solid var(--accent-primary);
  margin: 16px 0;
  padding: 12px 20px;
  background: var(--accent-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
}

.wiki table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.wiki table th,
.wiki table td {
  border: 1px solid var(--border-light);
  padding: 10px 14px;
}

.wiki table th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   Calendar
   ============================================ */
table.cal {
  border-collapse: separate;
  border-spacing: 4px;
}

table.cal th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 8px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

table.cal td {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px;
  vertical-align: top;
  transition: var(--transition-fast);
}

table.cal td:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

table.cal td.today {
  background: var(--accent-light);
  border-color: var(--accent-primary);
}

table.cal td.odd {
  background: var(--stripe-even);
}

/* ============================================
   Issue Statuses & Priorities
   ============================================ */
.priority-highest,
.priority-5 {
  color: #dc2626;
}

.priority-high,
.priority-4 {
  color: #ea580c;
}

.priority-normal,
.priority-3 {
  color: var(--text-secondary);
}

.priority-low,
.priority-2 {
  color: #16a34a;
}

.priority-lowest,
.priority-1 {
  color: #0284c7;
}

.status-closed {
  text-decoration: line-through;
  opacity: 0.6;
}

/* ============================================
   Context Menu
   ============================================ */
#context-menu {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  min-width: 180px;
}

#context-menu li {
  list-style: none;
}

#context-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

#context-menu a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#context-menu .folder > a {
  font-weight: 600;
}

/* ============================================
   Footer
   ============================================ */
#footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border-light);
  padding: 16px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

#footer a {
  color: var(--text-secondary);
}

/* ============================================
   Admin Menu
   ============================================ */
#admin-menu {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 0;
}

#admin-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: var(--transition-fast);
}

#admin-menu a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#admin-menu a.selected {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
  font-weight: 600;
}

/* ============================================
   Filters
   ============================================ */
fieldset#filters {
  background: var(--bg-card);
}

#filters-table {
  width: 100%;
}

#filters-table td {
  padding: 8px;
  color: var(--text-secondary);
}

.toggle-multiselect {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.toggle-multiselect:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* ============================================
   Autocomplete
   ============================================ */
.ui-autocomplete {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
}

.ui-autocomplete .ui-menu-item {
  padding: 10px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.ui-autocomplete .ui-menu-item:hover,
.ui-autocomplete .ui-state-active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================
   Flyout Menu (Mobile)
   ============================================ */
.flyout-menu {
  background: var(--bg-header);
  box-shadow: var(--shadow-xl);
}

.flyout-menu h3 {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 16px 20px 8px;
}

.flyout-menu a {
  display: block;
  padding: 12px 20px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider-subtle);
}

.flyout-menu a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Mobile toggle */
.mobile-toggle-button {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px;
}

/* ============================================
   Loading Indicator
   ============================================ */
#ajax-indicator {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  box-shadow: var(--shadow-lg);
}

#ajax-indicator span {
  color: var(--text-primary);
}

/* ============================================
   Scrollbars (Webkit)
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

/* ============================================
   SVG Icons
   ============================================ */
svg.s-icon {
  fill: currentColor;
  opacity: 0.7;
}

a:hover svg.s-icon {
  opacity: 1;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media screen and (max-width: 900px) {
  #main {
    flex-direction: column;
    padding: 12px;
  }

  #sidebar {
    width: 100%;
    order: 2;
  }

  #content {
    order: 1;
  }
}

@media screen and (max-width: 600px) {
  #header {
    padding: 12px 16px 0;
  }

  #header h1 {
    font-size: 1.2rem;
  }

  #content {
    padding: 16px;
  }

  #main-menu li a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   jQuery UI Overrides (Dropdowns, Autocomplete)
   Using body prefix for specificity
   ============================================ */
body .ui-widget {
  font-family: inherit;
}

body .ui-autocomplete,
body .ui-menu {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  max-height: 400px;
  overflow-y: auto;
}

body .ui-menu .ui-menu-item {
  padding: 0;
  margin: 0;
  list-style: none;
}

body .ui-menu .ui-menu-item-wrapper,
body .ui-menu .ui-menu-item a {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  text-decoration: none;
  transition: var(--transition-fast);
}

body .ui-menu .ui-menu-item-wrapper:hover,
body .ui-menu .ui-menu-item a:hover,
body .ui-menu .ui-state-active,
body .ui-menu .ui-state-focus {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: none;
  margin: 0;
}

body .ui-state-highlight {
  background: var(--accent-light);
  color: var(--accent-primary);
}

/* Project Jump Box Dropdown */
body .drdn-content {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

body .drdn-content input[type="text"],
body .drdn-content input[type="search"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: calc(100% - 28px);
  margin: 8px 14px;
}

body .drdn-content input[type="text"]:focus,
body .drdn-content input[type="search"]:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-light);
}

body .drdn-items {
  max-height: 300px;
  overflow-y: auto;
}

body .drdn-items a,
body .drdn-content a {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--divider-subtle);
}

body .drdn-items a:hover,
body .drdn-content a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

body .drdn-items a:last-child {
  border-bottom: none;
}

/* Search Results Dropdown */
body .ui-autocomplete.search-autocomplete {
  min-width: 300px;
}

/* Filter Selects */
body #filters select,
body .filter select,
body td.values select {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 32px 8px 12px;
  min-width: 150px;
}

body #filters select:focus,
body .filter select:focus,
body td.values select:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-light);
}

body #filters select option,
body .filter select option,
body select option {
  background: var(--bg-content);
  color: var(--text-primary);
  padding: 8px 12px;
}

/* Select dropdown arrow */
body select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Multiple select styling */
body select[multiple] {
  background-image: none;
  padding-right: 12px;
}

body select[multiple] option {
  padding: 8px 12px;
}

body select[multiple] option:checked {
  background: var(--accent-light);
  color: var(--accent-primary);
}

/* Tribute autocomplete (for @mentions) */
body .tribute-container {
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

body .tribute-container li {
  padding: 10px 16px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

body .tribute-container li:hover,
body .tribute-container li.highlight {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  *,
  *::before,
  *::after {
    background: transparent;
    color: black;
    box-shadow: none;
    text-shadow: none;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  #top-menu,
  #header,
  #sidebar,
  #footer,
  .contextual,
  .mobile-toggle-button,
  .flyout-menu,
  #ajax-indicator,
  #ajax-modal,
  .tabs-buttons,
  input[type="submit"],
  input[type="button"],
  button,
  .button,
  #sidebar-switch-panel {
    display: none;
  }

  #wrapper,
  #main,
  #content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: white;
    border: none;
    border-radius: 0;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="#"]:after,
  a[href^="javascript"]:after {
    content: "";
  }

  table {
    border-collapse: collapse;
    width: 100%;
  }

  table th,
  table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
  }

  table th {
    background: #f5f5f5;
    font-weight: bold;
  }

  h1, h2, h3, h4 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  img, table, pre, blockquote {
    page-break-inside: avoid;
  }

  pre, code {
    border: 1px solid #ddd;
    background: #f9f9f9;
    font-size: 10pt;
  }

  .flash,
  #flash_error,
  #flash_notice,
  #flash_warning {
    display: none;
  }
}
