*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#f4f7fb;color:#172033}a{color:#123b80;text-decoration:none}button,.button{display:inline-block;border:0;background:#123b80;color:#fff;padding:11px 18px;border-radius:7px;cursor:pointer;font-weight:600}button:hover,.button:hover{opacity:.92}.auth-card{max-width:460px;margin:60px auto;background:#fff;padding:30px;border-radius:14px;box-shadow:0 8px 30px #0001}.auth-card h1{margin-bottom:4px}.auth-card label,.book-admin label{display:block;margin:14px 0;font-weight:600}.auth-card input,.book-admin input:not([type=checkbox]){display:block;width:100%;margin-top:6px;padding:11px;border:1px solid #ccd5e1;border-radius:7px}.alert{background:#fee2e2;color:#991b1b;padding:12px;border-radius:8px;margin:15px 0}.top,.reader-top{background:#173b87;color:#fff;padding:16px 5%;display:flex;justify-content:space-between;align-items:center;gap:20px}.top a,.reader-top a{color:#fff}.container{max-width:1100px;margin:35px auto;padding:0 20px}.narrow{max-width:650px}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:22px}.book,.summary,.empty,.stats>div{background:#fff;padding:20px;border-radius:12px;box-shadow:0 3px 15px #0000000b}.book img{width:100%;height:290px;object-fit:cover;border-radius:8px}.book h2{font-size:18px}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:15px}.stats>div strong{display:block;font-size:30px;margin-top:8px}.book-admin{margin-bottom:20px}.muted{color:#667085}.reader-page{background:#e8edf4}.reader-top{position:sticky;top:0;z-index:5}.reader{max-width:1000px;margin:25px auto;padding:0 15px;position:relative}.reader-note{background:#fff3cd;padding:12px;border-radius:8px;margin-bottom:15px}.watermark{position:fixed;z-index:4;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-25deg);font-size:28px;color:#0002;pointer-events:none;white-space:nowrap}.reader img{display:block;max-width:100%;height:auto;margin:auto;background:white;box-shadow:0 4px 25px #0002}.controls{display:flex;justify-content:center;align-items:center;gap:15px;padding:18px}.controls button{min-width:70px}.empty{padding:30px}.summary{margin:20px 0}@media(max-width:700px){.stats{grid-template-columns:1fr 1fr}.top,.reader-top{flex-wrap:wrap}.reader-top strong{width:100%;order:3;font-size:13px}.auth-card{margin:20px 12px}.container{margin-top:20px}}
.actions{margin-top:15px}.success{color:#166534;font-weight:600}.order-card{margin-bottom:18px}.order-card form button:last-child{background:#7f1d1d}

/* ==============================
   E-BOOK READER — PRODUCTION UI v4
   ============================== */
.reader-page{
  min-height:100vh;
  background:#e8edf4;
  color:#172033;
}
.reader-page .reader-top{
  position:sticky;
  top:0;
  z-index:20;
  min-height:58px;
  padding:10px clamp(14px,4vw,52px);
  background:#173b87;
  box-shadow:0 2px 14px #0002;
  gap:20px;
}
.reader-back{flex:0 0 auto;color:#fff!important;font-weight:700;white-space:nowrap}
.reader-title{flex:1 1 auto;min-width:0;text-align:center;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:15px}
.reader-account{flex:0 0 auto;display:flex;align-items:center;gap:14px;font-size:13px;white-space:nowrap}
.reader-account a{color:#fff;text-decoration:underline;text-underline-offset:3px}
.reader-shell{width:min(1180px,calc(100% - 28px));margin:20px auto 34px}
.reader-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;background:#fff;border:1px solid #d8e0eb;border-radius:14px;padding:13px 16px;box-shadow:0 5px 22px #0000000c}
.reader-book-info{min-width:0;flex:1}
.reader-label{display:block;color:#667085;font-size:10px;font-weight:800;letter-spacing:.12em;margin-bottom:4px}
.reader-book-info strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:15px;color:#102c5f}
.reader-tools{display:flex;align-items:center;gap:7px;flex:0 0 auto}
.tool-caption{font-size:11px;color:#667085;font-weight:700;margin-right:2px}
.tool-btn{min-width:40px;height:38px;padding:7px 11px;border:1px solid #cbd5e1;background:#fff;color:#173b87;border-radius:8px;font-weight:800;font-size:13px}
.tool-btn:hover{background:#f5f8fc;opacity:1}
.tool-wide{min-width:auto;padding-left:13px;padding-right:13px}
.zoom-value{min-width:50px;text-align:center;font-size:12px;font-weight:800;color:#475467}
.reader-stage{position:relative;width:100%;min-height:calc(100vh - 210px);max-height:none;margin:14px auto;padding:24px;overflow:auto;display:flex;align-items:flex-start;justify-content:center;background:#dce4ee;border:1px solid #ccd7e5;border-radius:14px;box-shadow:inset 0 1px 0 #fff8,0 7px 28px #00000010}
.book-page{display:block;width:min(100%,980px);max-width:none;height:auto;margin:0 auto;background:#fff;box-shadow:0 8px 30px #0003;user-select:none;-webkit-user-drag:none;transition:opacity .15s ease;flex:0 0 auto}
.book-page.loading{opacity:.45}
.page-loading{position:absolute;left:50%;top:16px;transform:translateX(-50%);z-index:5;padding:8px 13px;border-radius:999px;background:#173b87;color:#fff;font-size:12px;font-weight:700;opacity:0;pointer-events:none;transition:opacity .15s ease;box-shadow:0 4px 15px #0003}
.page-loading.show{opacity:1}
.reader-watermark{position:absolute;z-index:4;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-24deg);color:#173b8726;font-size:clamp(18px,2.4vw,30px);font-weight:700;white-space:nowrap;pointer-events:none;user-select:none;mix-blend-mode:multiply}
.reader-controls{position:sticky;bottom:14px;z-index:10;display:flex;align-items:center;justify-content:center;gap:18px;width:max-content;max-width:calc(100% - 10px);margin:0 auto;padding:9px;background:#fff;border:1px solid #d6deea;border-radius:13px;box-shadow:0 8px 28px #0003}
.nav-btn{min-width:132px;height:44px;padding:9px 17px;border-radius:9px;background:#173b87;color:#fff;font-weight:800;font-size:13px}
.nav-btn:hover{opacity:.94}
.nav-btn:disabled{opacity:.38;cursor:not-allowed}
.page-jump{display:flex;align-items:center;gap:8px;color:#475467;font-size:13px;white-space:nowrap}
.page-jump label{font-weight:800}
.page-jump input{width:72px;height:40px;text-align:center;border:1px solid #cbd5e1;border-radius:8px;font-size:14px;font-weight:800;color:#172033;outline:none;background:#fff}
.page-jump input:focus{border-color:#173b87;box-shadow:0 0 0 3px #173b8718}
.reader-hint{margin:10px 0 0;text-align:center;color:#667085;font-size:12px}
.reader-hint span+span{margin-left:12px}
@media(max-width:900px){
  .reader-page .reader-top{padding:9px 13px;min-height:52px}
  .reader-title{font-size:13px}
  .reader-account span{display:none}
  .reader-shell{width:calc(100% - 14px);margin:10px auto 24px}
  .reader-toolbar{padding:10px;align-items:flex-start;flex-direction:column;gap:10px}
  .reader-book-info{width:100%}
  .reader-tools{width:100%;justify-content:flex-end}
  .reader-stage{padding:10px;min-height:65vh;border-radius:10px;margin:10px auto}
  .book-page{width:100%}
  .reader-controls{bottom:7px;gap:8px;padding:7px;border-radius:11px}
  .nav-btn{min-width:102px;height:42px;padding:8px 10px}
  .reader-watermark{font-size:15px}
}
@media(max-width:520px){
  .reader-tools{gap:4px;justify-content:space-between}
  .tool-caption{display:none}
  .tool-btn{min-width:35px;height:35px;padding:6px 8px}
  .tool-wide{padding:6px 8px;font-size:11px}
  .zoom-value{min-width:40px;font-size:11px}
  .reader-controls{width:calc(100% - 4px);justify-content:space-between}
  .nav-btn{min-width:44px;width:44px;padding:8px 5px}
  .nav-btn span{display:none}
  .page-jump{gap:5px;font-size:11px}
  .page-jump label{display:none}
  .page-jump input{width:54px;height:36px}
  .reader-hint{font-size:10px}
  .reader-hint span+span{margin-left:6px}
}

/* ==============================
   BUYER ACCOUNT — CLEAN STORE UI
   ============================== */
.buyer-page{min-height:100vh;background:#f4f7fb;color:#172033}
.buyer-top{min-height:48px;padding:0 4.5%;background:#173b87;color:#fff;display:flex;align-items:center;justify-content:space-between;gap:24px;box-shadow:0 2px 12px #0002}
.buyer-brand{font-weight:800;letter-spacing:.01em;white-space:nowrap}
.buyer-nav{display:flex;align-items:center;gap:4px;min-height:48px}
.buyer-nav a,.buyer-name{color:#fff;font-size:13px;padding:8px 11px;border-radius:7px;white-space:nowrap}
.buyer-nav a:hover{background:#ffffff18;opacity:1}
.buyer-nav a.active{background:#ffffff18;font-weight:800}
.buyer-nav .logout{margin-left:4px;padding-left:14px;border-left:1px solid #ffffff38;border-radius:0}
.buyer-name{font-weight:700;opacity:.96}
.nav-badge{display:inline-flex;min-width:18px;height:18px;align-items:center;justify-content:center;padding:0 5px;margin-left:3px;border-radius:999px;background:#fff;color:#173b87;font-size:10px;font-weight:800}
.buyer-container{max-width:1060px;margin:0 auto;padding:38px 22px 60px}
.buyer-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:28px;margin-bottom:28px}
.buyer-heading.compact{margin-bottom:24px}
.buyer-eyebrow{margin:0 0 7px;color:#6b7280;font-size:11px;font-weight:800;letter-spacing:.14em}
.buyer-heading h1{margin:0;color:#102c5f;font-size:31px;line-height:1.15}
.buyer-subtitle{margin:9px 0 0;max-width:690px;color:#667085;font-size:14px;line-height:1.65}
.catalog-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:0 0 auto;background:#173b87;color:#fff!important;padding:11px 16px;border-radius:8px;font-size:13px;font-weight:800;box-shadow:0 4px 12px #173b8728}
.catalog-button:hover{opacity:.94}
.buyer-empty{background:#fff;border:1px solid #e1e7ef;border-radius:16px;padding:58px 28px;text-align:center;box-shadow:0 7px 25px #0000000a}
.buyer-empty .empty-icon{width:64px;height:64px;margin:0 auto 17px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#eef3fa;font-size:29px}
.buyer-empty h2{margin:0;color:#173b87;font-size:22px}
.buyer-empty p{max-width:570px;margin:10px auto 23px;color:#667085;font-size:14px;line-height:1.7}
.empty-actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}
.buyer-primary{background:#173b87!important;color:#fff!important}
.buyer-secondary{background:#fff!important;color:#173b87!important;border:1px solid #cbd5e1!important}
.library-head{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:2px 0 17px}
.library-head h2{margin:0;color:#102c5f;font-size:20px}
.library-head p{margin:4px 0 0;color:#667085;font-size:13px}
.text-button{color:#173b87;font-size:13px;font-weight:800}
.buyer-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:20px}
.buyer-book{display:flex;flex-direction:column;background:#fff;border:1px solid #e1e7ef;border-radius:14px;overflow:hidden;box-shadow:0 6px 20px #0000000a}
.buyer-cover{background:#edf2f7;min-height:285px;display:flex;align-items:center;justify-content:center}
.buyer-cover img{display:block;width:100%;height:285px;object-fit:cover}
.cover-placeholder{font-size:44px;opacity:.55}
.buyer-book-body{padding:17px 18px 18px}
.book-status{display:inline-block;margin-bottom:9px;padding:4px 8px;border-radius:999px;background:#ecfdf3;color:#166534;font-size:10px;font-weight:800}
.buyer-book h3{margin:0;color:#172033;font-size:17px;line-height:1.35}
.buyer-book p{margin:7px 0 15px;color:#667085;font-size:13px;line-height:1.5}
.book-read{width:100%;text-align:center}
.orders-list{display:grid;gap:14px}
.buyer-order{display:flex;align-items:center;justify-content:space-between;gap:24px;background:#fff;border:1px solid #e1e7ef;border-radius:14px;padding:19px 20px;box-shadow:0 5px 18px #0000000a}
.order-main{min-width:0;flex:1}
.order-topline{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.order-code{color:#667085;font-size:11px;font-weight:800;letter-spacing:.04em}
.status-pill{display:inline-flex;padding:4px 9px;border-radius:999px;font-size:10px;font-weight:800}
.status-pending{background:#fff7ed;color:#9a3412}
.status-paid{background:#ecfdf3;color:#166534}
.status-cancelled,.status-failed,.status-expired{background:#f3f4f6;color:#4b5563}
.buyer-order h2{margin:0;color:#172033;font-size:17px;line-height:1.4}
.order-meta{display:flex;gap:16px;flex-wrap:wrap;margin-top:8px;color:#667085;font-size:12px}
.order-action{flex:0 0 auto}
.order-muted{color:#98a2b3;font-size:12px}
.small-empty{padding:45px 25px}
@media(max-width:800px){
  .buyer-top{padding:0 14px;min-height:52px;align-items:flex-start;flex-wrap:wrap}
  .buyer-brand{padding-top:15px}
  .buyer-nav{width:100%;overflow-x:auto;min-height:42px;padding-bottom:4px}
  .buyer-nav a,.buyer-name{font-size:12px;padding:7px 9px}
  .buyer-nav .logout{margin-left:auto}
  .buyer-container{padding:27px 15px 45px}
  .buyer-heading{align-items:stretch;flex-direction:column;gap:16px;margin-bottom:21px}
  .catalog-button{align-self:flex-start}
  .buyer-heading h1{font-size:27px}
  .buyer-order{align-items:stretch;flex-direction:column;gap:15px}
  .order-action .button{width:100%;text-align:center}
}
@media(max-width:520px){
  .buyer-grid{grid-template-columns:1fr}
  .buyer-cover,.buyer-cover img{height:330px;min-height:330px}
  .library-head{align-items:flex-start;flex-direction:column}
  .buyer-empty{padding:42px 18px}
  .buyer-nav{gap:1px}
  .buyer-nav .buyer-name{display:none}
}

/* ==============================
   MANUAL PAYMENT STATUS FLOW
   ============================== */
.status-awaiting{background:#eff6ff;color:#1d4ed8}
.status-notice{margin:0 0 18px;padding:13px 16px;border:1px solid #bfdbfe;background:#eff6ff;color:#1e40af;border-radius:10px;font-size:13px;font-weight:700}
.back-link{display:inline-block;margin-bottom:18px;color:#173b87;font-size:13px;font-weight:800}
.payment-layout{display:grid;grid-template-columns:1fr 1.15fr;gap:16px}
.payment-card{background:#fff;border:1px solid #e1e7ef;border-radius:15px;padding:23px;box-shadow:0 6px 20px #0000000a}
.payment-card h2{margin:6px 0 15px;color:#102c5f;font-size:20px;line-height:1.35}
.payment-label{margin:0 0 7px;color:#667085;font-size:10px;font-weight:900;letter-spacing:.14em}
.payment-code{display:block;color:#173b87;font-size:13px;letter-spacing:.04em}
.payment-total-label{margin-top:23px;color:#667085;font-size:12px}
.payment-total{margin-top:3px;color:#173b87;font-size:30px;font-weight:900}
.payment-current-status{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:20px;padding-top:15px;border-top:1px solid #e6ebf2;color:#667085;font-size:12px}
.payment-current-status strong{color:#173b87;text-align:right}
.bank-box{display:grid;gap:10px;padding:16px;background:#f7f9fc;border:1px solid #e2e8f0;border-radius:11px}
.bank-box div{display:flex;justify-content:space-between;gap:18px;font-size:13px}
.bank-box span{color:#667085}.bank-box strong{color:#172033;text-align:right}
.payment-help{color:#667085;font-size:13px;line-height:1.65;margin:16px 0}
.full-button{width:100%;text-align:center}
.payment-next-step{display:flex;align-items:flex-start;gap:16px;margin-top:16px}
.step-icon{flex:0 0 40px;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#fff7ed;color:#9a3412;font-weight:900}
.step-icon.waiting{background:#eff6ff;color:#1d4ed8}.step-icon.rejected{background:#fee2e2;color:#991b1b}
.step-content{min-width:0}.step-content h2{margin:0 0 6px;font-size:18px}.step-content p{margin:0 0 15px;color:#667085;font-size:13px;line-height:1.65}
.waiting-button{display:inline-block;padding:10px 14px;border-radius:8px;background:#eff6ff;color:#1d4ed8;font-size:13px;font-weight:800}
.admin-waiting{color:#9a3412;font-weight:700}.admin-rejected{color:#991b1b;font-weight:700}
@media(max-width:760px){.payment-layout{grid-template-columns:1fr}.bank-box div{flex-direction:column;gap:2px}.bank-box strong{text-align:left}.payment-next-step{padding:18px}.payment-total{font-size:27px}}
