/* ==========================================================================
   Modern UI Overlay for Contract Management
   Loaded after default.css — overrides legacy styles for a modern feel.
   Keeps all existing element IDs, classes, and layout structure intact.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Foundation
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

a {
    color: #1d4ed8;
    transition: color 0.15s ease;
}
a:hover {
    color: #1e40af;
    text-decoration: none;
}

ul li {
    font-family: inherit;
    font-size: inherit;
}

/* --------------------------------------------------------------------------
   Wrapper & Header — override default.css overflow:hidden that clips dropdowns
   -------------------------------------------------------------------------- */
#wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: visible;
    background-color: #fff;
}
#header {
    overflow: visible;
}

/* --------------------------------------------------------------------------
   Navigation Bar
   -------------------------------------------------------------------------- */
#header .menu .nav {
    background: linear-gradient(180deg, #1e293b, #0f172a);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
    overflow: visible;
    display: flex;
    flex-wrap: wrap;
}
/* QW-2: Nav text visibility — #f1f5f9 default, #fff on hover */
#header .menu .nav li a {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    background: transparent;
    padding: 12px 18px;
    letter-spacing: 0.02em;
    transition: background-color 0.2s ease, color 0.2s ease;
}
#header .menu .nav > li > a:hover,
#header .menu .nav > li > a.sub_sel {
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}
/* QW-3: Active page indicator — bottom accent bar on active nav item */
#header .menu .nav > li > a.sel {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 -3px 0 #3b82f6;
}

/* Dropdown parent — stacking context for z-index to work */
#header .menu .nav > li {
    position: relative;
}

/* Dropdown menus — keyboard accessible via :focus-within */
#header .menu .nav > li:focus-within > ul {
    display: block;
}
#header .menu .nav ul {
    z-index: 1000;
}
#header .menu .nav ul li {
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#header .menu .nav ul li:last-child {
    border-bottom: none;
}
#header .menu .nav ul a {
    background-color: #1e293b;
    padding: 10px 18px;
    font-weight: 500;
    transition: background-color 0.15s ease;
}
#header .menu .nav ul a:hover {
    background-color: #334155;
}
#header .menu .nav ul {
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

/* --------------------------------------------------------------------------
   Logo & User Info Bar — M-1: Cohesive header band
   -------------------------------------------------------------------------- */
#header .header-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    min-height: 52px;
}
#header .logo,
#header .info {
    padding: 10px 15px;
}
#header .logo {
    margin-right: 0;
}
#header .logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    margin: 0;
}
#header .info {
    font-size: 13px;
    color: #475569;
    text-align: right;
}
#header .info br {
    display: none;
}
#header .info a.sel {
    color: #1d4ed8;
    font-weight: 500;
    display: inline-block;
    padding: 4px 2px;
    min-height: 24px;
    line-height: 24px;
}
#header .info a.sel:hover {
    color: #1e40af;
}
/* Hamburger toggle — hidden on desktop */
.nav-toggle {
    display: none;
}
.nav-toggle-label {
    display: none;
    cursor: pointer;
    padding: 10px 14px;
    color: #1e293b;
    font-size: 22px;
    line-height: 1;
    position: absolute;
    right: 10px;
    top: 6px;
    z-index: 1001;
}

/* --------------------------------------------------------------------------
   Page Content Area
   -------------------------------------------------------------------------- */
#content {
    background-color: #fff;
    flex: 1;
}
/* Content area — no max-width constraint (overview tables need full width) */

/* Page subheading / title bar */
#content .sub_tit {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #334155;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    letter-spacing: 0.01em;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.but {
    width: auto;
    min-width: 100px;
    padding: 8px 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    background: linear-gradient(180deg, #fff, #f3f4f6);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.4;
}
.but:hover {
    background: linear-gradient(180deg, #f9fafb, #e5e7eb);
    border-color: #9ca3af;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.but:active {
    transform: translateY(1px);
    box-shadow: none;
}
.but:disabled,
.but[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.but-primary {
    color: #fff;
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border-color: #1e40af;
}
.but-primary:hover {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-color: #1d4ed8;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
/* M-5: Override legacy 280px with responsive widths */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
textarea,
select {
    font-family: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #fff;
    color: #1e293b;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.4;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}
select {
    max-width: 405px;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input[type="file"] {
    font-family: inherit;
    font-size: 13px;
    padding: 6px;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2563eb;
}

select {
    appearance: auto;
    padding-right: 12px;
}

legend {
    font-weight: 600;
    color: #475569;
    font-size: 14px;
}

/* Form structure */
#content .forms {
    padding-top: 0;
}
/* QW-6: Profile card — styled panels with background and border */
#content .forms .pan {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px 24px 12px;
    margin-bottom: 16px;
}
#content .forms .row {
    margin-top: 16px;
}
#content .forms .row label {
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    display: inline-block;
    margin-bottom: 4px;
}
#content .forms .row .field {
    margin-top: 6px;
    height: auto;
    color: #1e293b;
    font-size: 14px;
}

/* Validation error text */
.terr {
    font-size: 12px;
    color: #dc2626;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Notification Messages (error/success)
   -------------------------------------------------------------------------- */
.error,
.success {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.error .caption,
.success .caption {
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    color: #fff;
}
.error .msg,
.success .msg {
    padding: 10px 16px;
    font-size: 13px;
    border: none;
    line-height: 1.5;
}
.error .caption {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}
.error .msg {
    background-color: #fef2f2;
    color: #991b1b;
    border-left: 3px solid #dc2626;
}
.success .caption {
    background: linear-gradient(135deg, #059669, #047857);
}
.success .msg {
    background-color: #ecfdf5;
    color: #065f46;
    border-left: 3px solid #059669;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
#content .rows {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

#content .rows .tr_th {
    background: linear-gradient(180deg, #1e293b, #0f172a);
    color: #e2e8f0;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
#content .rows .tr_th td,
#content .rows .tr_th th {
    padding: 12px 10px;
    border-bottom: 2px solid #334155;
}

#content .rows .tr_od {
    background-color: #fff;
}
#content .rows .tr_ev {
    background-color: #f8fafc;
}
#content .rows .tr_od td,
#content .rows .tr_ev td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    vertical-align: middle;
}
#content .rows .tr_ev:hover,
#content .rows .tr_od:hover,
#content .rows .tr:hover {
    background-color: #eff6ff;
}

/* Table links */
#content .rows td a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}
#content .rows td a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
/* QW-5: Pagination — larger tap targets, clearer hover states */
.page {
    margin: 16px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.page div {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-left: 0;
    transition: all 0.15s ease;
    float: none;
}
.page div a {
    padding: 8px 14px;
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    display: block;
    min-width: 36px;
    text-align: center;
}
.page div:hover {
    border-color: #2563eb;
    background-color: #eff6ff;
}
.page div:hover a {
    color: #1d4ed8;
}
.page .cur {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 8px 14px;
    min-width: 36px;
    text-align: center;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Filter Options
   -------------------------------------------------------------------------- */
.filter_options {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 16px;
    margin-bottom: 16px;
}
.filter_options legend {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    padding: 12px 4px;
    cursor: pointer;
    transition: color 0.15s ease;
}
.filter_options legend:hover,
.filter_options legend a:hover {
    color: #1d4ed8;
}
.filter_options .filters .ftab {
    margin-right: 16px;
    padding: 8px 0;
}
.filter_options .filters .ftab .label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}
.filter_options .filters .ftab input,
.filter_options .filters .ftab select {
    font-size: 13px;
}

/* --------------------------------------------------------------------------
   Navigation Tabs (cap_buttons / cap_nav variants)
   -------------------------------------------------------------------------- */
.cap_buttons .cap_nav_black {
    background: linear-gradient(180deg, #374151, #1f2937);
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}
.cap_buttons .cap_nav_black li {
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.cap_buttons .cap_nav_black li:last-child {
    border-right: none;
}
.cap_buttons .cap_nav_black li a {
    background: transparent;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 13px;
    transition: background-color 0.15s ease;
}
.cap_buttons .cap_nav_black li a:hover,
.cap_buttons .cap_nav_black .sel {
    background-color: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   Home Page — Carousel
   -------------------------------------------------------------------------- */
#home_img {
    z-index: auto;
}
#content .home {
    margin-top: 30px;
    margin-bottom: 30px;
}
#content .home .cycle {
    border: none;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
#content .home .cycle img {
    border-radius: 10px;
}

/* --------------------------------------------------------------------------
   Footer — QW-4: Full-width, increased contrast
   -------------------------------------------------------------------------- */
#footer {
    border-top: 1px solid #e2e8f0;
    margin-top: 40px;
    padding: 24px 20px;
    color: #475569;
    font-size: 13px;
    background-color: #f1f5f9;
    text-align: center;
}
#footer p {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Left Panel (sidebar) Navigation
   -------------------------------------------------------------------------- */
#content .left_panel .left_menu {
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border-radius: 8px;
    overflow: hidden;
}
#content .left_panel .left_menu li a {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
    background: transparent;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background-color 0.15s ease, color 0.15s ease;
}
#content .left_panel .left_menu li a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}
#content .left_panel .left_menu a.sel {
    color: #fff;
    background-color: rgba(37, 99, 235, 0.2);
}

/* --------------------------------------------------------------------------
   Comments / Remarks
   -------------------------------------------------------------------------- */
.comments_msg,
.comments_msg1,
.comments_msg2 {
    background-color: #f8fafc;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
}
.comments_msg .title,
.comments_msg1 .title,
.comments_msg2 .title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}
.comments_msg .comments,
.comments_msg1 .comments,
.comments_msg2 .comments {
    margin-top: 8px;
    color: #475569;
    line-height: 1.6;
}
.comments_msg .author,
.comments_msg2 .author {
    color: #dc2626;
    font-style: italic;
    font-size: 12px;
}
.comments_msg .date,
.comments_msg1 .date,
.comments_msg2 .date {
    color: #94a3b8;
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   Status / Loading Indicator
   -------------------------------------------------------------------------- */
#header .status {
    border-radius: 4px;
}
#header .loading {
    background-color: #fef9c3;
    color: #854d0e;
    font-weight: 500;
    border-radius: 4px;
    padding: 2px 8px;
}

/* --------------------------------------------------------------------------
   Panel Captions (section headers)
   -------------------------------------------------------------------------- */
#content .pan_caption_org,
#content .pan_caption_org_l {
    border-radius: 4px;
    border: none;
}
#content .pan_caption_org {
    background: linear-gradient(135deg, #ea580c, #c2410c);
}
#content .pan_caption_org_l {
    background: linear-gradient(135deg, #fb923c, #f97316);
}

#content .pan_caption_qua,
#content .pan_caption_qua_l {
    border-radius: 4px;
    border: none;
}
#content .pan_caption_qua {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}
#content .pan_caption_qua_l {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

#content .pan_caption_grey,
#content .pan_caption_grey_l {
    border-radius: 4px;
    border: none;
}
#content .pan_caption_black,
#content .pan_caption_black_l {
    border-radius: 4px;
    border: none;
}
#content .pan_caption_black {
    background: linear-gradient(135deg, #374151, #1f2937);
}
#content .pan_caption_black_l {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* --------------------------------------------------------------------------
   Drag & Drop Lists
   -------------------------------------------------------------------------- */
.drag #selected_list ul li,
.drag #overall_list ul li {
    background-color: #334155;
    color: #e2e8f0;
    padding: 8px 12px;
    margin-top: 3px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}
.drag #selected_list ul li:hover,
.drag #overall_list ul li:hover {
    background-color: #475569;
}

/* --------------------------------------------------------------------------
   jQuery UI Dialog Overrides
   -------------------------------------------------------------------------- */
.ui-dialog {
    border-radius: 10px !important;
    border: none !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
}
.ui-dialog .ui-dialog-titlebar {
    background: linear-gradient(180deg, #1e293b, #0f172a) !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 14px 20px !important;
    color: #e2e8f0 !important;
    font-family: inherit !important;
    font-weight: 600 !important;
    font-size: 15px !important;
}
.ui-dialog .ui-dialog-titlebar-close {
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    top: 50% !important;
    transform: translateY(-50%);
    margin-top: 0 !important;
    transition: background-color 0.15s ease !important;
    text-indent: -9999px;
    overflow: hidden;
}
.ui-dialog .ui-dialog-titlebar-close .ui-icon {
    background-image: url("images/ui-icons_ffffff_256x240.png") !important;
}
.ui-dialog .ui-dialog-titlebar-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}
.ui-dialog .ui-dialog-content {
    font-family: inherit !important;
    font-size: 14px !important;
    padding: 20px !important;
    color: #334155 !important;
}
.ui-dialog .ui-dialog-buttonpane {
    padding: 12px 20px !important;
    border-top: 1px solid #e2e8f0 !important;
    background-color: #f8fafc !important;
}
.ui-dialog .ui-dialog-buttonpane button {
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 20px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

/* Overlay behind dialogs */
.ui-widget-overlay {
    background: rgba(15, 23, 42, 0.65) !important;
    opacity: 1 !important;
}

/* --------------------------------------------------------------------------
   Strikeout rows
   -------------------------------------------------------------------------- */
tr.strikeout {
    opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Scrollbar (Webkit browsers)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* --------------------------------------------------------------------------
   Selection highlight
   -------------------------------------------------------------------------- */
::selection {
    background-color: #bfdbfe;
    color: #1e293b;
}

/* --------------------------------------------------------------------------
   Table Horizontal Scroll (wide tables like contract overview — 19 columns)
   -------------------------------------------------------------------------- */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
    border-radius: 8px;
}
.table-scroll-wrapper > table {
    min-width: 1400px;
}
.table-scroll-wrapper > table.rows {
    width: auto;
}

/* --------------------------------------------------------------------------
   Content Area Padding
   -------------------------------------------------------------------------- */
#content > div[style*="padding"] {
    padding: 16px 20px !important;
}

/* --------------------------------------------------------------------------
   Responsive helpers — make wide tables scrollable automatically
   -------------------------------------------------------------------------- */
@media screen and (max-width: 1200px) {
    #content .rows {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* --------------------------------------------------------------------------
   Form Layout Enhancements
   -------------------------------------------------------------------------- */
#content .forms .row label {
    display: block;
}
input[type="submit"],
button[type="submit"] {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 24px;
    color: #fff;
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border: 1px solid #1d4ed8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}
input[type="submit"]:hover,
button[type="submit"]:hover {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
input[type="submit"]:active,
button[type="submit"]:active {
    transform: translateY(1px);
    box-shadow: none;
}
input[type="submit"]:disabled,
button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* --------------------------------------------------------------------------
   Input Width — desktop default (M-5 responsive override in media queries)
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Navigation — cap_nav variants (blue / orange / grey)
   -------------------------------------------------------------------------- */
.cap_buttons .cap_nav {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}
.cap_buttons .cap_nav li {
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.cap_buttons .cap_nav li:last-child {
    border-right: none;
}
.cap_buttons .cap_nav li a {
    background: transparent;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 13px;
    transition: background-color 0.15s ease;
}
.cap_buttons .cap_nav li a:hover,
.cap_buttons .cap_nav .sel {
    background-color: rgba(255, 255, 255, 0.15);
}

.cap_buttons .cap_nav_org {
    background: linear-gradient(180deg, #ea580c, #c2410c);
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}
.cap_buttons .cap_nav_org li {
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.cap_buttons .cap_nav_org li:last-child {
    border-right: none;
}
.cap_buttons .cap_nav_org li a {
    background: transparent;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 13px;
    transition: background-color 0.15s ease;
}
.cap_buttons .cap_nav_org li a:hover,
.cap_buttons .cap_nav_org .sel {
    background-color: rgba(255, 255, 255, 0.15);
}

.cap_buttons .cap_nav_grey {
    background: linear-gradient(180deg, #9ca3af, #6b7280);
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}
.cap_buttons .cap_nav_grey li {
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.cap_buttons .cap_nav_grey li:last-child {
    border-right: none;
}
.cap_buttons .cap_nav_grey li a {
    background: transparent;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    transition: background-color 0.15s ease;
}
.cap_buttons .cap_nav_grey li a:hover,
.cap_buttons .cap_nav_grey .sel {
    background-color: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   Fieldset / Form Grouping
   -------------------------------------------------------------------------- */
fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Tooltip-style small text
   -------------------------------------------------------------------------- */
.ent {
    font-size: 11px;
    color: #94a3b8;
}

/* --------------------------------------------------------------------------
   Focus-visible for keyboard navigation
   -------------------------------------------------------------------------- */
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Smooth transitions on interactive elements
   -------------------------------------------------------------------------- */
.but,
input[type="submit"],
button[type="submit"],
.page div,
.cap_buttons li a,
#header .menu .nav li a {
    transition: all 0.15s ease;
}

/* --------------------------------------------------------------------------
   M-4: Status Badge Cells — accessible color + text label
   -------------------------------------------------------------------------- */
.status-active {
    background-color: #dcfce7;
    color: #166534;
    font-weight: 600;
    font-size: 12px;
    border-radius: 4px;
}
.status-expired {
    background-color: #fee2e2;
    color: #991b1b;
    font-weight: 600;
    font-size: 12px;
    border-radius: 4px;
}
.status-warning {
    background-color: #fef9c3;
    color: #854d0e;
    font-weight: 600;
    font-size: 12px;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   M-2: Contract Create Form — two-column alignment
   -------------------------------------------------------------------------- */
#content .forms.lt {
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 24px;
}
#content .forms.lt + .forms.lt {
    padding-right: 0;
    padding-left: 8px;
}
#content .forms.lt .row {
    margin-bottom: 10px;
}
#content .forms.lt .row label {
    min-height: 18px;
}

/* --------------------------------------------------------------------------
   M-6: Styled File Input
   -------------------------------------------------------------------------- */
input[type="file"] {
    font-family: inherit;
    font-size: 13px;
    padding: 8px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    background-color: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}
input[type="file"]:hover {
    border-color: #2563eb;
    background-color: #eff6ff;
}
input[type="file"]:focus {
    outline: none;
    border-color: #2563eb;
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
input[type="file"]::file-selector-button {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    margin-right: 12px;
    color: #374151;
    background: linear-gradient(180deg, #fff, #f3f4f6);
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}
input[type="file"]::file-selector-button:hover {
    background: linear-gradient(180deg, #f9fafb, #e5e7eb);
    border-color: #9ca3af;
}

/* --------------------------------------------------------------------------
   L-6: Button Variants — danger
   -------------------------------------------------------------------------- */
.but-danger {
    color: #fff;
    background: linear-gradient(180deg, #ef4444, #dc2626);
    border-color: #b91c1c;
}
.but-danger:hover {
    background: linear-gradient(180deg, #f87171, #ef4444);
    border-color: #dc2626;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* --------------------------------------------------------------------------
   L-2: Edit User — Delete link styled as danger action
   -------------------------------------------------------------------------- */
#content .rows .tr_th a[id="delete_user"] {
    color: #fca5a5;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.03em;
}
#content .rows .tr_th a[id="delete_user"]:hover {
    color: #fef2f2;
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   L-5: Filter Options — chevron indicator for clickable legend
   -------------------------------------------------------------------------- */
.filter_options legend::after {
    content: " \25BC";
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s ease;
    display: inline-block;
    margin-left: 6px;
}
.filter_options legend:hover::after {
    color: #1d4ed8;
}

/* --------------------------------------------------------------------------
   L-4: Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumbs {
    font-size: 12px;
    color: #475569;
    padding: 8px 20px;
    background-color: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
}
.breadcrumbs a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}
.breadcrumbs .sep {
    margin: 0 6px;
    color: #cbd5e1;
}

/* ==========================================================================
   3.4 Toast Notifications — auto-dismiss success messages
   ========================================================================== */
.success.toast-fade {
    animation: toastFadeOut 0.5s ease forwards;
}
@keyframes toastFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); max-height: 0; margin: 0; padding: 0; overflow: hidden; }
}

/* ==========================================================================
   3.5 Accessibility — ARIA landmarks, skip-to-content
   ========================================================================== */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 10px 20px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 6px 0;
}
.skip-to-content:focus {
    left: 0;
}

/* ==========================================================================
   3.1 Mobile Responsiveness
   ========================================================================== */

/* --- Tablet (max 1024px) --- */
@media screen and (max-width: 1024px) {
    #header .logo h1 {
        font-size: 17px;
    }
    #header .info {
        font-size: 12px;
    }
    #content .forms {
        width: 100%;
    }
    #content .forms .row {
        width: 100%;
    }
    input[type="text"],
    input[type="password"],
    input[type="email"],
    textarea,
    select {
        width: 100%;
        max-width: 100%;
    }
    #content .left_panel {
        width: 20%;
    }
    #content .right_panel {
        width: 78%;
    }
    .cap_buttons .cap_nav li a,
    .cap_buttons .cap_nav_black li a,
    .cap_buttons .cap_nav_org li a,
    .cap_buttons .cap_nav_grey li a {
        padding: 8px 14px;
        font-size: 12px;
    }
    .filter_options .filters .ftab {
        margin-right: 10px;
    }
    /* M-2: Two-column contract form → single column on tablet */
    #content .forms.lt {
        float: none;
        width: 100% !important;
        padding-right: 0;
    }
    #content .forms.lt + .forms.lt {
        padding-left: 0;
    }
}

/* --- Mobile (max 768px) --- */
@media screen and (max-width: 768px) {
    /* M-3: Hamburger menu — show toggle, hide nav by default */
    .nav-toggle-label {
        display: block;
        position: fixed;
        top: 8px;
        right: 10px;
    }
    #header .menu {
        position: relative;
    }
    #header .menu .nav {
        display: none;
        flex-direction: column;
        width: 100%;
    }
    #header .menu .nav li {
        float: none;
        display: block;
    }
    #header .menu .nav li a {
        padding: 12px 18px;
        font-size: 13px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    /* Show nav when toggle is checked (specificity must beat #header .menu .nav) */
    #header .menu .nav-toggle:checked ~ .nav {
        display: flex;
    }
    /* Dropdown submenus — show inline on mobile */
    #header .menu .nav ul {
        position: static;
        display: block;
        box-shadow: none;
        border-radius: 0;
        background-color: rgba(0, 0, 0, 0.15);
    }
    #header .menu .nav ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }
    #header .menu .nav ul a {
        padding-left: 36px;
        font-size: 12px;
    }

    /* M-1: Header band — stack on mobile */
    #header .header-band {
        flex-direction: column;
        padding: 8px 15px;
        text-align: center;
    }
    #header .logo,
    #header .info {
        float: none;
        text-align: center;
        padding: 4px 10px;
    }
    #header .info {
        text-align: center;
    }
    #header .logo {
        margin-right: 0;
    }

    /* L-3: Carousel — cap height on mobile */
    #content .home .cycle {
        max-height: 50vh;
        overflow: hidden;
    }
    #content .home .cycle img {
        object-fit: cover;
        max-height: 50vh;
        width: 100%;
    }

    /* Page heading */
    #content .sub_tit {
        font-size: 14px;
        padding: 10px 14px;
    }

    /* Tables — horizontal scroll */
    #content .rows {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 12px;
    }
    #content .rows .tr_th td,
    #content .rows .tr_th th {
        padding: 8px 6px;
        font-size: 11px;
    }
    #content .rows .tr_od td,
    #content .rows .tr_ev td {
        padding: 6px 5px;
        font-size: 12px;
    }

    /* Forms — full width */
    #content .forms {
        width: 100%;
        padding: 0 10px;
    }
    #content .forms.lt {
        float: none;
        width: 100% !important;
        padding-right: 0;
    }
    input[type="file"] {
        max-width: 100%;
    }
    #content .forms .row {
        width: 100%;
    }
    input[type="text"],
    input[type="password"],
    input[type="email"],
    textarea,
    select {
        width: 100%;
        max-width: 100%;
    }

    /* Sidebar — stack above content */
    #content .left_panel,
    #content .right_panel {
        float: none;
        width: 100%;
    }
    #content .left_panel {
        margin-right: 0;
        margin-bottom: 10px;
    }
    #content .left_panel .left_menu {
        display: flex;
        flex-wrap: wrap;
        border-radius: 6px;
    }
    #content .left_panel .left_menu li {
        flex: 1 1 auto;
    }
    #content .left_panel .left_menu li a {
        text-align: center;
        padding: 8px 10px;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* Filter options — stack vertically */
    .filter_options .filters .ftab {
        float: none;
        width: 100%;
        margin-right: 0;
        padding: 6px 0;
    }

    /* Pagination */
    .page div {
        margin-left: 2px;
        margin-bottom: 4px;
    }
    .page div a {
        padding: 5px 8px;
        font-size: 12px;
    }

    /* Footer */
    #footer {
        padding: 16px 10px;
    }

    /* Comments */
    .comments_msg,
    .comments_msg1,
    .comments_msg2 {
        width: 100%;
        margin-left: 0;
    }

    /* Buttons */
    .but {
        min-width: 80px;
        padding: 7px 14px;
        font-size: 12px;
    }
}

/* --- Small mobile (max 480px) --- */
@media screen and (max-width: 480px) {
    #header .menu .nav li a {
        padding: 10px 14px;
        font-size: 12px;
    }
    #header .logo h1 {
        font-size: 15px;
    }
    #content .sub_tit {
        font-size: 13px;
        padding: 8px 10px;
    }
    #content > div[style*="padding"] {
        padding: 10px !important;
    }

    /* Two-column contract form → single column */
    #content .forms .pan {
        float: none;
        width: 100%;
    }
}
