/*
  Customer 365 modern theme: shell, buttons, forms, lists, dashboard, dialogs.
  Loaded only when Web.config ModernTheme=Y. Everything is scoped under body.c365-modern so it wins over
  the legacy hd-style rules without !important wars, and a site with the flag off is untouched.
  Colours: brand and surface colours only come from var(--c365-*) (tokens.css + the central theme block).
  The only literal colours here are neutral black/white alphas for shadows and overlays.

  Breakpoints:  < 768px phone (bottom tab bar)   768-991px tablet (icon rail)   >= 992px desktop (full menu)
*/

/* ---------- base ---------- */
body.c365-modern {
    display: block;
    min-height: 100vh;
    background: var(--c365-bg);
    color: var(--c365-ink);
    font-family: var(--c365-font);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}
.c365-modern a { color: var(--c365-brand-text); }
.c365-modern :focus-visible { outline: 2px solid var(--c365-brand-text); outline-offset: 2px; }
.c365-modern h1, .c365-modern h2, .c365-modern h3, .c365-modern h4 { font-family: inherit; color: var(--c365-ink); font-weight: 600; letter-spacing: -.01em; }
.c365-modern hr { border-color: var(--c365-line); }

/* ---------- header ---------- */
.c365-modern .hd-header {
    position: sticky;
    top: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--c365-header-h);
    padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
    background: var(--c365-header-bg);
    color: var(--c365-header-ink);
    border-bottom: 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 2px 10px rgba(20, 16, 28, .10);
}
.c365-modern .hd-brand,
.c365-modern .hd-brand-image {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    min-width: 0;
    text-align: left;
    color: inherit;
}
.c365-modern .hd-brand-image a { display: block; flex: none; line-height: 0; }
.c365-modern .hd-brand-image img { height: 30px; max-height: 30px; width: auto; max-width: 180px; }
.c365-modern .p_welcomenote { margin: 0; min-width: 0; }
.c365-modern .hd-brand-image .lbl_welcomenote {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: inherit;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.c365-modern .hd-back-button { width: 36px; height: 36px; margin: 0 -6px 0 -8px; display: none; align-items: center; justify-content: center; border-radius: 50%; }
.c365-modern .hd-menu-button { display: none; }
.c365-modern .announcementBar:empty { display: none; }
.c365-modern .announcementBar { background: var(--c365-ok-bg); color: var(--c365-ok) !important; padding: 8px 20px; }

/* ---------- layout: menu + content ---------- */
.c365-modern .hd-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    flex: none;
    min-height: calc(100vh - var(--c365-header-h));
    margin: 0;
}

/* ---------- side menu ---------- */
.c365-modern .hd-menu {
    display: block !important;      /* legacy JS slideToggle writes inline display */
    position: sticky;
    top: var(--c365-header-h);
    align-self: start;
    width: var(--c365-menu-w);
    height: calc(100vh - var(--c365-header-h));
    min-height: 0;
    overflow-y: auto;
    flex: none;
    padding: 14px 10px;
    background: var(--c365-menu-bg);
    color: var(--c365-menu-ink);
    transition: width .16s ease;
}
.c365-modern .hd-menu .hd-user {
    margin: 0 0 10px;
    padding: 6px 10px 14px;
    border-bottom: 1px solid var(--c365-menu-active);
    color: var(--c365-menu-strong);
    font-weight: 600;
    white-space: normal;
    overflow: hidden;
}
.c365-modern .hd-menu .hd-user:empty,
.c365-modern .hd-menu .hd-user.c365-empty { display: none; }
.c365-modern .hd-menu .hd-user span + span { display: block; font-weight: 400; font-size: 12.5px; color: var(--c365-menu-ink); }
.c365-modern .hd-menu .hd-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; }
.c365-modern .hd-menu .hd-nav li { margin: 0; padding: 0; list-style: none; }
.c365-modern .hd-menu .hd-nav li .hdm-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--c365-radius-sm);
    color: var(--c365-menu-ink);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
.c365-modern .hd-menu .hd-nav li .hdm-nav-link i { flex: none; width: 20px; margin: 0; text-align: center; font-size: 16px; }
/* legacy rule paints every span inside the item; keep the highlight on the link only */
.c365-modern .hd-menu .hd-nav li span:hover,
.c365-modern .hd-menu .hd-nav li.active span { background: transparent; color: inherit; }
.c365-modern .hd-menu .hd-nav li .hdm-nav-link:hover,
.c365-modern .hd-menu .hd-nav li.active .hdm-nav-link {
    background: var(--c365-menu-active);
    color: var(--c365-menu-strong);
}
.c365-modern .hd-menu .hd-nav li.active .hdm-nav-link { box-shadow: inset 3px 0 0 var(--c365-menu-strong); }
.c365-modern .hd-menu .hdm-nav-item-text { display: block; padding: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c365-modern .hd-menu #hdm-menu-collapse-button { color: var(--c365-menu-ink); opacity: .75; }
.c365-modern .hd-menu .fa-chevron-circle-right { display: none; }
.c365-modern .hd-menu #ctl00_collapseButton,
.c365-modern .hd-menu li[id$="collapseButton"] { display: block; margin-top: 10px; }
.c365-modern .hd-menu li.c365-more { display: none; }

/* collapsed (button) */
.c365-modern .hd-menu.collapsed { width: var(--c365-menu-w-collapsed); flex: none; }
.c365-modern .hd-menu.collapsed .hd-user,
.c365-modern .hd-menu.collapsed .hdm-nav-item-text,
.c365-modern .hd-menu.collapsed .fa-chevron-circle-left { display: none; }
.c365-modern .hd-menu.collapsed .fa-chevron-circle-right { display: block !important; }
.c365-modern .hd-menu.collapsed .hdm-nav-link { justify-content: center; }

/* ---------- content ---------- */
.c365-modern .hd-content {
    flex: none;
    min-width: 0;
    padding: 24px 28px 40px;
    background: transparent;
    overflow: visible;
    overflow-x: auto;
}
.c365-modern .hd-content > br:first-child,
.c365-modern .hd-content > span:empty + br { display: none; }

.c365-modern .hdo-main-content-header {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px 14px;
    margin: 0 0 20px;
    padding: 14px 18px;
    background: var(--c365-surface);
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
}
.c365-modern .hdo-main-content-header-title { font-size: 19px; font-weight: 600; color: var(--c365-ink); }
.c365-modern .hdo-main-content-header .hd-search { margin: 0; display: flex; flex-flow: row wrap; align-items: center; gap: 8px; flex: 1 1 auto; }
.c365-modern .hdo-main-content-header .hd-search > div[style*="float"] { float: none !important; order: 99; margin-left: auto; }
.c365-modern .VIEWBOXCAPTIONlarge { display: inline-block; margin: 4px 0 10px; font-size: 16px; font-weight: 600; color: var(--c365-ink); }
.c365-modern .hdo-title-caption { font-weight: 600; color: var(--c365-ink); }

/* ---------- footer ---------- */
.c365-modern .hd-footer {
    padding: 14px 20px;
    background: transparent;
    color: var(--c365-muted);
    font-size: 12.5px;
    text-align: center;
    border-top: 1px solid var(--c365-line);
}
.c365-modern .hd-footer p { margin: 0; }
.c365-modern .hd-footer a { color: inherit; text-decoration: underline; }

/* ---------- buttons ---------- */
.c365-modern .hda-btn,
.c365-modern .hd-content input[type="submit"],
.c365-modern .hd-content .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 38px;
    margin: 0;
    padding: 8px 15px;
    border: 1px solid var(--c365-line-strong);
    border-radius: var(--c365-radius-sm);
    background: var(--c365-surface);
    color: var(--c365-ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.2;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .12s, border-color .12s;
}
.c365-modern .hda-btn .fa, .c365-modern .hda-btn i { padding: 0 !important; margin: 0; }
.c365-modern .hda-btn:hover,
.c365-modern .hd-content .btn:hover { background: var(--c365-surface-2); border-color: var(--c365-muted); color: var(--c365-ink); }
.c365-modern .hda-btn-primary,
.c365-modern .hd-content input[type="submit"],
.c365-modern .hd-content .btn-primary,
.c365-modern .hdo-dialog-footer .hda-btn-primary {
    background: var(--c365-brand);
    border-color: var(--c365-brand);
    color: var(--c365-brand-ink) !important;
}
.c365-modern .hda-btn-primary span { color: inherit; }
.c365-modern .hda-btn-primary:hover,
.c365-modern .hda-btn-primary:focus,
.c365-modern .hd-content input[type="submit"]:hover,
.c365-modern .hd-content .btn-primary:hover,
.c365-modern a.bg-primary:hover,
.c365-modern button.bg-primary:hover {
    background: var(--c365-brand-hover) !important;
    border-color: var(--c365-brand-hover);
    color: var(--c365-brand-ink) !important;
}
.c365-modern .hda-btn-secondary,
.c365-modern .hdo-dialog-footer .hda-btn-secondary {
    background: var(--c365-surface);
    border-color: var(--c365-line-strong);
    color: var(--c365-ink) !important;
}
.c365-modern .hda-btn-secondary:hover { background: var(--c365-surface-2) !important; border-color: var(--c365-muted); color: var(--c365-ink) !important; }
.c365-modern .hda-btn-danger { background: var(--c365-danger); border-color: var(--c365-danger); color: var(--c365-surface) !important; }
.c365-modern .hda-btn-icon, .c365-modern .hda-btn-back { width: 38px; min-width: 38px; padding: 0; }
.c365-modern .bg-primary { background-color: var(--c365-brand) !important; color: var(--c365-brand-ink); }
.c365-modern .text-primary { color: var(--c365-brand-text) !important; }

/* ---------- form fields ---------- */
.c365-modern .hd-content input[type="text"],
.c365-modern .hd-content input[type="password"],
.c365-modern .hd-content input[type="email"],
.c365-modern .hd-content input[type="search"],
.c365-modern .hd-content input[type="tel"],
.c365-modern .hd-content input[type="url"],
.c365-modern .hd-content input[type="number"],
.c365-modern .hd-content input[type="date"],
.c365-modern .hd-content input[type="time"],
.c365-modern .hd-content select,
.c365-modern .hd-content textarea,
.c365-modern .hdo-dialog input[type="text"],
.c365-modern .hdo-dialog input[type="password"],
.c365-modern .hdo-dialog select,
.c365-modern .hdo-dialog textarea {
    height: auto;
    min-height: 38px;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid var(--c365-line-strong);
    border-radius: var(--c365-radius-sm);
    background-color: var(--c365-surface);
    color: var(--c365-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: none;
}
.c365-modern .hd-content select, .c365-modern .hdo-dialog select { padding-right: 28px; cursor: pointer; }
.c365-modern .hd-content textarea { min-height: 96px; }
.c365-modern .hd-content input:focus,
.c365-modern .hd-content select:focus,
.c365-modern .hd-content textarea:focus,
.c365-modern .hdo-dialog input:focus,
.c365-modern .hdo-dialog select:focus,
.c365-modern .hdo-dialog textarea:focus {
    border-color: var(--c365-brand-text);
    outline: 2px solid var(--c365-brand-soft);
    outline-offset: 0;
}
.c365-modern .hd-content input[type="file"] { border: 1px dashed var(--c365-line-strong); border-radius: var(--c365-radius-sm); padding: 8px; background: var(--c365-surface-2); }
.c365-modern .hd-content label { color: var(--c365-ink); font-size: 14px; font-weight: 500; }
.c365-modern .hd-content ::placeholder { color: var(--c365-muted); opacity: 1; }

/* ---------- cards used by existing pages ---------- */
.c365-modern .hdm-standard-table,
.c365-modern .hdp-dashboard-stats,
.c365-modern .hdp-dashboard-list {
    background: var(--c365-surface);
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
}
.c365-modern .hdm-standard-table { margin: 0 0 20px; padding: 18px; }

/* ---------- dashboard ---------- */
.c365-modern .hdp-dashboard { display: block; padding: 0; }
.c365-modern .hdp-dashboard-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin: 0 0 20px;
}
.c365-modern .hdp-dashboard-overview .hd-item {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 16px 18px;
    background: var(--c365-surface);
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
}
.c365-modern .hdp-dashboard-overview .hd-item .hd-title { font-size: 13px; color: var(--c365-muted); font-weight: 500; }
.c365-modern .hdp-dashboard-overview .hd-item .hd-number { margin: 2px 0 8px; font-size: 30px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c365-ink); }
.c365-modern .hdp-dashboard-overview .hd-item .hd-border { margin: 0 0 10px; padding: 0; border-bottom-color: var(--c365-line); }
.c365-modern .hdp-dashboard-overview .hd-item .hd-percent { font-size: 13px; color: var(--c365-muted); }
.c365-modern .hdp-dashboard-stats, .c365-modern .hdp-dashboard-list { margin: 0 0 20px; padding: 18px; }
.c365-modern .hdp-dashboard-stats h2, .c365-modern .hdp-dashboard-list h2 { font-size: 16px; margin: 0 0 14px; }

/* ---------- lists: legacy flex list (pages not yet on PortalList) ---------- */
.c365-modern .hdm-table-list {
    background: var(--c365-surface);
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
    overflow: hidden;
}
.c365-modern .hdm-table-list .hdm-table-item,
.c365-modern .hdm-table-list .hdm-table-item-header {
    border: 0;
    border-bottom: 1px solid var(--c365-line);
    padding: 2px 8px;
    color: var(--c365-ink);
}
.c365-modern .hdm-table-list .hdm-table-item:last-child { border-bottom: 0; }
.c365-modern .hdm-table-list .hdm-table-item .hdm-table-col,
.c365-modern .hdm-table-list .hdm-table-item-header .hdm-table-col { font-size: 13.5px; margin: 9px 8px; }
.c365-modern .hdm-table-list .hdm-table-item-header {
    background: var(--c365-surface-2);
    color: var(--c365-muted);
    font-weight: 600;
}
.c365-modern .hdm-table-list .hdm-table-item-header .hdm-table-col { font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; }
.c365-modern .hdm-table-list .hdm-table-item:hover { background: var(--c365-surface-2); text-decoration: none; }
.c365-modern .hd-status-index { color: var(--c365-muted); font-size: 12.5px; }

/* ---------- lists: PortalList (server rendered table, cards on phones) ---------- */
.c365-modern .c365-list {
    margin: 0 0 20px;
    background: var(--c365-surface);
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
    overflow: hidden;
}
.c365-modern .c365-list-scroll { overflow-x: auto; }
.c365-modern .c365-list table { width: 100%; margin: 0; border-collapse: collapse; }
.c365-modern .c365-list th {
    padding: 10px 14px;
    background: var(--c365-surface-2);
    border-bottom: 1px solid var(--c365-line);
    color: var(--c365-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}
.c365-modern .c365-list th a { color: inherit; text-decoration: none; }
.c365-modern .c365-list th a:hover { color: var(--c365-ink); }
.c365-modern .c365-list th .c365-sort { margin-left: 4px; color: var(--c365-brand-text); }
.c365-modern .c365-list td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--c365-line);
    vertical-align: middle;
    font-size: 14px;
}
.c365-modern .c365-list tbody tr:last-child td { border-bottom: 0; }
.c365-modern .c365-list tbody tr.c365-row-link { cursor: pointer; }
.c365-modern .c365-list tbody tr.c365-row-link:hover { background: var(--c365-surface-2); }
.c365-modern .c365-list td a { text-decoration: none; font-weight: 600; }
.c365-modern .c365-list td.c365-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c365-modern .c365-list td.c365-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.c365-modern .c365-list tr[class*="c365-status"] td:first-child { box-shadow: inset 4px 0 0 var(--c365-row-status, transparent); }
.c365-modern .c365-list .c365-status0 { --c365-row-status: var(--c365-status0); }
.c365-modern .c365-list .c365-status1 { --c365-row-status: var(--c365-status1); }
.c365-modern .c365-list .c365-status2 { --c365-row-status: var(--c365-status2); }
.c365-modern .c365-list .c365-status3 { --c365-row-status: var(--c365-status3); }
.c365-modern .c365-list .c365-status4 { --c365-row-status: var(--c365-status4); }
.c365-modern .c365-list .c365-status5 { --c365-row-status: var(--c365-status5); }
.c365-modern .c365-list .c365-status6 { --c365-row-status: var(--c365-status6); }
.c365-modern .c365-list .c365-status7 { --c365-row-status: var(--c365-status7); }
.c365-modern .c365-list .c365-status8 { --c365-row-status: var(--c365-status8); }
.c365-modern .c365-list .c365-status9 { --c365-row-status: var(--c365-status9); }
.c365-modern .c365-list .c365-status10 { --c365-row-status: var(--c365-status10); }
.c365-modern .c365-list-empty { padding: 28px 18px; text-align: center; color: var(--c365-muted); }
.c365-modern .c365-pager {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid var(--c365-line);
    color: var(--c365-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.c365-modern .c365-pager .c365-pager-info { margin-right: auto; }
.c365-modern .c365-pager a,
.c365-modern .c365-pager span.c365-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius-sm);
    color: var(--c365-ink);
    text-decoration: none;
}
.c365-modern .c365-pager a:hover { background: var(--c365-surface-2); }
.c365-modern .c365-pager span.c365-page.c365-current { background: var(--c365-brand-soft); border-color: transparent; color: var(--c365-brand-text); font-weight: 600; }
.c365-modern .c365-pager span.c365-page.c365-disabled { opacity: .45; }

/* ---------- dialogs ----------
   One look for every dialog: native <dialog class="hdo-dialog"> (account details, case detail, log case)
   and Bootstrap .modal (product support, application, quote signature).
   Same width, header, close button, body, footer and button order everywhere.
   The main action in a footer is the button with an id (or the only button); a plain close / No button stays outlined. */
.c365-modern .hdo-dialog,
.c365-modern .modal-content {
    border: 1px solid var(--c365-line);
    border-radius: 14px;
    background: var(--c365-surface);
    color: var(--c365-ink);
    box-shadow: 0 18px 50px rgba(20, 16, 28, .28);
    overflow: hidden;
}
.c365-modern .hdo-dialog {
    width: 500px;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px);
}
.c365-modern .hdo-dialog.hdo-dialog-wide { width: 980px !important; }
.c365-modern .hdo-dialog.hdo-dialog-lg { width: 880px; height: 710px; }
.c365-modern .hdo-dialog.hdo-dialog-status { width: 340px; }
.c365-modern .hdo-dialog::backdrop { background: rgba(20, 16, 28, .5); }
.c365-modern .modal-backdrop { background-color: rgb(20, 16, 28); }
.c365-modern .modal-backdrop.show { opacity: .5; }
.c365-modern .modal-dialog,
.c365-modern .modal-dialog.modal-sm {
    display: flex;
    align-items: center;
    width: calc(100vw - 32px);
    max-width: 500px;
    min-height: calc(100% - 32px);
    margin: 16px auto;
}
.c365-modern .modal-dialog.modal-lg { max-width: 880px; }
.c365-modern .modal-content { width: 100%; max-height: calc(100vh - 32px); }

.c365-modern .hdo-dialog-header,
.c365-modern .modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--c365-line);
    border-radius: 0;
    background: var(--c365-brand-soft);
}
.c365-modern .hdo-dialog-header > div { flex: 1 1 auto; min-width: 0; }
.c365-modern .hdo-dialog-header .hdo-title-caption,
.c365-modern .modal-header .modal-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    color: var(--c365-brand-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
}
.c365-modern .hdo-dialog-header h6.modal-title { font-size: 13px; font-weight: 400; color: var(--c365-muted); }
.c365-modern .hdo-dialog-close,
.c365-modern .modal-header .close {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    float: none;
    width: 32px;
    height: 32px;
    margin: -4px -6px -4px auto;
    padding: 0 0 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--c365-muted);
    font-size: 24px !important;
    font-weight: 400;
    line-height: 1;
    opacity: 1;
    text-shadow: none;
    cursor: pointer;
}
.c365-modern .hdo-dialog-close:hover,
.c365-modern .modal-header .close:hover { background: var(--c365-surface); color: var(--c365-ink); opacity: 1; }
.c365-modern .hdo-dialog-close:focus-visible,
.c365-modern .modal-header .close:focus-visible { outline: 2px solid var(--c365-brand); outline-offset: 1px; }

.c365-modern .hdo-dialog-body,
.c365-modern .modal-body {
    flex: 1 1 auto;
    padding: 18px;
    overflow: auto;
    color: var(--c365-ink);
    font-size: 14px;
    line-height: 1.5;
}
.c365-modern .hdo-dialog-body fieldset,
.c365-modern .modal-body fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
/* field captions inside a dialog */
.c365-modern .hdo-dialog-body fieldset p,
.c365-modern .hdo-dialog-body fieldset > span,
.c365-modern .hdo-dialog-body label,
.c365-modern .modal-body label,
.c365-modern .modal-body .hdo-title-caption {
    display: block;
    margin: 0 0 6px !important;
    color: var(--c365-ink);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}
.c365-modern .hdo-dialog-body fieldset p:not(:first-child) { margin-top: 14px !important; }
.c365-modern .hdo-dialog-body textarea,
.c365-modern .modal-body textarea { display: block; width: 100% !important; min-height: 150px; }
.c365-modern .modal-body table { width: 100%; }
.c365-modern .hdo-dialog-body input[type="file"],
.c365-modern .modal-body input[type="file"] { display: block; width: 100%; }

.c365-modern .hdo-dialog-footer,
.c365-modern .modal-footer {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--c365-line);
    border-radius: 0;
    background: var(--c365-dialog-footer);
}
.c365-modern .modal-footer > * { margin: 0; }
.c365-modern .hdo-dialog-footer .hda-btn,
.c365-modern .modal-footer .hda-btn,
.c365-modern .modal-footer .btn { min-width: 96px; margin: 0; justify-content: center; text-align: center; }
/* the main action is filled with the brand colour; No / Close stay outlined and sit to its left */
.c365-modern .hdo-dialog-footer .hda-btn[id],
.c365-modern .hdo-dialog-footer .hda-btn:only-child,
.c365-modern .modal-footer .hda-btn[id],
.c365-modern .modal-footer .hda-btn:only-child,
.c365-modern .modal-footer .btn-primary {
    order: 2;
    background: var(--c365-brand) !important;
    border-color: var(--c365-brand) !important;
    color: var(--c365-brand-ink) !important;
}
.c365-modern .hdo-dialog-footer .hda-btn[id]:hover,
.c365-modern .hdo-dialog-footer .hda-btn:only-child:hover,
.c365-modern .modal-footer .hda-btn[id]:hover,
.c365-modern .modal-footer .hda-btn:only-child:hover,
.c365-modern .modal-footer .btn-primary:hover {
    background: var(--c365-brand-hover) !important;
    border-color: var(--c365-brand-hover) !important;
}

/* ---------- filter bar above a list (cases.aspx, prosupport.aspx) ----------
   Caption above each control, controls on one baseline, actions after the fields, the add button at the end. */
.c365-modern .c365-filter { gap: 12px; }
.c365-modern .c365-filter-field { flex: 0 1 190px; gap: 4px; }
.c365-modern .c365-filter-field label {
    margin: 0;
    color: var(--c365-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}
.c365-modern .c365-filter-field select,
.c365-modern .c365-filter-field input[type="text"] { width: 100% !important; margin: 0 !important; }
.c365-modern .c365-filter-search { flex: 1 1 220px; max-width: 320px; }
.c365-modern .c365-filter .hda-btn { margin: 0; }
.c365-modern .c365-filter-actions { gap: 8px; }


/* ---------- standard buttons ----------
   One button shape for the whole portal. Page markup carries inline widths and heights from the old theme
   (style="width: 150px", "height: 30px"): they are ignored here so every button sizes to its caption.
   Primary = filled brand colour, secondary = outlined, icon = 38px square. */
.c365-modern .hd-content .hda-btn:not(.w-50),
.c365-modern .hdo-dialog .hda-btn {
    width: auto !important;
    height: auto !important;
    min-height: 38px;
    padding: 8px 16px !important;
    text-align: center;
    vertical-align: middle;
}
.c365-modern .hd-content .hda-btn-icon,
.c365-modern .hd-content .hda-btn-back,
.c365-modern .hd-content .hda-btn:has(> i:only-child) {
    width: 38px !important;
    min-width: 38px;
    padding: 0 !important;
}
/* buttons with no class of their own (lookup buttons, plain inputs) get the secondary look */
.c365-modern .hd-content button:not([class]),
.c365-modern .hd-content button[class=""],
.c365-modern .hd-content input[type="button"]:not([class]),
.c365-modern .hd-content input[type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid var(--c365-line-strong);
    border-radius: var(--c365-radius-sm);
    background: var(--c365-surface);
    color: var(--c365-ink);
    font: 600 14px/1.2 inherit;
    font-family: inherit;
    cursor: pointer;
}
.c365-modern .hd-content button:not([class]):hover,
.c365-modern .hd-content button[class=""]:hover,
.c365-modern .hd-content input[type="button"]:not([class]):hover { background: var(--c365-surface-2); border-color: var(--c365-muted); }
.c365-modern .hda-btn:focus-visible,
.c365-modern .hd-content .btn:focus-visible,
.c365-modern .hd-content button:focus-visible,
.c365-modern .hd-content input[type="submit"]:focus-visible,
.c365-modern .hd-content input[type="button"]:focus-visible { outline: 2px solid var(--c365-brand); outline-offset: 2px; }
.c365-modern .hda-btn[disabled],
.c365-modern .hda-btn.disabled,
.c365-modern .hd-content .btn[disabled],
.c365-modern .hd-content input[type="submit"][disabled] { opacity: .55; cursor: not-allowed; }
/* groups of buttons in a page header sit in a row with even gaps */
.c365-modern .hdo-main-content-header > div:has(> .hda-btn) { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }

/* ---------- intro and hint text under a page or section heading ---------- */
.c365-modern .hd-content p.c365-intro,
.c365-modern .hd-content span.c365-intro {
    display: block;
    max-width: 72ch;
    margin: 6px 0 0;
    color: var(--c365-muted);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.5;
    text-align: left;
}
.c365-modern .hdo-main-content-header:has(.c365-intro) { display: block; }
.c365-modern .hdo-main-content-header:has(> .c365-intro) > br { display: none; }
.c365-modern .hd-content p.c365-hint {
    margin: 3px 0 0;
    color: var(--c365-muted);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.45;
    text-align: left;
    text-transform: none;
}

/* ---------- notice: a section that CRM could not show (see PortalModern.FriendlySageErrors) ---------- */
.c365-modern .c365-notice {
    margin: 8px 0;
    padding: 12px 14px;
    border: 1px solid var(--c365-line);
    border-left: 4px solid var(--c365-warn);
    border-radius: var(--c365-radius-sm);
    background: var(--c365-warn-bg);
    color: var(--c365-ink);
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}
.c365-modern .c365-notice b { display: block; font-weight: 600; }
.c365-modern .c365-notice p { margin: 2px 0 0; }
.c365-modern .c365-notice-detail { color: var(--c365-muted); }

/* ---------- screen recording step on case detail ---------- */
.c365-modern .recordingWrapper { padding: 20px; }
.c365-modern .recordingWrapper > .hda-btn.record { margin: 0 0 16px; }
.c365-modern #recordingStatus:not(:empty) { margin: 0 0 12px; font-weight: 600; color: var(--c365-brand-text); }
.c365-modern .c365-record-explainer { width: 100%; border: 0; border-collapse: collapse; }
.c365-modern .c365-record-explainer td { padding: 0; border: 0; vertical-align: top; }
.c365-modern .c365-record-explainer .c365-record-text {
    width: 42%;
    padding: 4px 28px 0 0;
    color: var(--c365-ink);
    font-size: 15px;
    line-height: 1.6;
}
.c365-modern .c365-record-explainer img {
    display: block;
    width: 100%;
    max-width: 520px;
    height: auto;
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
    box-shadow: var(--c365-shadow);
}
.c365-modern .recordingInProgress { padding: 0 !important; }
.c365-modern .videoWrapper table { width: 100%; }
.c365-modern .videoWrapper td { vertical-align: top; }
.c365-modern .videoWrapper video { max-width: 100%; border-radius: var(--c365-radius-sm); background: #000; }
.c365-modern .videoWrapper input[type="text"], .c365-modern .videoWrapper #inputClipName, .c365-modern .videoWrapper textarea { width: 100% !important; }
.c365-modern .videoWrapper td > div { margin-bottom: 12px; }

/* ---------- page header with intro text on the left and its buttons on the right (account details) ---------- */
.c365-modern .hdo-main-content-header:has(> div > .c365-intro) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    text-align: left !important;
}
.c365-modern .hdo-main-content-header:has(> div > .c365-intro) > div:first-child { flex: 1 1 50%; min-width: 240px; max-width: 64ch; }
.c365-modern .hdo-main-content-header:has(> div > .c365-intro) > div:first-child br { display: none; }
.c365-modern .hdo-main-content-header:has(> div > .c365-intro) > div:last-child { flex: 0 1 auto; margin-left: auto; justify-content: flex-end; }
.c365-modern .hdo-main-content-header:has(> div > .c365-intro) p.c365-intro { margin: 0; text-align: left; }
/* intro above a filter bar (cases) or under a page title (log case) */
.c365-modern .hdo-main-content-header > p.c365-intro { margin: 0 0 12px; }
.c365-modern .hdo-main-content-header:has(> p.c365-intro) { display: block; }
.c365-modern .hdo-main-content-header > div p.c365-intro.c365-intro-centre { margin: 6px auto 0; text-align: center; }

/* ---------- case detail: conversation on the left, case details in a side panel ----------
   Only when the page has the messages block, and only on wide screens. Below that everything stacks. */
@media (min-width: 1200px) {
    .c365-modern :is(div, section, form):has(> .c365-pagehead):has(> #app) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        column-gap: 20px;
        align-items: start;
    }
    .c365-modern :is(div, section, form):has(> .c365-pagehead):has(> #app) > * { grid-column: 1; min-width: 0; }
    .c365-modern :is(div, section, form):has(> .c365-pagehead):has(> #app) > .c365-pagehead { grid-column: 1 / -1; order: -4; }
    .c365-modern :is(div, section, form):has(> .c365-pagehead):has(> #app) > .recordingWrapper { order: -3; }
    .c365-modern :is(div, section, form):has(> .c365-pagehead):has(> #app) > #app { order: -2; }
    .c365-modern :is(div, section, form):has(> .c365-pagehead):has(> #app) > .c365-case-details { grid-column: 2; grid-row: 2 / span 40; order: -1; }
}

/* ---------- messages (Vuetify app on case detail) ---------- */
.c365-modern #app {
    margin: 0 0 20px;
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
    background: var(--c365-surface);
    box-shadow: var(--c365-shadow);
    overflow: hidden;
}
.c365-modern #app .v-application { background: transparent; color: var(--c365-ink); font-family: inherit; }
.c365-modern #app .v-application__wrap { min-height: 0; }
.c365-modern #app .v-main { padding: 0 !important; }
.c365-modern #app .v-container { max-width: none; padding: 16px 20px 18px; }
.c365-modern #app h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 38px; color: var(--c365-ink); }
.c365-modern #app h4 { margin: 14px 0 10px; font-size: 14px; font-weight: 600; color: var(--c365-ink); }
.c365-modern #app label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: var(--c365-ink); }
.c365-modern #app .v-divider { margin: 12px 0; border-color: var(--c365-line); opacity: 1; }
.c365-modern #app hr { margin: 0; border: 0; border-top: 1px solid var(--c365-line); }
.c365-modern #app .v-btn {
    height: 38px;
    min-width: 0;
    padding: 0 16px;
    border: 1px solid var(--c365-brand);
    border-radius: var(--c365-radius-sm);
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.c365-modern #app .v-btn .v-icon { margin-right: 6px; font-size: 18px; }
.c365-modern #app .v-btn.bg-primary { background: var(--c365-brand) !important; color: var(--c365-brand-ink) !important; }
.c365-modern #app .v-btn.bg-primary:hover { background: var(--c365-brand-hover) !important; border-color: var(--c365-brand-hover); }
/* Cancel: outlined like every other secondary button (Vuetify's default "secondary" is teal) */
.c365-modern #app .v-btn.bg-secondary {
    border-color: var(--c365-line-strong);
    background: var(--c365-surface) !important;
    color: var(--c365-ink) !important;
}
.c365-modern #app .v-btn.bg-secondary:hover { background: var(--c365-surface-2) !important; border-color: var(--c365-muted); }
.c365-modern #app .v-btn .v-btn__overlay, .c365-modern #app .v-btn .v-btn__underlay { display: none; }
.c365-modern #app .v-btn.mt-4 { margin-top: 14px !important; }
.c365-modern #app .v-btn.mr-4 { margin-right: 10px !important; }
.c365-modern #app .v-field { border-radius: var(--c365-radius-sm); font-size: 14px; }
.c365-modern #app .v-field__input { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
.c365-modern #app .v-input__details { min-height: 0; padding: 0; }
.c365-modern #app .v-input__details:has(.v-messages:empty) { display: none; }
.c365-modern #app p.error { margin: 0 0 6px; color: var(--c365-danger); font-size: 13px; background: transparent; }
.c365-modern #app .v-list { padding: 0; background: transparent; }
.c365-modern #app .v-list-item { padding: 14px 0; }
.c365-modern #app .v-list-item-title { font-size: 14px; font-weight: 600; white-space: normal; }
.c365-modern #app .v-list-item .mt-1 { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.c365-modern #app .v-list:empty { display: none; }
/* rich text editor (summernote), here and on log case */
.c365-modern .note-editor.note-frame { border: 1px solid var(--c365-line-strong); border-radius: var(--c365-radius-sm); box-shadow: none; overflow: hidden; }
.c365-modern .note-editor .note-toolbar { padding: 6px 8px; border-bottom: 1px solid var(--c365-line); background: var(--c365-surface-2); }
.c365-modern .note-editor .note-statusbar { border-top: 1px solid var(--c365-line); background: var(--c365-surface-2); }

/* ---------- case detail: files attached ---------- */
.c365-modern .hd-content table.MainMenu { width: 100%; border: 0 !important; border-collapse: collapse; }
.c365-modern .hd-content table.MainMenu tr.ROW1 td,
.c365-modern .hd-content table.MainMenu tr.ROW2 td { padding: 10px 8px; border: 0; border-bottom: 1px solid var(--c365-line); background: transparent; vertical-align: middle; }
.c365-modern .hd-content table.MainMenu tr:last-child td { border-bottom: 0; }
.c365-modern .hd-content table.MainMenu tr.ROW1:hover td,
.c365-modern .hd-content table.MainMenu tr.ROW2:hover td { background: var(--c365-surface-2); }
.c365-modern .hd-content table.MainMenu[id$="gvFileList"] tr:has(> th) { display: none; }
.c365-modern .hd-content table.MainMenu th {
    padding: 8px;
    border: 0 !important;
    border-bottom: 1px solid var(--c365-line) !important;
    background: transparent;
    color: var(--c365-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-align: left;
}
.c365-modern .hd-content table.MainMenu[id$="gvFileList"] td:first-child a {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--c365-ink);
    font-weight: 600;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.c365-modern .hd-content table.MainMenu[id$="gvFileList"] td:first-child a:hover { color: var(--c365-brand-text); }
.c365-modern .hd-content table.MainMenu[id$="gvFileList"] td:first-child a::before {
    content: "";
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background-color: var(--c365-brand-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676472' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7z'/%3E%3Cpath d='M14 3v4h4M9 13h6M9 17h6'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px;
}
.c365-modern .hd-content table.MainMenu[id$="gvFileList"] td:not(:first-child) { color: var(--c365-muted); font-size: 13.5px; }

/* ---------- case detail: tracking notes ----------
   Each note is a Sage screen inside a list row. The list row styles must not reach into the nested Sage table
   (that is where the stray lines came from): one line between notes, date on the left, note beside it. */
.c365-modern .hd-content tr.ROW1 td td,
.c365-modern .hd-content tr.ROW2 td td { padding: 0 24px 0 0; border: 0; background: transparent; vertical-align: top; }
.c365-modern .hd-content #TrackingNotesTable > tbody > tr > td { padding: 14px 8px; border: 0; border-bottom: 1px solid var(--c365-line); background: transparent; }
.c365-modern .hd-content #TrackingNotesTable > tbody > tr:last-child > td { border-bottom: 0; }
.c365-modern .hd-content #TrackingNotesTable tr:hover td { background: transparent; }
.c365-modern .hd-content #TrackingNotesTable td:empty { display: none; }
.c365-modern .hd-content #TrackingNotesTable table { width: 100%; }
.c365-modern .hd-content #TrackingNotesTable table.CONTENT td:first-child { width: 190px; white-space: nowrap; }
.c365-modern .hd-content #TrackingNotesTable .VIEWBOX { display: inline-block; width: auto !important; overflow-wrap: anywhere; }

/* ---------- show / hide on password fields (js/modern/shell.js) ---------- */
.c365-modern span.c365-pw,
.c365-modern .hdo-dialog-body fieldset > span.c365-pw { display: flex; align-items: stretch; gap: 6px; width: 100%; margin: 0 !important; font-weight: 400; }
.c365-modern .c365-pw > input { flex: 1 1 auto; min-width: 0; width: auto !important; }
.c365-modern .c365-pw-toggle,
.c365-modern .c365-mic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: none;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--c365-line-strong);
    border-radius: var(--c365-radius-sm);
    background: var(--c365-surface);
    color: var(--c365-ink);
    font: 600 13px/1 inherit;
    font-family: inherit;
    cursor: pointer;
}
.c365-modern .c365-pw-toggle { min-width: 62px; }
.c365-modern .c365-pw-toggle:hover,
.c365-modern .c365-mic:hover { background: var(--c365-surface-2); border-color: var(--c365-muted); }

/* ---------- dictation on multiline fields (js/modern/shell.js) ---------- */
.c365-modern .c365-mic { margin: 6px 0 0; }
.c365-modern .c365-mic i { font-size: 14px; }
.c365-modern .c365-mic.c365-mic-on { border-color: var(--c365-danger); background: var(--c365-danger); color: #fff; }
.c365-modern .c365-mic.c365-mic-on i { animation: c365-pulse 1s ease-in-out infinite; }
.c365-modern .c365-mic-note { display: inline-block; margin: 6px 0 0 8px; color: var(--c365-muted); font-size: 12.5px; }
@keyframes c365-pulse { 50% { opacity: .35; } }

/* ---------- page head (case detail): title, a line of detail, actions on the right ---------- */
.c365-modern .hdo-main-content-header.c365-pagehead {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.c365-modern .c365-pagehead > div:first-child { flex: none; }
.c365-modern .c365-pagehead > div:first-child:not(:has(.hda-btn)) { display: none; }
.c365-modern .c365-pagehead-text { display: block; flex: 1 1 260px; min-width: 0; }
.c365-modern .c365-pagehead-text h1 {
    margin: 0;
    color: var(--c365-ink);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.c365-modern .c365-pagehead-text p { margin: 3px 0 0; color: var(--c365-muted); font-size: 13.5px; }
.c365-modern .c365-pagehead-text p b { color: var(--c365-ink); font-weight: 600; }
.c365-modern .c365-pagehead > div[style*="inline"] { display: none !important; }
.c365-modern .c365-pagehead > div[style*="inline"]:has(span > span:not(:empty)) { display: block !important; flex: 1 1 100%; order: 9; text-align: left !important; color: var(--c365-muted); }
.c365-modern .c365-pagehead #ctl00_ContentPlaceHolder1_buttonHolder,
.c365-modern .c365-pagehead #ctl00_ContentPlaceHolder1_reopenCase,
.c365-modern .c365-pagehead [id$="buttonHolder"],
.c365-modern .c365-pagehead [id$="reopenCase"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    text-align: left !important;
}
/* in a page head only the first action is filled; the rest are outlined */
.c365-modern .c365-pagehead [id$="buttonHolder"] > .hda-btn-primary ~ .hda-btn-primary {
    background: var(--c365-surface);
    border-color: var(--c365-line-strong);
    color: var(--c365-ink) !important;
}
.c365-modern .c365-pagehead [id$="buttonHolder"] > .hda-btn-primary ~ .hda-btn-primary:hover { background: var(--c365-surface-2) !important; border-color: var(--c365-muted); color: var(--c365-ink) !important; }

/* ---------- signed-in user in the top bar (built by js/modern/shell.js) ---------- */
.c365-userchip { display: none; }
.c365-modern .c365-userchip {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: none;
    margin-left: auto;
    color: var(--c365-header-ink);
    font-size: 13.5px;
    line-height: 1.25;
}
.c365-modern .c365-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c365-header-ink);
    color: var(--c365-header-bg);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}
.c365-modern .c365-userchip-text { display: flex; flex-direction: column; min-width: 0; max-width: 220px; }
.c365-modern .c365-userchip-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c365-modern .c365-userchip-text small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 768px) {
    .c365-modern.c365-has-chip .hd-menu .hd-user { display: none; }
}

/* ---------- home page tiles (info.aspx) ---------- */
.c365-modern .hda-tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    text-align: left;
}
.c365-modern .hda-tiles-container .hda-tile-item { display: block; float: none; width: auto !important; height: auto !important; margin: 0 !important; padding: 0 !important; }
/* the tile for the page you are on is left out */
.c365-modern .hda-tiles-container .hda-tile-item:has([id="info.aspx" i]) { display: none; }
.c365-modern .hda-tiles-container .ct-button {
    display: flex !important;
    align-items: center;
    gap: 14px;
    width: 100% !important;
    height: auto !important;
    min-height: 78px;
    margin: 0 !important;
    padding: 16px !important;
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
    background: var(--c365-surface) !important;
    box-shadow: var(--c365-shadow);
    color: var(--c365-ink) !important;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left !important;
    text-shadow: none;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s, transform .12s;
}
.c365-modern .hda-tiles-container .ct-button br { display: none; }
.c365-modern .hda-tiles-container .ct-button i {
    display: grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--c365-brand-soft);
    color: var(--c365-brand-text);
    font-size: 20px !important;
    line-height: 1;
}
.c365-modern .hda-tiles-container .ct-button::after {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-top: 2px solid var(--c365-line-strong);
    border-right: 2px solid var(--c365-line-strong);
    transform: rotate(45deg);
}
.c365-modern .hda-tiles-container .ct-button:hover,
.c365-modern .hda-tiles-container .ct-button:focus-visible {
    border-color: var(--c365-brand);
    background: var(--c365-surface) !important;
    box-shadow: 0 6px 18px rgba(20, 16, 28, .10);
    color: var(--c365-ink) !important;
    transform: translateY(-1px);
}
.c365-modern .hda-tiles-container .ct-button:hover::after { border-color: var(--c365-brand); }

/* ---------- download list (downloadPage.aspx and the pages built like it) ---------- */
.c365-modern .hd-content .hd-content { padding: 0; min-height: 0; }
.c365-modern .hd-content .hd-content > br { display: none; }
.c365-modern .hd-content .hd-content > .hdo-main-content-header-title { display: block; margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--c365-ink); }
.c365-modern .hdm-list-downloads {
    margin: 0;
    padding: 0;
    border: 1px solid var(--c365-line);
    border-radius: var(--c365-radius);
    background: var(--c365-surface);
    box-shadow: var(--c365-shadow);
    overflow: hidden;
}
.c365-modern .hdm-list-downloads ul { list-style: none; margin: 0; padding: 0; border: 0; }
.c365-modern .hdm-list-downloads-files:not(:has(li)) { display: none; }
.c365-modern .hdm-list-downloads-header li {
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid var(--c365-line);
    background: var(--c365-surface-2);
    color: var(--c365-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.c365-modern .hdm-list-downloads-files li {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 60px;
    margin: 0;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid var(--c365-line);
    background: var(--c365-surface);
    cursor: pointer;
    transition: background-color .12s;
}
.c365-modern .hdm-list-downloads-files li:last-child { border-bottom: 0; }
.c365-modern .hdm-list-downloads-files li:hover { background: var(--c365-surface-2); }
/* file icon in front of the name */
.c365-modern .hdm-list-downloads-files li::before {
    content: "";
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background-color: var(--c365-brand-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676472' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7z'/%3E%3Cpath d='M14 3v4h4M9 13h6M9 17h6'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px;
}
.c365-modern .hdm-list-downloads-details { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; float: none; width: auto; }
.c365-modern .hdm-list-downloads-name { display: block; color: var(--c365-ink); font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.c365-modern .hdm-list-downloads-desc { display: none; }
.c365-modern .hdm-list-downloads-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    float: none;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--c365-line-strong);
    border-radius: var(--c365-radius-sm);
    background: var(--c365-surface);
    color: var(--c365-brand-text) !important;
    text-decoration: none;
}
.c365-modern .hdm-list-downloads-icon i { font-size: 15px; line-height: 1; }
.c365-modern .hdm-list-downloads-files li:hover .hdm-list-downloads-icon { background: var(--c365-brand); border-color: var(--c365-brand); color: var(--c365-brand-ink) !important; }

/* ---------- page loader + navigation feedback ----------
   While a page is loading: a bar along the top, a spinner on the menu item that was clicked,
   the old content dimmed and a spinner in the middle of it. */
@keyframes c365-spin { to { transform: rotate(360deg); } }
.c365-modern .ts_modal { background: rgba(255, 255, 255, .6); }
.c365-modern .ts_modal .inner { position: absolute; inset: 0; display: grid; place-items: center; width: auto; height: auto; margin: 0; padding: 0; background: none; }
.c365-modern .ts_modal .inner img { display: none; }
.c365-modern .ts_modal .inner::after,
.c365-modern.c365-nav-busy::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid var(--c365-brand-soft);
    border-top-color: var(--c365-brand);
    border-radius: 50%;
    background: transparent;
    animation: c365-spin .7s linear infinite;
}
.c365-modern.c365-nav-busy { cursor: progress; }
.c365-modern.c365-nav-busy::after {
    position: fixed;
    top: calc(50% - 20px);
    left: calc(50% - 20px);
    z-index: 10002;
    pointer-events: none;
}
@media (min-width: 992px) {
    .c365-modern.c365-nav-busy::after { left: calc(50% + (var(--c365-menu-w, 244px) / 2) - 20px); }
}
.c365-modern .hd-menu .hd-nav li.c365-busy .hdm-nav-link { background: var(--c365-menu-active); color: var(--c365-menu-strong); }
.c365-modern .hd-menu .hd-nav li.c365-busy .hdm-nav-link::after {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    margin-left: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-right-color: currentColor;
    border-radius: 50%;
    animation: c365-spin .7s linear infinite;
}
.c365-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10001;
    height: 4px;
    width: 0;
    background: var(--c365-menu-strong);
    box-shadow: 0 0 6px var(--c365-brand);
    opacity: 0;
    pointer-events: none;
}
.c365-progress.c365-run { opacity: 1; width: 82%; transition: width 6s cubic-bezier(.1, .7, .2, 1); }
.c365-progress.c365-done { opacity: 0; width: 100%; transition: width .15s linear, opacity .25s .15s; }
.c365-modern .hd-content.c365-loading { opacity: .4; pointer-events: none; transition: opacity .15s; }

/* full page loads cross-fade where the browser supports it (the shell stays visually in place) */
@view-transition { navigation: auto; }

/* ---------- logon, register and contact us: the same card and fields ---------- */
.c365-modern :is(#logon-page, #register-page, #contact-page).container {
    max-width: 440px;
    margin: 28px auto;
    padding: 26px 28px;
    background: var(--c365-surface);
    border: 1px solid var(--c365-line);
    border-radius: 14px;
    box-shadow: var(--c365-shadow);
}
.c365-modern :is(#logon-page, #register-page, #contact-page) h4.d-flex { justify-content: flex-start !important; margin: 0 0 14px; font-size: 18px; line-height: 1.3; }
.c365-modern :is(#logon-page, #register-page, #contact-page) hr { display: none; }
.c365-modern :is(#logon-page, #register-page, #contact-page) .form-group.row { display: block; margin: 0 0 14px; }
.c365-modern :is(#logon-page, #register-page, #contact-page) .form-group.row > * { max-width: 100%; flex: none; padding: 0; text-align: left !important; }
.c365-modern :is(#logon-page, #register-page, #contact-page) .col-form-label { padding: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--c365-ink); }
.c365-modern :is(#logon-page, #register-page, #contact-page) input[type="text"],
.c365-modern :is(#logon-page, #register-page, #contact-page) input[type="password"],
.c365-modern :is(#logon-page, #register-page, #contact-page) input[type="email"] { border: 1px solid var(--c365-line-strong) !important; border-radius: var(--c365-radius-sm); width: 100%; }
/* the master form is permanently "was-validated": do not show empty fields as errors before anything is typed */
.c365-modern :is(#logon-page, #register-page, #contact-page) .form-control:invalid,
.c365-modern :is(#logon-page, #register-page, #contact-page) .form-control:valid { background-image: none; padding-right: 10px; }
.c365-modern :is(#logon-page, #register-page, #contact-page) .form-control:invalid:not(:focus) { border-color: var(--c365-line-strong) !important; box-shadow: none; }
.c365-modern :is(#logon-page, #register-page, #contact-page) .form-check-label { color: var(--c365-ink) !important; }
.c365-modern :is(#logon-page, #register-page, #contact-page) .btn-primary { width: 100%; background: var(--c365-brand); border-color: var(--c365-brand); }
.c365-modern :is(#logon-page, #register-page, #contact-page) .btn-primary:hover { background: var(--c365-brand-hover); border-color: var(--c365-brand-hover); }
.c365-modern :is(#logon-page, #register-page, #contact-page) .text-center { text-align: left !important; }
.c365-modern :is(#logon-page, #register-page, #contact-page) p.d-flex { justify-content: flex-start !important; margin: 10px 0 0; }
.c365-modern #register-page input[type="tel"] { border: 1px solid var(--c365-line-strong) !important; border-radius: var(--c365-radius-sm); width: 100%; }
.c365-modern #register-page .register-companies:not(:has(input)) { display: none !important; }
.c365-modern #register-page .alert { margin: 0 0 16px; }
.c365-modern #contact-page textarea { border: 1px solid var(--c365-line-strong) !important; border-radius: var(--c365-radius-sm); width: 100%; min-height: 150px; }
.c365-modern #contact-page .contact-sent { margin: 0; }
.c365-modern #contact-page .c365-mic { margin-top: 8px; }

/* ---------- tablet: icon rail ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
    .c365-modern .hd-menu { width: var(--c365-menu-w-collapsed); }
    .c365-modern .hd-menu .hd-user,
    .c365-modern .hd-menu .hdm-nav-item-text,
    .c365-modern .hd-menu li[id$="collapseButton"] { display: none; }
    .c365-modern .hd-menu .hdm-nav-link { justify-content: center; }
    .c365-modern .hd-content { padding: 20px; }
}

/* ---------- phone: bottom tab bar, cards, bigger touch targets ---------- */
@media (max-width: 767.98px) {
    .c365-modern { --c365-header-h: 52px; }
    .c365-modern .hd-header { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); gap: 10px; }
    .c365-modern .hd-back-button.visible-xs { display: flex; }
    .c365-modern .hd-brand-image img { height: 24px; max-height: 24px; }
    .c365-modern .hd-brand-image .lbl_welcomenote { font-size: 14px; }

    .c365-modern .hd-main { display: block; min-height: 0; }
    .c365-modern .hd-content {
        padding: 16px max(14px, env(safe-area-inset-right, 0px)) calc(var(--c365-tabbar-h) + 28px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
    }
    .c365-modern .hd-footer { padding-bottom: calc(var(--c365-tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); margin-top: calc(-1 * (var(--c365-tabbar-h) + 12px)); border-top: 0; }

    /* tab bar */
    .c365-modern .hd-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1020;
        width: auto;
        height: auto;
        max-height: 80vh;
        padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
        box-shadow: 0 -1px 0 rgba(0, 0, 0, .10), 0 -6px 18px rgba(20, 16, 28, .12);
        transition: none;
    }
    .c365-modern .hd-menu .hd-user,
    .c365-modern .hd-menu li[id$="collapseButton"] { display: none; }
    .c365-modern .hd-menu .hd-nav { flex-direction: row; gap: 0; overflow-x: auto; scrollbar-width: none; }
    .c365-modern .hd-menu .hd-nav::-webkit-scrollbar { display: none; }
    .c365-modern .hd-menu .hd-nav li { flex: 1 0 68px; min-width: 0; }
    .c365-modern .hd-menu .hd-nav li .hdm-nav-link {
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        min-height: calc(var(--c365-tabbar-h) - 8px);
        padding: 6px 2px;
        font-size: 10.5px;
        text-align: center;
    }
    .c365-modern .hd-menu .hd-nav li.active .hdm-nav-link { box-shadow: none; }
    .c365-modern .hd-menu .hd-nav li .hdm-nav-link i { font-size: 18px; line-height: 1; height: 18px; vertical-align: 0; }
    .c365-modern .hd-menu .hdm-nav-item-text { display: block !important; max-width: 100%; }

    /* more than five items: first four + "More", which opens the whole menu as a sheet (js/modern/shell.js) */
    .c365-modern .hd-menu.c365-has-more .hd-nav { overflow: visible; }
    .c365-modern .hd-menu.c365-has-more .hd-nav > li:nth-child(n+5):not(.c365-more) { display: none; }
    .c365-modern .hd-menu.c365-has-more li.c365-more { display: block; }
    .c365-modern .hd-menu.c365-sheet-open { border-radius: 16px 16px 0 0; padding-top: 12px; overflow-y: auto; }
    .c365-modern .hd-menu.c365-sheet-open .hd-nav { flex-direction: column; gap: 2px; }
    .c365-modern .hd-menu.c365-sheet-open .hd-nav > li:nth-child(n+5):not(.c365-more) { display: block; }
    .c365-modern .hd-menu.c365-sheet-open .hd-nav li { flex: none; }
    .c365-modern .hd-menu.c365-sheet-open .hd-nav li .hdm-nav-link {
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        min-height: 48px;
        padding: 10px 14px;
        font-size: 15px;
        text-align: left;
    }
    .c365-backdrop { position: fixed; inset: 0; z-index: 1015; background: rgba(20, 16, 28, .45); }

    /* content */
    .c365-modern .hdo-main-content-header { padding: 12px 14px; margin-bottom: 14px; }
    .c365-modern .hdo-main-content-header .hd-search > * { flex: 1 1 100%; }
    .c365-modern .hdo-main-content-header .hd-search input[type="text"],
    .c365-modern .hdo-main-content-header .hd-search select { width: 100% !important; }
    .c365-modern .hda-btn, .c365-modern .hd-content .btn, .c365-modern .hd-content input[type="submit"] { min-height: 44px; }
    /* 16px stops iOS zooming the page when a field gets focus */
    .c365-modern .hd-content input[type="text"],
    .c365-modern .hd-content input[type="password"],
    .c365-modern .hd-content input[type="email"],
    .c365-modern .hd-content input[type="search"],
    .c365-modern .hd-content input[type="tel"],
    .c365-modern .hd-content input[type="number"],
    .c365-modern .hd-content input[type="date"],
    .c365-modern .hd-content select,
    .c365-modern .hd-content textarea,
    .c365-modern .hdo-dialog input,
    .c365-modern .hdo-dialog select,
    .c365-modern .hdo-dialog textarea { font-size: 16px; min-height: 44px; }

    /* PortalList rows become cards: first column is the title line, the rest are label / value pairs */
    .c365-modern .c365-list { background: transparent; border: 0; border-radius: 0; overflow: visible; }
    .c365-modern .c365-list-scroll { overflow: visible; }
    .c365-modern .c365-list table, .c365-modern .c365-list tbody { display: block; }
    .c365-modern .c365-list thead { display: none; }
    .c365-modern .c365-list tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 6px 14px;
        margin: 0 0 10px;
        padding: 12px 14px;
        background: var(--c365-surface);
        border: 1px solid var(--c365-line);
        border-radius: var(--c365-radius);
        border-left: 4px solid var(--c365-row-status, var(--c365-line));
    }
    .c365-modern .c365-list td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
    .c365-modern .c365-list tr[class*="c365-status"] td:first-child { box-shadow: none; }
    .c365-modern .c365-list td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: var(--c365-muted);
    }
    .c365-modern .c365-list td.c365-primary { grid-column: 1 / -1; font-size: 15px; font-weight: 600; }
    .c365-modern .c365-list td.c365-primary::before { display: none; }
    .c365-modern .c365-list td.c365-num { text-align: left; }
    .c365-modern .c365-list td.c365-empty { display: none; }
    .c365-modern .c365-list-empty { background: var(--c365-surface); border: 1px solid var(--c365-line); border-radius: var(--c365-radius); }
    .c365-modern .c365-pager { border: 0; padding: 4px 0 0; flex-wrap: wrap; }
    .c365-modern .c365-pager a, .c365-modern .c365-pager span.c365-page { min-width: 44px; height: 44px; background: var(--c365-surface); }

    /* page head, user chip, home tiles on a phone */
    .c365-modern .c365-pagehead-text h1 { font-size: 20px; }
    .c365-modern .c365-pagehead [id$="buttonHolder"],
    .c365-modern .c365-pagehead [id$="reopenCase"] { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
    .c365-modern .c365-pagehead [id$="buttonHolder"] > .hda-btn { flex: 1 1 auto; }
    .c365-modern .c365-userchip-text { display: none; }
    .c365-modern .hda-tiles-container { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .c365-modern .hda-tiles-container .ct-button { flex-direction: column; align-items: flex-start; gap: 10px; min-height: 0; padding: 14px !important; font-size: 14px; }
    .c365-modern .hda-tiles-container .ct-button::after { display: none; }
    .c365-modern.c365-nav-busy::after { top: calc(50% - 20px); }

    /* filter bar: two fields per row, search and buttons full width */
    .c365-modern .c365-filter-field { flex: 1 1 calc(50% - 6px); }
    .c365-modern .c365-filter-search { flex: 1 1 100%; max-width: none; }
    .c365-modern .c365-filter-actions { flex: 1 1 100%; }
    .c365-modern .c365-filter-actions .hda-btn { flex: 1 1 0; }
    .c365-modern .c365-filter-end { display: flex; flex: 1 1 100%; margin-left: 0; }
    .c365-modern .c365-filter-end .hda-btn:not(.hda-btn-icon) { flex: 1 1 auto; justify-content: center; }

    /* dialogs stay cards with a small margin and their buttons share the footer width.
       Only the big ones (screen shot, lookup) take the whole screen. */
    .c365-modern .hdo-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px) !important; max-height: calc(100% - 24px); }
    .c365-modern .modal-dialog, .c365-modern .modal-dialog.modal-sm { width: calc(100vw - 24px); margin: 12px auto; min-height: calc(100% - 24px); }
    .c365-modern .hdo-dialog-footer .hda-btn, .c365-modern .modal-footer .hda-btn, .c365-modern .modal-footer .btn { flex: 1 1 0; }
    .c365-modern .hdo-dialog.hdo-dialog-lg,
    .c365-modern .hdo-dialog.hdo-dialog-wide {
        left: 0;
        top: 0;
        transform: none;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100%;
        max-height: 100%;
        border: 0;
        border-radius: 0;
        animation: none;
    }
    .c365-modern .hdo-dialog-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

    .c365-modern :is(#logon-page, #register-page, #contact-page).container { margin: 8px auto; padding: 20px 18px; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    .c365-modern .hd-menu, .c365-progress, .c365-modern .hd-content.c365-loading { transition: none !important; }
    @view-transition { navigation: none; }
}
