/* ============================================================
   PATYTA PRO · UI SYSTEM R2
   ============================================================ */

:root{
  /* Brand */
  --pt-navy:#052F5E;
  --pt-sky:#ACDCF2;

  /* Neutrals */
  --pt-bg:#F7F9FB;
  --pt-surface:#FFFFFF;
  --pt-surface-2:#F3F6F8;
  --pt-line:rgba(5,47,94,.085);
  --pt-line-strong:rgba(5,47,94,.14);
  --pt-muted:#6F8295;
  --pt-muted-2:#94A3B2;

  /* Status */
  --pt-progress-bg:#C4F5B4;
  --pt-progress-fg:#008C4F;
  --pt-complete-bg:#008C4F;
  --pt-complete-fg:#C4F5B4;
  --pt-danger:#BA2D63;
  --pt-danger-soft:#F5CED6;

  /* Type */
  --pt-font:"Poppins",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --pt-fs-xxs:11px;
  --pt-fs-xs:12px;
  --pt-fs-sm:14px;
  --pt-fs-md:16px;
  --pt-fs-lg:18px;
  --pt-fs-xl:22px;
  --pt-fs-2xl:30px;
  --pt-fs-3xl:40px;

  /* Spacing */
  --pt-1:4px;
  --pt-2:8px;
  --pt-3:12px;
  --pt-4:16px;
  --pt-5:24px;
  --pt-6:32px;
  --pt-7:48px;
  --pt-8:64px;

  /* Radius */
  --pt-r-sm:10px;
  --pt-r-md:14px;
  --pt-r-lg:20px;
  --pt-r-xl:26px;
  --pt-r-pill:999px;

  /* Shadow */
  --pt-shadow-pop:0 16px 42px rgba(5,47,94,.14);
  --pt-shadow-soft:0 10px 30px rgba(5,47,94,.07);

  /* Motion */
  --pt-fast:160ms;
  --pt-med:240ms;
  --pt-slow:300ms;
}

/* ------------------------------------------------------------
   Gentle global normalization
   ------------------------------------------------------------ */

html{
  color-scheme:light;
}

body.pt-ui-r2{
  background:var(--pt-bg);
  color:var(--pt-navy);
  font-family:var(--pt-font);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

body.pt-ui-r2 button,
body.pt-ui-r2 input,
body.pt-ui-r2 select,
body.pt-ui-r2 textarea{
  font:inherit;
}

body.pt-ui-r2 button,
body.pt-ui-r2 a{
  -webkit-tap-highlight-color:transparent;
}

body.pt-ui-r2 :focus-visible{
  outline:2px solid var(--pt-sky);
  outline-offset:3px;
}

::selection{
  background:var(--pt-sky);
  color:var(--pt-navy);
}

/* ------------------------------------------------------------
   Page shell
   ------------------------------------------------------------ */

.pt-page{
  width:min(100%,1440px);
  margin:0 auto;
  padding:32px 36px 56px;
}

.pt-page--narrow{
  max-width:980px;
}

.pt-page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:24px;
  margin-bottom:32px;
}

.pt-page-head__copy{
  min-width:0;
}

.pt-page-eyebrow{
  margin:0 0 8px;
  color:var(--pt-muted);
  font-size:var(--pt-fs-xxs);
  line-height:1.2;
  font-weight:600;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.pt-page-title{
  margin:0;
  color:var(--pt-navy);
  font-size:clamp(30px,3.2vw,42px);
  line-height:1.05;
  font-weight:700;
  letter-spacing:-.045em;
}

.pt-page-subtitle{
  max-width:760px;
  margin:12px 0 0;
  color:var(--pt-muted);
  font-size:var(--pt-fs-md);
  line-height:1.65;
  font-weight:400;
}

.pt-page-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

/* ------------------------------------------------------------
   Sections / rows
   ------------------------------------------------------------ */

.pt-section{
  padding:0;
  background:transparent;
}

.pt-section + .pt-section{
  margin-top:48px;
}

.pt-section-head{
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:20px;
  margin-bottom:16px;
}

.pt-section-title{
  margin:0;
  font-size:22px;
  line-height:1.2;
  font-weight:600;
  letter-spacing:-.02em;
}

.pt-section-copy{
  margin:6px 0 0;
  color:var(--pt-muted);
  font-size:14px;
  line-height:1.55;
}

.pt-divider{
  height:1px;
  border:0;
  background:var(--pt-line);
  margin:24px 0;
}

.pt-list{
  border-top:1px solid var(--pt-line);
}

.pt-list-row{
  width:100%;
  min-height:72px;
  padding:16px 0;

  display:flex;
  align-items:center;
  gap:14px;

  border:0;
  border-bottom:1px solid var(--pt-line);

  background:transparent;
  color:var(--pt-navy);

  text-align:left;
  text-decoration:none;
}

.pt-list-row__icon{
  flex:0 0 40px;
  width:40px;
  height:40px;

  display:grid;
  place-items:center;

  border-radius:50%;
  background:var(--pt-surface-2);
  color:var(--pt-navy);
}

.pt-list-row__icon svg{
  width:21px;
  height:21px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.pt-list-row__body{
  min-width:0;
  flex:1;
}

.pt-list-row__title{
  display:block;
  font-size:15px;
  line-height:1.3;
  font-weight:500;
}

.pt-list-row__meta{
  display:block;
  margin-top:4px;
  color:var(--pt-muted);
  font-size:12px;
  line-height:1.4;
}

.pt-list-row__end{
  flex:0 0 auto;
  color:var(--pt-muted);
}

.pt-list-row:hover{
  color:var(--pt-navy);
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */

.pt-btn{
  min-height:44px;
  padding:0 18px;

  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;

  border:1px solid transparent;
  border-radius:var(--pt-r-pill);

  font-size:13px;
  line-height:1;
  font-weight:500;

  text-decoration:none;
  cursor:pointer;

  transition:
    transform var(--pt-fast) ease,
    background var(--pt-fast) ease,
    border-color var(--pt-fast) ease,
    box-shadow var(--pt-fast) ease;
}

.pt-btn:active{
  transform:scale(.98);
}

.pt-btn--primary{
  background:var(--pt-navy);
  color:var(--pt-sky);
}

.pt-btn--secondary{
  background:var(--pt-sky);
  color:var(--pt-navy);
}

.pt-btn--ghost{
  background:transparent;
  color:var(--pt-navy);
  border-color:var(--pt-line-strong);
}

.pt-btn--danger{
  background:var(--pt-danger);
  color:#fff;
}

.pt-icon-btn{
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;

  display:grid;
  place-items:center;

  padding:0;
  border:1px solid var(--pt-line);
  border-radius:50%;

  background:var(--pt-surface);
  color:var(--pt-navy);

  cursor:pointer;
}

.pt-icon-btn svg{
  width:21px;
  height:21px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

/* ------------------------------------------------------------
   Fields
   ------------------------------------------------------------ */

.pt-field{
  display:grid;
  gap:8px;
}

.pt-label{
  font-size:13px;
  line-height:1.3;
  font-weight:500;
  color:var(--pt-navy);
}

.pt-help{
  color:var(--pt-muted);
  font-size:12px;
  line-height:1.5;
}

.pt-input,
.pt-select,
.pt-textarea{
  width:100%;

  border:1px solid var(--pt-line-strong);
  border-radius:var(--pt-r-md);

  background:var(--pt-surface);
  color:var(--pt-navy);

  font-size:15px;
  font-weight:400;
}

.pt-input,
.pt-select{
  min-height:48px;
  padding:0 14px;
}

.pt-textarea{
  min-height:120px;
  padding:13px 14px;
  resize:vertical;
}

.pt-input::placeholder,
.pt-textarea::placeholder{
  color:var(--pt-muted-2);
}

.pt-input:focus,
.pt-select:focus,
.pt-textarea:focus{
  border-color:var(--pt-sky);
  box-shadow:0 0 0 3px rgba(172,220,242,.28);
  outline:0;
}

.pt-search{
  position:relative;
}

.pt-search .pt-input{
  padding-left:42px;
}

.pt-search__icon{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  pointer-events:none;
  color:var(--pt-muted);
}

/* ------------------------------------------------------------
   Switch
   ------------------------------------------------------------ */

.pt-switch{
  position:relative;
  width:50px;
  height:30px;
  display:inline-block;
  flex:0 0 auto;
}

.pt-switch input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.pt-switch__track{
  position:absolute;
  inset:0;
  border-radius:var(--pt-r-pill);
  background:#D8E0E7;
  transition:background var(--pt-fast) ease;
}

.pt-switch__thumb{
  position:absolute;
  top:3px;
  left:3px;
  width:24px;
  height:24px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 2px 8px rgba(5,47,94,.14);
  transition:transform var(--pt-fast) ease;
}

.pt-switch input:checked + .pt-switch__track{
  background:var(--pt-navy);
}

.pt-switch input:checked + .pt-switch__track + .pt-switch__thumb{
  transform:translateX(20px);
}

/* ------------------------------------------------------------
   Popover
   ------------------------------------------------------------ */

.pt-popover{
  position:fixed;
  z-index:300;

  min-width:220px;
  max-width:min(360px,calc(100vw - 24px));

  padding:8px;

  border:1px solid var(--pt-line);
  border-radius:var(--pt-r-md);

  background:rgba(255,255,255,.98);
  box-shadow:var(--pt-shadow-pop);

  opacity:0;
  visibility:hidden;
  transform:translateY(4px) scale(.985);

  transition:
    opacity var(--pt-fast) ease,
    visibility var(--pt-fast) ease,
    transform var(--pt-fast) ease;
}

.pt-popover.is-open{
  opacity:1;
  visibility:visible;
  transform:translateY(0) scale(1);
}

.pt-popover__item{
  width:100%;
  min-height:42px;
  padding:0 12px;

  display:flex;
  align-items:center;
  gap:10px;

  border:0;
  border-radius:10px;

  background:transparent;
  color:var(--pt-navy);

  text-decoration:none;
  text-align:left;
  font-size:13px;
  font-weight:500;
}

.pt-popover__item:hover{
  background:var(--pt-surface-2);
}

/* ------------------------------------------------------------
   Overlay / Drawer / Sheet / Modal
   ------------------------------------------------------------ */

.pt-overlay{
  position:fixed;
  inset:0;
  z-index:250;

  background:rgba(5,47,94,.18);

  opacity:0;
  visibility:hidden;
  pointer-events:none;

  transition:
    opacity var(--pt-med) ease,
    visibility var(--pt-med) ease;
}

.pt-overlay.is-open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

.pt-drawer{
  position:fixed;
  z-index:260;

  top:0;
  right:0;
  bottom:0;

  width:min(460px,92vw);

  background:var(--pt-surface);
  border-left:1px solid var(--pt-line);

  transform:translateX(100%);
  transition:transform var(--pt-med) cubic-bezier(.2,.8,.2,1);

  display:flex;
  flex-direction:column;
}

.pt-drawer.is-open{
  transform:translateX(0);
}

.pt-drawer__head{
  min-height:72px;
  padding:14px 18px;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;

  border-bottom:1px solid var(--pt-line);
}

.pt-drawer__body{
  flex:1;
  overflow:auto;
  padding:24px;
  overscroll-behavior:contain;
}

.pt-drawer__foot{
  padding:14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top:1px solid var(--pt-line);
  background:var(--pt-surface);
}

.pt-sheet{
  position:fixed;
  z-index:270;

  left:0;
  right:0;
  bottom:0;

  max-height:min(88dvh,900px);

  background:var(--pt-surface);
  border-radius:28px 28px 0 0;

  transform:translateY(105%);
  transition:transform var(--pt-slow) cubic-bezier(.2,.8,.2,1);

  display:flex;
  flex-direction:column;
}

.pt-sheet.is-open{
  transform:translateY(0);
}

.pt-sheet__handle{
  width:42px;
  height:4px;
  margin:9px auto 3px;
  border-radius:999px;
  background:#D8E0E7;
}

.pt-sheet__head{
  min-height:64px;
  padding:12px 20px;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;

  border-bottom:1px solid var(--pt-line);
}

.pt-sheet__body{
  flex:1;
  overflow:auto;
  padding:22px 20px;
  overscroll-behavior:contain;
}

.pt-sheet__foot{
  padding:12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top:1px solid var(--pt-line);
}

.pt-modal{
  position:fixed;
  z-index:280;

  left:50%;
  top:50%;

  width:min(620px,calc(100vw - 32px));
  max-height:min(86dvh,900px);

  display:flex;
  flex-direction:column;

  border:1px solid var(--pt-line);
  border-radius:var(--pt-r-xl);

  background:var(--pt-surface);
  box-shadow:var(--pt-shadow-pop);

  opacity:0;
  visibility:hidden;
  transform:translate(-50%,-48%) scale(.985);

  transition:
    opacity var(--pt-med) ease,
    visibility var(--pt-med) ease,
    transform var(--pt-med) ease;
}

.pt-modal.is-open{
  opacity:1;
  visibility:visible;
  transform:translate(-50%,-50%) scale(1);
}

.pt-modal__body{
  overflow:auto;
  padding:26px;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */

.pt-toast-host{
  position:fixed;
  z-index:500;

  right:18px;
  bottom:18px;

  display:grid;
  gap:10px;

  pointer-events:none;
}

.pt-toast{
  min-width:240px;
  max-width:min(380px,calc(100vw - 32px));

  padding:13px 15px;

  border:1px solid var(--pt-line);
  border-radius:var(--pt-r-md);

  background:var(--pt-navy);
  color:#fff;

  box-shadow:var(--pt-shadow-pop);

  font-size:13px;
  line-height:1.4;

  opacity:0;
  transform:translateY(8px);

  animation:pt-toast-in var(--pt-fast) ease forwards;
}

@keyframes pt-toast-in{
  to{
    opacity:1;
    transform:translateY(0);
  }
}

/* ------------------------------------------------------------
   Empty / Skeleton
   ------------------------------------------------------------ */

.pt-empty{
  min-height:280px;
  padding:48px 24px;

  display:grid;
  place-items:center;

  text-align:center;
}

.pt-empty__inner{
  max-width:520px;
}

.pt-empty__title{
  margin:0;
  font-size:22px;
  font-weight:600;
}

.pt-empty__copy{
  margin:10px 0 0;
  color:var(--pt-muted);
  font-size:14px;
  line-height:1.6;
}

.pt-skeleton{
  position:relative;
  overflow:hidden;
  background:#E9EEF2;
  border-radius:8px;
}

.pt-skeleton::after{
  content:"";
  position:absolute;
  inset:0;
  transform:translateX(-100%);
  background:linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.6),
    transparent
  );
  animation:pt-skeleton 1.2s infinite;
}

@keyframes pt-skeleton{
  to{
    transform:translateX(100%);
  }
}

/* ------------------------------------------------------------
   Status helpers
   ------------------------------------------------------------ */

.pt-status--progress{
  background:var(--pt-progress-bg)!important;
  color:var(--pt-progress-fg)!important;
}

.pt-status--complete{
  background:var(--pt-complete-bg)!important;
  color:var(--pt-complete-fg)!important;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media(max-width:820px){

  body.pt-ui-r2{
    background:var(--pt-bg);
  }

  .pt-page{
    padding:
      22px
      20px
      calc(110px + env(safe-area-inset-bottom));
  }

  .pt-page-head{
    display:block;
    margin-bottom:28px;
  }

  .pt-page-title{
    font-size:30px;
  }

  .pt-page-subtitle{
    font-size:15px;
  }

  .pt-page-actions{
    justify-content:flex-start;
    margin-top:18px;
  }

  .pt-section + .pt-section{
    margin-top:38px;
  }

  .pt-section-title{
    font-size:20px;
  }

  .pt-input,
  .pt-select,
  .pt-textarea{
    font-size:16px;
  }

  .pt-drawer{
    display:none!important;
  }

  .pt-modal{
    display:none!important;
  }

  .pt-toast-host{
    left:16px;
    right:16px;
    bottom:calc(94px + env(safe-area-inset-bottom));
  }

  .pt-toast{
    width:100%;
    max-width:none;
  }
}

@media(min-width:821px){

  .pt-sheet{
    display:none!important;
  }
}

@media(prefers-reduced-motion:reduce){

  *,
  *::before,
  *::after{
    scroll-behavior:auto!important;
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
}
