/* ULF flat UI (2026-11-25, user: "ui, ux sahi karo, 3d button na ho, simple and user friendly, professional ho").
   One shared file, loaded by every module (app.py _FLAT_UI_PATCH, replacing the old _3D_CARD_PATCH), the portal
   and WorkDesk. Removes raised / embossed shadows and the lift-on-hover / press-down movement from buttons and
   cards. Colours, sizes and layout are untouched; the keyboard focus ring is kept (accessibility). */

/* cards: a thin border instead of a heavy layered shadow, no lift on hover */
.card, .u-card, .stat-card, .nv-card, .kpi, .tile {
  box-shadow: none !important;
  transition: background-color .15s ease, border-color .15s ease !important;
}
.card, .u-card { border: 1px solid rgba(255, 255, 255, .09) !important; }
html:not(#_) .card:hover, html:not(#_) .u-card:hover, html:not(#_) .stat-card:hover, html:not(#_) .nv-card:hover, html:not(#_) .kpi:hover, html:not(#_) .tile:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* buttons and button-like links: flat, no 3D edge, no jump on hover or press */
button, .btn, [class*="btn"], a[class*="btn"], input[type="button"], input[type="submit"], .chip, .ai-chip, .tab, .nav-item {
  text-shadow: none !important;
}
button:not(:focus-visible), .btn:not(:focus-visible), [class*="btn"]:not(:focus-visible),
input[type="button"]:not(:focus-visible), input[type="submit"]:not(:focus-visible) {
  box-shadow: none !important;
}
html:not(#_) button:hover, html:not(#_) button:active, html:not(#_) .btn:hover, html:not(#_) .btn:active,
html:not(#_) [class*="btn"]:hover, html:not(#_) [class*="btn"]:active, html:not(#_) input[type="button"]:hover,
html:not(#_) input[type="submit"]:hover, html:not(#_) .chip:hover, html:not(#_) .ai-chip:hover, html:not(#_) .tab:hover,
html:not(#_) .nav-item:hover {
  transform: none !important;
}
button, .btn, [class*="btn"], input[type="button"], input[type="submit"] {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease !important;
}
/* a calm hover cue instead of movement */
button:not(:disabled):hover, .btn:hover, a[class*="btn"]:hover { filter: brightness(1.06); }
button:disabled, .btn:disabled { filter: none; }

/* portal shell: its own hover lifts / slides (incl. the Design Studio "premium" mode, which uses html.ds-premium) */
html:not(#_) .side .item:hover, html.ds-premium:not(#_) .side .item:hover,
html:not(#_) .stat:hover, html.ds-premium:not(#_) .stat:hover, html:not(#_) .stat:hover .si, html.ds-premium:not(#_) .stat:hover .si,
html:not(#_) .nv-card:hover, html.ds-premium:not(#_) .nv-card:hover, html:not(#_) .card:hover, html.ds-premium:not(#_) .card:hover,
html:not(#_) .chart-card:hover, html.ds-premium:not(#_) .chart-card:hover, html:not(#_) .dqa-btn:hover, html:not(#_) .role-card:hover,
html:not(#_) .pill:hover, html.ds-premium:not(#_) .pill:hover, html:not(#_) .applybtn:hover, html.ds-premium:not(#_) .applybtn:hover,
html:not(#_) .filterbar .applybtn:hover, html:not(#_) .btn:hover, html.ds-premium:not(#_) .btn:hover,
html:not(#_) .quickbtn:hover, html.ds-premium:not(#_) .quickbtn:hover, html:not(#_) .ai-fab:hover {
  transform: none !important;
}
html:not(#_) .stat:hover, html.ds-premium:not(#_) .stat:hover, html:not(#_) .nv-card:hover, html:not(#_) .dqa-btn:hover, html:not(#_) .role-card:hover,
html:not(#_) .pill:hover, html:not(#_) .applybtn:hover, html:not(#_) .filterbar .applybtn:hover, html.ds-premium:not(#_) .card:hover,
html.ds-premium:not(#_) .chart-card:hover, html.ds-premium:not(#_) .btn:hover {
  box-shadow: none !important;
}

/* 2026-11-26 (user: "attendance card par click karne par blue background kyu"): clickable cards / tiles / rows never
   flash blue -- no touch tap highlight, no text selection on quick clicks, no focus glow (keyboard focus keeps a thin
   gold outline only). */
html, body { -webkit-tap-highlight-color: transparent; }
html:not(#_) .stat, html:not(#_) .stat-card, html:not(#_) .fov-stat, html:not(#_) .hmc, html:not(#_) .don-card,
html:not(#_) [onclick].card, html:not(#_) [role=button], html:not(#_) .ulf-pend-btn, html:not(#_) [data-tray], html:not(#_) .att-row {
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
html:not(#_) .stat:focus, html:not(#_) .stat-card:focus, html:not(#_) .fov-stat:focus, html:not(#_) [role=button]:focus,
html:not(#_) .hmc:focus, html:not(#_) [data-tray]:focus { box-shadow: none !important; outline: none !important; }
html:not(#_) .stat:focus-visible, html:not(#_) [role=button]:focus-visible, html:not(#_) [data-tray]:focus-visible { outline: 1px solid rgba(255,215,0,.6) !important; }

/* 2026-11-30 (user: tables crushed -- "AM OU NT", "22/ 11/ 20 26", rows 4-5 lines tall): the 2026-11-26 "fit every table
   into the screen" rule (min-width:0 + overflow-wrap:anywhere) is replaced. A data table now scrolls sideways INSIDE its
   own box (the page never does), words and numbers never break, headers are compact and sticky. Column kinds are set by
   /static/vendor/ulf-table-layout.js from the header text. Tab bars still wrap onto a second line. */
@media (min-width: 900px) {
  html:not(#_) .tabs, html:not(#_) .tab-bar, html:not(#_) .ctabs, html:not(#_) [class$="-tabs"], html:not(#_) [class*="tabs "] { flex-wrap: wrap !important; overflow-x: visible !important; row-gap: 6px; }
}
html:not(#_) table.ulf-dt, html:not(#_) table.ulf-dt th, html:not(#_) table.ulf-dt td { word-break: normal !important; overflow-wrap: normal !important; hyphens: none !important; }
html:not(#_) .ulf-tscroll { overflow-x: auto !important; max-width: 100%; -webkit-overflow-scrolling: touch; }
html:not(#_) .ulf-tscroll > table.ulf-dt { table-layout: auto !important; min-width: 100% !important; width: max-content !important; max-width: none !important; }
html:not(#_) table.ulf-dt th { text-transform: none !important; white-space: nowrap !important; font-size: 12px !important; letter-spacing: 0 !important; padding: 8px 10px !important; position: sticky; top: 0; z-index: 3; background: #2b3826 !important; }
html:not(#_) table.ulf-dt td { padding: 8px 10px !important; vertical-align: middle; }
html.ulf-dense:not(#_) table.ulf-dt td { padding: 4px 8px !important; font-size: 12.5px; }
html:not(#_) table.ulf-dt .ulf-c-num { white-space: nowrap !important; min-width: 110px; text-align: right !important; font-variant-numeric: tabular-nums; }
html:not(#_) table.ulf-dt .ulf-c-date { white-space: nowrap !important; min-width: 100px; }
html:not(#_) table.ulf-dt .ulf-c-ref { white-space: nowrap !important; min-width: 170px; }
html:not(#_) table.ulf-dt .ulf-c-st { white-space: nowrap !important; min-width: 110px; }
html:not(#_) table.ulf-dt .ulf-c-sno { white-space: nowrap !important; min-width: 44px; }
html:not(#_) table.ulf-dt .ulf-c-text { min-width: 150px; max-width: 280px; }
html:not(#_) table.ulf-dt .ulf-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
html:not(#_) table.ulf-dt .ulf-c-act { white-space: nowrap !important; }
html:not(#_) table.ulf-dt .ulf-c-act > *, html:not(#_) table.ulf-dt .ulf-c-act > div > * { display: inline-flex !important; vertical-align: middle; margin: 1px 2px !important; }
html:not(#_) table.ulf-dt .ulf-c-act > div { display: inline-flex !important; flex-wrap: nowrap !important; gap: 3px; }
html:not(#_) table.ulf-dt .ulf-c-act br { display: none; }
html:not(#_) table.ulf-dt .ulf-stick { position: sticky; z-index: 2; background: #303d2c !important; }
html:not(#_) table.ulf-dt th.ulf-stick { z-index: 4; background: #2b3826 !important; }
html:not(#_) .ulf-tl-bar { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin: 2px 0 4px; position: relative; }
html:not(#_) .ulf-tl-bar button { cursor: pointer; background: transparent; color: #f7f9f2; border: 1px solid #55684a; border-radius: 7px; padding: 3px 9px; font-size: 11.5px; }
html:not(#_) .ulf-tl-bar button:hover { border-color: #ffd700; color: #ffd700; }
html:not(#_) .ulf-tl-menu { position: absolute; right: 0; top: 100%; z-index: 50; background: #26311f; border: 1px solid #55684a; border-radius: 10px; padding: 8px 10px; max-height: 320px; overflow: auto; min-width: 200px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
html:not(#_) .ulf-tl-menu label { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: #f7f9f2; padding: 3px 0; white-space: nowrap; cursor: pointer; }
/* more room: the Finance in-module menu is narrower and can be folded away (remembered) */
@media (min-width: 900px) {
  html:not(#_) .layout > .sidebar { width: 196px !important; min-width: 196px !important; }
  html:not(#_) .layout.ulf-sb-off > .sidebar { display: none !important; }
  html:not(#_) .layout > .main { padding-left: 14px !important; padding-right: 14px !important; max-width: none !important; }
}
/* phone: the in-module menu slides in OVER the page (it was moved off-screen but still took 250px, squeezing the page to ~100px) */
@media (max-width: 899px) {
  html:not(#_) .layout > .sidebar { position: fixed !important; top: 0; left: 0; height: 100vh !important; z-index: 300; }
  html:not(#_) .layout > .main { width: 100% !important; min-width: 0 !important; }
}
html:not(#_) table.ulf-dt th > *, html:not(#_) table.ulf-dt th .ulf-i { display: inline-flex !important; white-space: nowrap !important; vertical-align: middle; }
/* phone: filter rows (FY / type / status / project / month / search ...) two per line instead of 8 squeezed boxes */
@media (max-width: 700px) {
  html:not(#_) .filter-bar, html:not(#_) .filters, html:not(#_) .filter-row, html:not(#_) [class*="filter-bar"] { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  html:not(#_) .filter-bar > *, html:not(#_) .filters > *, html:not(#_) .filter-row > * { min-width: 0 !important; width: 100% !important; max-width: none !important; }
}
html:not(#_) .ulf-sb-btn { position: sticky; top: 6px; z-index: 30; cursor: pointer; background: #26311f; color: #ffd700; border: 1px solid #55684a; border-radius: 8px; padding: 3px 9px; font-size: 12px; margin: 0 0 6px; }

/* 2026-11-26 (user: "8 chhod kar sab karo", item 9 -- long pages shorter): project boxes side by side on a laptop
   (Finance Overview 'Project x Head', Expenditure 'Fund Utilization'); long holiday tables in a short box */
@media (min-width: 1000px) {
  html:not(#_) #fov-projhead-body, html:not(#_) .fov-projhead-body { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 10px; align-items: start; }
  html:not(#_) #fov-projhead-body > *, html:not(#_) .fov-projhead-body > * { margin: 0 !important; }
  html:not(#_) #exp-fund-util-card, html:not(#_) .exp-fund-util-card { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 10px; align-items: start; }
  html:not(#_) #exp-fund-util-card > *, html:not(#_) .exp-fund-util-card > * { grid-column: 1 / -1; }
  html:not(#_) #exp-fund-util-card > div:has(table), html:not(#_) .exp-fund-util-card > div:has(table) { grid-column: auto; margin: 0 !important; }
  html:not(#_) #holidayTable, html:not(#_) #rhTable { max-height: 330px; overflow-y: auto; display: block; }
}
