/*
  CENTRAL FLEET SYSTEMS
  CFS_UI_POLISH_20261007
  Final non-destructive visual consistency layer.
  Loaded last so older feature-specific styles keep their behaviour
  while shared controls, cards, forms and pages look consistent.
*/

:root{
  --cfs-bg:#050b14;
  --cfs-bg-soft:#081321;
  --cfs-panel:#0b1726;
  --cfs-panel-2:#0e1e31;
  --cfs-panel-3:#11263c;
  --cfs-line:rgba(151,177,211,.14);
  --cfs-line-strong:rgba(151,177,211,.24);
  --cfs-text:#f3f7fc;
  --cfs-muted:#91a0b5;
  --cfs-accent:#48c7ff;
  --cfs-accent-2:#6ce7c5;
  --cfs-danger:#ff6f78;
  --cfs-warning:#ffc765;
  --cfs-success:#65dea7;
  --cfs-radius:16px;
  --cfs-shadow:0 14px 36px rgba(0,0,0,.20);
}

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

html{
  color-scheme:dark;
  background:var(--cfs-bg);
}

body{
  color:var(--cfs-text);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

body,
button,
input,
select,
textarea{
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

h1,h2,h3,h4{
  color:var(--cfs-text);
  letter-spacing:-.02em;
}

h1{line-height:1.08}
h2{line-height:1.15}
h3{line-height:1.2}

p{
  line-height:1.55;
}

.muted{
  color:var(--cfs-muted) !important;
}

.small{
  line-height:1.45;
}

/* Shared surfaces */
.card,
.stat,
.item,
.notice,
.ff-hub-card,
.ff-settings-card,
.ff-settings-page-card,
.ff-performance-card,
.team-member-card,
.garage-job-card,
.tech-job-card,
.cfsExecPanel{
  border-color:var(--cfs-line) !important;
  box-shadow:var(--cfs-shadow);
}

.card,
.ff-settings-page-card,
.cfsExecPanel{
  background:
    linear-gradient(145deg,rgba(13,28,46,.96),rgba(7,16,28,.98)) !important;
}

.item,
.notice,
.ff-settings-card,
.ff-performance-card,
.team-member-card,
.garage-job-card,
.tech-job-card{
  background:rgba(13,27,44,.76);
}

.card,
.ff-settings-page-card{
  border-radius:18px !important;
}

.item,
.notice,
.stat,
.ff-settings-card,
.ff-performance-card,
.team-member-card,
.garage-job-card,
.tech-job-card{
  border-radius:14px !important;
}

.card > :first-child,
.notice > :first-child,
.item > :first-child{
  margin-top:0;
}

.card > :last-child,
.notice > :last-child,
.item > :last-child{
  margin-bottom:0;
}

/* Page headers */
.ff-page-heading,
.ff-page-head,
.ff-section-head,
.ff-wp-head,
.ff-dispatch-head,
.ff-audit-head,
.ff-report-head,
.ff-calendar-page-head{
  margin-bottom:18px;
}

.ff-page-heading h1,
.ff-wp-head h1,
.ff-dispatch-head h1,
.ff-audit-head h1,
.ff-report-head h1,
.ff-calendar-page-head h1{
  margin-top:0;
  margin-bottom:7px;
}

.ff-page-heading p,
.ff-wp-head p,
.ff-dispatch-head p,
.ff-audit-head p,
.ff-report-head p,
.ff-calendar-page-head p{
  margin-top:0;
}

.ff-page-eyebrow,
.ff2-page-eyebrow,
.ff-login-eyebrow{
  color:var(--cfs-accent) !important;
  font-weight:900;
  letter-spacing:.11em;
  text-transform:uppercase;
}

/* Buttons */
.button,
button{
  -webkit-tap-highlight-color:transparent;
}

.button{
  min-height:44px;
  border-radius:11px !important;
  font-weight:800 !important;
  letter-spacing:.01em;
  transition:
    transform .14s ease,
    border-color .14s ease,
    background .14s ease,
    box-shadow .14s ease,
    opacity .14s ease;
}

.button:hover:not(:disabled){
  transform:translateY(-1px);
}

.button:active:not(:disabled){
  transform:translateY(0);
}

.button:disabled,
button:disabled{
  opacity:.48;
  cursor:not-allowed;
}

.button.primary{
  color:#03111a !important;
  border-color:rgba(95,217,255,.28) !important;
  background:
    linear-gradient(135deg,var(--cfs-accent),var(--cfs-accent-2)) !important;
  box-shadow:0 9px 24px rgba(54,190,235,.16);
}

.button.secondary{
  color:var(--cfs-text) !important;
  border-color:var(--cfs-line-strong) !important;
  background:rgba(255,255,255,.045) !important;
}

.button.secondary:hover:not(:disabled){
  background:rgba(255,255,255,.075) !important;
  border-color:rgba(95,202,255,.28) !important;
}

.button.danger,
.danger.button{
  color:#ffd7da !important;
  border-color:rgba(255,111,120,.28) !important;
  background:rgba(255,111,120,.10) !important;
}

button:focus-visible,
.button:focus-visible,
.field:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline:2px solid rgba(72,199,255,.72) !important;
  outline-offset:2px;
}

/* Forms */
.label{
  display:block;
  margin:0 0 7px;
  color:#bdc9d8;
  font-size:12px;
  font-weight:800;
  letter-spacing:.025em;
}

.field,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea{
  width:100%;
  min-height:46px;
  color:var(--cfs-text);
  border:1px solid var(--cfs-line-strong) !important;
  border-radius:11px !important;
  background:rgba(3,10,19,.66) !important;
  transition:border-color .14s ease,box-shadow .14s ease,background .14s ease;
}

textarea{
  min-height:104px;
  resize:vertical;
}

.field:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus{
  border-color:rgba(72,199,255,.55) !important;
  background:rgba(5,15,26,.86) !important;
  box-shadow:0 0 0 3px rgba(72,199,255,.08);
}

input::placeholder,
textarea::placeholder{
  color:#687a91;
  opacity:1;
}

input[type="checkbox"],
input[type="radio"]{
  accent-color:var(--cfs-accent);
}

/* Common layout rhythm */
.actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:9px !important;
}

.row,
.grid{
  gap:12px;
}

.list{
  gap:10px !important;
}

.admin-tab-panel,
.ff-shell-hub{
  min-width:0;
}

.admin-tab-panel:not(.hidden),
.ff-shell-hub:not(.hidden){
  animation:cfsPolishIn .16s ease-out;
}

@keyframes cfsPolishIn{
  from{opacity:.72;transform:translateY(3px)}
  to{opacity:1;transform:none}
}

/* Status messages and chips */
.error,
.success,
.notice{
  padding:12px 14px;
  border:1px solid var(--cfs-line);
}

.error{
  color:#ffd8db;
  border-color:rgba(255,111,120,.24);
  background:rgba(255,111,120,.075);
}

.success{
  color:#c9ffe5;
  border-color:rgba(101,222,167,.22);
  background:rgba(101,222,167,.07);
}

.notice{
  color:#d8e5f2;
}

.badge,
[class$="-chip"],
[class*="-chip "]{
  font-weight:800;
}

/* Tables */
table{
  border-collapse:separate;
  border-spacing:0;
}

th{
  color:#aab9cb;
  font-size:11px;
  letter-spacing:.045em;
  text-transform:uppercase;
}

th,
td{
  padding:11px 12px;
  border-bottom:1px solid rgba(151,177,211,.09);
}

tbody tr{
  transition:background .12s ease;
}

tbody tr:hover{
  background:rgba(255,255,255,.025);
}

.ff-report-table-scroll,
.ff-audit-table-wrap,
.ff-calendar-scroll,
[class*="table-scroll"]{
  border-radius:13px;
  scrollbar-color:rgba(130,158,190,.30) transparent;
}

/* Left command centre navigation */
@media(min-width:901px){
  #fixFleetAdminSidebar{
    border-right:1px solid var(--cfs-line) !important;
    background:
      linear-gradient(180deg,rgba(7,17,29,.985),rgba(5,12,22,.985)) !important;
  }

  .ff-sidebar-brand{
    padding-bottom:18px;
    margin-bottom:8px;
    border-bottom:1px solid rgba(151,177,211,.09);
  }

  .ff-nav-item{
    min-height:43px;
    border-radius:10px !important;
    transition:background .14s ease,color .14s ease,transform .14s ease;
  }

  .ff-nav-item:hover{
    transform:translateX(2px);
    background:rgba(255,255,255,.045) !important;
  }

  .ff-nav-item.active{
    color:#fff !important;
    background:
      linear-gradient(90deg,rgba(72,199,255,.15),rgba(108,231,197,.055)) !important;
    box-shadow:inset 3px 0 0 rgba(72,199,255,.76);
  }

  body.ff-clean-legacy #admin:not(.hidden),
  body.ff-show-real-page #admin:not(.hidden){
    padding:28px 30px 48px !important;
  }

  body.ff-clean-legacy #admin .admin-tab-panel:not(.hidden),
  body.ff-clean-legacy #admin .ff-shell-hub:not(.hidden),
  body.ff-show-real-page #admin .admin-tab-panel:not(.hidden),
  body.ff-show-real-page #admin .ff-shell-hub:not(.hidden){
    max-width:1500px !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }

  #garage:not(.hidden),
  #recovery:not(.hidden),
  #tech:not(.hidden),
  #driver:not(.hidden),
  #job:not(.hidden),
  #detail:not(.hidden),
  #breakdown:not(.hidden),
  #check:not(.hidden),
  #vehicleForm:not(.hidden),
  #users:not(.hidden){
    width:100%;
    max-width:1220px;
    margin:0 auto;
    padding:26px 26px 48px;
  }

  #platformAdmin:not(.hidden){
    width:100%;
    max-width:1500px;
    margin:0 auto;
    padding:26px 26px 48px;
  }
}

/* Portal cards */
.garage-job-card,
.tech-job-card,
.team-member-card{
  padding:16px !important;
}

.garage-job-card:hover,
.tech-job-card:hover,
.team-member-card:hover,
.ff-settings-card:hover{
  border-color:rgba(72,199,255,.22) !important;
}

/* Modal consistency */
[class*="modal-backdrop"],
.ff-dc-modal{
  backdrop-filter:blur(8px);
}

[class*="modal"]:not([class*="backdrop"]),
.ff-dc-modal-card{
  border-color:var(--cfs-line-strong) !important;
  box-shadow:0 28px 80px rgba(0,0,0,.48) !important;
}

/* Top bar */
#top{
  border-bottom-color:var(--cfs-line) !important;
}

.ff-top-user-avatar{
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}

/* Login: retain approved composition, tidy controls only */
#login .ff-login-form-wrap .field{
  margin-bottom:15px;
}

#login .ff-login-button{
  width:100%;
}

#login .ff-login-security{
  color:#7f91a8;
}

/* Phone and tablet */
@media(max-width:900px){
  main{
    padding-left:12px !important;
    padding-right:12px !important;
  }

  #top{
    padding-left:12px !important;
    padding-right:12px !important;
  }

  #admin,
  #garage,
  #recovery,
  #tech,
  #driver,
  #job,
  #detail,
  #breakdown,
  #check,
  #vehicleForm,
  #users,
  #platformAdmin{
    min-width:0 !important;
  }

  .card,
  .ff-settings-page-card,
  .cfsExecPanel{
    padding:16px !important;
    border-radius:15px !important;
  }

  .item,
  .notice,
  .stat,
  .ff-settings-card,
  .ff-performance-card,
  .team-member-card,
  .garage-job-card,
  .tech-job-card{
    border-radius:12px !important;
  }

  .actions{
    gap:8px !important;
  }

  .button{
    min-height:46px;
  }

  .ff-page-heading,
  .ff-page-head,
  .ff-section-head,
  .ff-wp-head,
  .ff-dispatch-head,
  .ff-audit-head,
  .ff-report-head,
  .ff-calendar-page-head{
    margin-bottom:14px !important;
  }

  th,
  td{
    padding:10px;
  }
}

@media(max-width:600px){
  .actions > .button{
    flex:1 1 100%;
  }

  .card,
  .ff-settings-page-card,
  .cfsExecPanel{
    padding:14px !important;
  }

  .field,
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea{
    min-height:48px;
  }

  .ff-page-eyebrow,
  .ff2-page-eyebrow{
    font-size:10px;
  }

  .ff-page-heading p,
  .ff-wp-head p,
  .ff-dispatch-head p,
  .ff-audit-head p,
  .ff-report-head p,
  .ff-calendar-page-head p{
    font-size:13px;
  }
}

/* Reduced motion */
@media(prefers-reduced-motion:reduce){
  *,
  *::before,
  *::after{
    scroll-behavior:auto !important;
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}
