/* =====================================================================
   Ganader AI — paparan iPhone / telefon.
   Semua gaya di sini hanya aktif pada skrin <= 760px.
   Versi PC tidak berubah.
   ===================================================================== */
.m-only{display:none}
.avatar .m-ic{display:none}

@supports (-webkit-touch-callout: none){
  input,select,textarea{font-size:16px !important} /* elak Safari zoom masuk */
}
html{-webkit-text-size-adjust:100%}
body{-webkit-tap-highlight-color:transparent}

@media (max-width:760px){
  :root{--m-card:#fff;--m-line:#e4e9f1;--m-soft:#eaf1fa;--m-muted:#5b6b80;--m-safe:env(safe-area-inset-bottom,0px)}
  .m-only{display:block}
  body{background:#f4f6fa;font-family:Archivo,system-ui,-apple-system,sans-serif}
  .main{padding-bottom:calc(96px + var(--m-safe))}

  /* ---------- Bar atas ---------- */
  .menu-btn{display:none !important}
  .topbar{position:sticky;top:0;z-index:15;height:auto;min-height:0;padding:12px 18px 10px;background:rgba(244,246,250,.92);
    -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border-bottom:1px solid transparent}
  .topbar .eyebrow{font-size:12px;letter-spacing:0;text-transform:none;color:var(--m-muted);font-weight:500}
  .topbar h1{font-size:24px !important;font-weight:700;letter-spacing:-.4px;line-height:1.15;margin:1px 0 0}
  .icon-btn{width:40px;height:40px;border-radius:12px;background:#fff;border:1px solid var(--m-line)}
  .content{padding:4px 16px 24px !important}

  /* ---------- Kepala halaman (hero) ---------- */
  .hero{display:block !important;margin:0 0 12px !important;padding:0 !important;background:none !important;border:0 !important;box-shadow:none !important}
  .hero > div:first-child > h2,.hero > div:first-child > p,.hero .eyebrow{display:none !important}
  .hero > div:first-child:empty{display:none}
  .hm-head-acts,.hero .hero-actions{display:flex !important;flex-direction:row !important;flex-wrap:nowrap !important;align-items:center;gap:8px;overflow-x:auto;scrollbar-width:none;margin:0;padding:2px 0}
  .hm-head-acts::-webkit-scrollbar{display:none}
  .hero .btn{margin:0 !important;min-height:38px;padding:8px 14px;font-size:13.5px;border-radius:12px;white-space:nowrap;flex:none}
  .hero #addWeightBtn{display:none !important} /* ganti dengan butang + di bar bawah */
  .dash-head{margin-bottom:12px}
  .content select,.content input:not([type=checkbox]):not([type=radio]):not(.m-search input){min-height:44px;border:1px solid #c4d3e3 !important;border-radius:12px !important;background:#fff;padding:0 12px;color:#1c2d42;font-family:inherit;max-width:100%;box-sizing:border-box}
  .content select{-webkit-appearance:none;appearance:none;padding-right:34px;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6b80' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center}
  .dash-actions{display:none !important} /* butang + di bar bawah ganti */

  /* ---------- Kotak angka (KPI) dua sebaris ---------- */
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:10px !important;margin-bottom:14px !important}
  .kpis .kpi,.kpis > .card{padding:13px 14px !important}
  .kpi-label{font-size:12px !important}
  .kpi-value{font-size:24px !important;margin:4px 0 2px !important}
  .kpi-foot{font-size:11.5px !important;line-height:1.35}

  /* ---------- Kad umum ---------- */
  .card{border-radius:18px;border:1px solid var(--m-line);box-shadow:none}

  /* ---------- Kad ringkasan kawanan ---------- */
  .m-summary{background:#1c2d42;color:#fff;border-radius:20px;padding:15px 16px 14px;margin:0 0 12px}
  .m-summary .m-cap{font-size:11px;letter-spacing:.5px;color:#a9c6ea;font-weight:600}
  .m-summary .m-row{display:flex;justify-content:space-between;align-items:stretch;margin-top:8px}
  .m-summary .m-stat{flex:1;text-align:left}
  .m-summary .m-stat + .m-stat{border-left:1px solid #33485f;padding-left:12px}
  .m-summary b{display:block;font-size:24px;font-weight:700;line-height:1.1}
  .m-summary span{font-size:11.5px;color:#c9d6e6}
  .m-summary .m-dim b{color:#a9c6ea}

  /* ---------- Carian ---------- */
  .m-search{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid var(--m-line);border-radius:14px;padding:0 12px;margin:0 0 10px;color:#8a97a8}
  .m-search input{flex:1;border:0;outline:0;background:transparent;min-height:42px;padding:0;color:#1c2d42;font-family:inherit}
  .m-search input::placeholder{color:#8a97a8}
  .m-search svg{flex:none}
  .m-nohit{padding:18px;text-align:center;color:var(--m-muted);font-size:14px}

  /* ---------- Suis Aktif / Keluar (gaya iOS) ---------- */
  .hm-tabs{display:flex !important;gap:0 !important;background:#e6ebf2;border-radius:12px;padding:3px;margin:0 0 12px !important;border:0 !important}
  .hm-tabs .nm-tab{flex:1;border:0 !important;background:transparent !important;border-radius:9px !important;min-height:34px;padding:6px 8px;font-size:13px;font-weight:600;color:var(--m-muted) !important;box-shadow:none !important}
  .hm-tabs .nm-tab.is-on{background:#fff !important;color:#1c2d42 !important;box-shadow:0 1px 3px rgba(28,45,66,.12) !important}

  /* ---------- Jadual jadi kad ---------- */
  .table-card{background:transparent !important;border:0 !important;box-shadow:none !important;padding:0 !important;overflow:visible !important}
  .table-card > .panel{padding:0 0 8px !important}
  .table-scroll:has(> table.m-table){overflow:visible !important;max-height:none !important;border:0 !important}
  table.m-table{display:block;width:100%;border:0;background:transparent;min-width:0 !important}
  table.m-table thead{display:none}
  table.m-table tbody{display:flex;flex-direction:column;gap:10px}
  table.m-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;background:var(--m-card);
    border:1px solid var(--m-line);border-radius:16px;padding:13px 14px;margin:0}
  table.m-table tr.hm-row{cursor:pointer}
  table.m-table tr.hm-row:active{background:#f7f9fc}
  table.m-table td{display:block;border:0 !important;padding:0 !important;font-size:13.5px;line-height:1.35;min-width:0;overflow-wrap:anywhere;background:transparent !important;white-space:normal !important;text-align:left !important}
  table.m-table td::before{content:attr(data-label);display:block;font-size:11px;font-weight:500;color:#7a889a;margin-bottom:2px}
  table.m-table td.m-title{grid-column:1/-1;font-size:15px}
  table.m-table td.m-title::before,table.m-table td[data-label=""]::before{display:none}
  table.m-table td.m-title strong{font-size:16px;font-weight:700}
  table.m-table td.m-empty{display:none}
  table.m-table td.m-acts{grid-column:1/-1;display:flex !important;gap:6px;flex-wrap:wrap;border-top:1px solid #eef2f7 !important;padding-top:10px !important;margin-top:2px}
  table.m-table td.m-acts::before{display:none}
  table.m-table td.m-acts .btn{min-height:34px;padding:6px 12px;font-size:12.5px;border-radius:10px;margin:0}
  table.m-table .avatar{width:40px;height:40px;border-radius:12px;background:var(--m-soft);color:#334a69;font-weight:700;flex:none}
  table.m-table .avatar.m-cow{display:flex;align-items:center;justify-content:center}
  table.m-table .avatar.m-cow .m-l{display:none}
  table.m-table .avatar.m-cow .m-ic{display:flex}
  table.m-table .animal{display:flex;align-items:center;gap:12px}
  table.m-table .pill{font-size:11.5px}

  /* ---------- Bar navigasi bawah ---------- */
  .m-tabbar{position:fixed;left:12px;right:12px;bottom:calc(10px + var(--m-safe));z-index:25;display:flex;justify-content:space-around;align-items:center;
    background:rgba(255,255,255,.96);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);border:1px solid var(--m-line);border-radius:22px;
    padding:6px 4px;box-shadow:0 6px 24px rgba(28,45,66,.10)}
  .m-tab{display:flex;flex-direction:column;align-items:center;gap:2px;width:60px;min-height:46px;justify-content:center;border:0;background:none;
    color:#8a97a8;font:500 10.5px Archivo,system-ui,sans-serif;padding:2px 0;cursor:pointer}
  .m-tab.is-on{color:#1c2d42;font-weight:700}
  .m-tab.is-on svg{stroke:#1c2d42}
  .m-plus{width:52px;height:52px;border-radius:17px;border:4px solid #f4f6fa;background:#76a9e0;color:#1c2d42;display:flex;align-items:center;justify-content:center;
    margin-top:-28px;box-shadow:0 4px 14px rgba(28,45,66,.18);cursor:pointer;padding:0}
  .m-plus:active{transform:scale(.96)}
  .login-active .m-tabbar,body:has(#loginScreen:not([style*="none"])) .m-tabbar{display:none}

  /* ---------- Laci menu "Lagi" ---------- */
  .sidebar{z-index:40 !important;width:min(300px,84vw) !important;padding-bottom:calc(16px + var(--m-safe)) !important;transition:transform .22s ease}
  .m-backdrop{position:fixed;inset:0;background:rgba(16,28,44,.42);z-index:35;opacity:0;pointer-events:none;transition:opacity .2s}
  .m-backdrop.is-on{opacity:1;pointer-events:auto}

  /* ---------- Helaian tindakan "+" ---------- */
  .m-sheet{position:fixed;left:0;right:0;bottom:0;z-index:45;background:#fff;border-radius:22px 22px 0 0;padding:8px 16px calc(16px + var(--m-safe));
    transform:translateY(105%);transition:transform .22s ease;box-shadow:0 -8px 30px rgba(28,45,66,.12)}
  .m-sheet.is-on{transform:none}
  .m-sheet .m-grip{width:38px;height:5px;border-radius:3px;background:#d5dde8;margin:2px auto 12px}
  .m-sheet h3{margin:0 4px 10px;font-size:15px;font-weight:700;color:#1c2d42}
  .m-act{display:flex;align-items:center;gap:14px;width:100%;border:0;background:none;padding:11px 6px;border-radius:14px;text-align:left;cursor:pointer;font-family:inherit}
  .m-act:active{background:#f4f6fa}
  .m-act i{width:44px;height:44px;border-radius:13px;background:var(--m-soft);display:flex;align-items:center;justify-content:center;flex:none}
  .m-act b{display:block;font-size:15px;color:#1c2d42;font-weight:600}
  .m-act span{display:block;font-size:12.5px;color:var(--m-muted)}

  /* ---------- Modal jadi helaian bawah ---------- */
  .modal{place-items:end center !important;padding:0 !important;z-index:50 !important}
  .modal .modal-card{width:100% !important;max-width:none !important;border-radius:22px 22px 0 0 !important;max-height:92vh !important;
    overflow-y:auto !important;padding:20px 18px calc(22px + var(--m-safe)) !important;margin:0 !important}
  .modal .modal-actions{position:sticky;bottom:calc(-22px - var(--m-safe));background:#fff;padding:12px 0 4px;margin-top:8px}
  .toast{bottom:calc(92px + var(--m-safe)) !important;left:16px !important;right:16px !important;width:auto !important;border-radius:14px !important;z-index:60 !important}
}
