/* Clinic v4.7.0 — UI/UX Foundation
   Presentation-only layer. No booking/payment/ownership/business logic. */

:root{
  --ux470-touch:44px;
  --ux470-radius-sm:12px;
  --ux470-radius:16px;
  --ux470-radius-lg:22px;
  --ux470-border:rgba(148,163,184,.28);
  --ux470-shadow:0 12px 34px rgba(15,23,42,.07);
  --ux470-focus:0 0 0 3px rgba(14,116,144,.18);
}

/* Shared accessibility and interaction consistency */
body.admin-body :is(a,button,input,select,textarea):focus-visible,
body.secretary-body :is(a,button,input,select,textarea):focus-visible,
body.public-shell :is(a,button,input,select,textarea):focus-visible{
  outline:2px solid #0e7490;
  outline-offset:2px;
  box-shadow:var(--ux470-focus);
}
body.admin-body .form-control,
body.admin-body .form-select,
body.secretary-body .form-control,
body.secretary-body .form-select,
body.public-shell .form-control,
body.public-shell .form-select{
  min-height:var(--ux470-touch);
  border-radius:var(--ux470-radius-sm);
}
body.admin-body textarea.form-control,
body.secretary-body textarea.form-control,
body.public-shell textarea.form-control{min-height:96px}
body.admin-body .btn,
body.secretary-body .btn,
body.public-shell .btn{
  border-radius:var(--ux470-radius-sm);
  font-weight:750;
}
body.admin-body .btn:not(.btn-sm),
body.secretary-body .btn:not(.btn-sm),
body.public-shell .btn:not(.btn-sm){min-height:var(--ux470-touch)}

/* Admin: calmer hierarchy and more consistent spacing */
body.admin-body .admin-content{width:100%;max-width:1720px;margin-inline:auto;padding-bottom:32px}
body.admin-body .admin-topbar{border-bottom:1px solid rgba(148,163,184,.20)}
body.admin-body .admin-page-title{letter-spacing:-.015em}
body.admin-body .admin-card,
body.admin-body .admin-table-card,
body.admin-body .admin-appointments-card,
body.admin-body .ops-center-v4350{
  border-color:var(--ux470-border);
  border-radius:var(--ux470-radius-lg);
  box-shadow:var(--ux470-shadow);
}
body.admin-body .admin-stat-card{
  min-height:112px;
  border:1px solid var(--ux470-border);
  border-radius:18px;
  box-shadow:0 8px 24px rgba(15,23,42,.055);
}
body.admin-body .admin-nav-link,
body.admin-body .admin-nav-group>summary,
body.admin-body .admin-sidebar-tool{min-height:44px}
body.admin-body .admin-nav-create{border-radius:16px}
body.admin-body .admin-sidebar-nav{scrollbar-width:thin}

/* Secretary: action-first workspace */
body.secretary-body .secretary-container{max-width:1720px;margin-inline:auto}
body.secretary-body .secretary-appointment-card,
body.secretary-body .secretary-month-calendar,
body.secretary-body .ops-center-v4350,
body.secretary-body .registry-sheet,
body.secretary-body .registry-filter-card{
  border-color:var(--ux470-border);
  box-shadow:var(--ux470-shadow);
}
body.secretary-body .secretary-appointment-card{border-radius:18px}
body.secretary-body .secretary-card-action-grid :is(button,a),
body.secretary-body .secretary-primary-action,
body.secretary-body .secretary-reschedule-trigger,
body.secretary-body .secretary-delay-trigger{min-height:44px}

/* Registry: desktop remains a sortable table; mobile becomes readable appointment cards. */
.registry-toolbar-hint--mobile{display:none!important}
.registry-filter-grid .form-control,
.registry-filter-grid .form-select{min-height:44px}
.registry-action-group .btn{min-height:36px}
.registry-dialog{border:1px solid rgba(148,163,184,.22)}
.registry-dialog-close{min-width:44px;min-height:44px}

/* Public booking/patient UI: keep flow, improve clarity and touch comfort. */
body.public-shell .booking-easy-progress,
body.public-shell .booking-easy-panel,
body.public-shell .booking-redesign-card,
body.public-shell .clinic-booking-card,
body.public-shell .patient-next-card,
body.public-shell .patient-appointment-card{
  border-color:var(--ux470-border);
  box-shadow:0 10px 30px rgba(15,23,42,.055);
}
body.public-shell .booking-service-option,
body.public-shell .clinic-service-card,
body.public-shell .clinic-slot-grid button,
body.public-shell .booking-slot-grid button,
body.public-shell .booking-easy-time-grid button,
body.public-shell .booking-redesign-slot-grid button{
  min-height:48px;
}
body.public-shell .booking-easy-progress{border-radius:16px}
body.public-shell .booking-easy-panel,
body.public-shell .booking-redesign-card,
body.public-shell .clinic-booking-card{border-radius:20px}
body.public-shell .patient-appointment-action{min-height:42px}

@media (max-width: 991.98px){
  body.admin-body .admin-content{padding-inline:14px}
  body.admin-body .admin-sidebar{width:min(86vw,330px)}
  body.secretary-body .secretary-container{padding-inline:12px}
}

@media (max-width: 767.98px){
  :root{--ux470-radius-lg:18px}

  /* Admin mobile header: important actions stay visible without horizontal overflow. */
  body.admin-body .admin-topbar{min-height:64px;padding-inline:max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right))}
  body.admin-body .admin-topbar-start{min-width:0;gap:9px}
  body.admin-body .admin-topbar-titles{min-width:0}
  body.admin-body .admin-page-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.98rem}
  body.admin-body .admin-page-subtitle{display:none}
  body.admin-body .admin-topbar-actions{gap:7px}
  body.admin-body .admin-user-chip{width:40px;height:40px;padding:0;justify-content:center;border-radius:12px;overflow:hidden}
  body.admin-body .admin-user-chip>span:not(.admin-user-chip-avatar){display:none}
  body.admin-body .admin-content{padding:14px 10px 28px!important}
  body.admin-body .admin-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  body.admin-body .admin-stat-card{min-height:100px;padding:13px}
  body.admin-body .admin-card-header{gap:10px}
  body.admin-body .admin-card-header>.btn,
  body.admin-body .admin-toolbar .btn{min-height:42px}

  /* Secretary navigation becomes a predictable bottom dock on phones. */
  body.secretary-body{padding-bottom:calc(72px + env(safe-area-inset-bottom))}
  body.secretary-body .secretary-topbar{position:sticky;top:0;z-index:1030}
  body.secretary-body .secretary-topbar__inner{min-height:62px;padding:8px 10px;gap:8px}
  body.secretary-body .secretary-brand small,
  body.secretary-body .secretary-account__identity{display:none}
  body.secretary-body .secretary-brand>span:last-child strong{font-size:.82rem}
  body.secretary-body .secretary-account{gap:6px}
  body.secretary-body .secretary-logout{width:40px;height:40px;padding:0;justify-content:center}
  body.secretary-body .secretary-logout span{display:none}
  body.secretary-body .secretary-nav{
    position:fixed!important;
    z-index:1040;
    right:0;
    left:0;
    bottom:0;
    width:100%!important;
    order:initial!important;
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:2px;
    overflow:visible!important;
    padding:7px max(8px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important;
    border-top:1px solid rgba(148,163,184,.30);
    background:rgba(255,255,255,.96);
    box-shadow:0 -10px 30px rgba(15,23,42,.10);
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
  }
  body.secretary-body .secretary-nav a{
    min-width:0!important;
    min-height:52px;
    display:grid!important;
    place-items:center;
    align-content:center;
    gap:3px!important;
    padding:5px 3px!important;
    border-radius:12px!important;
    font-size:.68rem!important;
    line-height:1.15;
  }
  body.secretary-body .secretary-nav a svg{width:20px;height:20px}
  body.secretary-body .secretary-nav a.is-active{background:#eaf7f8;color:#0f6f78}
  body.secretary-body .internal-notification-popup-v453{bottom:calc(76px + env(safe-area-inset-bottom))}
  body.secretary-body .secretary-main{padding:12px 0 18px!important}
  body.secretary-body .secretary-container{padding-inline:10px}
  body.secretary-body .secretary-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  body.secretary-body .secretary-appointment-card{padding:13px}

  /* Mobile registry cards. */
  .registry-toolbar-hint--desktop{display:none!important}
  .registry-toolbar-hint--mobile{display:block!important}
  .registry-sheet__toolbar{gap:10px}
  .registry-sheet__toolbar>[data-reset-columns]{display:none}
  .registry-table-wrap{overflow:visible;background:#f5f8fa}
  .registry-table{display:block;width:100%;min-width:0!important;background:transparent;font-size:.84rem}
  .registry-table thead{display:none}
  .registry-table tbody{display:grid;gap:12px;padding:12px}
  .registry-table tbody tr{
    display:grid;
    width:100%;
    overflow:hidden;
    border:1px solid rgba(148,163,184,.28);
    border-radius:17px;
    background:#fff;
    box-shadow:0 8px 24px rgba(15,23,42,.055);
  }
  .registry-table tbody tr.is-awaiting{box-shadow:inset -4px 0 #f0a22b,0 8px 24px rgba(15,23,42,.055)}
  .registry-table tbody tr>td[data-label]{
    display:grid;
    grid-template-columns:88px minmax(0,1fr);
    align-items:start;
    gap:9px;
    min-width:0;
    padding:9px 12px;
    border:0;
    border-bottom:1px solid #eef2f5;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  .registry-table tbody tr>td[data-label]::before{
    content:attr(data-label);
    color:#71808d;
    font-size:.70rem;
    font-weight:850;
    line-height:1.65;
  }
  .registry-table tbody tr>td[data-column="name"]{
    padding-top:13px;
    background:linear-gradient(180deg,#fbfdfe,#fff);
  }
  .registry-table tbody tr>td[data-column="name"] strong{font-size:.96rem}
  .registry-table tbody tr>td[data-column="tracking"]{order:-1}
  .registry-table tbody tr>td[data-column="actions"]{
    grid-template-columns:1fr;
    padding:12px;
    border-bottom:0;
    background:#fafcfd;
  }
  .registry-table tbody tr>td[data-column="actions"]::before{display:none}
  .registry-action-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0;width:100%}
  .registry-action-group .btn{width:100%;min-height:42px;white-space:normal}
  .registry-action-group .btn:first-child:last-child{grid-column:1/-1}
  .registry-empty{min-height:120px;padding:18px}
  .registry-table tbody tr>td[colspan]{display:block!important;border:0!important}

  /* Modal/dialog patterns become bottom sheets on phones, preserving native dialog top-layer behavior. */
  .registry-dialog{
    inset:auto 0 0 0;
    width:100%;
    max-width:none;
    max-height:min(90dvh,760px);
    margin:0;
    border-radius:24px 24px 0 0;
    border-bottom:0;
  }
  .registry-edit-form>header{position:sticky;top:0;z-index:3;padding:14px 15px}
  .registry-edit-grid{padding:14px;gap:12px}
  .registry-edit-form>footer{padding:12px 14px max(12px,env(safe-area-inset-bottom));display:grid;grid-template-columns:1fr 1fr}
  .registry-edit-form>footer .btn{min-height:46px}

  /* Filters and actions: single column, no accidental tiny tap targets. */
  .registry-filter-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .registry-filter-actions .btn{min-height:44px}

  /* Public booking: readable spacing without changing the workflow. */
  body.public-shell .booking-easy-panel,
  body.public-shell .booking-redesign-card,
  body.public-shell .clinic-booking-card{border-radius:17px}
  body.public-shell .booking-easy-panel__head,
  body.public-shell .booking-easy-block{padding-inline:14px}
  body.public-shell .booking-service-option,
  body.public-shell .clinic-service-card{border-radius:14px}
  body.public-shell .booking-easy-time-grid,
  body.public-shell .booking-slot-grid,
  body.public-shell .booking-redesign-slot-grid,
  body.public-shell .clinic-slot-grid{gap:8px}
  body.public-shell .booking-easy-time-grid button,
  body.public-shell .booking-slot-grid button,
  body.public-shell .booking-redesign-slot-grid button,
  body.public-shell .clinic-slot-grid button{min-height:50px;border-radius:12px}
  body.public-shell .patient-appointment-actions{gap:8px}
  body.public-shell .patient-appointment-action{min-height:44px}
}

@media (max-width: 420px){
  body.admin-body .admin-stats,
  body.secretary-body .secretary-stat-grid{grid-template-columns:1fr 1fr}
  .registry-action-group{grid-template-columns:1fr}
  .registry-edit-form>footer{grid-template-columns:1fr}
  .registry-filter-actions{grid-template-columns:1fr}
}

@media (prefers-reduced-motion: reduce){
  body.admin-body *,body.secretary-body *,body.public-shell *{scroll-behavior:auto!important}
}
