:root{
  --sidebar:#17396b;
  --sidebar-dark:#132f58;
  --primary:#2a6fe5;
  --bg:#f4f7fb;
  --card:#ffffff;
  --line:#e5eaf3;
  --text:#1c2a3a;
  --muted:#7a8798;
  --success:#27ae60;
  --warning:#f0ad4e;
  --danger:#eb5757;
  --info:#56ccf2;
}

*{box-sizing:border-box}

html,body{
  margin:0;
  padding:0;
  font-family:Inter,Segoe UI,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{text-decoration:none}

.layout-shell{
  display:flex;
  min-height:100vh;
  overflow:hidden;
  width:100%;
}

.sidebar{
  width:270px;
  min-width:270px;
  background:linear-gradient(180deg,var(--sidebar),var(--sidebar-dark));
  color:#fff;
  padding:18px 16px;
  display:flex;
  flex-direction:column;
  position:fixed;
  left:0;
  top:0;
  bottom:0;
  z-index:1045;
  box-shadow:8px 0 28px rgba(19,47,88,.10);
  overflow:hidden;
  transition:transform .32s ease, margin-left .32s ease, width .32s ease, min-width .32s ease;
  scrollbar-width:thin;
  scrollbar-color:rgba(255,255,255,.24) transparent;
}

.sidebar-scroll-area{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding-bottom:10px;
  scrollbar-width:thin;
  scrollbar-color:rgba(255,255,255,.24) transparent;
}

.sidebar-scroll-area::-webkit-scrollbar{
  width:8px;
}

.sidebar-scroll-area::-webkit-scrollbar-track{
  background:transparent;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.18);
  border-radius:10px;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.28);
}

.main-area{
  margin-left:270px;
  width:calc(100% - 270px);
  flex:0 0 calc(100% - 270px);
  min-width:0;
  display:flex;
  flex-direction:column;
  position:relative;
  z-index:1;
  transition:margin-left .32s ease, width .32s ease, flex-basis .32s ease;
}

body.sidebar-collapsed .sidebar{
  transform:translateX(-100%);
  margin-left:0;
}

body.sidebar-collapsed .main-area{
  margin-left:0;
  width:100%;
  flex:0 0 100%;
}

.topbar{
  min-height:86px;
  padding:20px 28px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#f8fbff;
  border-bottom:1px solid var(--line);
  position:relative;
  z-index:1100;
}

.topbar-expanded{
  min-height:74px;
  padding:14px 28px;
}

.topbar-right-ghost{
  width:180px;
}

.page-content{
  padding:20px 28px 28px;
}

.sidebar-brand{
  padding:8px 8px 18px;
  border-bottom:1px solid rgba(255,255,255,.08);
  margin-bottom:16px;
}

.brand-link{
  color:#fff !important;
  display:block;
}

.brand-title{
  display:block;
  font-size:17px;
  font-weight:700;
  line-height:1.25;
}

.sidebar-nav{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:4px;
  padding-bottom:14px;
}

.nav-item{
  display:flex;
  align-items:center;
  gap:12px;
  color:rgba(255,255,255,.92);
  padding:14px 16px;
  border-radius:16px;
  font-size:15px;
  font-weight:700;
  transition:.2s;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.05);
}

.nav-item i{
  font-size:18px;
  width:20px;
  min-width:20px;
  text-align:center;
}

.nav-item:hover,
.nav-item.active{
  background:rgba(255,255,255,.12);
  color:#fff;
  border-color:rgba(255,255,255,.10);
  transform:translateX(2px);
}

.sidebar-userbox{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:12px;
  flex-shrink:0;
}

.sidebar-user-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.sidebar-avatar{
  width:42px;
  height:42px;
  border-radius:50%;
  background:#fff;
  color:#17396b;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:16px;
  flex-shrink:0;
}

.sidebar-user-meta{
  min-width:0;
}

.sidebar-username{
  color:#fff;
  font-size:14px;
  font-weight:700;
  line-height:1.1;
}

.sidebar-role{
  color:rgba(255,255,255,.70);
  font-size:12px;
  margin-top:3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:110px;
}

.sidebar-logout-btn{
  border:0;
  background:#fff;
  color:#17396b;
  font-weight:700;
  border-radius:12px;
  padding:10px 14px;
  transition:.2s;
  cursor:pointer;
}

.sidebar-logout-btn:hover{
  background:#eef4ff;
}

.page-mini-title{
  font-size:14px;
  font-weight:700;
  color:#22344b;
}

.card,
.table-card,
.hero-card,
.panel-card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:0 10px 24px rgba(25,51,94,.04);
}

.hero-card{
  padding:24px;
  background:linear-gradient(180deg,#ffffff,#f8fbff);
}

.hero-grid{
  display:grid;
  grid-template-columns:1.6fr .9fr;
  gap:24px;
  align-items:center;
}

.hero-title{
  font-size:34px;
  font-weight:700;
  margin-bottom:8px;
}

.hero-text{
  color:var(--muted);
  max-width:760px;
  line-height:1.65;
}

.hero-illustration{
  height:170px;
  border-radius:24px;
  background:linear-gradient(180deg,#eff6ff,#ffffff);
  border:1px solid var(--line);
  position:relative;
  overflow:hidden;
}

.hero-illustration::before,
.hero-illustration::after{
  content:"";
  position:absolute;
  border-radius:18px;
  background:#fff;
  border:1px solid var(--line);
  box-shadow:0 8px 20px rgba(33,61,112,.06);
}

.hero-illustration::before{
  width:180px;
  height:108px;
  left:38px;
  top:30px;
}

.hero-illustration::after{
  width:96px;
  height:66px;
  right:34px;
  bottom:26px;
}

.hero-illustration-logo{
  display:flex;
  align-items:center;
  justify-content:center;
}

.clean-logo-card::before,
.clean-logo-card::after{
  display:none !important;
  content:none !important;
}

.clean-logo-card .illus-dot{
  display:none !important;
}

.hero-logo-image{
  position:relative;
  z-index:2;
  height:auto;
  object-fit:contain;
  display:block;
}

.hero-logo-fit{
  width:82%;
  max-width:260px;
  max-height:110px;
}

.illus-dot{
  position:absolute;
  width:14px;
  height:14px;
  border-radius:50%;
  background:#ffca6a;
  right:48px;
  top:24px;
  box-shadow:0 0 0 12px rgba(255,202,106,.15);
  z-index:3;
}

.stat-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
  margin-top:22px;
}

.stat-card{
  padding:18px 20px;
  border-radius:20px;
  background:#fff;
  border:1px solid var(--line);
  position:relative;
  min-height:102px;
  box-shadow:0 10px 24px rgba(25,51,94,.04);
}

.stat-label{
  font-size:13px;
  color:var(--muted);
  margin-bottom:10px;
}

.stat-value{
  font-size:34px;
  font-weight:700;
  line-height:1;
}

.stat-sub{
  font-size:12px;
  color:#95a1af;
  margin-top:8px;
}

.stat-icon{
  position:absolute;
  right:18px;
  top:18px;
  width:42px;
  height:42px;
  border-radius:14px;
  display:grid;
  place-items:center;
  font-size:18px;
}

.icon-blue{background:#eaf2ff;color:#2a6fe5}
.icon-green{background:#eaf8f0;color:#2ab66f}
.icon-orange{background:#fff4e5;color:#ef9e22}
.icon-red{background:#ffefef;color:#eb5757}
.icon-cyan{background:#ecfbff;color:#21a5d8}

.section-grid-3{
  display:grid;
  grid-template-columns:1.05fr 1.1fr 1fr;
  gap:18px;
  margin-top:20px;
}

.section-grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-top:20px;
}

.panel-card{
  padding:20px;
}

.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
  gap:12px;
}

.panel-title{
  font-size:18px;
  font-weight:700;
  margin:0;
}

.panel-muted{
  font-size:13px;
  color:var(--muted);
}

.quick-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.quick-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:16px;
  color:var(--text);
  background:#fcfdff;
  gap:12px;
}

.table-card{
  padding:18px;
}

.table-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.filter-row{
  display:grid;
  grid-template-columns:1.4fr repeat(3,.8fr) auto;
  gap:12px;
  align-items:center;
}

.filter-row.compact{
  grid-template-columns:1.4fr .9fr auto;
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus{
  background:#fff;
  border-color:var(--line);
  box-shadow:none;
  color:var(--text);
  border-radius:14px;
  min-height:46px;
}

textarea.form-control{min-height:120px}

.btn{
  border-radius:14px;
  padding:.72rem 1rem;
  font-weight:600;
}

.btn-primary{
  background:var(--primary);
  border-color:var(--primary);
}

.btn-primary:hover{
  background:#185dd6;
  border-color:#185dd6;
}

.btn-light-custom{
  background:#fff;
  border:1px solid var(--line);
  color:var(--text);
}

.btn-light-custom:hover{
  background:#f8fbff;
}

.table{
  margin:0;
  vertical-align:middle;
}

.table thead th{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#8a97a8;
  font-weight:700;
  border-bottom:1px solid var(--line);
  padding:14px 12px;
  background:#fbfcfe;
}

.table td{
  padding:14px 12px;
  border-color:#edf1f7;
  color:#273646;
}

.table tbody tr:hover{
  background:#fbfdff;
}

.badge-soft{
  display:inline-flex;
  align-items:center;
  padding:7px 12px;
  border-radius:999px;
  font-weight:600;
  font-size:12px;
  border:1px solid transparent;
  white-space:nowrap;
}

.badge-status-active,
.badge-status-received,
.badge-status-resolved{
  background:#e9f8ef;
  color:#1f8f54;
  border-color:#bde8cc;
}

.badge-status-warehouse,
.badge-status-accepted,
.badge-status-in_progress{
  background:#eaf2ff;
  color:#2a6fe5;
  border-color:#cae0ff;
}

.badge-status-passive,
.badge-status-waiting,
.badge-status-pending_acceptance{
  background:#fff6e8;
  color:#d68910;
  border-color:#ffe0a4;
}

.badge-status-faulty,
.badge-status-critical,
.badge-status-cancelled,
.badge-status-retired{
  background:#ffefef;
  color:#db4f4f;
  border-color:#ffd1d1;
}

.badge-status-repair,
.badge-status-need_info,
.badge-status-sent{
  background:#f1efff;
  color:#6f59d9;
  border-color:#ddd7ff;
}

.badge-priority-low{background:#eef9f1;color:#2ab66f}
.badge-priority-medium{background:#edf5ff;color:#2a6fe5}
.badge-priority-high{background:#fff6e8;color:#ef9e22}
.badge-priority-critical{background:#ffefef;color:#eb5757}

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

.resource-card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  text-align:center;
}

.resource-card i{
  font-size:24px;
  color:#2a6fe5;
  display:block;
  margin-bottom:10px;
}

.resource-card strong{
  display:block;
  font-size:15px;
  margin-bottom:6px;
}

.resource-card span{
  color:var(--muted);
  font-size:13px;
}

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

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

.kv-item{
  background:#fbfcff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
}

.kv-item .label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
}

.detail-text{
  font-weight:600;
}

.timeline-comment{
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px 16px;
  background:#fbfdff;
}

.meta-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.empty-note{
  padding:26px;
  border:1px dashed #d8dfeb;
  border-radius:18px;
  background:#fcfdff;
  color:var(--muted);
  text-align:center;
}

.alert{
  border-radius:16px;
}

.auth-body{
  min-height:100vh;
  background:
    radial-gradient(circle at top left, rgba(42,111,229,.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(23,57,107,.10), transparent 24%),
    linear-gradient(135deg,#f3f8ff 0%, #eef4fb 52%, #ffffff 100%);
}

.modern-login-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:1.05fr .95fr;
}

.modern-login-left{
  position:relative;
  overflow:hidden;
  background:linear-gradient(180deg,#17396b 0%, #132f58 100%);
  color:#fff;
  padding:56px 52px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.modern-login-left::before{
  content:"";
  position:absolute;
  width:320px;
  height:320px;
  border-radius:50%;
  background:rgba(255,255,255,.06);
  top:-80px;
  right:-80px;
}

.modern-login-left::after{
  content:"";
  position:absolute;
  width:240px;
  height:240px;
  border-radius:50%;
  background:rgba(255,255,255,.05);
  bottom:-60px;
  left:-60px;
}

.login-brand-badge{
  width:74px;
  height:74px;
  border-radius:22px;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.14);
  display:grid;
  place-items:center;
  font-size:30px;
  margin-bottom:28px;
  position:relative;
  z-index:1;
}

.modern-login-content{
  position:relative;
  z-index:1;
  max-width:560px;
}

.login-kicker{
  font-size:13px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:rgba(255,255,255,.72);
  margin-bottom:14px;
}

.modern-login-content h1{
  font-size:42px;
  line-height:1.15;
  font-weight:800;
  margin:0 0 16px;
}

.modern-login-content p{
  font-size:17px;
  line-height:1.7;
  color:rgba(255,255,255,.82);
  margin:0 0 26px;
}

.login-feature-list{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.login-feature-item{
  display:flex;
  align-items:center;
  gap:12px;
  color:#fff;
  font-weight:500;
}

.login-feature-item i{
  color:#8dd3ff;
  font-size:18px;
}

.modern-login-right{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:40px 26px;
}

.modern-login-card{
  width:min(470px, 100%);
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(10px);
  border:1px solid rgba(255,255,255,.8);
  box-shadow:0 24px 70px rgba(23,57,107,.12);
  border-radius:30px;
  padding:34px 30px;
}

.modern-login-header{
  margin-bottom:24px;
}

.login-mini-badge{
  width:52px;
  height:52px;
  border-radius:16px;
  background:#eef4ff;
  color:#2a6fe5;
  display:grid;
  place-items:center;
  font-size:22px;
  margin-bottom:16px;
}

.modern-login-header h3{
  font-size:28px;
  font-weight:800;
  margin:0 0 8px;
  color:#17304d;
}

.modern-login-header p{
  margin:0;
  color:#738296;
  font-size:15px;
}

.auth-label{
  font-weight:600;
  color:#25364c;
  margin-bottom:8px;
}

.modern-login-card .form-control{
  min-height:54px;
  border-radius:16px;
  border:1px solid #dbe5f0;
  background:#fdfefe;
  padding:0 16px;
}

.modern-login-card .form-control:focus{
  border-color:#2a6fe5;
  box-shadow:0 0 0 4px rgba(42,111,229,.10);
}

.modern-login-btn{
  min-height:54px;
  border-radius:16px;
  font-size:16px;
  font-weight:700;
  margin-top:10px;
}

@media (max-width: 1200px){
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .section-grid-3,
  .section-grid-2,
  .hero-grid,
  .resource-grid,
  .filter-row,
  .filter-row.compact,
  .kv-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width: 992px){
  .sidebar{
    width:300px;
    min-width:300px;
    max-width:86vw;
    padding:18px 12px;
    transform:translateX(-100%);
    transition:transform .25s ease;
    z-index:1045;
  }

  .sidebar.open{
    transform:translateX(0);
  }

  .main-area{
    margin-left:0;
    width:100%;
    flex:0 0 100%;
  }

  .topbar{
    padding:18px;
    z-index:1100;
  }

  .topbar-left-wrap{
    position:relative;
    z-index:1101;
  }

  .sidebar-toggle-btn{
    position:relative;
    z-index:1102;
    pointer-events:auto;
  }

  .page-content{
    padding:18px;
  }

  .modern-login-shell{
    grid-template-columns:1fr;
  }

  .modern-login-left{
    display:none;
  }

  .modern-login-right{
    padding:28px 16px;
  }

  .modern-login-card{
    border-radius:24px;
    padding:28px 20px;
  }

  .hero-logo-fit{
    width:68%;
    max-width:220px;
    max-height:90px;
  }

  body.sidebar-collapsed .sidebar{
    transform:translateX(-100%);
    margin-left:0;
  }

  body.sidebar-collapsed .main-area{
    margin-left:0;
    width:100%;
    flex:0 0 100%;
  }
}