/* ==========================================================================
   AccService Manager – Design system
   ========================================================================== */

* {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

:root {
    --asm-header-height: 64px;
    --asm-primary: #0d9488;
    --asm-primary-dark: #0f766e;
    --asm-sidebar-bg: #f5f5f5;
    --asm-sidebar-border: #ebebeb;
    --asm-sidebar-text: #1a1a1a;
    --asm-sidebar-text-muted: #6b7280;
    --asm-sidebar-hover: rgba(13, 148, 136, 0.08);
    --asm-sidebar-active: rgba(13, 148, 136, 0.14);
    --asm-surface: #ffffff;
    --asm-border: #e5e7eb;
    --asm-text: #0f172a;
    --asm-text-muted: #64748b;
    --asm-radius: 12px;
    --asm-radius-sm: 8px;
    --asm-shadow: 0 1px 3px rgba(0,0,0,0.05);
    --asm-shadow-card: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

.mud-theme-dark {
    --asm-sidebar-bg: #1f2937;
    --asm-sidebar-border: #374151;
    --asm-sidebar-text: #f9fafb;
    --asm-sidebar-text-muted: #9ca3af;
    --asm-sidebar-hover: rgba(45, 212, 191, 0.1);
    --asm-sidebar-active: rgba(45, 212, 191, 0.18);
    --asm-surface: #111827;
    --asm-border: #374151;
    --asm-text: #f1f5f9;
    --asm-text-muted: #94a3b8;
    --asm-shadow: 0 1px 3px rgba(0,0,0,0.25);
    --asm-shadow-card: 0 2px 12px rgba(0,0,0,0.3);
}

/* --------------------------------------------------------------------------
   Layout – App shell (sidebar + main)
   Only .app-content scrolls; header and sidebar stay fixed.
   -------------------------------------------------------------------------- */

html, body {
    height: 100%;
    overflow: hidden;
}

.app-shell {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.app-shell.mud-layout {
    height: 100vh !important;
    min-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row !important;
}

/* Left sidebar: fixed width, does not scroll */
.mud-drawer.app-sidebar {
    position: relative !important;
    height: 100vh !important;
    max-height: 100vh !important;
    flex: 0 0 280px !important;
    min-width: 280px !important;
    overflow: hidden !important;
}

/* When drawer is closed: collapse sidebar, main content fills the viewport */
.app-shell.app-drawer-closed .mud-drawer.app-sidebar {
    flex: 0 0 0 !important;
    min-width: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

.app-shell.app-drawer-closed .mud-drawer.app-sidebar .mud-drawer-content {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.mud-drawer.app-sidebar .mud-drawer-content {
    background: var(--asm-sidebar-bg) !important;
    border-right: 1px solid var(--asm-sidebar-border) !important;
    box-shadow: none !important;
    width: 280px !important;
    min-width: 280px !important;
    height: 100% !important;
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Sidebar header: logo on top */
/* Sidebar header: stays visible when nav scrolls (flex-shrink: 0) */
.app-sidebar-header {
    flex-shrink: 0;
    min-height: var(--asm-header-height);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
}

.app-sidebar-brand-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    container-type: inline-size;
    container-name: sidebar-brand;
}

.app-sidebar-organization-name {
    color: var(--asm-primary);
    font-size: clamp(0.6875rem, 5.5cqi, 0.9375rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0.35rem 0.6rem;
    background: rgba(13, 148, 136, 0.18);
    border-radius: 8px;
    border-left: 3px solid var(--asm-primary);
    box-sizing: border-box;
}

.app-brand-sidebar {
    text-decoration: none;
}

.app-brand-sidebar:hover .app-logo-accent {
    color: var(--asm-primary-dark) !important;
}

.app-logo {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.app-logo-accent {
    color: var(--asm-primary);
}

.app-logo-word {
    color: var(--asm-sidebar-text-muted);
}

.app-brand-sidebar .app-logo-accent {
    color: var(--asm-primary) !important;
}

.app-brand-sidebar .app-logo-word {
    color: var(--asm-sidebar-text) !important;
}

.app-brand-sidebar:hover .app-logo-word {
    color: var(--asm-sidebar-text) !important;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.app-logo-icon {
    height: 3.5rem;
    min-width: 3.5rem;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.app-brand-sidebar .app-logo-icon {
    height: 3.125rem;
    min-width: 3.125rem;
}

/* App bars: slightly larger mark than sidebar (icon only; text uses .app-logo rules) */
.app-topbar-logo .app-logo-icon,
.client-portal-appbar .app-logo-icon,
.legal-appbar .app-logo-icon {
    height: 3.75rem;
    min-width: 3.75rem;
}

/* Sidebar nav: menu below logo, same color and style as nav link */
.app-sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.75rem 0.5rem;
}

.app-sidebar-nav-menu {
    padding: 0;
}

.app-sidebar .nav-menu-group-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--asm-primary) !important;
}

.app-sidebar .mud-nav-menu .mud-nav-link,
.app-sidebar .mud-nav-link {
    color: var(--asm-sidebar-text) !important;
    background: transparent !important;
    border-radius: var(--asm-radius-sm);
    margin: 0 0.5rem 2px;
    padding: 0.625rem 1rem;
}

.app-sidebar .mud-nav-link:hover {
    background: var(--asm-sidebar-hover) !important;
    color: var(--asm-primary-dark) !important;
}

.app-sidebar .mud-nav-link.mud-nav-link-active,
.app-sidebar .mud-nav-link.active {
    background: var(--asm-sidebar-active) !important;
    color: var(--asm-primary-dark) !important;
}

.app-sidebar .mud-nav-link .mud-nav-link-icon {
    color: var(--asm-sidebar-text-muted) !important;
}

.app-sidebar .mud-nav-link:hover .mud-nav-link-icon,
.app-sidebar .mud-nav-link.mud-nav-link-active .mud-nav-link-icon {
    color: var(--asm-primary) !important;
}

.app-sidebar .mud-nav-group .mud-nav-group-title {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--asm-sidebar-text-muted) !important;
    padding: 0.5rem 1rem;
    min-height: auto;
}

.app-sidebar .mud-nav-group {
    margin-bottom: 0.25rem;
}

.app-sidebar .mud-nav-group-expand-icon {
    color: var(--asm-sidebar-text-muted) !important;
}

.app-sidebar .mud-divider {
    border-color: var(--asm-sidebar-border) !important;
}

/* User / login section at bottom of sidebar */
.app-sidebar-footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--asm-sidebar-border);
    flex-shrink: 0;
}

.app-sidebar-user {
    background: var(--asm-surface);
    border-radius: var(--asm-radius-sm);
    padding: 0.75rem;
    border: 1px solid var(--asm-sidebar-border);
}

.app-sidebar-user .mud-menu {
    display: block !important;
    width: 100% !important;
}

.app-sidebar-user .mud-card {
    border-radius: var(--asm-radius-sm);
    box-shadow: none !important;
}

.app-sidebar-user .mud-card-header {
    padding: 0 !important;
}

.app-sidebar-user .mud-card-header .mud-avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 0.875rem !important;
}

.app-sidebar-user .mud-card-header-content {
    padding: 0 0 0 0.75rem !important;
}

.app-sidebar-user .mud-typography-body2 {
    font-weight: 600;
    font-size: 0.9375rem;
}

.app-sidebar-user .mud-typography-caption {
    font-size: 0.75rem;
    color: var(--asm-sidebar-text-muted) !important;
}

.app-sidebar-user .mud-chip {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.35rem;
}

.app-sidebar-user .mud-chip:last-child {
    margin-bottom: 0;
}

/* Left sidebar: ensure it starts at top with no gap (MudLayout can add padding) */
.mud-layout .mud-drawer {
    top: 0 !important;
    padding-top: 0 !important;
}

/* Top bar: slim, no heavy white block – hamburger, breadcrumb, language, user */
.app-topbar {
    height: var(--asm-header-height);
    min-height: var(--asm-header-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    background: var(--asm-surface) !important;
    border-bottom: 1px solid var(--asm-border);
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.app-topbar-menu {
    margin-right: 0.5rem;
}

/* Logo and org name in topbar when sidebar is closed (so they stay visible).
   Min-width must fit icon + full org name or the breadcrumb overlaps. */
.app-topbar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 0;
    padding-right: 0;
    container-type: inline-size;
    container-name: topbar-logo;
    flex-shrink: 0;
    min-width: 360px;
    overflow: hidden;
}

/* Vertical divider between logo/org block and breadcrumb (only when sidebar is closed) */
.app-topbar-divider {
    width: 1px;
    height: 1.5rem;
    margin: 0 0.75rem;
    background: var(--asm-border);
    flex-shrink: 0;
    align-self: center;
}

.app-topbar-logo .app-brand {
    text-decoration: none;
}

.app-brand-icon-only {
    gap: 0;
}

.app-topbar-logo .app-logo {
    font-size: 1rem;
}

.app-topbar-organization-name {
    font-size: clamp(0.6875rem, 6cqi, 1rem);
    font-weight: 700;
    color: var(--asm-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 4.5rem;
    max-width: 280px;
    padding: 0.35rem 0.6rem;
    background: rgba(13, 148, 136, 0.12);
    border-radius: 8px;
    border-left: 3px solid var(--asm-primary);
    box-sizing: border-box;
    flex-shrink: 0;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-topbar-actions .trial-ends-header-link {
    color: var(--asm-text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

.app-topbar-actions .trial-ends-header-link:hover {
    color: var(--asm-primary);
}

.app-topbar-actions .mud-icon-button {
    width: 40px !important;
    height: 40px !important;
    padding: 8px !important;
}

.app-topbar-actions .mud-icon-button .mud-icon-root {
    font-size: 1.25rem !important;
}

.app-breadcrumb {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    margin-left: 0;
}

/* MudBreadcrumbs root - allow shrinking so it doesn't overlap the logo */
.app-breadcrumb .mud-breadcrumbs,
.app-breadcrumb-list {
    display: flex;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
    max-width: 100%;
}

.app-breadcrumb-list {
    padding: 0;
}

.app-breadcrumb-list .mud-breadcrumb-item {
    font-size: 0.9375rem;
    color: var(--asm-text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-breadcrumb-list .mud-breadcrumb-item a {
    color: var(--asm-text);
    font-weight: 500;
    text-decoration: none;
}

.app-breadcrumb-list .mud-breadcrumb-item a:hover {
    color: var(--asm-primary);
}

.app-breadcrumb-list .mud-breadcrumb-separator {
    color: var(--asm-text-muted);
    margin: 0 0.35rem;
}

.app-topbar .mud-input-root {
    min-height: 40px;
}

.app-topbar-search-wrap {
    display: flex;
    align-items: center;
}

.app-topbar-search-wrap .app-topbar-search-toggle {
    width: 40px !important;
    height: 40px !important;
    padding: 8px !important;
}

.app-topbar-search-wrap .app-topbar-search-toggle .mud-icon-root {
    font-size: 1.25rem !important;
}

.app-topbar-search-wrap .app-topbar-search {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-width 0.25s ease, opacity 0.2s ease;
}

.app-topbar-search-wrap.expanded .app-topbar-search {
    max-width: 220px;
    opacity: 1;
    pointer-events: auto;
}

.app-topbar-search {
    max-width: 220px;
}

.app-topbar-search .mud-input-slot {
    font-size: 0.875rem;
}

.app-topbar-actions .app-topbar-search .mud-input-root {
    min-height: 40px !important;
}

/* Main content area: flex column, only inner .app-content scrolls */
.app-main {
    background: var(--asm-surface) !important;
    height: 100vh;
    min-height: 0;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    padding-top: 0 !important;
}

/* MudLayout: main content sits flush next to drawer (no extra margin = no white gap) */
.mud-layout .mud-main-content {
    padding-top: 0 !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
}

/* MudBlazor adds margin via drawer container; remove it so no gap between sidebar and main */
.mud-drawer-container,
.mud-drawer-container .mud-main-content {
    margin-left: 0 !important;
}

/* Content wrapper: column so main scrolls and footer stays at bottom */
.app-content-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.app-main .app-content-wrap {
    flex: 1 1 0%;
    min-height: 0;
}

/* Only this main block scrolls; header and sidebar stay fixed */
.app-content {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.75rem 1.5rem;
    background: var(--asm-surface) !important;
}

/* Main layout footer: always visible at bottom of content area */
.app-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1.75rem;
    background: var(--asm-surface) !important;
    border-top: 1px solid var(--asm-border);
    font-size: 0.8125rem;
    color: var(--asm-text-muted);
}

.app-footer-link {
    color: var(--asm-text-muted);
    text-decoration: none;
}

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

.app-footer-sep {
    color: var(--asm-text-muted);
    user-select: none;
}

.app-footer-copyright {
    color: var(--asm-text-muted);
}

/* Right drawer: overlay, only visible when content is set */
.app-right-drawer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
}

.app-right-drawer.open {
    pointer-events: auto;
}

.app-right-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.app-right-drawer.open .app-right-drawer-backdrop {
    opacity: 1;
}

.app-right-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100%;
    background: var(--asm-sidebar-bg) !important;
    border-left: 1px solid var(--asm-sidebar-border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.app-right-drawer.open .app-right-drawer-panel {
    transform: translateX(0);
}

.mud-theme-dark .app-right-drawer-panel {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
}

.app-right-drawer-header {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    border-bottom: 1px solid var(--asm-sidebar-border);
}

.app-right-drawer-close {
    color: var(--asm-sidebar-text-muted) !important;
}

.app-right-drawer-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.25rem;
}

/* --------------------------------------------------------------------------
   Page pattern – Hero (title + subtitle) and cards
   -------------------------------------------------------------------------- */

.page-section {
    padding: 0;
}

.page-hero {
    margin-bottom: 1.5rem;
    padding: 0 0 0.5rem 0;
    border: none;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.page-hero .page-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--asm-text);
    margin-bottom: 0.25rem;
}

.page-hero .page-subtitle {
    font-size: 0.9375rem;
    color: var(--asm-text-muted);
    margin: 0;
}

.page-card {
    border-radius: var(--asm-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--asm-border) !important;
    box-shadow: var(--asm-shadow-card) !important;
    background: var(--mud-palette-surface) !important;
}

/* Legacy alias */
.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.9375rem;
    opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Legal layout (public pages: Privacy, Terms – no main app layout)
   -------------------------------------------------------------------------- */

.legal-shell {
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.legal-appbar {
    flex-shrink: 0;
    min-height: 56px;
    padding: 0 16px;
    background: var(--asm-surface) !important;
    border-bottom: 1px solid var(--asm-border);
    color: var(--asm-text);
    justify-content: center;
}

.legal-appbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.legal-appbar .legal-back {
    margin-right: 4px;
}

.legal-main {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: var(--mud-palette-background, #f5f5f5);
    padding-top: 16px;
}

/* --------------------------------------------------------------------------
   Legal documents (Privacy, Terms of Service)
   -------------------------------------------------------------------------- */

.legal-doc .content-card {
    overflow: visible;
    margin-left: auto;
    margin-right: auto;
}

.legal-doc-header {
    padding: 1.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid var(--asm-border);
    margin-bottom: 1rem;
    text-align: center;
}

.legal-doc-title {
    font-weight: 600;
    color: var(--asm-text);
    margin-bottom: 0.25rem;
}

.legal-doc-body {
    padding: 0 1.5rem 1.5rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.page-section.legal-doc {
    padding: 1.5rem 1rem 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.legal-doc-intro {
    line-height: 1.65;
    color: var(--asm-text);
    margin-bottom: 1.5rem;
}

.legal-doc-section {
    margin-bottom: 1.5rem;
}

.legal-doc-section .legal-doc-heading {
    font-weight: 600;
    color: var(--asm-text);
    margin-bottom: 0.25rem;
}

.legal-doc-section .mud-typography-body1 {
    line-height: 1.65;
    color: var(--asm-text);
}

/* --------------------------------------------------------------------------
   List / Table template
   -------------------------------------------------------------------------- */

.content-card {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border) !important;
    box-shadow: var(--asm-shadow-card) !important;
    overflow: hidden;
    background: var(--mud-palette-surface) !important;
}

.client-view-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.data-table .mud-table-container {
    border: none;
}

.data-table .mud-table {
    box-shadow: none !important;
}

.data-table .mud-table-head .mud-table-row {
    background: var(--asm-surface) !important;
    border-bottom: 2px solid var(--asm-border);
}

.data-table .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--asm-text-muted);
}

.data-table .mud-table-body .mud-table-row {
    transition: background 0.15s ease;
    cursor: pointer;
}

.data-table .mud-table-body .mud-table-row:hover {
    background: var(--asm-sidebar-hover) !important;
}

.data-table .mud-table-cell {
    padding: 0.875rem 16px;
    font-size: 0.9375rem;
}

.data-table .row-actions-cell {
    cursor: default;
}

.data-table .mud-table-toolbar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--asm-border);
    min-height: 56px;
}

.data-table .mud-table-pagination {
    border-top: 1px solid var(--asm-border);
    padding: 0.5rem 1rem;
}

/* Clients list: narrow status chips, pipeline gets width, compact secondary cells */
.data-table.clients-table .clients-th-nowrap {
    white-space: nowrap;
}

.data-table.clients-table .clients-th-first {
    min-width: 6.75rem;
}

.data-table.clients-table .clients-th-last {
    min-width: 7rem;
}

.data-table.clients-table .clients-th-business {
    min-width: 8.75rem;
}

.data-table.clients-table .clients-th-email {
    min-width: 9rem;
}

.data-table.clients-table .clients-th-status {
    width: 1%;
    min-width: 9.75rem;
}

.data-table.clients-table .clients-th-pipeline {
    min-width: 10rem;
}

.data-table.clients-table .clients-th-actions {
    width: 1%;
    white-space: nowrap;
}

.data-table.clients-table .clients-td-compact {
    font-size: 0.8125rem;
    line-height: 1.35;
}

.data-table.clients-table .clients-td-status {
    width: 1%;
    min-width: 9.75rem;
    vertical-align: top;
    padding-left: 10px;
    padding-right: 10px;
}

.data-table.clients-table .clients-td-pipeline {
    min-width: 10rem;
    vertical-align: top;
}

.data-table.clients-table .clients-td-actions {
    width: 1%;
    white-space: nowrap;
    vertical-align: top;
}

.data-table.clients-table .clients-status-stack {
    align-items: flex-start;
}

.data-table.clients-table .clients-status-text {
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}

.data-table.clients-table .clients-pipeline-lines .mud-typography {
    line-height: 1.35;
}

/* --------------------------------------------------------------------------
   Account / Login layout
   -------------------------------------------------------------------------- */

/* Account layout: align with main app (app-topbar, app-content) */
/* Client upload link layout: no nav, no header – only the upload form */
.client-upload-layout {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.client-upload-layout.mud-layout {
    display: flex;
    flex-direction: column;
}

.client-upload-main {
    flex: 1;
    min-height: 0;
    background: var(--asm-surface) !important;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* --------------------------------------------------------------------------
   Account / Login layout
   -------------------------------------------------------------------------- */

.account-shell {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.account-shell-no-header .account-main {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, var(--mud-palette-background, #f5f5f5) 0%, var(--mud-palette-surface, #fff) 100%) !important;
}

.account-appbar {
    height: var(--asm-header-height);
    min-height: var(--asm-header-height);
    padding: 0 1rem;
    background: var(--asm-surface) !important;
    border-bottom: 1px solid var(--asm-border);
    color: var(--asm-text);
}

.account-appbar .mud-icon-button {
    color: var(--asm-text-muted);
}

.account-main {
    flex: 1;
    min-height: 0;
    background: var(--asm-surface) !important;
    display: flex;
    flex-direction: column;
}

.account-content-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1.75rem 3rem;
}

.account-content {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.account-dialog-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.account-dialog-logo {
    height: 4.5rem;
    min-width: 4.5rem;
    width: auto;
    object-fit: contain;
    display: block;
}

.account-dialog-organization-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--asm-primary);
    text-align: center;
    padding: 0.25rem 0.5rem;
    background: rgba(13, 148, 136, 0.12);
    border-radius: 6px;
    border-left: 3px solid var(--asm-primary);
    box-sizing: border-box;
    max-width: 100%;
}

.account-paper.form-card {
    width: 100%;
    padding: 1.5rem 1.75rem 1.25rem !important;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--asm-border);
    background: var(--mud-palette-surface, #fff);
}

.account-footer-inside {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--asm-border);
    margin-bottom: 0;
}

.account-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem 0.75rem;
    text-align: center;
}

.account-footer-link {
    font-size: 0.875rem;
    color: var(--asm-text-muted);
    text-decoration: none;
}

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

.account-footer-sep {
    margin: 0 0.5rem;
    color: var(--asm-text-muted);
}

/* Login form */
.login-form {
    padding: 0;
}

.login-header {
    margin-bottom: 1rem;
}

.login-title {
    font-weight: 600;
    color: var(--asm-text);
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
}

.login-subtitle {
    color: var(--asm-text-muted);
    margin: 0;
}

.login-link {
    font-weight: 500;
    text-decoration: none;
}

.login-link:hover {
    text-decoration: underline;
}

.login-demo-panel {
    border: 1px solid var(--asm-border);
    border-radius: var(--asm-radius-sm);
    margin: 0.25rem 0 0.5rem;
}

.login-demo-panel .mud-expansion-panel {
    border: none !important;
}

.login-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.login-submit {
    margin-top: 0.25rem;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 0.5rem;
}

.login-divider-line {
    flex: 1;
}

.login-divider-text {
    color: var(--asm-text-muted);
    text-transform: lowercase;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.login-external {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-validation {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-error);
}

/* External login buttons: stacked, full width, consistent with app */
.account-content .external-login {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 1rem;
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--asm-radius-sm);
    color: #fff !important;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.account-content .external-login:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.account-content .external-login-icon {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Form template
   -------------------------------------------------------------------------- */

.form-card {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border) !important;
    box-shadow: var(--asm-shadow-card) !important;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--mud-palette-surface) !important;
}

.form-card .mud-input-control {
    margin-bottom: 0.25rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--asm-border);
}

/* --------------------------------------------------------------------------
   Dashboard / grid cards
   -------------------------------------------------------------------------- */

.dashboard-card {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border) !important;
    box-shadow: var(--asm-shadow-card) !important;
    padding: 1.25rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--mud-palette-surface) !important;
}

.dashboard-card:hover {
    border-color: var(--asm-primary) !important;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12) !important;
}

.dashboard-card .mud-icon-root {
    opacity: 0.9;
}

/* Plan selection cards (subscription) */
.plan-card {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border) !important;
    box-shadow: var(--asm-shadow-card) !important;
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--mud-palette-surface) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plan-card:hover {
    border-color: var(--asm-primary) !important;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12) !important;
}

.plan-card.plan-card-featured {
    border-color: var(--asm-primary) !important;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15) !important;
}

.plan-card .plan-name {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.plan-card .plan-description {
    font-size: 0.9375rem;
    color: var(--asm-text-muted);
    margin-bottom: 1.25rem;
}

.plan-card .plan-features {
    flex: 1;
    margin-bottom: 1.5rem;
}

.trial-banner {
    border-radius: 0;
    margin-bottom: 0;
}

.dashboard-stat {
    min-width: 2rem;
    justify-content: center;
}

/* Dashboard insight page (greeting + KPIs + summary) */
.dashboard-insight .dashboard-hero {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border);
    background: linear-gradient(135deg, var(--mud-palette-surface) 0%, var(--mud-palette-background) 100%);
}

.dashboard-insight .dashboard-greeting {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--asm-text);
}

/* Dashboard KPI stat cards (display-only, no link) */
.dashboard-insight .dashboard-kpi {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border) !important;
    background: var(--mud-palette-surface) !important;
    box-shadow: var(--asm-shadow-card) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-insight .dashboard-kpi-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--asm-radius);
    background: rgba(13, 148, 136, 0.12);
    color: var(--asm-primary);
}

.mud-theme-dark .dashboard-insight .dashboard-kpi-icon-wrap {
    background: rgba(45, 212, 191, 0.15);
}

.dashboard-insight .dashboard-kpi-value {
    font-weight: 700;
    color: var(--asm-text);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.dashboard-insight .dashboard-summary-card {
    border-radius: var(--asm-radius);
    border: 1px solid var(--asm-border);
}

/* --------------------------------------------------------------------------
   Utility & overrides
   -------------------------------------------------------------------------- */

.full-width {
    width: 100%;
}

/* Validation */
.validation-message {
    color: #f44336;
    font-size: .8rem;
    margin: 3px 0 0;
    text-align: start;
    font-weight: 400;
    line-height: 1.66;
    letter-spacing: .03333em;
}

/* MudBlazor overrides */
.mud-snackbar-location-bottom-left {
    bottom: 50px !important;
}

.mud-snackbar-location-bottom-right {
    bottom: 50px !important;
}

.mud-progress-linear {
    margin: 0 !important;
}

/* App branding in header */
.app-brand {
    text-decoration: none;
    color: inherit;
}

.app-brand:hover {
    color: inherit;
    opacity: 0.9;
}

/* External Login Buttons */
.external-login {
    display: flex;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 5px;
    height: 40px;
    padding: 0 16px;
    font-size: 16px;
    text-decoration: none;
    border-radius: 4px;
    color: #fff;
    transition: background-color 0.3s;
}

.external-login-icon {
    background-repeat: no-repeat;
    background-size: contain;
    width: 35px;
    height: 35px;
    margin-right: 8px;
}

.microsoft-external-login {
    background-color: #2F2F2F;
}

.microsoft-external-login-icon {
    background-image: url('../assets/icons/external-auth/auth-microsoft.png');
}

.google-external-login {
    background-color: #4285F4;
}

.google-external-login-icon {
    background-image: url('../assets/icons/external-auth/auth-google.png');
}

.twitter-external-login {
    background-color: #1DA1F2;
}

.twitter-external-login-icon {
    background-image: url('../assets/icons/external-auth/auth-twitter.png');
}

.linkedin-external-login {
    background-color: #0A66C2;
}

.linkedin-external-login-icon {
    background-image: url('../assets/icons/external-auth/auth-linkedin.png');
}

.facebook-external-login {
    background-color: #1877F2;
}

.facebook-external-login-icon {
    background-image: url('../assets/icons/external-auth/auth-facebook.png');
}

/* --------------------------------------------------------------------------
   Client portal – header + tabs, no nav menu
   -------------------------------------------------------------------------- */

.client-portal-layout .client-portal-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.client-portal-appbar {
    flex-shrink: 0;
}

.client-portal-appbar-left {
    min-width: 0;
}

.client-portal-appbar-title {
    min-width: 0;
}

.client-portal-tenant-name {
    color: var(--mud-palette-text-secondary, rgba(0,0,0,0.6));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.client-portal-client-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.client-portal-appbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.client-portal-breadcrumb-wrap {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--mud-palette-background, #f5f5f5);
    border-bottom: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.12));
}

.client-portal-breadcrumb {
    padding: 0;
}

.client-portal-breadcrumb .mud-breadcrumb-item {
    font-size: 0.875rem;
}

.client-portal-tabs-wrap {
    flex-shrink: 0;
    border-radius: 0;
    background: var(--mud-palette-surface, #fff);
    border-bottom: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.12));
}

.client-portal-tabs-wrap .mud-tabs {
    min-height: 48px;
}

.client-portal-tabs-wrap .mud-tabs-toolbar {
    min-height: 48px;
    padding: 0 8px;
}

.client-portal-tabs-wrap .mud-tabs-panels {
    display: none !important;
}

.client-portal-tab-panel-hidden {
    display: none !important;
}

.client-portal-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.client-portal-home {
    width: 100%;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.client-portal-home-cards {
    width: 100%;
}

.client-portal-home-cards .client-portal-dashboard-card {
    min-height: 120px;
}

.client-portal-dashboard-card {
    border-radius: var(--mud-default-borderradius, 8px);
    height: 100%;
}

/* Firm notification preferences matrix (settings) */
.notification-preferences-matrix-wrap {
    overflow-x: auto;
    border: 1px solid var(--asm-border);
    border-radius: var(--asm-radius);
    background: var(--mud-palette-surface);
}

.notification-preferences-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.notification-preferences-matrix th,
.notification-preferences-matrix td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--asm-border);
    vertical-align: middle;
}

.notification-preferences-matrix thead th {
    font-weight: 600;
    color: var(--asm-text-muted);
    background: var(--asm-surface);
    position: sticky;
    top: 0;
    z-index: 2;
}

.notification-preferences-matrix-sticky-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--mud-palette-surface);
    min-width: 12rem;
    max-width: 16rem;
    box-shadow: 4px 0 8px -4px rgba(0, 0, 0, 0.08);
}

.notification-preferences-matrix-user-col {
    min-width: 6.5rem;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.notification-preferences-matrix-check {
    text-align: center;
}

.notification-client-portal-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 36rem;
}
