/* AURORA Styles */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Serif:wght@500;600;700&display=swap');

/* ============================================================================
   DESIGN TOKENS
   CSS Custom Properties for consistent theming and design system
   WCAG 2.1 AA compliant color contrasts (4.5:1 minimum)
   ============================================================================ */

:root {
    /* Primary Colors */
    --primary-color: #1f3a5f;
    --primary-dark: #152a46;
    --primary-light: #3a5a8a;
    --primary-50: #e8edf5;
    --primary-100: #c5d4ea;
    --primary-200: #9cb5dc;
    --primary-300: #7396cd;
    --primary-400: #4a77be;
    --primary-500: #1f3a5f;
    --primary-600: #152a46;
    --primary-700: #0f1f33;

    /* Secondary Colors */
    --secondary-color: #5c6a7a;
    --secondary-light: #7a8a9e;
    --secondary-dark: #4b5968;

    /* Semantic Colors */
    --success-color: #1f8a70;
    --success-light: #d1fae5;
    --success-dark: #187a63;
    --warning-color: #b7791f;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;
    --danger-color: #b8322f;
    --danger-light: #fee2e2;
    --danger-dark: #991b1b;

    /* Neutral Colors */
    --dark-bg: #132035;
    --light-bg: #f5f7fb;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Text Colors */
    --text-color: #0b1f33;
    --text-muted: #5f6c7b;
    --text-light: #8b95a5;

    /* Border Colors */
    --border-color: #d7e0ea;
    --border-color-light: #e8eef5;
    --border-color-dark: #c5d4ea;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(15 32 50 / 0.08);
    --shadow-md: 0 8px 14px -6px rgb(15 32 50 / 0.16);
    --shadow-lg: 0 18px 26px -12px rgb(15 32 50 / 0.2);
    --shadow-xl: 0 25px 50px -12px rgb(15 32 50 / 0.25);

    /* Spacing Scale (8px base unit) */
    --spacing-xs: 0.25rem;    /* 4px */
    --spacing-sm: 0.5rem;     /* 8px */
    --spacing-md: 1rem;       /* 16px */
    --spacing-lg: 1.5rem;     /* 24px */
    --spacing-xl: 2rem;       /* 32px */
    --spacing-2xl: 3rem;      /* 48px */

    /* Typography Scale */
    --font-size-xs: 0.75rem;   /* 12px */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;   /* 24px */
    --font-size-3xl: 2rem;     /* 32px */

    /* Border Radius */
    --radius-sm: 0.25rem;   /* 4px */
    --radius-md: 0.375rem;  /* 6px */
    --radius-lg: 0.5rem;    /* 8px */
    --radius-xl: 0.75rem;   /* 12px */
    --radius-2xl: 1rem;     /* 16px */
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* ============================================================================
       ADDITIONAL DESIGN TOKENS (SPEC-UIX-002)
       Expanded token system for comprehensive UI consistency
       ============================================================================ */

    /* Info Color (for semantic color completeness) */
    --color-info: #0ea5e9;
    --info-light: #e0f2fe;
    --info-dark: #0284c7;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-base: 1.55;
    --line-height-relaxed: 1.75;

    /* Letter Spacing */
    --letter-spacing-tight: -0.025em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;

    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Breakpoints (for reference in JS/CSS logic) */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
    line-height: 1.55;
    color: var(--text-color);
    background: radial-gradient(circle at top left, #fbfcfe 0%, #f4f6fb 45%, #edf2f7 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Browsers do not let <button> inherit the page font, so every button that is
   not a .btn (header dropdown toggles, user menu, tabs) rendered in Arial. */
button {
    font-family: inherit;
}

/* The header toggles and user menu sit beside <a class="nav-link">; with the
   browser's default line-height they were 6px shorter than the links. */
.nav-link.nav-dropdown-toggle,
.user-menu-button {
    line-height: inherit;
}

/* Focus visible for better keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================================
   CONTAINER
   ============================================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Signed-in pages get 1440px: at 1200px the Users, Applications and
   discussion tables scrolled sideways even on a 1920px screen, and with no
   cap at all the forms and two-column cards built for ~1200px spread into
   mostly empty space. The public landing page keeps the cap above. */
.header > .container,
.main-content > .container,
.footer > .container {
    max-width: 1440px;
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-lg);
}

/* ============================================================================
   HEADER
   Enhanced with backdrop blur, smooth transitions, and mobile responsiveness
   ============================================================================ */

.header {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: box-shadow var(--transition-base);
}

.header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    gap: 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    min-width: 0;
    transition: transform var(--transition-base);
}

.brand:hover {
    transform: translateX(4px);
}

.brand-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: transform var(--transition-base);
}

.brand:hover .brand-icon {
    transform: scale(1.05);
}

/* Horizontal AURORA logo in the header brand. The width comes from the file's
   own 182:48 ratio, so only the height is pinned. */
.brand-logo {
    display: block;
    height: 36px;
    width: auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    max-width: 190px;
}

.brand-name {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.01em;
    white-space: normal;
    word-break: break-word;
    transition: color var(--transition-base);
}

.brand:hover .brand-name {
    color: var(--primary-light);
}

.brand-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================================
   NAVIGATION
   Enhanced with smooth transitions and better hover states
   ============================================================================ */

.nav {
    display: flex;
    /* Menu spacing at 70% of the original (gap 0.9rem + 0.6rem link padding):
       the admin header had more air between items than it needed. */
    gap: 0.63rem;
    align-items: center;
    flex: 1;
    min-width: 0;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: visible;
}

.nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition-base);
    white-space: nowrap;
    padding: 0.35rem 0.42rem;
    border-radius: var(--radius-md);
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all var(--transition-base);
    transform: translateX(-50%);
}

.nav a:hover {
    color: var(--primary-color);
    background: var(--primary-50);
}

.nav a:hover::after {
    width: 60%;
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-link.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition-base);
    white-space: nowrap;
    padding: 0.35rem 0.42rem;
    border-radius: var(--radius-md);
}

.nav-link.nav-dropdown-toggle:hover {
    color: var(--primary-color);
    background: var(--primary-50);
}

.nav-dropdown-caret {
    font-size: 0.7em;
    transition: transform var(--transition-base);
}

.nav-dropdown-toggle[aria-expanded="true"] .nav-dropdown-caret {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1000;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

.nav-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu[role="menu"] a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background var(--transition-base);
    white-space: nowrap;
}

.nav-dropdown-menu[role="menu"] a:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.nav-dropdown-menu[role="menu"] a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
    background: var(--gray-100);
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: var(--spacing-sm);
    cursor: pointer;
    border-radius: var(--radius-md);
    color: var(--text-color);
    transition: background var(--transition-base);
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus {
    background: var(--gray-100);
}

.mobile-menu-toggle-icon {
    display: block;
    width: 24px;
    height: 24px;
}

/* ============================================================================
   USER MENU
   Enhanced with smooth animations and better accessibility
   ============================================================================ */

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: transform var(--transition-base);
}

.user-menu-button:hover .user-avatar {
    transform: scale(1.05);
}

.user-menu {
    position: relative;
    flex-shrink: 0;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--text-color);
    cursor: pointer;
    transition: all var(--transition-base);
}

.user-menu-button:hover,
.user-menu-button:focus {
    background: var(--gray-100);
    border-color: var(--border-color);
    outline: none;
}

.user-menu-label {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-caret {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    transition: transform var(--transition-base);
}

.user-menu-button[aria-expanded="true"] .user-menu-caret {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    padding: var(--spacing-sm) 0;
    display: none;
    z-index: var(--z-dropdown);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.user-menu-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.user-menu-dropdown a {
    display: block;
    padding: 0.5rem 0.9rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: var(--font-size-sm);
    transition: background var(--transition-fast);
}

.user-menu-dropdown a:hover {
    background: var(--light-bg);
}

.user-menu:hover .user-menu-dropdown,
.user-menu:focus-within .user-menu-dropdown {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main-content {
    padding: var(--spacing-xl) 0;
    min-height: calc(100vh - 80px);
}

/* ============================================================================
   SUB-NAVIGATION
   Enhanced with smooth transitions and better focus states
   ============================================================================ */

.subnav {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    border: 1px solid transparent;
}

.subnav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: #ffffff;
    white-space: nowrap;
    transition: all var(--transition-base);
}

.subnav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.subnav-link.is-active {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: none;
}

/* ============================================================================
   HEADINGS
   ============================================================================ */

h1, h2, h3, h4 {
    font-family: 'IBM Plex Serif', 'Georgia', serif;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.2;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

/* A sub-heading after other content starts a new group, so it needs room
   above it; several sat flush against the rule or button before them. */
h4:not(:first-child) { margin-top: var(--spacing-lg); }

/* ============================================================================
   CARDS
   Enhanced with hover effects and smooth animations
   ============================================================================ */

.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    transition: all var(--transition-base);
}

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

.card-header {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header a:not(.btn) {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base);
}

.card-header a:not(.btn):hover {
    color: var(--primary-color);
}

.card-body {
    padding: 0;
}

/* ============================================================================
   FORMS
   Enhanced with floating labels, validation states, and better focus indicators
   ============================================================================ */

.form-group {
    margin-bottom: var(--spacing-md);
    position: relative;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    transition: color var(--transition-base);
}

.form-label.required::after {
    content: '*';
    color: var(--danger-color);
    margin-left: 4px;
}

/* Floating label pattern */
.form-floating {
    position: relative;
}

.form-floating label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all var(--transition-base);
    background: white;
    padding: 0 4px;
}

.form-floating input:focus ~ label,
.form-floating input:not(:placeholder-shown) ~ label,
.form-floating textarea:focus ~ label,
.form-floating textarea:not(:placeholder-shown) ~ label,
.form-floating select:focus ~ label,
.form-floating select:valid ~ label {
    top: -0.5rem;
    left: 0.5rem;
    font-size: 0.75rem;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    background: white;
}

/* A one-line value (an email, a name, a choice) does not need the whole card:
   in a one-column form a 1400px input separates its label from everything
   else. Text areas keep the full width for long writing. */
input.form-control,
select.form-control {
    max-width: 40rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.1);
}

.form-control:focus ~ .form-label {
    color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* Character counter for textareas */
.char-counter {
    text-align: right;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 4px;
    transition: color var(--transition-base);
}

.char-counter.warning {
    color: var(--warning-color);
    font-weight: 600;
}

.char-counter.error {
    color: var(--danger-color);
    font-weight: 700;
}

/* ============================================================================
   BUTTONS
   Enhanced with hover effects, loading states, and smooth animations
   ============================================================================ */

.btn {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    /* <button> does not inherit font or line-height the way <a> does; without
       these three lines a <button class="btn"> next to an <a class="btn"> is
       6px shorter, in Arial, and sits 16px lower (declare_conflict.php). */
    font-family: inherit;
    line-height: var(--line-height-tight);
    vertical-align: middle;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
    text-align: center;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

/* A text link that sits among buttons (used by the reviewer dashboard's
   "Declare conflict"). The class had no rule, so it rendered as a boxed,
   shadowed button. */
.btn-link {
    display: inline-block;
    padding: 0.1rem 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.btn-link:hover {
    text-decoration-thickness: 2px;
}

/* No lift on hover: moving one button of a row makes it look misaligned
   with its neighbour. The shadow still signals the hover. */
.btn:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    padding: 0.4rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    display: block;
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-dark);
}

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

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: none;
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-color);
    box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-lg);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Button loading state */
.btn.is-loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spinner 0.6s linear infinite;
}

@keyframes btn-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================================
   TABLES
   Enhanced with hover states, sticky headers, and better responsive behavior
   ============================================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-md);
}

.table th,
.table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    background: var(--light-bg);
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

/* Drag handle for sortable rows */
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    width: 30px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.1em;
    transition: color var(--transition-base);
}

.drag-handle:hover {
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

.is-dragging {
    opacity: 0.6;
    background: var(--gray-100);
}

/* Order status indicators */
.order-status {
    font-size: var(--font-size-xs);
    margin-top: 0.25rem;
    transition: color var(--transition-base);
}

.order-status.is-saving {
    color: var(--primary-color);
}

.order-status.is-saved {
    color: var(--success-color);
}

.order-status.is-error {
    color: var(--danger-color);
}

/* Checkbox list */
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--gray-50);
}

.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checkbox-item:hover {
    color: var(--primary-color);
}

.checkbox-item.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.checkbox-item input {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
}

/* Table links */
.table-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-base);
}

.table-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Striped table variant */
.table-striped tbody tr:nth-child(even) {
    background: var(--gray-50);
}

/* ============================================================================
   ALERTS
   Enhanced with better visual hierarchy and accessibility
   ============================================================================ */

.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    animation: slideIn 0.3s ease;
}

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

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* ============================================================================
   BADGES
   Enhanced with better color contrast and smooth transitions
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ============================================================================
   SCORE DISPLAY
   ============================================================================ */

.score-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.score-excellent {
    background: var(--success-light);
    color: #065f46;
}

.score-good {
    background: #dbeafe;
    color: #1e40af;
}

.score-fair {
    background: var(--warning-light);
    color: #92400e;
}

.score-poor {
    background: var(--danger-light);
    color: #991b1b;
}

/* ============================================================================
   CHAT/DISCUSSION
   Enhanced with better spacing and animations
   ============================================================================ */

.chat-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    background: white;
}

.chat-message {
    margin-bottom: var(--spacing-md);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--light-bg);
    animation: messageSlideIn 0.3s ease;
}

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

.chat-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-sm);
}

.chat-author {
    font-weight: 600;
    color: var(--primary-color);
}

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

.chat-content {
    color: var(--text-color);
    line-height: 1.5;
}

.chat-input-area {
    margin-top: var(--spacing-md);
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
}

/* The discussions composer carries a file picker, the message box, its
   buttons and a note. Side by side, those squeezed the message box to a
   sliver on a laptop-width window, so this composer stacks them. */
.chat-input-area--stacked {
    flex-direction: column;
    align-items: stretch;
}

.chat-input-area--stacked .chat-input {
    flex: none;
    width: 100%;
    min-height: 6rem;
}

/* ============================================================================
   GRID SYSTEM
   ============================================================================ */

.grid {
    display: grid;
    gap: var(--spacing-xl);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Asymmetric grids */
.grid-3-1 {
    grid-template-columns: 3fr 1fr;
}

/* Stat Grid */
.grid-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* ============================================================================
   STAT CARDS
   Enhanced with hover effects and better visual hierarchy
   ============================================================================ */

.stat-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.stat-card {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition-base);
}

.stat-link:hover .stat-card {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(31, 58, 95, 0.35);
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-color);
    transition: color var(--transition-base);
}

.stat-link:hover .stat-value {
    color: var(--primary-color);
}

.stat-meta {
    font-size: var(--font-size-xs);
    color: var(--primary-color);
    margin-top: 0.35rem;
}

/* ============================================================================
   LOGIN PAGE
   Enhanced with better visual design and animations
   ============================================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f2d46 0%, #0f4c5c 45%, #1f6f8b 100%);
}

.login-card {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: loginSlideUp 0.4s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.login-brand-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

/* AURORA symbol above the sign-in heading. Decorative: the heading below it
   carries the name, so the image itself has empty alt text. */
.login-brand-mark {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 0.5rem;
}

.login-brand-meta {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.login-fullname {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: -0.25rem 0 0.75rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.login-credentials {
    text-align: center;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: var(--light-bg);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.login-credentials small {
    font-size: var(--font-size-xs);
}

.login-footer {
    text-align: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.login-footer p {
    margin: 0;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

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

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

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

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

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

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

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

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

/* Margin utilities */
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.my-1 { margin-top: var(--spacing-sm); margin-bottom: var(--spacing-sm); }
.my-2 { margin-top: var(--spacing-md); margin-bottom: var(--spacing-md); }
.my-3 { margin-top: var(--spacing-lg); margin-bottom: var(--spacing-lg); }
.my-4 { margin-top: var(--spacing-xl); margin-bottom: var(--spacing-xl); }

/* Padding utilities */
.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
.p-4 { padding: var(--spacing-xl); }

.py-1 { padding-top: var(--spacing-sm); padding-bottom: var(--spacing-sm); }
.py-2 { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }
.py-3 { padding-top: var(--spacing-lg); padding-bottom: var(--spacing-lg); }
.py-4 { padding-top: var(--spacing-xl); padding-bottom: var(--spacing-xl); }

/* Display utilities */
.d-flex {
    display: flex;
}

.d-inline-flex {
    display: inline-flex;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

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

.align-start {
    align-items: flex-start;
}

.align-end {
    align-items: flex-end;
}

/* Gap utilities */
.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }

/* Width utilities */
.w-full {
    width: 100%;
}

.w-auto {
    width: auto;
}

/* Position utilities */
.position-relative {
    position: relative;
}

.position-absolute {
    position: absolute;
}

/* ============================================================================
   RESPONSIVE DESIGN
   Mobile-first responsive breakpoints
   ============================================================================ */

@media (max-width: 1100px) {
    .brand-meta {
        display: none;
    }

    .brand-name {
        font-size: var(--font-size-lg);
    }

    .nav {
        gap: 0.7rem;
        justify-content: flex-start;
    }

    .user-menu-label {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Stack grids */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-stats,
    .grid-3-1 {
        grid-template-columns: 1fr;
    }

    /* Mobile navigation */
    .nav {
        flex-direction: column;
        gap: var(--spacing-md);
        display: none;
    }

    .nav.show {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .brand {
        justify-content: center;
        text-align: center;
    }

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

    /* Smaller tables on mobile */
    .table {
        font-size: var(--font-size-sm);
    }

    .chat-input-area {
        flex-direction: column;
    }

    /* Smaller buttons on mobile */
    .btn {
        padding: 0.5rem 1rem;
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    .card {
        padding: var(--spacing-md);
    }

    .stat-card {
        padding: var(--spacing-md);
    }
}

/* ============================================================================
   BULLET LIST STYLING
   ============================================================================ */

ul.bullet-list {
    list-style-type: disc;
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

ul.bullet-list li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

ul.bullet-list li:last-child {
    margin-bottom: 0;
}

/* Bullet textarea styling */
.bullet-textarea {
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.bullet-textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* ============================================================================
   AGR BULLET EDITOR STYLES
   TAG: SPEC-UI-001-BULLET-EDITOR-CSS
   ============================================================================ */

/* Bullet Editor Wrapper */
.agr-bullet-editor-wrapper {
    margin-bottom: var(--spacing-md);
}

/* Editor Content Area */
.agr-bullet-editor {
    position: relative;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.agr-bullet-editor:focus {
    outline: 0;
}

/* Bullet Items */
.agr-bullet-item {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.25rem;
    min-height: 1.5em;
    word-wrap: break-word;
}

.agr-bullet-item:last-child {
    margin-bottom: 0;
}

/* Bullet Markers */
.agr-bullet-marker {
    position: absolute;
    left: -0.75rem;
    color: #333;
    font-weight: bold;
    user-select: none;
}

/* Empty bullet item placeholder */
.agr-bullet-item:empty::before {
    content: 'Type bullet point...';
    color: #999;
    font-style: italic;
    pointer-events: none;
}

/* Character/Word Counter */
.agr-bullet-counter {
    font-size: var(--font-size-xs);
    color: #6c757d;
    text-align: right;
    margin-top: 0.25rem;
    transition: color var(--transition-base);
}

.agr-bullet-counter.warning {
    color: var(--warning-color);
    font-weight: 600;
}

.agr-bullet-counter.error {
    color: var(--danger-color);
    font-weight: 700;
}

/* Toolbar */
.agr-bullet-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.agr-bullet-toolbar button {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.agr-bullet-toolbar button:hover {
    background-color: var(--gray-100);
}

.agr-bullet-toolbar button:focus {
    outline: 2px solid #80bdff;
    outline-offset: 2px;
}

/* Help Button */
.agr-bullet-help {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Preview Button */
.agr-bullet-preview-btn {
    padding: 0.25rem 0.75rem;
    margin-top: 0.5rem;
    font-size: var(--font-size-sm);
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-base);
}

.agr-bullet-preview-btn:hover {
    background-color: #5a6268;
}

.agr-bullet-preview-btn:focus {
    outline: 2px solid #80bdff;
    outline-offset: 2px;
}

.agr-bullet-preview-btn[aria-pressed="true"] {
    background-color: var(--success-color);
}

.agr-bullet-preview-btn[aria-pressed="true"]:hover {
    background-color: var(--success-dark);
}

/* Preview Display */
.agr-bullet-preview {
    display: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    background-color: var(--gray-100);
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}

.agr-bullet-preview.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.agr-bullet-preview ul {
    margin: 0;
    padding-left: 1.5rem;
}

.agr-bullet-preview li {
    margin-bottom: 0.25rem;
}

.agr-bullet-preview li:last-child {
    margin-bottom: 0;
}

/* Dark mode support (if theme system is active) */
@media (prefers-color-scheme: dark) {
    .agr-bullet-editor {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .agr-bullet-marker {
        color: #cbd5e0;
    }

    .agr-bullet-preview {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .agr-bullet-counter {
        color: #a0aec0;
    }
}

/* Print styles */
@media print {
    .agr-bullet-toolbar,
    .agr-bullet-preview-btn,
    .agr-bullet-counter {
        display: none;
    }

    .agr-bullet-editor {
        border: 1px solid #000;
    }

    .agr-bullet-preview {
        display: block;
        border: 1px solid #000;
    }
}

/* Accessibility - High contrast mode */
@media (prefers-contrast: high) {
    .agr-bullet-editor {
        border-width: 2px;
    }

    .agr-bullet-preview-btn {
        border: 2px solid currentColor;
    }
}
