/**
 * watch.ly Design System
 * Refined Industrial Victorian
 * Precision instruments meet modern dashboard
 */

/* ==========================================================================
   CSS VARIABLES / DESIGN TOKENS
   ========================================================================== */

:root {
    /* Primary Palette - Polished Brass */
    --brass: #c49a1a;
    --brass-light: #e0b83a;
    --brass-dark: #96750e;
    --copper: #b87333;
    --copper-light: #da8a47;
    --bronze: #cd7f32;

    /* Backgrounds */
    --bg-dark: #13100c;
    --bg-card: #1c1812;
    --bg-surface: #231e16;
    --bg-paper: #2a2318;
    --bg-input: #0e0c09;
    --bg-sidebar: #171310;

    /* Text */
    --text-primary: #ede5d4;
    --text-secondary: #b5a48a;
    --text-muted: #7d6f58;

    /* Borders */
    --border: #342c20;
    --border-brass: #5c4d36;

    /* Status Colors */
    --success: #6fa834;
    --success-muted: rgba(111, 168, 52, 0.12);
    --warning: #e8a000;
    --warning-muted: rgba(232, 160, 0, 0.12);
    --error: #c43030;
    --error-muted: rgba(196, 48, 48, 0.12);
    --info: #3a8fd4;
    --info-muted: rgba(58, 143, 212, 0.12);

    /* Gradients */
    --gradient-brass: linear-gradient(180deg, var(--brass-light) 0%, var(--brass) 100%);
    --gradient-card: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 20px rgba(196, 154, 26, 0.08);

    /* Typography */
    --font-display: 'Cinzel', serif;
    --font-body: 'EB Garamond', 'Georgia', serif;
    --font-mono: 'Share Tech Mono', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.12s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;

    /* Sidebar */
    --sidebar-width: 260px;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 1.05rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Blueprint grid + warm ambient glow */
    background-image:
        radial-gradient(ellipse at 15% 30%, rgba(196, 154, 26, 0.035) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 60%, rgba(184, 115, 51, 0.025) 0%, transparent 50%),
        linear-gradient(rgba(92, 77, 54, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(92, 77, 54, 0.025) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
    background-attachment: fixed;
}

a {
    color: var(--brass-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brass);
}

::selection {
    background: rgba(196, 154, 26, 0.25);
    color: var(--text-primary);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
h4 { font-size: 1.15rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.85rem; }

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.text-gradient {
    background: linear-gradient(135deg, var(--brass-light), var(--copper), var(--brass));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-brass { color: var(--brass-light); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

.italic { font-style: italic; }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    border: 1px solid var(--brass);
    transition: all var(--transition-base);
    position: relative;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--gradient-brass);
    color: var(--bg-dark);
    border-color: var(--brass-light);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--brass) 0%, var(--brass-dark) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

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

.btn-secondary {
    background: transparent;
    color: var(--brass-light);
    border-color: var(--border-brass);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(196, 154, 26, 0.08);
    border-color: var(--brass);
}

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

.btn-success:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-surface);
    border-color: var(--border-brass);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.7rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 0.9rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* Social login buttons */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    text-transform: none;
    letter-spacing: 0;
    transition: all var(--transition-base);
}

.btn-social:hover {
    background: var(--bg-paper);
    border-color: var(--border-brass);
}

.btn-google:hover { border-color: #4285f4; }
.btn-github:hover { border-color: #8b5cf6; }

/* ==========================================================================
   FORMS
   ========================================================================== */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(196, 154, 26, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237d6f58' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-checkbox,
.form-radio {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-checkbox input,
.form-radio input {
    accent-color: var(--brass);
    width: 16px;
    height: 16px;
}

.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: var(--space-xs);
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: var(--space-xs);
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-lg);
    position: relative;
    transition: box-shadow var(--transition-slow);
}

/* Subtle brass accent line at top */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, var(--brass-dark) 30%, var(--brass) 50%, var(--brass-dark) 70%, transparent 95%);
    opacity: 0.5;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.card-hover:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 0;
    letter-spacing: 0.02em;
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

/* Card with precision corner marks (CSS-only, no extra DOM) */
.card-ornate,
.card-decorated {
    position: relative;
}

.card-ornate::before,
.card-decorated::before {
    content: '';
    position: absolute;
    inset: -1px;
    pointer-events: none;
    z-index: 1;
    border-radius: var(--radius-sm);
    /* Top-left and top-right corner marks */
    background:
        linear-gradient(var(--brass), var(--brass)) 0 0 / 14px 1px no-repeat,
        linear-gradient(var(--brass), var(--brass)) 0 0 / 1px 14px no-repeat,
        linear-gradient(var(--brass), var(--brass)) 100% 0 / 14px 1px no-repeat,
        linear-gradient(var(--brass), var(--brass)) 100% 0 / 1px 14px no-repeat;
}

.card-ornate::after,
.card-decorated::after {
    content: '';
    position: absolute;
    inset: -1px;
    pointer-events: none;
    z-index: 1;
    border-radius: var(--radius-sm);
    /* Bottom-left and bottom-right corner marks */
    background:
        linear-gradient(var(--brass), var(--brass)) 0 100% / 14px 1px no-repeat,
        linear-gradient(var(--brass), var(--brass)) 0 100% / 1px 14px no-repeat,
        linear-gradient(var(--brass), var(--brass)) 100% 100% / 14px 1px no-repeat,
        linear-gradient(var(--brass), var(--brass)) 100% 100% / 1px 14px no-repeat;
}

/* Card header with icon */
.card-header-ornate,
.card-header-decorated {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.card-header-ornate .gear-icon,
.card-header-decorated .gear-icon {
    color: var(--brass);
    display: flex;
    align-items: center;
}

/* Featured card variant */
.card-featured {
    border-color: var(--brass-dark);
    box-shadow: var(--shadow-glow);
}

.card-featured::before {
    opacity: 1;
}

/* ==========================================================================
   PLATES (Steampunk panels)
   ========================================================================== */

.plate {
    background: var(--gradient-card);
    border: 1px solid var(--border-brass);
    border-radius: var(--radius-sm);
    padding: var(--space-xl);
    position: relative;
}

.plate-brass {
    background: var(--gradient-brass);
    color: var(--bg-dark);
}

/* ==========================================================================
   BADGES & TAGS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid;
    border-radius: var(--radius-sm);
}

.badge-brass {
    background: rgba(196, 154, 26, 0.1);
    border-color: var(--brass-dark);
    color: var(--brass-light);
}

.badge-success {
    background: var(--success-muted);
    border-color: rgba(111, 168, 52, 0.3);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-muted);
    border-color: rgba(232, 160, 0, 0.3);
    color: var(--warning);
}

.badge-error {
    background: var(--error-muted);
    border-color: rgba(196, 48, 48, 0.3);
    color: var(--error);
}

/* ==========================================================================
   TABLES
   ========================================================================== */

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

.table th,
.table td {
    padding: 12px var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
}

.table td {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

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

.table tbody tr:hover {
    background: rgba(196, 154, 26, 0.04);
}

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

/* ==========================================================================
   ALERTS / NOTIFICATIONS
   ========================================================================== */

.alert {
    padding: var(--space-md) var(--space-lg);
    border: 1px solid;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.alert-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-size: 0.9rem;
}

.alert-info {
    background: var(--info-muted);
    border-color: rgba(58, 143, 212, 0.3);
    color: var(--text-primary);
}

.alert-success {
    background: var(--success-muted);
    border-color: rgba(111, 168, 52, 0.3);
}

.alert-warning {
    background: var(--warning-muted);
    border-color: rgba(232, 160, 0, 0.3);
}

.alert-error {
    background: var(--error-muted);
    border-color: rgba(196, 48, 48, 0.3);
}

/* ==========================================================================
   INDICATORS & STATUS
   ========================================================================== */

.indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    flex-shrink: 0;
}

.indicator-success {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.indicator-warning {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.indicator-error {
    background: var(--error);
    box-shadow: 0 0 6px var(--error);
}

.indicator-pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Telegraph-style indicator lights */
.indicator-light {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    display: inline-block;
}

.indicator-light.on {
    background: var(--success);
    box-shadow: 0 0 6px var(--success), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.indicator-light.warning {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.indicator-light.blinking {
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */

.navbar-ornate {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(19, 16, 12, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-lg);
    height: 56px;
    display: flex;
    align-items: center;
}

.navbar-ornate::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brass-dark), transparent);
    opacity: 0.4;
}

.logo-ornate {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.logo-icon {
    color: var(--brass);
    display: flex;
    align-items: center;
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-ornate .highlight {
    color: var(--brass);
}

/* Navigation links */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color var(--transition-base);
    padding: 4px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--brass-light);
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.sidebar-ornate {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: var(--space-lg) 0;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: calc(100vh - 56px);
}

/* Subtle inner edge highlight */
.sidebar-ornate::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, var(--brass-dark) 0%, transparent 30%, transparent 70%, var(--brass-dark) 100%);
    opacity: 0.3;
}

.sidebar-section {
    margin-bottom: var(--space-md);
    padding: 0 var(--space-md);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-sm);
}

.sidebar-section-header .section-icon {
    color: var(--brass-dark);
    display: flex;
    align-items: center;
}

.sidebar-section-header .section-icon svg {
    width: 10px;
    height: 10px;
    opacity: 0.6;
}

.sidebar-section-label {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-nav-ornate {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-nav-ornate a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 0 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    transition: all var(--transition-base);
    position: relative;
}

.sidebar-nav-ornate a:hover {
    color: var(--text-primary);
    background: rgba(196, 154, 26, 0.06);
}

.sidebar-nav-ornate a.active {
    color: var(--brass-light);
    background: rgba(196, 154, 26, 0.08);
    border-left-color: var(--brass);
}

.sidebar-nav-ornate a .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.7;
}

.sidebar-nav-ornate a:hover .nav-icon,
.sidebar-nav-ornate a.active .nav-icon {
    opacity: 1;
}

.sidebar-nav-ornate a .nav-icon svg {
    width: 16px;
    height: 16px;
}

/* Credit display in sidebar */
.credit-display {
    margin: auto var(--space-md) 0;
    padding: var(--space-md);
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.credit-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brass), transparent);
    opacity: 0.6;
}

.credit-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    font-family: var(--font-display);
    margin-bottom: 4px;
}

.credit-value {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    color: var(--brass-light);
    line-height: 1.2;
}

/* ==========================================================================
   PAGE LAYOUT
   ========================================================================== */

.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.dashboard-layout {
    display: flex;
    flex: 1;
}

.dashboard-content {
    flex: 1;
    padding: var(--space-xl) var(--space-xl) var(--space-2xl);
    max-width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - 56px);
}

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

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }

/* Page header */
.page-header {
    position: relative;
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--brass-dark), transparent 70%);
    opacity: 0.5;
}

.page-header h1 {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.page-header h1 .header-icon {
    color: var(--brass);
    display: flex;
    align-items: center;
}

.page-header h1 .header-icon svg {
    width: 24px;
    height: 24px;
}

/* Legacy support for .header-gear */
.page-header h1 .header-gear {
    color: var(--brass);
    font-size: 1.35rem;
}

/* ==========================================================================
   DASHBOARD COMPONENTS
   ========================================================================== */

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card,
.stat-card-ornate {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-slow);
}

.stat-card:hover,
.stat-card-ornate:hover {
    box-shadow: var(--shadow-glow);
}

/* Top accent line on stat cards */
.stat-card::before,
.stat-card-ornate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brass-dark), var(--brass), var(--brass-dark));
    opacity: 0.4;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    color: var(--brass-light);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-display);
}

.stat-icon {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 1.1rem;
    color: var(--border);
    opacity: 0.4;
}

/* Data table wrapper */
.data-table {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Request card (telegraph-inspired) */
.request-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    position: relative;
    transition: border-color var(--transition-base);
}

.request-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--warning);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.request-card.approved::before {
    background: var(--success);
}

.request-card.denied::before {
    background: var(--error);
}

.request-card:hover {
    border-color: var(--border-brass);
}

/* Ticker tape display (monospace readout) */
.ticker-display {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--brass);
    letter-spacing: 0.05em;
}

.ticker-display.success {
    border-color: rgba(111, 168, 52, 0.3);
    color: var(--success);
}

/* Empty state */
.empty-state,
.empty-state-ornate {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-muted);
}

.empty-state .gear-decoration,
.empty-state-ornate .gear-decoration {
    font-size: 2.5rem;
    color: var(--border-brass);
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-state h3,
.empty-state-ornate h3 {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    font-size: 1.15rem;
}

/* Action buttons (lever-style) */
.lever-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    text-transform: uppercase;
    transition: all var(--transition-base);
}

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

.lever-btn-approve:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.lever-btn-deny {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}

.lever-btn-deny:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* ==========================================================================
   DECORATIVE ELEMENTS
   ========================================================================== */

/* Section divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-brass), transparent);
    margin: var(--space-xl) 0;
    position: relative;
}

.divider-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    padding: 0 var(--space-md);
    font-family: var(--font-display);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Pipe divider */
.pipe-divider {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-lg) 0;
}

.pipe-segment {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-brass), transparent);
}

.pipe-joint {
    color: var(--border-brass);
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Section header with line */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.section-header h1,
.section-header h2,
.section-header h3 {
    margin: 0;
    white-space: nowrap;
}

.header-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--brass-dark), transparent);
    opacity: 0.5;
}

.header-line-left {
    background: linear-gradient(90deg, transparent, var(--brass-dark));
}

/* Status row */
.status-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

.status-row:last-child {
    border-bottom: none;
}

.status-indicator-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

/* Callout box */
.callout {
    border-left: 3px solid var(--brass);
    background: rgba(196, 154, 26, 0.04);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.callout p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.callout-title {
    font-family: var(--font-display);
    color: var(--brass-light);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-xs);
}

/* ==========================================================================
   SETUP WIZARD
   ========================================================================== */

.setup-container {
    max-width: 780px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.setup-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-2xl);
}

.setup-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-display);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.setup-step.active {
    color: var(--brass-light);
    border-color: var(--border-brass);
    background: rgba(196, 154, 26, 0.06);
}

.setup-step.completed {
    color: var(--success);
}

.setup-step-num {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid currentColor;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
}

.setup-step.completed .setup-step-num {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-connector {
    width: 28px;
    height: 1px;
    background: var(--border);
}

.step-panel {
    display: none;
}

.step-panel.active {
    display: block;
}

/* Mode selection cards */
.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.mode-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-xl);
    cursor: pointer;
    transition: all var(--transition-slow);
    position: relative;
}

.mode-card:hover {
    border-color: var(--border-brass);
    box-shadow: var(--shadow-md);
}

.mode-card.selected {
    border-color: var(--brass);
    background: rgba(196, 154, 26, 0.04);
}

.mode-card.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-brass);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.mode-card-icon {
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
}

.mode-card h3 {
    font-size: 1.05rem;
    margin-bottom: var(--space-sm);
}

.mode-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.mode-badge {
    display: inline-block;
    padding: 2px 8px;
    font-family: var(--font-display);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: var(--space-sm);
    border-radius: var(--radius-sm);
}

.mode-badge-free {
    border: 1px solid rgba(111, 168, 52, 0.3);
    color: var(--success);
}

.mode-badge-paid {
    border: 1px solid var(--brass-dark);
    color: var(--brass-light);
}

/* Code blocks */
.code-block {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--brass-light);
    overflow-x: auto;
    position: relative;
    margin: var(--space-md) 0;
    line-height: 1.8;
    white-space: pre-wrap;
}

.code-block .comment { color: var(--text-muted); }
.code-block .string { color: var(--success); }

.copy-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 4px 10px;
    font-family: var(--font-display);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all var(--transition-base);
}

.copy-btn:hover {
    border-color: var(--brass);
    color: var(--brass-light);
}

.copy-btn.copied {
    border-color: rgba(111, 168, 52, 0.3);
    color: var(--success);
}

/* Tabbed content */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg);
}

.tab-btn {
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-display);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-base);
}

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

.tab-btn.active {
    color: var(--brass-light);
    border-bottom-color: var(--brass);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Step titles */
.step-title {
    font-size: 1.4rem;
    margin-bottom: var(--space-sm);
}

.step-subtitle {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: var(--space-xl);
}

/* Setup navigation buttons */
.setup-nav {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

/* Checklist */
.setup-checklist {
    list-style: none;
    margin: var(--space-lg) 0;
}

.setup-checklist li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.setup-checklist li .check-icon {
    color: var(--brass);
    flex-shrink: 0;
    margin-top: 2px;
}

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

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

/* Spacing */
.m-0 { margin: 0; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Visibility */
.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

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

/* Entrance animations for dashboard cards */
.stats-grid .stat-card {
    animation: fadeIn 0.4s ease both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }

/* Sidebar nav entrance */
.sidebar-nav-ornate a {
    animation: slideIn 0.3s ease both;
}
.sidebar-nav-ornate a:nth-child(1) { animation-delay: 0.05s; }
.sidebar-nav-ornate a:nth-child(2) { animation-delay: 0.08s; }
.sidebar-nav-ornate a:nth-child(3) { animation-delay: 0.11s; }
.sidebar-nav-ornate a:nth-child(4) { animation-delay: 0.14s; }
.sidebar-nav-ornate a:nth-child(5) { animation-delay: 0.17s; }

/* Legacy support for spinning decorations (toned down) */
.gear-spin { animation: spin 40s linear infinite; }
.gear-spin-slow { animation: spin 80s linear infinite; }
.gear-spin-reverse { animation-direction: reverse; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .hide-tablet { display: none; }
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 { grid-template-columns: 1fr; }

    .hide-mobile { display: none; }
    .flex-col-mobile { flex-direction: column; }

    .sidebar-ornate {
        display: none;
    }

    .dashboard-content {
        max-width: 100%;
        padding: var(--space-lg);
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

    .setup-steps {
        flex-wrap: wrap;
    }

    .step-connector {
        display: none;
    }

    .navbar-ornate {
        padding: 0 var(--space-md);
    }
}

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