:root{
  --fft-primary:#0B2E59;
  --fft-accent:#10B981;
  --fft-support:#0F766E;

  --fft-bg:#f4f7fb;
  --fft-bg-soft:#eef2f7;
  --fft-card:#ffffff;
  --fft-text:#0f172a;
  --fft-muted:#64748b;
  --fft-border:rgba(15,23,42,.10);

  --fft-shadow-sm:0 2px 10px rgba(16,24,40,.06);
  --fft-shadow-md:0 10px 30px rgba(16,24,40,.10);

  --fft-radius:16px;
  --fft-radius-lg:18px;

  --fft-topbar-height:72px;
  --fft-content-max:1480px;
  --fft-content-pad:24px;
}

/* ==========================================================================
   Base
========================================================================== */
html,
body{
  height:100%;
  max-width:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  background:
    radial-gradient(circle at 20% 20%, rgba(11,46,89,.05), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(15,118,110,.05), transparent 30%),
    linear-gradient(90deg, #f7f9fc 0%, #eef2f7 40%, #f7f9fc 100%);
  color:var(--fft-text);
  font-family:Arial, Helvetica, sans-serif;
  line-height:1.45;
}

/* ==========================================================================
   App shell
========================================================================== */
body.app-page{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.app-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

.app-main{
  flex:1 0 auto;
  width:100%;
  display:block;
}

.app-content{
  width:100%;
  max-width:var(--fft-content-max);
  margin:0 auto;
  padding:22px 24px 28px;
  box-sizing:border-box;
}

.app-footer{
  margin-top:auto;
  flex-shrink:0;
  padding:10px 20px 14px;
  text-align:center;
  color:var(--fft-muted);
  font-size:12px;
  border-top:1px solid rgba(15,23,42,.06);
  background:rgba(255,255,255,.92);
}

/* ==========================================================================
   Fixed pages
========================================================================== */
body.fixed-page{
  overflow:hidden;
}

body.fixed-page .app-shell{
  height:100vh;
  overflow:hidden;
}

body.fixed-page .app-main{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

body.fixed-page .app-content{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
}

@media (max-width: 768px){
  body.fixed-page{
    overflow:auto;
  }

  body.fixed-page .app-shell{
    height:auto;
    overflow:visible;
  }

  body.fixed-page .app-main{
    display:block;
    overflow:visible;
    min-height:auto;
  }

  body.fixed-page .app-content{
    overflow:visible;
    min-height:auto;
  }
}

/* ==========================================================================
   Content width
========================================================================== */
@media (max-width: 1600px){
  .app-content{
    max-width:1400px;
  }
}

@media (max-width: 1400px){
  .app-content{
    max-width:1280px;
    padding:20px 20px 24px;
  }
}

@media (max-width: 1200px){
  .app-content{
    max-width:1120px;
    padding:18px 16px 22px;
  }
}

@media (max-width: 768px){
  .app-content{
    padding:14px;
  }
}

/* ==========================================================================
   Topbar
========================================================================== */
.app-topbar{
  min-height:var(--fft-topbar-height);
  background:var(--fft-primary);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:10px 18px;
  box-shadow:var(--fft-shadow-sm);
  border-bottom:1px solid rgba(255,255,255,.08);
}

.brand-wrap{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  flex:1 1 auto;
}

.brand-logo{
  height:40px;
  width:auto;
  max-width:180px;
  object-fit:contain;
  display:block;
  flex-shrink:0;
}

.brand-meta{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.brand-title{
  font-size:16px;
  font-weight:700;
  line-height:1.1;
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.brand-tagline{
  font-size:11px;
  color:rgba(255,255,255,.92);
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
  flex:0 1 420px;
  min-width:0;
}

.topbar-user-block{
  text-align:right;
  font-size:12px;
  line-height:1.3;
  white-space:normal;
  overflow-wrap:anywhere;
  min-width:0;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}

.topbar-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 10px;
  border-radius:9px;
  text-decoration:none;
  font-weight:600;
  background:rgba(255,255,255,.08);
  color:#fff;
  border:1px solid rgba(255,255,255,.12);
  font-size:13px;
}

.topbar-link:hover{
  background:rgba(255,255,255,.14);
}

.topbar-logout{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:9px;
  text-decoration:none;
  font-weight:700;
  background:rgba(239,68,68,.14);
  color:#fff;
  border:1px solid rgba(255,255,255,.16);
  font-size:13px;
}

.topbar-logout:hover{
  background:rgba(239,68,68,.22);
}

@media (max-width: 1280px){
  .app-topbar{
    flex-direction:column;
    align-items:flex-start;
    text-align:left;
    padding:10px 14px;
  }

  .topbar-right{
    justify-content:flex-start;
    width:100%;
    flex:1 1 auto;
  }

  .topbar-user-block{
    text-align:left;
  }
}

@media (max-width: 768px){
  .brand-logo{
    height:36px;
    max-width:150px;
  }

  .brand-title{
    font-size:15px;
  }

  .brand-tagline{
    font-size:10px;
  }
}

/* ==========================================================================
   Module navigation
========================================================================== */
.module-nav{
  background:#ffffff;
  border-bottom:1px solid rgba(15,23,42,.08);
  box-shadow:0 2px 8px rgba(15,23,42,.04);
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
}

.module-nav-inner{
  max-width:1440px;
  margin:0 auto;
  padding:0 18px;
  display:flex;
  flex-wrap:nowrap;
  gap:6px;
  align-items:center;
  min-height:44px;
  white-space:nowrap;
}

.module-nav-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:32px;
  padding:0 10px;
  border-radius:9px;
  text-decoration:none;
  color:var(--fft-primary);
  font-weight:600;
  font-size:12px;
  transition:.15s ease-in-out;
  flex:0 0 auto;
}

.module-nav-link:hover{
  background:rgba(16,185,129,.08);
  color:var(--fft-support);
}

.module-nav-link.active{
  background:rgba(16,185,129,.15);
  color:var(--fft-support);
  box-shadow:inset 0 0 0 1px rgba(16,185,129,.25);
}

@media (max-width: 768px){
  .module-nav-inner{
    padding:6px 12px;
    gap:6px;
    min-height:42px;
  }

  .module-nav-link{
    height:32px;
    padding:0 10px;
    font-size:12px;
  }
}

/* ==========================================================================
   Cards
========================================================================== */
.card{
  border:1px solid var(--fft-border);
  border-radius:var(--fft-radius-lg);
  background:var(--fft-card);
  box-shadow:var(--fft-shadow-sm);
  transition:box-shadow .15s ease-in-out, transform .15s ease-in-out;
}

.card:hover{
  box-shadow:var(--fft-shadow-md);
}

/* ==========================================================================
   Dashboard / Reports
========================================================================== */
.dashboard-page{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.dashboard-hero{
  padding:1.15rem 1.35rem;
  margin-bottom:2px;
  border-radius:18px;
  background:linear-gradient(135deg, rgba(255,255,255,.97), rgba(255,255,255,.90));
  border:1px solid var(--fft-border);
  box-shadow:var(--fft-shadow-sm);
}

.dashboard-hero-inner{
  display:grid;
  grid-template-columns:1.7fr 1fr;
  gap:16px;
  align-items:center;
}

.dashboard-hero-title{
  margin:0 0 .3rem 0;
  color:var(--fft-primary);
  font-size:2rem;
  line-height:1.06;
  letter-spacing:-.03em;
}

.dashboard-hero-text{
  margin:0;
  color:#475569;
  font-size:.97rem;
  max-width:820px;
}

.dashboard-hero-side{
  display:flex;
  justify-content:flex-end;
  align-items:flex-start;
}

.dashboard-hero-meta{
  display:flex;
  flex-wrap:wrap;
  gap:.45rem;
  justify-content:flex-end;
}

.dashboard-chip{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:.4rem .7rem;
  border-radius:999px;
  background:rgba(15,23,42,.05);
  color:var(--fft-text);
  font-size:.78rem;
  font-weight:600;
  border:1px solid var(--fft-border);
}

.dashboard-chip-success{
  background:rgba(16,185,129,.10);
  color:#166534;
  border-color:rgba(16,185,129,.18);
}

.stats-grid,
.stats-grid-compact{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:14px;
}

.stat-card,
.stat-card-compact{
  padding:.9rem 1rem .85rem;
  min-height:unset;
  height:auto;
  border-left:4px solid var(--fft-accent);
}

.stat-label{
  color:var(--fft-muted);
  font-size:.88rem;
  font-weight:600;
  margin-bottom:.35rem;
}

.stat-value{
  font-size:1.1rem;
  font-weight:700;
  color:var(--fft-primary);
  line-height:1.1;
  margin:0 0 .25rem 0;
}

.stat-note{
  color:var(--fft-muted);
  font-size:.85rem;
  line-height:1.35;
}

.dashboard-grid{
  display:grid;
  grid-template-columns:minmax(0, 2fr) minmax(320px, 1fr);
  gap:16px;
  align-items:start;
}

.dashboard-left,
.dashboard-right{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.dashboard-actions-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}

.panel-card,
.action-section-card,
.info-panel{
  padding:1rem 1rem 1.05rem;
  height:100%;
}

.panel-title,
.action-section-title{
  margin:0 0 .28rem 0;
  color:var(--fft-primary);
  font-size:1.02rem;
  font-weight:700;
}

.action-section-text{
  color:var(--fft-muted);
  font-size:.9rem;
  line-height:1.45;
  margin-bottom:1rem;
}

.action-list,
.quick-links{
  display:flex;
  flex-direction:column;
  gap:.7rem;
}

.action-link,
.quick-link{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  padding:.9rem 1rem;
  border:1px solid var(--fft-border);
  border-radius:12px;
  background:#fff;
  color:var(--fft-text);
  text-decoration:none;
  transition:.15s ease-in-out;
}

.action-link:hover,
.quick-link:hover{
  background:rgba(16,185,129,.045);
  border-color:rgba(16,185,129,.20);
  transform:translateY(-1px);
}

.action-meta{
  display:flex;
  flex-direction:column;
  gap:.12rem;
  min-width:0;
}

.action-name,
.quick-link-title{
  font-weight:700;
  color:var(--fft-primary);
}

.action-desc,
.quick-link small{
  font-size:.84rem;
  color:var(--fft-muted);
  line-height:1.35;
}

.action-arrow{
  color:var(--fft-muted);
  font-size:1rem;
  flex-shrink:0;
}

.info-box{
  border:1px solid var(--fft-border);
  border-radius:12px;
  background:rgba(15,23,42,.02);
  padding:1rem;
  margin-bottom:1rem;
}

.info-box-date{
  color:var(--fft-muted);
  font-size:.84rem;
}

.info-box-user{
  margin-top:.3rem;
  font-weight:700;
  color:var(--fft-primary);
}

.info-box-text{
  margin-top:.18rem;
  color:var(--fft-muted);
  font-size:.9rem;
}

.info-list{
  display:grid;
  gap:12px;
}

.info-row{
  display:flex;
  flex-direction:column;
  gap:3px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(15,23,42,.08);
}

.info-row:last-child{
  border-bottom:none;
  padding-bottom:0;
}

.info-label{
  color:var(--fft-muted);
  font-size:.82rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.info-value{
  color:var(--fft-text);
  font-size:.98rem;
  font-weight:600;
}

.note-panel{
  border:1px solid var(--fft-border);
  border-radius:12px;
  background:rgba(16,185,129,.04);
  padding:1rem;
  margin-top:1rem;
}

.note-title{
  margin:0 0 .35rem 0;
  color:var(--fft-primary);
  font-size:.96rem;
  font-weight:700;
}

.note-text{
  margin:0;
  color:var(--fft-muted);
  font-size:.9rem;
  line-height:1.45;
}

@media (max-width: 1280px){
  .dashboard-hero-inner{
    grid-template-columns:1fr;
  }

  .dashboard-hero-side{
    justify-content:flex-start;
  }

  .dashboard-hero-meta{
    justify-content:flex-start;
  }

  .stats-grid,
  .stats-grid-compact{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid{
    grid-template-columns:1fr;
  }

  .dashboard-actions-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width: 768px){
  .stats-grid,
  .stats-grid-compact{
    grid-template-columns:1fr;
  }

  .dashboard-hero-title{
    font-size:1.65rem;
  }

  .dashboard-hero{
    padding:1rem;
  }
}

/* ==========================================================================
   Buttons
========================================================================== */
.button-primary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  background:var(--fft-accent);
  color:#fff;
  padding:11px 16px;
  border-radius:10px;
  font-weight:600;
  border:none;
  cursor:pointer;
  transition:.15s ease-in-out;
  min-height:44px;
}

.button-primary:hover{
  background:var(--fft-support);
}

.button-secondary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  background:#fff;
  color:var(--fft-primary);
  padding:11px 16px;
  border-radius:10px;
  font-weight:600;
  border:1px solid var(--fft-border);
  cursor:pointer;
  transition:.15s ease-in-out;
  min-height:44px;
}

.button-secondary:hover{
  background:#f8fafc;
  border-color:rgba(11,46,89,.22);
}

.button-link{
  color:var(--fft-primary);
  text-decoration:none;
  font-weight:600;
}

.button-link:hover{
  color:var(--fft-support);
}

/* ==========================================================================
   Generic page layouts
========================================================================== */
.page-card{
  padding:1.15rem 1.2rem 1.2rem;
  margin-bottom:18px;
}

.page-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:16px;
}

.page-title-wrap{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.page-title{
  margin:0;
  color:var(--fft-primary);
  font-size:2rem;
  line-height:1.05;
  letter-spacing:-.03em;
}

.page-subtitle{
  margin:0;
  color:var(--fft-muted);
  font-size:.96rem;
}

@media (max-width: 900px){
  .page-header{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* ==========================================================================
   Tables
========================================================================== */
.data-table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
  border:1px solid var(--fft-border);
  border-radius:14px;
  max-width:100%;
}

.data-table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

.data-table thead th{
  background:#f8fafc;
  color:#475569;
  font-size:.9rem;
  font-weight:700;
  text-align:left;
  padding:13px 14px;
  border-bottom:1px solid var(--fft-border);
  white-space:nowrap;
}

.data-table tbody td{
  padding:13px 14px;
  border-bottom:1px solid rgba(15,23,42,.07);
  vertical-align:middle;
}

.data-table tbody tr:hover{
  background:rgba(16,185,129,.035);
}

/* ==========================================================================
   Forms
========================================================================== */
.form-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}

.form-group{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.form-group.span-2{
  grid-column:span 2;
}

.form-label{
  font-size:.92rem;
  font-weight:700;
  color:var(--fft-primary);
}

.form-help{
  font-size:.82rem;
  color:var(--fft-muted);
}

.form-actions{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top:18px;
  margin-bottom:6px;
}

input,
textarea,
select{
  width:100%;
  padding:11px 12px;
  border:1px solid #cbd5e1;
  border-radius:12px;
  font-size:14px;
  background:#fff;
  color:var(--fft-text);
  transition:border-color .15s ease, box-shadow .15s ease;
  box-sizing:border-box;
}

input:focus,
textarea:focus,
select:focus{
  outline:none;
  border-color:rgba(16,185,129,.65);
  box-shadow:0 0 0 3px rgba(16,185,129,.14);
}

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

.error-text{
  color:#dc2626;
  font-size:.82rem;
  margin-top:2px;
}

.checkbox-row{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:44px;
}

.checkbox-row input[type="checkbox"]{
  width:auto;
  margin:0;
}

@media (max-width: 900px){
  .form-grid{
    grid-template-columns:1fr;
  }

  .form-group.span-2{
    grid-column:span 1;
  }
}

/* ==========================================================================
   Invoice / business form helpers
========================================================================== */
.invoice-form-section{
  margin-top:18px;
  margin-bottom:8px;
}

.invoice-items-note{
  margin-top:10px;
  color:var(--fft-muted);
  font-size:.84rem;
}

.invoice-items-table td{
  vertical-align:middle;
}

.invoice-items-table input,
.invoice-items-table select,
.invoice-items-table textarea{
  margin:0;
}

.remove-item-btn{
  background:none;
  border:none;
  padding:0;
  cursor:pointer;
  font:inherit;
  color:var(--fft-primary);
  font-weight:600;
}

.remove-item-btn:hover{
  color:var(--fft-support);
  text-decoration:underline;
}

.totals-panel{
  margin-top:18px;
  margin-left:auto;
  max-width:320px;
  padding:16px;
  border-radius:12px;
  background:#f8fafc;
  border:1px solid var(--fft-border);
}

.totals-row{
  display:flex;
  justify-content:space-between;
  margin-bottom:8px;
  font-size:14px;
}

.totals-row strong{
  color:var(--fft-primary);
}

.grand-total{
  border-top:1px solid var(--fft-border);
  padding-top:10px;
  margin-top:10px;
  font-size:16px;
  font-weight:700;
}

/* ==========================================================================
   Badges / states
========================================================================== */
.badge{
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  border-radius:999px;
  font-size:.82rem;
  font-weight:700;
  line-height:1;
}

.badge-success{
  background:#d1fae5;
  color:#065f46;
}

.badge-warning{
  background:#fef3c7;
  color:#92400e;
}

.badge-danger{
  background:#fee2e2;
  color:#991b1b;
}

.badge-muted{
  background:#eef2f7;
  color:#475569;
}

.empty-state{
  padding:28px 18px;
  text-align:center;
  color:var(--fft-muted);
}

/* ==========================================================================
   Login page
========================================================================== */
body.login-page{
  min-height:100vh;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  background:
    radial-gradient(circle at 20% 20%, rgba(11,46,89,.05), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(15,118,110,.05), transparent 30%),
    linear-gradient(90deg, #f7f9fc 0%, #eef2f7 40%, #f7f9fc 100%);
}

.login-shell{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.login-card{
  width:100%;
  max-width:480px;
  background:rgba(255,255,255,.88);
  border:1px solid rgba(255,255,255,.28);
  border-radius:20px;
  box-shadow:var(--fft-shadow-md);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  padding:28px;
}

.login-logo{
  display:flex;
  justify-content:center;
  margin-bottom:18px;
}

.login-logo img{
  max-height:118px;
  width:auto;
  display:block;
}

.login-title{
  margin:0 0 6px 0;
  color:var(--fft-primary);
  text-align:center;
  font-size:2rem;
  line-height:1.1;
}

.login-subtitle{
  margin:0 0 20px 0;
  color:var(--fft-muted);
  text-align:center;
}

.login-footer{
  text-align:center;
  margin-top:18px;
  color:var(--fft-muted);
  font-size:13px;
}

.error-box{
  margin-bottom:14px;
  padding:12px 14px;
  border-radius:12px;
  background:#fef2f2;
  color:#b91c1c;
  border:1px solid #fecaca;
}

@media (max-width: 768px){
  body.login-page{
    overflow:auto;
  }

  .login-shell{
    padding:16px;
  }

  .login-card{
    padding:22px 18px;
  }

  .login-logo img{
    max-height:96px;
  }

  .login-title{
    font-size:1.75rem;
  }
}

/* ==========================================================================
   Print
========================================================================== */
@media print{
  .app-topbar,
  .module-nav,
  .button-primary,
  .button-secondary,
  .button-link,
  form{
    display:none !important;
  }

  body{
    background:#fff !important;
  }

  .app-content{
    max-width:100% !important;
    padding:0 !important;
  }

  .card{
    box-shadow:none !important;
    border:1px solid #ddd !important;
  }

  .data-table thead th{
    background:#f5f5f5 !important;
    color:#333 !important;
  }
}