/* ======================================================================
   SIMPEL v0.16.32 — Unified Task-First UI/UX & Mobile Consistency
   Additive visual refinement only. No business rule, route, permission,
   persistence, validation, or request contract is changed here.
   ====================================================================== */

body.ui-refined-v01632{
  --ui-content-max:1440px;
  --ui-card-radius:20px;
  --ui-card-radius-sm:15px;
  --ui-control-radius:12px;
  --ui-control-height:44px;
  --ui-space-1:6px;
  --ui-space-2:10px;
  --ui-space-3:14px;
  --ui-space-4:18px;
  --ui-space-5:22px;
  --ui-space-6:28px;
  --ui-shadow-card:0 5px 18px rgba(25,35,55,.045);
  --ui-shadow-float:0 18px 50px rgba(20,30,50,.14);
  --ui-ease:cubic-bezier(.2,.75,.25,1);
}
[data-theme="dark"] body.ui-refined-v01632{
  --ui-shadow-card:0 8px 22px rgba(0,0,0,.18);
  --ui-shadow-float:0 22px 58px rgba(0,0,0,.42);
}

/* ---------- Workspace density & hierarchy ---------- */
body.ui-refined-v01632 .page-container{
  width:100%;
  max-width:var(--ui-content-max);
  padding-top:28px;
  padding-bottom:104px;
}
body.ui-refined-v01632 .page-head,
body.ui-refined-v01632 .page-header,
body.ui-refined-v01632 .content-header,
body.ui-refined-v01632 .ypia-page-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:end;
  gap:18px;
  margin-bottom:22px;
}
body.ui-refined-v01632 .page-head>div:first-child,
body.ui-refined-v01632 .page-header>div:first-child,
body.ui-refined-v01632 .content-header>div:first-child,
body.ui-refined-v01632 .ypia-page-head>div:first-child{min-width:0}
body.ui-refined-v01632 .page-head h1,
body.ui-refined-v01632 .page-header h1,
body.ui-refined-v01632 .content-header h1,
body.ui-refined-v01632 .ypia-page-head h1{
  margin:4px 0 6px;
  font-size:clamp(1.72rem,2.5vw,2.35rem);
  line-height:1.04;
  letter-spacing:-.05em;
  text-wrap:balance;
}
body.ui-refined-v01632 .page-head p,
body.ui-refined-v01632 .page-header p,
body.ui-refined-v01632 .content-header p,
body.ui-refined-v01632 .ypia-page-head p{
  max-width:840px;
  margin:0;
  font-size:.91rem;
  line-height:1.52;
  text-wrap:pretty;
}
body.ui-refined-v01632 .eyebrow{
  font-size:.62rem;
  letter-spacing:.15em;
  line-height:1.25;
}
body.ui-refined-v01632 .page-actions,
body.ui-refined-v01632 .button-row,
body.ui-refined-v01632 .version-stack,
body.ui-refined-v01632 .migration-head-actions,
body.ui-refined-v01632 .history-actions{
  gap:8px;
}
body.ui-refined-v01632 .page-head>.page-actions,
body.ui-refined-v01632 .page-head>.button-row,
body.ui-refined-v01632 .page-head>.version-stack,
body.ui-refined-v01632 .page-head>.status-pill{
  justify-self:end;
  align-self:center;
}

/* ---------- Surfaces: less visual noise, clearer grouping ---------- */
body.ui-refined-v01632 .card,
body.ui-refined-v01632 .section-card,
body.ui-refined-v01632 .panel,
body.ui-refined-v01632 .widget,
body.ui-refined-v01632 .box,
body.ui-refined-v01632 .ypia-panel{
  border-radius:var(--ui-card-radius);
  box-shadow:var(--ui-shadow-card);
}
body.ui-refined-v01632 .section-card{padding:clamp(18px,1.8vw,23px)}
body.ui-refined-v01632 .section-head,
body.ui-refined-v01632 .section-heading-row{
  align-items:flex-end;
  margin-bottom:16px;
}
body.ui-refined-v01632 .section-head.compact{margin-bottom:13px}
body.ui-refined-v01632 .section-head h2,
body.ui-refined-v01632 .section-heading-row h2{
  font-size:1.18rem;
  line-height:1.15;
}
body.ui-refined-v01632 .card+.card,
body.ui-refined-v01632 .section-card+.section-card{scroll-margin-top:86px}

/* ---------- Buttons: one clear hierarchy ---------- */
body.ui-refined-v01632 .btn{
  min-height:var(--ui-control-height);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border-radius:var(--ui-control-radius);
  padding:9px 15px;
  font-size:.85rem;
  font-weight:820;
  line-height:1.15;
  transition:transform .14s var(--ui-ease),background .16s ease,border-color .16s ease,box-shadow .16s ease,opacity .16s ease;
}
body.ui-refined-v01632 .btn:hover:not(:disabled){transform:translateY(-1px)}
body.ui-refined-v01632 .btn:active:not(:disabled){transform:translateY(0) scale(.985)}
body.ui-refined-v01632 .btn-primary{
  box-shadow:0 8px 20px color-mix(in srgb,var(--primary) 19%,transparent);
}
body.ui-refined-v01632 .btn-ghost,
body.ui-refined-v01632 .btn-secondary{
  border:1px solid var(--line-strong);
  background:var(--surface);
  box-shadow:none;
}
body.ui-refined-v01632 .btn-danger:not(.btn-ghost){box-shadow:0 8px 20px color-mix(in srgb,var(--danger) 14%,transparent)}
body.ui-refined-v01632 .btn-small{min-height:36px;padding:7px 11px;border-radius:10px;font-size:.76rem}
body.ui-refined-v01632 .btn-large{min-height:50px;font-size:.92rem}
body.ui-refined-v01632 .btn:disabled,
body.ui-refined-v01632 button:disabled{cursor:not-allowed;opacity:.52;transform:none;box-shadow:none}

/* ---------- Forms: calmer, touch-safe, consistent ---------- */
body.ui-refined-v01632 :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  min-height:var(--ui-control-height);
  border-radius:var(--ui-control-radius);
  padding:10px 13px;
  background:color-mix(in srgb,var(--surface) 96%,var(--surface-2));
  border-color:var(--line-strong);
  transition:border-color .15s ease,box-shadow .15s ease,background .15s ease;
}
body.ui-refined-v01632 textarea{min-height:106px;padding-top:11px;padding-bottom:11px}
body.ui-refined-v01632 :where(input,select,textarea)::placeholder{color:color-mix(in srgb,var(--muted) 72%,transparent)}
body.ui-refined-v01632 :where(input,select,textarea):focus{
  background:var(--surface);
  border-color:color-mix(in srgb,var(--primary) 70%,var(--line));
  box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 11%,transparent);
}
body.ui-refined-v01632 label{
  margin-top:14px;
  margin-bottom:6px;
  font-size:.82rem;
  font-weight:760;
}
body.ui-refined-v01632 .field-help,
body.ui-refined-v01632 .form-help,
body.ui-refined-v01632 .help-text,
body.ui-refined-v01632 .form-note,
body.ui-refined-v01632 .hint{
  font-size:.72rem;
  line-height:1.48;
}
body.ui-refined-v01632 input[type="checkbox"],
body.ui-refined-v01632 input[type="radio"]{
  accent-color:var(--primary);
}
body.ui-refined-v01632 input[type="file"]{
  padding:7px;
  min-height:50px;
  background:var(--surface-2);
}
body.ui-refined-v01632 input[type="file"]::file-selector-button{
  min-height:34px;
  margin-right:10px;
  border:1px solid var(--line-strong);
  border-radius:9px;
  padding:6px 11px;
  background:var(--surface);
  color:var(--text);
  font:inherit;
  font-size:.76rem;
  font-weight:800;
  cursor:pointer;
}
body.ui-refined-v01632 .form-grid,
body.ui-refined-v01632 .ypia-form-grid,
body.ui-refined-v01632 .settings-grid,
body.ui-refined-v01632 .policy-grid{gap:12px 14px}

/* ---------- Tabs & horizontal discoverability ---------- */
body.ui-refined-v01632 :is(.ypia-tabs,[role="tablist"],.tabs,.tab-list,.segmented-control,.settings-tabs,.workspace-tabs,.master-tabs,.report-tabs){
  gap:5px;
  padding:4px;
  border-radius:14px;
  scrollbar-width:none;
  scroll-snap-type:x proximity;
}
body.ui-refined-v01632 :is(.ypia-tabs,[role="tablist"],.tabs,.tab-list,.segmented-control,.settings-tabs,.workspace-tabs,.master-tabs,.report-tabs)::-webkit-scrollbar{display:none}
body.ui-refined-v01632 :is(.ypia-tabs,[role="tablist"],.tabs,.tab-list,.segmented-control,.settings-tabs,.workspace-tabs,.master-tabs,.report-tabs)>*{
  scroll-snap-align:start;
}
body.ui-refined-v01632 .ui-overflow-scrollable:not(.ui-scroll-end){
  box-shadow:inset -18px 0 18px -20px color-mix(in srgb,var(--text) 38%,transparent);
}
body.ui-refined-v01632 .ui-overflow-scrollable:not(.ui-scroll-start){
  box-shadow:inset 18px 0 18px -20px color-mix(in srgb,var(--text) 30%,transparent),inset -18px 0 18px -20px color-mix(in srgb,var(--text) 38%,transparent);
}
body.ui-refined-v01632 .ui-overflow-scrollable.ui-scroll-end:not(.ui-scroll-start){
  box-shadow:inset 18px 0 18px -20px color-mix(in srgb,var(--text) 30%,transparent);
}

/* ---------- Status, alerts, empty states ---------- */
body.ui-refined-v01632 .status-pill,
body.ui-refined-v01632 .mini-status,
body.ui-refined-v01632 .badge,
body.ui-refined-v01632 .chip{
  min-height:28px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  padding:5px 9px;
  line-height:1.15;
  font-size:.67rem;
  font-weight:820;
}
body.ui-refined-v01632 .alert{
  padding:12px 14px;
  border-radius:13px;
  line-height:1.48;
}
body.ui-refined-v01632 .empty-state{
  min-height:150px;
  padding:28px 18px;
  border-radius:18px;
  background:color-mix(in srgb,var(--surface-2) 78%,var(--surface));
}
body.ui-refined-v01632 .empty-state h3{margin:7px 0 4px;font-size:1rem}
body.ui-refined-v01632 .empty-state p{max-width:560px;margin:0 auto;color:var(--muted);font-size:.8rem;line-height:1.5}

/* ---------- Tables: dense enough, still touch-friendly ---------- */
body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table){
  border-radius:16px;
  scrollbar-width:thin;
  scrollbar-color:color-mix(in srgb,var(--primary) 26%,var(--line)) transparent;
}
body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table) th{
  padding:11px 13px!important;
  font-size:.68rem;
  letter-spacing:.04em;
}
body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table) td{
  padding:11px 13px!important;
  font-size:.82rem;
}
body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table) tbody tr{
  transition:background .12s ease;
}

/* ---------- KPI / task cards: information first ---------- */
body.ui-refined-v01632 :is(.kpi,.stat-card,.metric-card,.dashboard-kpi,.ypia-stat-card,.summary-card,.kpi-card){
  border-radius:16px;
  box-shadow:none;
}
body.ui-refined-v01632 :is(.kpi,.stat-card,.metric-card,.dashboard-kpi,.ypia-stat-card,.summary-card,.kpi-card) b,
body.ui-refined-v01632 :is(.kpi,.stat-card,.metric-card,.dashboard-kpi,.ypia-stat-card,.summary-card,.kpi-card) strong{
  letter-spacing:-.035em;
}
body.ui-refined-v01632 .task-card,
body.ui-refined-v01632 .menu-grid>a,
body.ui-refined-v01632 .report-action-card{
  border-radius:16px;
  box-shadow:none;
  transition:border-color .15s ease,background .15s ease,transform .14s var(--ui-ease);
}
body.ui-refined-v01632 :is(.task-card,.menu-grid>a,.report-action-card):hover{
  transform:translateY(-1px);
}

/* ---------- Journal: distinguish stored media from new upload ---------- */
body.ui-refined-v01632 form[data-journal-form] .gallery-existing{
  padding:10px;
  border:1px solid color-mix(in srgb,var(--success) 20%,var(--line));
  border-radius:15px;
  background:color-mix(in srgb,var(--success) 4%,var(--surface));
}
body.ui-refined-v01632 form[data-journal-form] .gallery-existing label{
  margin:0;
}
body.ui-refined-v01632 form[data-journal-form] [data-preview-grid]:not(:empty){
  margin-top:10px;
  padding:10px;
  border:1px dashed color-mix(in srgb,var(--primary) 28%,var(--line));
  border-radius:15px;
  background:color-mix(in srgb,var(--primary) 3%,var(--surface));
}
body.ui-refined-v01632 form[data-journal-form]>.button-row{
  padding-top:14px;
  border-top:1px solid var(--line);
}

/* ---------- Filter/search bars ---------- */
body.ui-refined-v01632 :is(.filter-panel,.filter-card,.search-panel,.master-toolbar,.gallery-toolbar){
  border-radius:17px;
  box-shadow:none;
}
body.ui-refined-v01632 :is(.filters,.filter-bar,.toolbar,.ypia-toolbar){gap:8px}
body.ui-refined-v01632 .search-input{min-height:44px}

/* ---------- Shell / top bar ---------- */
body.ui-refined-v01632 .topbar{
  box-shadow:0 1px 0 var(--line);
}
body.ui-refined-v01632 .topbar-context strong{
  font-size:.94rem;
  max-width:min(42vw,520px);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body.ui-refined-v01632 .topbar-search-button,
body.ui-refined-v01632 .icon-button,
body.ui-refined-v01632 .account-button{
  box-shadow:none;
}
body.ui-refined-v01632 .sidebar nav{padding-top:10px}
body.ui-refined-v01632 .nav-label{margin-top:18px}
body.ui-refined-v01632 .nav-link{min-height:42px;border-radius:11px;font-size:.8rem}
body.ui-refined-v01632 .nav-link.active{font-weight:800}

/* ---------- Network bar & system feedback ---------- */
body.ui-refined-v01632 .network-bar{
  min-height:38px;
  font-size:.73rem;
  font-weight:700;
  letter-spacing:-.005em;
}
body.ui-refined-v01632 .toast{border-radius:14px}

/* ---------- Auth: same product language, less visual weight ---------- */
body.ui-refined-v01632.auth-body .login-card{
  border-radius:24px;
  box-shadow:0 20px 56px rgba(20,30,50,.11);
}
body.ui-refined-v01632.auth-body .login-card h2{font-size:1.95rem}
body.ui-refined-v01632.auth-body .sso-button-primary{min-height:50px;border-radius:13px}

/* ---------- Mobile first: reduce scrolling and preserve thumb reach ---------- */
@media(max-width:850px){
  body.ui-refined-v01632{
    --ui-card-radius:17px;
    --ui-control-radius:12px;
    --topbar:60px;
  }
  body.ui-refined-v01632 .page-container{
    padding:16px 12px 98px;
  }
  body.ui-refined-v01632 .page-head,
  body.ui-refined-v01632 .page-header,
  body.ui-refined-v01632 .content-header,
  body.ui-refined-v01632 .ypia-page-head{
    grid-template-columns:minmax(0,1fr);
    align-items:start;
    gap:12px;
    margin-bottom:17px;
  }
  body.ui-refined-v01632 .page-head h1,
  body.ui-refined-v01632 .page-header h1,
  body.ui-refined-v01632 .content-header h1,
  body.ui-refined-v01632 .ypia-page-head h1{
    font-size:clamp(1.55rem,7vw,1.9rem);
    line-height:1.06;
    margin-top:3px;
  }
  body.ui-refined-v01632 .page-head p,
  body.ui-refined-v01632 .page-header p,
  body.ui-refined-v01632 .content-header p,
  body.ui-refined-v01632 .ypia-page-head p{
    font-size:.82rem;
    line-height:1.48;
  }
  body.ui-refined-v01632 .page-head>.page-actions,
  body.ui-refined-v01632 .page-head>.button-row,
  body.ui-refined-v01632 .page-head>.version-stack,
  body.ui-refined-v01632 .page-head>.status-pill{
    justify-self:stretch;
  }
  body.ui-refined-v01632 .page-head>.page-actions,
  body.ui-refined-v01632 .page-head>.button-row{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  body.ui-refined-v01632 .page-head>.page-actions>.btn,
  body.ui-refined-v01632 .page-head>.button-row>.btn{width:100%}
  body.ui-refined-v01632 .section-card{padding:16px}
  body.ui-refined-v01632 .section-head,
  body.ui-refined-v01632 .section-heading-row{margin-bottom:13px}
  body.ui-refined-v01632 .section-head h2,
  body.ui-refined-v01632 .section-heading-row h2{font-size:1.08rem}
  body.ui-refined-v01632 :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){font-size:16px}
  body.ui-refined-v01632 label{font-size:.8rem}
  body.ui-refined-v01632 .bottom-nav{
    left:8px;
    right:8px;
    bottom:max(7px,env(safe-area-inset-bottom));
    padding:5px;
    border-radius:18px;
  }
  body.ui-refined-v01632 .bottom-nav a,
  body.ui-refined-v01632 .bottom-nav button{
    min-height:50px;
    border-radius:13px;
    font-size:.59rem;
  }
  body.ui-refined-v01632 .bottom-nav a span,
  body.ui-refined-v01632 .bottom-nav button span{font-size:1.08rem}
  body.ui-refined-v01632 .topbar{padding-left:8px;padding-right:8px}
  body.ui-refined-v01632 .topbar-context small{display:none}
  body.ui-refined-v01632 .topbar-context strong{max-width:44vw;font-size:.84rem}
  body.ui-refined-v01632 .topbar-search-button,
  body.ui-refined-v01632 .top-actions>.icon-button,
  body.ui-refined-v01632 .account-button,
  body.ui-refined-v01632 .mobile-menu-button{width:38px;height:38px;min-width:38px}
  body.ui-refined-v01632 .topbar-search-button b,
  body.ui-refined-v01632 .topbar-search-button kbd{display:none}
  body.ui-refined-v01632 :is(.kpi-grid,.stats-grid,.summary-grid,.ypia-stat-grid,.dashboard-kpis){
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;
  }
  body.ui-refined-v01632 :is(.kpi,.stat-card,.metric-card,.dashboard-kpi,.ypia-stat-card,.summary-card,.kpi-card){padding:13px}
  body.ui-refined-v01632 :is(.kpi,.stat-card,.metric-card,.dashboard-kpi,.ypia-stat-card,.summary-card,.kpi-card) small{font-size:.65rem}
  body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table){border-radius:14px}
  body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table) th,
  body.ui-refined-v01632 :is(.ypia-table-scroll,.table-responsive,.table-wrap,.overflow-table) td{padding:10px 11px!important}

  /* The journal is a high-frequency student task: keep the final action reachable. */
  body.ui-refined-v01632 form[data-journal-form]>.button-row{
    position:sticky;
    bottom:76px;
    z-index:12;
    display:grid;
    grid-template-columns:minmax(0,.82fr) minmax(0,1.18fr);
    gap:8px;
    margin:16px -8px 0;
    padding:9px 8px;
    border:1px solid var(--line);
    border-radius:15px;
    background:color-mix(in srgb,var(--surface) 92%,transparent);
    box-shadow:0 12px 34px rgba(20,30,50,.12);
    backdrop-filter:saturate(145%) blur(18px);
    -webkit-backdrop-filter:saturate(145%) blur(18px);
  }
  body.ui-refined-v01632 form[data-journal-form]>.button-row .btn{width:100%}
}

@media(max-width:540px){
  body.ui-refined-v01632 .page-head>.page-actions,
  body.ui-refined-v01632 .page-head>.button-row{grid-template-columns:minmax(0,1fr)}
  body.ui-refined-v01632 .version-stack{align-items:stretch}
  body.ui-refined-v01632 .version-stack .status-pill{justify-content:center}
  body.ui-refined-v01632 .filter-panel,
  body.ui-refined-v01632 .filter-card,
  body.ui-refined-v01632 .search-panel{padding:13px}
  body.ui-refined-v01632 .command-palette>section{border-radius:20px 20px 0 0}
}

@media(max-width:390px){
  body.ui-refined-v01632 :is(.kpi-grid,.stats-grid,.summary-grid,.ypia-stat-grid,.dashboard-kpis){grid-template-columns:minmax(0,1fr)}
  body.ui-refined-v01632 form[data-journal-form]>.button-row{grid-template-columns:minmax(0,1fr)}
}

@media(prefers-reduced-motion:reduce){
  body.ui-refined-v01632 .btn,
  body.ui-refined-v01632 .task-card,
  body.ui-refined-v01632 .menu-grid>a,
  body.ui-refined-v01632 .report-action-card{transition:none!important;transform:none!important}
}

@media(forced-colors:active){
  body.ui-refined-v01632 .ui-overflow-scrollable{box-shadow:none!important}
  body.ui-refined-v01632 form[data-journal-form]>.button-row{border:1px solid CanvasText}
}

@media print{
  body.ui-refined-v01632 .ui-overflow-scrollable{box-shadow:none!important}
  body.ui-refined-v01632 form[data-journal-form]>.button-row{position:static;box-shadow:none;border:0}
}

@media(max-width:850px){
  body.ui-refined-v01632.ui-keyboard-open form[data-journal-form]>.button-row{
    position:static;
    box-shadow:none;
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
  }
}
