
@font-face { font-family: "Kook"; src: url("fonts/Kook-Light.ttf") format("truetype"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Kook"; src: url("fonts/Kook-Regular.ttf") format("truetype"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Kook"; src: url("fonts/Kook-ExtraBold.ttf") format("truetype"); font-weight: 800 900; font-style: normal; font-display: swap; }

:root {
  --teal: #0a8f98;
  --teal-dark: #08747b;
  --teal-soft: #d9f1ef;
  --ink: #17343a;
  --muted: #71878c;
  --line: rgba(35, 94, 99, .13);
  --glass: rgba(243, 250, 248, .7);
  --glass-strong: rgba(250, 253, 252, .88);
  --shadow: 0 18px 45px rgba(41, 91, 96, .12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { color: var(--ink); font-family: "Kook", Tahoma, Arial, sans-serif; font-size: 14px; background: #b8dfe0; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid rgba(10,143,152,.5); outline-offset: 2px; }

.login-page, .app-bg {
  min-height: 100vh;
  padding: 38px;
  direction: rtl;
  background:
    radial-gradient(circle at 12% 16%, rgba(211, 248, 235, .96), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(194, 192, 245, .82), transparent 35%),
    radial-gradient(circle at 55% 96%, rgba(202, 241, 230, .92), transparent 39%),
    linear-gradient(135deg, #a8d5d7 0%, #d7e8df 49%, #afc9e6 100%);
}

.login-frame, .app-frame {
  border: 1px solid rgba(255,255,255,.8);
  background: rgba(237,248,245,.58);
  box-shadow: 0 32px 90px rgba(43,82,89,.18);
  backdrop-filter: blur(28px);
}
.login-frame { width: min(1050px,100%); min-height: 660px; margin: 0 auto; display: grid; grid-template-columns: .82fr 1.18fr; overflow: hidden; border-radius: 34px; }
.login-visual { position: relative; overflow: hidden; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: linear-gradient(160deg, rgba(10,143,152,.94), rgba(14,112,124,.86)); }
.login-visual::after { content: ""; position: absolute; width: 360px; height: 360px; left: -150px; bottom: -190px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.05), 0 0 0 140px rgba(255,255,255,.03); }
.login-visual > div:nth-child(2) { position: relative; z-index: 2; }
.login-visual h1 { margin: 10px 0 0; font-size: 38px; font-weight: 800; }
.login-visual small { color: rgba(255,255,255,.72); }
.login-decoration { position: absolute; top: 150px; right: 75px; width: 95px; height: 95px; border-radius: 28px; transform: rotate(15deg); background: rgba(209,191,255,.25); box-shadow: 75px 70px 0 -18px rgba(183,243,221,.2); }
.login-content { padding: 50px; display: flex; flex-direction: column; justify-content: center; }
.login-heading > span { color: var(--teal-dark); font-size: 12px; }
.login-heading h2 { margin: 8px 0 25px; font-size: 30px; }

.brand { display: flex; align-items: center; gap: 11px; position: relative; z-index: 2; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; position: relative; background: linear-gradient(135deg,#0b969d,#18b1ae); box-shadow: 0 10px 24px rgba(10,143,152,.2); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; inset: 50% auto auto 50%; border-radius: 3px; background: #fff; transform: translate(-50%,-50%); }
.brand-mark::before { width: 5px; height: 20px; }
.brand-mark::after { width: 20px; height: 5px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: #789095; font-size: 9px; }
.login-visual .brand small { color: rgba(255,255,255,.68); }

.role-pills { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; }
.role-pills button { min-height: 82px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #527076; background: rgba(255,255,255,.5); cursor: pointer; transition: .18s ease; font-size: 10px; }
.role-pills button:hover { transform: translateY(-2px); background: rgba(255,255,255,.75); }
.role-pills button.active { color: #fff; border-color: transparent; background: linear-gradient(135deg,#068a95,#24a7aa); box-shadow: 0 12px 24px rgba(8,137,146,.2); }
.role-pills button > span { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--teal-dark); background: rgba(10,143,152,.1); font-weight: 800; }
.role-pills button.active > span { color: #fff; background: rgba(255,255,255,.18); }
.login-form { margin-top: 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.login-form .wide, .login-form .form-error { grid-column: 1/-1; }

label > span { display: block; margin: 0 3px 7px; color: #617a7f; font-size: 10px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid rgba(38,104,110,.15); border-radius: 12px; outline: none; color: var(--ink); background: rgba(255,255,255,.66); }
input, select { height: 44px; padding: 0 13px; }
textarea { min-height: 92px; padding: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(10,143,152,.09); background: rgba(255,255,255,.94); }
input:disabled, select:disabled { opacity: .65; cursor: not-allowed; }
.input-note { display: block; margin: 6px 4px 0; color: var(--muted); font-size: 8px; }

.primary-button, .secondary-button, .row-actions button, .logout-button { border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; transition: .17s ease; }
.primary-button { min-height: 43px; padding: 0 17px; border: 0; color: #fff; background: linear-gradient(135deg,#068a95,#18a8a8); box-shadow: 0 10px 22px rgba(8,137,146,.18); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(8,137,146,.23); }
.primary-button.compact { min-height: 39px; font-size: 10px; }
.primary-button:disabled { color: #eef5f4; background: #a9bdbd; box-shadow: none; cursor: not-allowed; transform: none; }
.secondary-button { min-height: 39px; padding: 0 14px; border: 1px solid rgba(12,132,140,.2); color: var(--teal-dark); background: rgba(255,255,255,.62); }
.secondary-button:hover { background: #fff; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.form-error, .success-message { margin: 0; padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 7px; font-size: 9px; }
.form-error { color: #a14e4e; background: #fee7e7; }
.success-message { color: #147966; background: #def3e9; }
.full { grid-column: 1/-1; }

.app-frame { width: min(1520px,100%); min-height: calc(100vh - 76px); margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0,1fr); overflow: hidden; border-radius: 31px; }
.sidebar { min-height: 100%; padding: 28px 17px 18px; display: flex; flex-direction: column; border-left: 1px solid rgba(47,105,109,.11); background: rgba(231,245,241,.44); }
.sidebar > .brand { padding: 0 8px 26px; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sidebar nav button { width: 100%; min-height: 45px; padding: 0 14px; border: 0; border-radius: 12px; display: flex; align-items: center; gap: 11px; color: #3e7378; background: transparent; cursor: pointer; text-align: right; font-size: 11px; }
.sidebar nav button:hover { background: rgba(255,255,255,.5); }
.sidebar nav button.active { color: #fff; background: linear-gradient(90deg,#078b95,#16a7a9); box-shadow: 0 12px 24px rgba(8,137,146,.18); }
.sidebar-account { padding: 12px; display: flex; align-items: center; gap: 9px; border-radius: 14px; background: rgba(255,255,255,.48); }
.sidebar-account > div { flex: 1; min-width: 0; }
.sidebar-account b, .sidebar-account small { display: block; }
.sidebar-account b { font-size: 10px; }
.sidebar-account small { margin-top: 3px; color: #789094; font-size: 8px; }
.sidebar-account > button { border: 0; color: #688387; background: transparent; cursor: pointer; }
.app-content { min-width: 0; }
.topbar { min-height: 78px; padding: 0 28px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid rgba(48,102,107,.09); background: rgba(246,252,250,.28); }
.welcome { display: flex; flex-direction: column; gap: 3px; }
.welcome small { color: var(--teal-dark); font-size: 8px; }
.welcome b { font-size: 11px; }
.data-state { margin-right: auto; display: flex; align-items: center; gap: 7px; color: #6d8589; font-size: 8px; }
.data-state i { width: 7px; height: 7px; border-radius: 50%; background: #77b7b3; }
.logout-button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); color: #4a7478; background: rgba(255,255,255,.52); font-size: 9px; }
.menu-button, .mobile-backdrop { display: none; }
.workspace { max-width: 1340px; margin: 0 auto; padding: 27px; }

.page-heading { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.page-heading p { margin: 0 0 6px; color: var(--teal-dark); font-size: 9px; }
.page-heading h1 { margin: 0; font-size: 28px; line-height: 1.3; font-weight: 800; }
.glass-panel, .metric-card, .stock-card { border: 1px solid rgba(255,255,255,.68); border-radius: 19px; background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.panel-head { min-height: 67px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(38,100,105,.09); }
.panel-head h2 { margin: 0; font-size: 14px; }
.panel-head p { margin: 5px 0 0; color: #789095; font-size: 8px; }
.panel-head > button { border: 0; color: var(--teal-dark); background: transparent; cursor: pointer; font-size: 8px; }
.top-gap { margin-top: 14px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 13px; }
.metric-card { min-height: 118px; padding: 17px; display: flex; align-items: flex-start; gap: 12px; }
.metric-icon, .drug-icon, .big-med { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; }
.metric-icon.teal, .drug-icon.teal { color: #078b95; background: #d8f0ed; }
.metric-icon.purple, .drug-icon.purple { color: #7867d8; background: #e7e2ff; }
.metric-icon.pink, .drug-icon.pink { color: #d95b96; background: #f9ddef; }
.metric-icon.orange, .drug-icon.orange { color: #d88435; background: #ffe7cc; }
.drug-icon.blue { color: #4e84bf; background: #deecfb; }
.drug-icon.green { color: #3a9876; background: #ddf2e8; }
.drug-icon.violet { color: #8463bd; background: #ebe2f9; }
.metric-card small, .metric-card strong, .metric-card p { display: block; }
.metric-card small { color: #6d8489; font-size: 9px; }
.metric-card strong { margin-top: 8px; font-size: 22px; }
.metric-card p { margin: 5px 0 0; color: #8a9ea2; font-size: 8px; }
.dashboard-grid { margin-top: 14px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.quick-panel { grid-column: 2; }
.empty-state { min-height: 245px; padding: 34px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state > span { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; color: var(--teal); background: rgba(216,241,237,.7); }
.empty-state h3 { margin: 14px 0 7px; font-size: 13px; }
.empty-state p { max-width: 360px; margin: 0; color: #7b9195; font-size: 9px; line-height: 1.9; }
.empty-state .primary-button { margin-top: 16px; }
.list-stack { padding: 6px 18px 15px; }
.list-stack > div { min-height: 62px; display: grid; grid-template-columns: 48px 33px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid rgba(37,94,99,.08); }
.list-stack time { font-size: 9px; font-weight: 700; }
.list-stack b, .list-stack small { display: block; }
.list-stack b { font-size: 10px; }
.list-stack small { margin-top: 4px; color: #809397; font-size: 8px; }
.avatar { width: 33px; height: 33px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; color: #078b95; background: rgba(213,240,237,.85); font-size: 9px; font-weight: 800; }
.tag { width: max-content; padding: 5px 9px; border-radius: 20px; font-size: 8px; font-style: normal; white-space: nowrap; }
.tag.success { color: #147966; background: #dff4eb; }
.tag.info { color: #4b6da8; background: #e4ecfa; }
.tag.danger { color: #a14e4e; background: #fee4e4; }
.mini-stock { padding: 10px 18px 16px; }
.mini-stock > div { min-height: 38px; display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 9px; border-bottom: 1px solid rgba(39,96,101,.07); }
.mini-stock > div:last-child { border-bottom: 0; }
.mini-stock b { font-size: 9px; }
.mini-stock strong { font-size: 10px; }
.mini-stock strong small { color: #829599; font-size: 7px; font-weight: 400; }
.drug-dot { width: 8px; height: 8px; border-radius: 3px; background: #0a8f98; }
.drug-dot.blue { background:#5c91ca; }.drug-dot.purple { background:#806adc; }.drug-dot.pink { background:#dc6ca1; }.drug-dot.orange { background:#e4944a; }.drug-dot.green { background:#4aa982; }.drug-dot.violet { background:#896bc2; }
.quick-actions { padding: 7px 16px 15px; }
.quick-actions button { width: 100%; padding: 11px 2px; border: 0; border-bottom: 1px solid rgba(38,95,100,.08); display: flex; align-items: center; gap: 10px; color: #397176; background: transparent; text-align: right; cursor: pointer; }
.quick-actions button:last-child { border-bottom: 0; }
.quick-actions button > svg { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: rgba(220,241,238,.74); }
.quick-actions b, .quick-actions small { display: block; }
.quick-actions b { color: var(--ink); font-size: 9px; }
.quick-actions small { margin-top: 4px; color: #7d9397; font-size: 7px; }

.table-panel { overflow: hidden; }
.panel-toolbar { min-height: 66px; padding: 12px 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(38,98,103,.09); }
.search-field { width: min(380px,60%); height: 40px; padding: 0 11px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; color: #668084; background: rgba(255,255,255,.5); }
.search-field input { height: auto; flex: 1; min-width: 0; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 9px; }
.record-count { padding: 6px 10px; border-radius: 10px; color: var(--teal-dark); background: rgba(213,239,236,.72); font-size: 8px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 12px 16px; color: #71878b; background: rgba(244,251,249,.36); font-size: 8px; font-weight: 500; text-align: right; }
td { height: 58px; padding: 9px 16px; border-top: 1px solid rgba(41,99,104,.07); color: #4e686d; font-size: 9px; }
tbody tr:hover { background: rgba(216,241,237,.28); }
.patient-cell { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.row-actions { display: flex; gap: 5px; }
.row-actions button { min-height: 31px; padding: 0 9px; border: 1px solid var(--line); color: var(--teal-dark); background: rgba(255,255,255,.6); font-size: 8px; }

.two-column { display: grid; grid-template-columns: 1.25fr .75fr; gap: 14px; align-items: start; }
.form-panel { overflow: hidden; }
.form-grid { padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-footer { min-height: 68px; padding: 12px 18px; border-top: 1px solid rgba(38,98,103,.09); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-footer > span { color: #6e8589; font-size: 9px; }
.current-plan { min-height: 270px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.big-med { width: 58px; height: 58px; border-radius: 18px; color: var(--teal); background: var(--teal-soft); }
.current-plan > small { margin-top: 14px; color: #789095; }
.current-plan h2 { margin: 7px 0 5px; font-size: 22px; }
.current-plan p { margin: 0; color: var(--teal-dark); font-size: 9px; }

.stock-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 13px; }
.stock-card { min-height: 188px; padding: 17px; position: relative; }
.stock-card > small, .stock-card > strong, .stock-card > p { display: block; }
.stock-card > small { margin-top: 13px; color: #5f7b80; font-size: 10px; }
.stock-card > strong { margin-top: 6px; font-size: 24px; }
.stock-card > p { margin: 0; color: #83979a; font-size: 8px; }
.allocation-line { margin-top: 13px; padding-top: 10px; border-top: 1px solid rgba(39,96,101,.08); display: flex; flex-direction: column; gap: 4px; color: #6e8589; font-size: 7px; }
.info-strip { margin-top: 14px; padding: 15px 18px; border: 1px solid rgba(255,255,255,.7); border-radius: 15px; display: flex; align-items: center; gap: 10px; color: #53757a; background: rgba(242,250,248,.62); }
.info-strip p { margin: 0; font-size: 9px; }

.toggle-field { min-height: 64px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.38); cursor: pointer; }
.toggle-field input { display: none; }
.toggle-field > span { width: 38px; height: 22px; border-radius: 20px; position: relative; background: #bed1d1; transition: .2s; }
.toggle-field > span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12); transition: .2s; }
.toggle-field input:checked + span { background: var(--teal); }
.toggle-field input:checked + span::after { transform: translateX(-16px); }
.toggle-field b, .toggle-field small { display: block; }
.toggle-field b { font-size: 9px; }
.toggle-field small { margin-top: 4px; color: #748b90; font-size: 8px; }
.surplus-box { padding: 14px; border: 1px dashed rgba(125,98,194,.27); border-radius: 14px; background: rgba(234,226,249,.34); }
.surplus-box h3 { margin: 0 4px; color: #785fab; font-size: 11px; }
.surplus-box .form-grid.inner { padding: 13px 0 0; }

.session-list { padding: 8px 17px 16px; }
.session-list > div { padding: 13px 0; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid rgba(38,96,101,.08); }
.session-list > div:last-child { border-bottom: 0; }
.session-list b, .session-list small { display: block; }
.session-list b { font-size: 9px; }
.session-list small { margin-top: 4px; color: #789095; font-size: 7px; }
.session-list p { margin: 7px 0 0; color: #5f777b; font-size: 8px; line-height: 1.8; }

.export-builder { overflow: hidden; }
.export-filters { padding: 18px; display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }
.export-summary { padding: 14px 18px; display: grid; grid-template-columns: repeat(4,1fr) auto; align-items: center; gap: 14px; border-top: 1px solid rgba(39,99,104,.08); background: rgba(249,253,252,.24); }
.export-summary small, .export-summary b { display: block; }
.export-summary small { color: #71898d; font-size: 8px; }
.export-summary b { margin-top: 5px; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 20px; display: grid; place-items: center; background: rgba(20,54,59,.38); backdrop-filter: blur(9px); }
.modal-card { width: min(580px,100%); max-height: calc(100vh - 40px); overflow-y: auto; border: 1px solid rgba(255,255,255,.82); border-radius: 22px; background: rgba(244,251,249,.96); box-shadow: 0 30px 80px rgba(24,65,71,.3); }
.modal-card > header { min-height: 67px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-card > header h2 { margin: 0; font-size: 14px; }
.modal-card > header button { width: 36px; height: 36px; border: 0; border-radius: 11px; display: grid; place-items: center; color: #5f7a7e; background: rgba(255,255,255,.62); cursor: pointer; }
.modal-form > footer { min-height: 68px; padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1120px) {
  .app-bg { padding: 18px; }
  .app-frame { min-height: calc(100vh - 36px); grid-template-columns: 215px minmax(0,1fr); }
  .metrics-grid, .stock-grid { grid-template-columns: repeat(2,1fr); }
  .export-filters { grid-template-columns: repeat(3,1fr); }
  .export-summary { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 860px) {
  .login-page, .app-bg { padding: 13px; }
  .login-frame { grid-template-columns: 1fr; min-height: auto; }
  .login-visual { min-height: 220px; padding: 28px; }
  .login-content { padding: 29px; }
  .app-frame { min-height: calc(100vh - 26px); display: block; border-radius: 24px; }
  .sidebar { position: fixed; top: 13px; right: 13px; bottom: 13px; width: 240px; z-index: 30; transform: translateX(110%); transition: transform .22s ease; background: rgba(229,244,240,.97); box-shadow: -18px 0 50px rgba(30,70,76,.18); }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { display: block; position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(22,58,63,.28); }
  .menu-button { width: 38px; height: 38px; border: 0; border-radius: 11px; display: grid; place-items: center; color: #397378; background: rgba(255,255,255,.52); cursor: pointer; }
  .topbar { padding: 0 18px; }
  .data-state { display: none; }
  .welcome { margin-left: auto; }
  .dashboard-grid, .two-column { grid-template-columns: 1fr; }
  .quick-panel { grid-column: auto; }
}

@media (max-width: 590px) {
  .login-page, .app-bg { padding: 0; }
  .login-frame, .app-frame { min-height: 100vh; border: 0; border-radius: 0; }
  .login-visual { min-height: 175px; padding: 22px; }
  .login-visual h1 { font-size: 26px; }
  .login-content { padding: 22px 15px 28px; }
  .login-heading h2 { margin-bottom: 18px; font-size: 24px; }
  .role-pills { grid-template-columns: repeat(2,1fr); }
  .role-pills button { min-height: 62px; flex-direction: row; }
  .login-form { grid-template-columns: 1fr; }
  .login-form .wide, .login-form .form-error { grid-column: auto; }
  .sidebar { top: 0; right: 0; bottom: 0; }
  .topbar { min-height: 68px; padding: 0 12px; }
  .logout-button { width: 38px; padding: 0; font-size: 0; }
  .workspace { padding: 18px 11px 28px; }
  .page-heading { margin-bottom: 17px; align-items: flex-end; }
  .page-heading h1 { font-size: 22px; }
  .page-heading .primary-button.compact { width: 40px; padding: 0; font-size: 0; }
  .header-actions .secondary-button { display: none; }
  .metrics-grid, .stock-grid { grid-template-columns: repeat(2,1fr); gap: 9px; }
  .metric-card { min-height: 136px; padding: 13px; flex-direction: column; }
  .stock-card { min-height: 180px; }
  .panel-toolbar { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .form-grid { grid-template-columns: 1fr; padding: 14px; }
  .full { grid-column: auto; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
  .surplus-box .form-grid.inner { grid-template-columns: 1fr; }
  .export-filters { grid-template-columns: 1fr 1fr; padding: 14px; }
  .export-summary { grid-template-columns: 1fr 1fr; }
  .export-summary .primary-button { grid-column: 1/-1; width: 100%; }
  th, td { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition: none !important; scroll-behavior: auto !important; } }

/* خوانایی نسخه دوم */
body { font-size: 16px; font-weight: 600; line-height: 1.65; }
button, input, select, textarea { font: inherit; }
input, select, textarea { font-size: 14px; font-weight: 600; }
label > span, .role-pills button, .sidebar nav button, .sidebar-account b, .welcome b, .panel-head h2, .empty-state h3, .quick-actions b, .mini-stock b, .stock-card > small, .toggle-field b, .session-list b { font-size: 13px; font-weight: 800; }
.brand strong { font-size: 18px; font-weight: 800; }
.brand small, .sidebar-account small, .welcome small, .page-heading p, .panel-head p, .metric-card small, .metric-card p, .empty-state p, .list-stack small, .quick-actions small, .mini-stock strong small, .input-note, .allocation-line, .info-strip p, .toggle-field small, .session-list small, .session-list p, .export-summary small, .form-footer > span { font-size: 11px; font-weight: 600; }
.sidebar nav button { min-height: 49px; }
.metric-card strong { font-size: 25px; }
.metric-card small { font-size: 12px; }
.list-stack b, .mini-stock strong, .current-plan p, .stock-card > p { font-size: 12px; }
.tag, .record-count, .row-actions button, th, td, .primary-button.compact, .logout-button, .form-error, .success-message { font-size: 11px; font-weight: 700; }
th { font-weight: 800; }
td { font-size: 12px; }
.panel-head > button { font-size: 11px; font-weight: 800; }
.menu-button span { display: none; }
.sidebar { overflow-y: auto; }

.reminder-panel, .provider-state, .daily-allocation-summary { margin-top: 14px; padding: 16px 18px; border: 1px solid rgba(255,255,255,.78); border-radius: 17px; display: flex; align-items: center; gap: 13px; background: rgba(247,251,250,.78); box-shadow: var(--shadow); }
.reminder-panel > div, .provider-state > div { flex: 1; }
.reminder-panel b, .provider-state b { display: block; font-size: 14px; font-weight: 800; }
.reminder-panel p, .provider-state p, .daily-allocation-summary p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.provider-state { margin: 0 0 14px; color: #4f777b; }
.provider-state > span { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; display: grid; place-items: center; color: var(--teal-dark); background: var(--teal-soft); }
.daily-allocation-summary { margin: 0 0 14px; justify-content: space-between; background: linear-gradient(120deg,rgba(216,240,237,.85),rgba(247,251,250,.76)); }
.daily-allocation-summary small, .daily-allocation-summary strong { display: block; }
.daily-allocation-summary small { color: var(--teal-dark); font-size: 12px; }
.daily-allocation-summary strong { margin-top: 3px; font-size: 27px; }
.section-title { margin: 22px 2px 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-title h2 { margin: 0; font-size: 17px; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.live-badge { padding: 6px 10px; border-radius: 20px; display: inline-flex; align-items: center; gap: 6px; color: #147966; background: #dff4eb; font-size: 11px; font-weight: 800; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #26a884; box-shadow: 0 0 0 4px rgba(38,168,132,.12); }
.staff-live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.staff-live-card { overflow: hidden; border: 1px solid rgba(255,255,255,.72); border-radius: 19px; background: var(--glass); box-shadow: var(--shadow); }
.staff-live-card > header { min-height: 76px; padding: 13px 16px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(38,100,105,.09); }
.staff-live-card > header > div { flex: 1; }
.staff-live-card > header b, .staff-live-card > header small { display: block; }
.staff-live-card > header b { font-size: 14px; }
.staff-live-card > header small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.staff-live-card > header > strong { font-size: 24px; }
.staff-live-card > div { padding: 7px 16px 13px; }
.staff-live-card p { min-height: 38px; margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(38,96,101,.07); font-size: 12px; }
.staff-live-card p:last-child { border-bottom: 0; }
.staff-live-card p b { font-size: 13px; }
.staff-live-card p small { color: var(--muted); font-size: 9px; }
.course-calculation { margin: 0 18px 16px; padding: 13px; border: 1px solid rgba(10,143,152,.14); border-radius: 14px; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; background: rgba(216,240,237,.4); }
.course-calculation small, .course-calculation b { display: block; }
.course-calculation small { color: var(--muted); font-size: 11px; }
.course-calculation b { margin-top: 4px; font-size: 13px; }
.reminder-list { padding: 8px 16px 15px; }
.reminder-list button { width: 100%; min-height: 66px; padding: 9px 0; border: 0; border-bottom: 1px solid rgba(38,96,101,.08); display: flex; align-items: center; gap: 10px; color: var(--ink); background: transparent; text-align: right; cursor: pointer; }
.reminder-list button > div { flex: 1; min-width: 0; }
.reminder-list b, .reminder-list small { display: block; }
.reminder-list b { font-size: 13px; }
.reminder-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.sms-preview { min-height: 140px; white-space: pre-wrap; line-height: 2; }
.danger-text { display: block; max-width: 260px; margin-top: 7px; color: #9f3446; font-size: 12px; line-height: 1.7; white-space: normal; }
.test-link { padding: 12px; border: 1px dashed rgba(10,143,152,.3); border-radius: 13px; background: rgba(216,240,237,.35); }
.test-link span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.test-link a { display: block; overflow-wrap: anywhere; color: var(--teal-dark); font-size: 12px; }
.message-cell { max-width: 420px; white-space: normal; line-height: 1.9; }

.booking-page { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: linear-gradient(135deg,#b8dfe0,#dfe9fb); }
.booking-card { width: min(500px,100%); padding: 28px; border: 1px solid rgba(255,255,255,.84); border-radius: 26px; background: rgba(246,251,250,.88); box-shadow: 0 30px 80px rgba(27,71,77,.18); }
.booking-heading { margin: 36px 0 24px; }
.booking-heading small { color: var(--teal-dark); font-size: 13px; }
.booking-heading h1 { margin: 6px 0; font-size: 30px; }
.booking-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.booking-card form { display: grid; gap: 16px; }
.wide { width: 100%; }

/* قابلیت‌های نسخه سوم */
.login-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.role-choice-card { width: min(720px,100%); margin: auto; padding: 34px; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; background: rgba(247,252,251,.82); box-shadow: var(--shadow); }
.role-choice-card h1 { margin: 25px 0 4px; font-size: 28px; }
.role-choice-card > p { margin: 0 0 22px; color: var(--muted); }
.role-choice-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.role-choice-grid button { min-height: 116px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--teal-dark); background: rgba(255,255,255,.68); cursor: pointer; font-weight: 800; }
.role-choice-grid button:hover { transform: translateY(-2px); background: #fff; box-shadow: 0 12px 28px rgba(41,91,96,.1); }
.role-choice-grid .avatar { width: 45px; height: 45px; font-size: 16px; }
.role-switch { width: 170px; height: 39px; margin-right: auto; background: rgba(255,255,255,.78); }
.metric-link { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: right; cursor: pointer; }
.metric-link:hover .metric-card { transform: translateY(-2px); border-color: rgba(10,143,152,.25); }
.metric-link .metric-card { height: 100%; transition: .18s ease; }
.treatment-items { padding: 0 18px 18px; display: grid; gap: 12px; }
.treatment-item { padding: 15px; border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-columns: 1.15fr .7fr .7fr 1fr auto; gap: 10px; align-items: end; background: rgba(255,255,255,.38); }
.treatment-item label > span { white-space: nowrap; }
.remove-row { width: 40px; height: 44px; border: 1px solid rgba(181,84,84,.16); border-radius: 11px; color: #a14e4e; background: #feeaea; cursor: pointer; }
.add-treatment { margin: 0 18px 17px; }
.standalone-field { padding: 0 18px 18px; }
.search-panel { padding: 14px 18px; }
.search-panel label { min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.56); }
.search-panel input { height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }
.profile-modal { width: min(980px,94vw); max-height: 88vh; overflow-y: auto; }
.profile-grid { padding: 18px; display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.profile-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.42); }
.profile-grid small, .profile-grid b { display: block; }
.profile-grid small { color: var(--muted); font-size: 11px; }
.profile-grid b { margin-top: 4px; font-size: 13px; }
.profile-timeline { padding: 0 18px 20px; }
.profile-timeline h3 { margin: 17px 0 8px; font-size: 15px; }
.table-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--teal-dark); background: rgba(255,255,255,.62); cursor: pointer; }
tfoot td, tfoot th { background: rgba(216,240,237,.55); font-weight: 800; }
.sms-modes { padding: 18px 18px 0; display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.sms-modes label, .patient-check-grid label, .check-field { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.48); cursor: pointer; }
.sms-modes input, .patient-check-grid input, .check-field input { width: 17px; height: 17px; }
.patient-check-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.patient-check-grid[hidden] { display: none; }
.permission-panel { overflow: hidden; }
.permission-table { padding: 18px; min-width: 720px; overflow-x: auto; }
.permission-head, .permission-row { min-height: 52px; display: grid; grid-template-columns: minmax(230px,1fr) repeat(3,150px); align-items: center; gap: 8px; border-bottom: 1px solid rgba(38,96,101,.08); }
.permission-head { color: var(--muted); }
.permission-row label { display: flex; justify-content: center; }
.permission-row input { width: 19px; height: 19px; }
.floating-message { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(430px,calc(100vw - 48px)); padding: 13px 17px; border-radius: 13px; color: #147966; background: #e1f5ed; box-shadow: 0 18px 45px rgba(41,91,96,.2); font-weight: 800; }
.floating-message.error { color: #a14e4e; background: #fee7e7; }

@media (max-width: 860px) {
  .topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; background: rgba(242,250,248,.96); backdrop-filter: blur(18px); }
  .menu-button { width: auto; min-width: 86px; height: 44px; padding: 0 13px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(10,143,152,.18); font-size: 13px; font-weight: 800; background: #fff; box-shadow: 0 8px 20px rgba(27,71,77,.1); }
  .menu-button span { display: inline; }
  .sidebar { width: min(310px,88vw); padding-top: 22px; z-index: 50; }
  .mobile-backdrop { display: none !important; z-index: 45; }
  .mobile-backdrop.open { display: block !important; }
  .reminder-panel { align-items: flex-start; flex-wrap: wrap; }
  .reminder-panel .primary-button { width: 100%; }
  .role-choice-grid { grid-template-columns: 1fr; }
  .role-choice-grid button { min-height: 78px; flex-direction: row; }
  .treatment-item { grid-template-columns: 1fr 1fr; }
  .treatment-item .remove-row { width: 100%; }
  .profile-grid { grid-template-columns: 1fr 1fr; }
  .patient-check-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 590px) {
  .workspace { padding: 18px 12px 84px; }
  .topbar { padding: 0 10px; }
  .welcome { min-width: 0; }
  .welcome small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-button { min-width: 82px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .primary-button.compact { width: 100%; padding: 0 14px; font-size: 12px; }
  .header-actions { width: 100%; }
  .header-actions .secondary-button { display: inline-flex; flex: 1; }
  .header-actions .primary-button { flex: 1.4; }
  .metrics-grid, .stock-grid { grid-template-columns: 1fr 1fr; }
  .course-calculation { grid-template-columns: 1fr; }
  .daily-allocation-summary { align-items: flex-start; flex-direction: column; }
  .staff-live-grid { grid-template-columns: 1fr; }
  .provider-state { align-items: flex-start; }
  .booking-page { padding: 0; }
  .booking-card { min-height: 100vh; border: 0; border-radius: 0; }
  .role-switch { width: 125px; }
  .treatment-item { grid-template-columns: 1fr; }
  .profile-grid, .patient-check-grid, .sms-modes { grid-template-columns: 1fr; }
}
