/* Aden Asset Management final enterprise layout normalization
   Loaded last so all modules share one disciplined visual rhythm. */
:root{
  --af-accent:#ED4F18;
  --af-dark:#283948;
  --af-bg:#f4f6f8;
  --af-surface:#fff;
  --af-border:#e3e8ed;
  --af-text:#263743;
  --af-muted:#74828d;
  --af-radius-lg:20px;
  --af-radius-md:14px;
  --af-shadow:0 10px 30px rgba(40,57,72,.065);
  --af-page-max:1600px;
}

html{scroll-behavior:smooth}
body.system-body{overflow-x:hidden;background:var(--af-bg);color:var(--af-text)}
img,svg,video,canvas{max-width:100%}
button,input,select,textarea{font:inherit}

/* Main application frame */
.system-main{min-width:0}
.system-topbar{padding-inline:clamp(18px,2.2vw,36px)}
.system-content{
  min-width:0;
  padding:24px clamp(16px,2.2vw,36px) 38px!important;
}
.system-content>*,
.system-content>.container,
.system-content>.container-fluid{
  width:100%;
  max-width:var(--af-page-max)!important;
  margin-left:auto!important;
  margin-right:auto!important;
}
.system-footer{
  width:100%;
  max-width:calc(var(--af-page-max) + 72px);
  margin-inline:auto;
  padding-inline:clamp(18px,2.2vw,36px);
}

/* Ensure every page root behaves inside the shell */
.management-dashboard,.admin-page,.edit-page,.asset-page,.asset-data-system,
.asset-form-page,.asset-detail-page,.asset-edit-page,.enterprise-page,
.assignment-page,.details-page,.handover-page,.stock-page,.transfer-page,
.opname-shell{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  padding-left:0!important;
  padding-right:0!important;
}

/* Standard vertical rhythm */
.system-content section+section,
.system-content .page-section+.page-section{margin-top:20px}
.system-content h1,.system-content h2,.system-content h3{color:var(--af-dark)}
.system-content p:last-child{margin-bottom:0}

/* Shared headers and hero blocks */
.corp-page-header,.page-header,.asset-hero,.dashboard-hero,.admin-hero,
.handover-hero,.opname-hero,.detail-hero,.form-hero{
  margin:0 0 20px!important;
}
.corp-page-header,.page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding:22px 24px!important;
  border:1px solid var(--af-border);
  border-radius:var(--af-radius-lg)!important;
  background:var(--af-surface);
  box-shadow:var(--af-shadow);
}
.corp-page-header h1,.page-header h1{margin:4px 0 6px!important;font-size:clamp(1.45rem,2.2vw,2rem)!important;letter-spacing:-.035em}
.corp-page-header p,.page-header p{color:var(--af-muted);max-width:760px}

/* Surfaces */
.card,.corp-card,.panel,.data-panel,.form-card,.detail-card,.summary-card,
.scanner-panel,.dataset-panel,.opname-metric{
  border-color:var(--af-border)!important;
  box-shadow:var(--af-shadow)!important;
}
.card,.corp-card,.panel,.data-panel,.form-card,.detail-card,.summary-card{
  border-radius:var(--af-radius-lg)!important;
  overflow:hidden;
}
.card-header,.panel-head,.section-head,.dataset-toolbar-pro{
  padding:17px 20px!important;
  border-bottom:1px solid #ebeff2!important;
  background:#fff!important;
}
.card-body,.panel-body,.section-body{padding:20px!important}

/* Grid safety: prevents a wide child from breaking the entire page */
.row>* ,[class*="grid"]>*{min-width:0}
.container,.container-fluid{min-width:0}

/* Forms */
.form-label,label{color:#4d5e6a;font-weight:650}
.form-control,.form-select{
  min-height:44px;
  border-color:#dbe2e7;
  border-radius:11px;
  color:#2e404d;
  background-color:#fff;
}
textarea.form-control{min-height:100px}
.form-control:focus,.form-select:focus{
  border-color:var(--af-accent);
  box-shadow:0 0 0 4px rgba(237,79,24,.10);
}
.input-group>.form-control,.input-group>.form-select{min-width:0}
.form-text,.text-muted{color:var(--af-muted)!important}

/* Buttons */
.btn{min-height:40px;border-radius:11px;font-weight:650;display:inline-flex;align-items:center;justify-content:center;gap:4px}
.btn-sm{min-height:34px;border-radius:9px}
.btn-primary{--bs-btn-bg:var(--af-accent);--bs-btn-border-color:var(--af-accent);--bs-btn-hover-bg:#d94412;--bs-btn-hover-border-color:#d94412;--bs-btn-active-bg:#c93c0d;--bs-btn-active-border-color:#c93c0d}
.btn-dark{--bs-btn-bg:var(--af-dark);--bs-btn-border-color:var(--af-dark)}

/* Tables: stable alignment and contained overflow */
.table-responsive,.reconciliation-scroll{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.table{margin-bottom:0;color:#40535f}
.table>:not(caption)>*>*{padding:13px 14px;border-color:#ebeff2;vertical-align:middle}
.table thead th{background:#f7f9fa;color:#71808b;font-size:.69rem;font-weight:750;letter-spacing:.045em;text-transform:uppercase;white-space:nowrap}
.table tbody tr{transition:background-color .16s ease}
.table tbody tr:hover{background:#fafcfd}
.table td{overflow-wrap:anywhere}

/* Alerts and empty states */
.alert{border-radius:13px;border-width:1px;padding:13px 15px}
.empty-state{padding:42px 22px!important;color:#82909a;text-align:center}

/* Dashboard/chart containment */
canvas{max-height:100%;max-width:100%}
.chart-container,.chart-wrap,.map-wrap{min-width:0;overflow:hidden}

/* Modal discipline */
.modal-content{border:0;border-radius:20px;box-shadow:0 24px 70px rgba(25,39,50,.22)}
.modal-header,.modal-footer{padding:16px 20px;border-color:#e9edf0}
.modal-body{padding:20px}

/* Stock opname register desktop containment */
.opname-grid{min-width:0}
.dataset-panel{min-width:0}
.opname-table{max-width:100%}

/* Long identifiers */
.asset-code,.font-monospace{overflow-wrap:anywhere}

@media(max-width:1199.98px){
  .system-content{padding:20px 22px 32px!important}
}

@media(max-width:991.98px){
  .system-content{padding:18px 18px 28px!important}
  .system-topbar{padding-inline:18px}
  .corp-page-header,.page-header{padding:19px!important}
  .card-body,.panel-body,.section-body{padding:17px!important}
}

@media(max-width:767.98px){
  .system-content{padding:14px 12px 24px!important}
  .system-footer{flex-direction:column;gap:5px;padding:14px 15px 20px}
  .corp-page-header,.page-header{flex-direction:column;padding:17px!important;border-radius:16px!important}
  .corp-page-header>.btn,.corp-page-header>div+.btn,.page-header>.btn{width:100%}
  .card,.corp-card,.panel,.data-panel,.form-card,.detail-card,.summary-card{border-radius:16px!important}
  .card-header,.panel-head,.section-head,.dataset-toolbar-pro{padding:15px!important}
  .card-body,.panel-body,.section-body{padding:15px!important}
  .btn:not(.btn-sm){min-height:43px}
  .form-control,.form-select{font-size:16px}
  .table>:not(caption)>*>*{padding:11px 12px}
}

@media(max-width:480px){
  .system-content{padding-inline:9px!important}
  .system-topbar{padding-inline:12px}
  .system-topbar h1{max-width:230px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}

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