:root {
    /* MS365 Brand Colors */
    --ms-brand-primary: #0078D4;
    --ms-brand-dark: #005A9E;
    --ms-brand-light: #EFF6FC;

    /* Neutrals */
    --ms-neutral-black: #000000;
    --ms-neutral-dark: #201F1E;
    --ms-neutral-primary: #323130;
    --ms-neutral-secondary: #605E5C;
    --ms-neutral-tertiary: #A19F9D;
    --ms-neutral-light: #EDEBE9;
    --ms-neutral-lighter: #F3F2F1;
    --ms-neutral-white: #FFFFFF;

    /* Backgrounds */
    --body-bg: #FAFAFA;
    --card-bg: #FFFFFF;

    /* Shadows */
    --shadow-depth-4: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108);
    --shadow-depth-8: 0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108);
    --shadow-depth-16: 0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108);

    /* Typography */
    --font-family-base: 'Segoe UI', 'Segoe UI Web (West European)', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;

    /* --- 3MWORKS Premium Theme --- */
    --brand-dark-blue: #0f172a;
    --brand-gradient-start: #1e1b4b;
    /* Deep Indigo */
    --brand-gradient-end: #312e81;
    /* Indigo */
    --brand-accent-glow: #818cf8;
    /* Soft Purple/Blue */
    --brand-text-gold: #fbbf24;
    /* Amber/Gold for contrast */
}

html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: var(--font-family-base);
    background-color: var(--body-bg);
    color: var(--ms-neutral-primary);
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Navbar overrides */
.navbar-custom {
    background-color: var(--ms-brand-primary);
    color: var(--ms-neutral-white);
    box-shadow: var(--shadow-depth-4);
    height: 48px;
    padding: 0 1rem;
}

.navbar-custom .navbar-brand,
.navbar-custom .nav-link {
    color: var(--ms-neutral-white) !important;
    font-weight: 600;
}

.navbar-custom .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Card - Fluent Style */
.card-fluent {
    background-color: var(--card-bg);
    border: none;
    border-radius: 4px;
    /* MS365 uses smaller rounding mostly, 4px is standard */
    box-shadow: var(--shadow-depth-4);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    height: 100%;
    overflow: hidden;
}

.card-fluent:hover {
    box-shadow: var(--shadow-depth-8);
}

.card-fluent .card-body {
    padding: 20px;
}

.card-fluent .card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ms-neutral-primary);
    margin-bottom: 8px;
}

.card-fluent .card-subtitle {
    font-size: 14px;
    color: var(--ms-neutral-secondary);
    margin-bottom: 16px;
}

/* Interactive Tile (for Dashboard) */
.tile-fluent {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.tile-fluent:hover {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.tile-fluent:hover .card-fluent {
    box-shadow: var(--shadow-depth-16);
    transform: translateY(-2px);
}

/* Buttons */
.btn-fluent-primary {
    background-color: var(--ms-brand-primary);
    color: white;
    border: none;
    border-radius: 2px;
    padding: 6px 20px;
    font-weight: 600;
    transition: background-color 0.1s;
}

.btn-fluent-primary:hover {
    background-color: var(--ms-brand-dark);
    color: white;
}

.btn-fluent-secondary {
    background-color: var(--ms-neutral-white);
    color: var(--ms-neutral-primary);
    border: 1px solid var(--ms-neutral-tertiary);
    /* tertiary border */
    border-radius: 2px;
    padding: 6px 20px;
    font-weight: 600;
}

.btn-fluent-secondary:hover {
    background-color: var(--ms-neutral-lighter);
    color: var(--ms-neutral-black);
}

/* Inputs */
.form-control {
    border: 1px solid var(--ms-neutral-tertiary);
    /* Default border to tertiary */
    border-radius: 2px;
    padding: 6px 12px;
}

.form-control:focus {
    border-color: var(--ms-brand-primary);
    box-shadow: none;
    border-bottom-width: 2px;
    /* Bottom border emphasis */
}

.form-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--ms-neutral-primary);
}

/* Utility */
.text-brand {
    color: var(--ms-brand-primary);
}

.bg-neutral-light {
    background-color: var(--ms-neutral-lighter);
}

footer.footer {
    background-color: var(--ms-neutral-lighter);
    border-top: 1px solid var(--ms-neutral-light);
    padding: 1rem 0;
    margin-top: auto;
    font-size: 12px;
}

/* --- Premium 3MWORKS Login Styles --- */

.login-body {
    background: radial-gradient(circle at top right, var(--brand-gradient-end), var(--brand-gradient-start));
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism Header */
.login-header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
}

.login-title-brand {
    font-family: 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 1.1rem;
    color: white;
}

.login-footer {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hero Content */
.landing-hero {
    padding-top: 5vh;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    /* Extra bold */
    background: linear-gradient(90deg, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #cbd5e1;
    /* Slate 300 */
    margin-bottom: 2.5rem;
    font-weight: 300;
    max-width: 600px;
    line-height: 1.6;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 1.5rem;
    color: var(--brand-accent-glow);
    margin-bottom: 0.5rem;
}

.feature-text {
    font-weight: 600;
    color: white;
}

/* Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: white;
}

.glass-card h5 {
    font-weight: 600;
    color: white;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Custom Inputs for Dark Theme */
.input-glass {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    height: 50px;
    padding-left: 15px;
}

.input-glass:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--brand-accent-glow);
    color: white;
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.3);
}

.input-glass::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Premium Button */
.btn-glow {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    padding: 12px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-glow:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
    transform: translateY(-1px);
    color: white;
}

/* --- Main Application Theme --- */

.app-body {
    background-color: #1e293b;
    /* Dark Slate */
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(124, 58, 237, 0.15) 0px, transparent 50%);
    color: #f1f5f9;
    min-height: 100vh;
}

/* Premium Navbar */
.navbar-premium {
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.navbar-premium .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 1.25rem;
    color: white !important;
}

.navbar-premium .nav-link {
    color: #cbd5e1 !important;
    /* Slate 300 */
    font-weight: 500;
    transition: color 0.15s ease;
}

.navbar-premium .nav-link:hover,
.navbar-premium .nav-link.active {
    color: white !important;
    background: rgba(255, 255, 255, 0.05);
    /* Subtle hover bg */
    border-radius: 4px;
}

/* App Glass Card */
.card-app {
    background: rgba(30, 41, 59, 0.7);
    /* Darker semi-transparent */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    overflow: hidden;
}

.card-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: var(--brand-accent-glow);
}

.card-app-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-app-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: white;
}

.card-app-body {
    padding: 1.25rem;
}

/* Dashboard Tiles */
.tile-stat {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    background: linear-gradient(90deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: #94a3b8;
    /* Slate 400 */
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-icon {
    opacity: 0.2;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
}

/* Tables in Premium Theme */
.table-premium {
    color: #e2e8f0;
    margin-bottom: 0;
}

.table-premium thead th {
    background-color: rgba(15, 23, 42, 0.5);
    color: #94a3b8;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
}

.table-premium tbody td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.table-premium tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Main Footer */
.app-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    color: #64748b;
    /* Slate 500 */
    font-size: 0.875rem;
    margin-top: auto;
}

/* --- Form Elements for Dark Theme --- */

/* Floating Labels in Glass Cards */
.card-app .form-floating>.form-control,
.card-app .form-floating>.form-select {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.card-app .form-floating>.form-control:focus,
.card-app .form-floating>.form-select:focus {
    background-color: rgba(0, 0, 0, 0.4);
    border-color: var(--brand-accent-glow);
    color: white;
    box-shadow: 0 0 0 0.25rem rgba(129, 140, 248, 0.25);
}

.card-app .form-floating>label {
    color: rgba(255, 255, 255, 0.6);
}

.card-app .form-floating>.form-control:focus~label,
.card-app .form-floating>.form-control:not(:placeholder-shown)~label,
.card-app .form-floating>.form-select~label {
    color: rgba(255, 255, 255, 0.8);
}

.card-app .form-select option {
    background-color: #1e293b;
    color: white;
}

/* Validation Text */
.card-app .text-danger {
    color: #ff8080 !important;
    /* Lighter red for visibility on dark */
}

/* Headings in App Body */
.app-body h1,
.app-body h2,
.app-body h3,
.app-body h4,
.app-body h5,
.app-body h6 {
    color: white !important;
}

.app-body .text-muted {
    color: #94a3b8 !important;
    /* Slate 400 override */
}

.app-body .text-primary {
    color: #60a5fa !important;
    /* Lighter blue override */
}